Skip to content

MadryLab/pytorch-imagenet-dataset

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Imagenet dataset for Pytorch.

Prereqs.

  1. Download the imagenet data at this URL.
  • (The imageNet Fall 2011 release link).
  1. This download will take 3-5 days.
  2. Unzip.

Format the validation set.

We want both the train and val to be in this format:

train/
  n01443537/
    images/
      n02058221_0.JPEG
  ...

To format val dataset:

python build_folder_tree.py -split_path /path/to/imagenet-folder/val     

Dataloader

Train

train_path = '/path/to/imagenet-folder/train'
transform = transforms.Compose(
    [transforms.ToTensor()]
)
imagenet_data = torchvision.datasets.ImageFolder(train_path, transform=transform)
data_loader = torch.utils.data.DataLoader(
    imagenet_data,
    batch_size=64,
    shuffle=True,
    num_workers=0
)
return data_loader

About

Imagenet dataset for pytorch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%