Skip to content

Instantly share code, notes, and snippets.

View chirag-agarwall's full-sized avatar
🎯
Focusing

Chirag Agarwal chirag-agarwall

🎯
Focusing
View GitHub Profile
@chirag-agarwall
chirag-agarwall / imagenet_validation_class_id_net_id_mapper
Created May 3, 2020 23:56
A python loader for mapping ImageNet validation image to their respective class id's and net id's
def image_name_to_netid():
# Map imagenet names to their netids
input_f = open("./imagenet_validation_imagename_labels.txt")
label_map = {}
netid_map = {}
for line in input_f:
parts = line.strip().split(" ")
label_map[parts[0]] = parts[1]
netid_map[parts[0]] = parts[2]
return label_map, netid_map
@Tushar-N
Tushar-N / hook_activations.py
Created August 3, 2018 00:06
Pytorch code to save activations for specific layers over an entire dataset
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as tmodels
from functools import partial
import collections
# dummy data: 10 batches of images with batch size 16
dataset = [torch.rand(16,3,224,224).cuda() for _ in range(10)]
@AruniRC
AruniRC / ms_coco_classnames.txt
Created March 5, 2018 20:37
Class Names of MS-COCO classes in order of Detectron dict
{0: u'__background__',
1: u'person',
2: u'bicycle',
3: u'car',
4: u'motorcycle',
5: u'airplane',
6: u'bus',
7: u'train',
8: u'truck',
9: u'boat',
@wanghailei
wanghailei / cstsunami.py
Last active June 25, 2024 00:33
Code snippets of Tsunami
# The following code and the code generated art works are the intellectrual properities of Hailei Wang.
# © 2010 - 2014, Hailei Wang. All rights reserved.
cornu = ximport("cornu")
colors = ximport("colors")
# Painting waves
palette_for_wave = [ colors.hex( “#020034”, “dark blue” ), colors.hex( “#0A5CD6”, “aqua blue” ), colors.hex( “#FEFFFF”, “milk white” ) ]
# Draw Wave