-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
You need to change the names of class folders (0, 1, 2, ..) to index codes which are specified in the json files.
The example below shows how you could create 'val' dataset using torchvision:
import os
from pathlib import Path
with open('path/to/ImageNet_class_index.json') as f:
d = json.load(f)
root = Path("path/to/ImageNet/val")
for path in root.iterdir():
idx = path.name
new_path = path.parent / d[idx][0]
os.rename(str(path), str(new_path))
Then, you can create imagenet dataset using torchvision by
dataset = ImageNet(root="ImageNet", split="val")
Note that you also need ILSVRC2012_devkit_t12.tar.gz which can be downloaded from the imagenet website.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels