shrinusn77 commited on
Commit
6740d5c
·
verified ·
1 Parent(s): 28a21c6

Update imagenet_classes.json

Browse files
Files changed (1) hide show
  1. imagenet_classes.json +12 -15
imagenet_classes.json CHANGED
@@ -1,15 +1,12 @@
1
- {
2
- "0": "tench",
3
- "1": "goldfish",
4
- "2": "great white shark",
5
- "3": "tiger shark",
6
- "4": "hammerhead shark",
7
- "5": "electric ray",
8
- "6": "stingray",
9
- "7": "cock",
10
- "8": "hen",
11
- "9": "ostrich",
12
- "10": "brambling",
13
- "...": "...",
14
- "999": "toilet tissue"
15
- }
 
1
+ import json
2
+
3
+ # Download from official repo
4
+ !wget -q https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt
5
+
6
+ with open("imagenet_classes.txt") as f:
7
+ classes = f.read().splitlines()
8
+
9
+ mapping = {str(i): classes[i] for i in range(len(classes))}
10
+
11
+ with open("imagenet_classes.json", "w") as f:
12
+ json.dump(mapping, f)