This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |