Skip to content

Instantly share code, notes, and snippets.

@atharvas
atharvas / vipergpt-eagle-demo.ipynb
Last active May 27, 2024 19:00
vipergpt-eagle-demo.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@atharvas
atharvas / profile_masks_to_boxes.py
Last active January 29, 2024 18:12
Profiling masks_to_boxes
import torch
import time
import tracemalloc
import matplotlib.pyplot as plt
def masks_to_boxes(masks: torch.Tensor) -> torch.Tensor:
"""
Compute the bounding boxes around the provided masks.
Returns a [N, 4] tensor containing bounding boxes. The boxes are in ``(x1, y1, x2, y2)`` format with
@atharvas
atharvas / neurosym-lib-demo.ipynb
Last active November 7, 2023 17:10
A simple tutorial for using the neurosym-lib (currently private). Install all dependencies with `pip install neurosym`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

CLEVR_val_0.png

Has the following (formatted) output:

cy | me  | blu : res = < 0.06,  2.04,  0.71> | gt = < 3.00, -3.00,  0.70>
cy | me  | red : res = < 1.32,  2.75,  0.92> | gt = < 0.00, -3.00,  0.70>
cy | me  | yel : res = < 1.09,  1.51,  0.97> | gt = <-3.00, -3.00,  0.70>
cy | ru  | blu : res = < 1.34,  1.01,  0.71> | gt = < 3.00,  0.00,  0.70>
cy | ru  | bro : res = < 1.13, -1.36,  0.90> | gt = <-3.00,  3.00,  0.70>
cy | ru | cya : res = &lt; 2.08, 0.21, 0.68&gt; | gt = &lt; 3.00, 3.00, 0.70&gt;
import numpy as np
import scipy
l = 0.09218/2 # dist b.w. 2 sides of hexagon
f_s_orig = 16000 # sampling frequency
c = scipy.constants.speed_of_sound # speed of sound
user = "2"
setting = "2"
file_path = f"./data/user{user}_setting{setting}/*.csv"
@atharvas
atharvas / nltk_movies_naive_bayes.ipynb
Last active November 14, 2019 19:57
nltk_movies_naive_bayes.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@atharvas
atharvas / -nltk_movies_ml.ipynb
Last active October 3, 2019 20:50
nltk_movies_ml.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@atharvas
atharvas / nltk_movies_naive_bayes.ipynb
Last active September 20, 2019 19:29
nltk_movies_naive_bayes.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@atharvas
atharvas / nltk_movies_emolex.ipynb
Last active September 20, 2019 19:31
nltk_movies_EmoLex.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@atharvas
atharvas / mesonet_pulldata.ipynb
Last active May 15, 2019 16:08
mesonet_pulldata.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.