Skip to content

Latest commit

 

History

History
executable file
·
287 lines (216 loc) · 10.5 KB

DATASETS.md

File metadata and controls

executable file
·
287 lines (216 loc) · 10.5 KB

How to install datasets

The dataset download instruction is modified from official CoOp repository. We also include installation of the audio classification dataset ESC-50 in this tutorial.

We suggest putting all datasets under the same folder (say $DATA) to ease management and following the instructions below to organize datasets to avoid modifying the source code. The file structure looks like

$DATA/
|–– imagenet/
|–– caltech-101/
|–– oxford_pets/
|–– stanford_cars/

If you have some datasets already installed somewhere else, you can create symbolic links in $DATA/dataset_name that point to the original data to avoid duplicate download.

Datasets list:

The instructions to prepare each dataset are detailed below. To ensure reproducibility and fair comparison for future work, we provide fixed train/val/test splits for all datasets except ImageNet where the validation set is used as test set. The fixed splits are either from the original datasets (if available) or created by us.

ImageNet

  • Create a folder named imagenet/ under $DATA.
  • Download split_ImageNet.json (google drive link)) to this folder. (Note that the original CoOp does not make a train/val split.)
  • Create images/ under imagenet/.
  • Download the dataset from the official website and extract the training and validation sets to $DATA/imagenet/images. The directory structure should look like
imagenet/
|–– split_ImageNet.json
|–– images/
|   |–– train/ # contains 1,000 folders like n01440764, n01443537, etc.
|   |–– val/
  • If you had downloaded the ImageNet dataset before, you can create symbolic links to map the training and validation sets to $DATA/imagenet/images.
  • Download the classnames.txt to $DATA/imagenet/ from this link. The class names are copied from CLIP.

Caltech101

The directory structure should look like

caltech-101/
|–– 101_ObjectCategories/
|–– split_zhou_Caltech101.json

OxfordPets

The directory structure should look like

oxford_pets/
|–– images/
|–– annotations/
|–– split_zhou_OxfordPets.json

StanfordCars

The directory structure should look like

stanford_cars/
|–– cars_test\
|–– cars_test_annos_withlabels.mat
|–– cars_train\
|–– devkit\
|–– split_zhou_StanfordCars.json

Flowers102

The directory structure should look like

oxford_flowers/
|–– cat_to_name.json
|–– imagelabels.mat
|–– jpg/
|–– split_zhou_OxfordFlowers.json

Food101

The directory structure should look like

food-101/
|–– images/
|–– license_agreement.txt
|–– meta/
|–– README.txt
|–– split_zhou_Food101.json

FGVCAircraft

The directory structure should look like

fgvc_aircraft/
|–– images/
|–– ... # a bunch of .txt files

SUN397

The directory structure should look like

sun397/
|–– SUN397/
|–– split_zhou_SUN397.json
|–– ... # a bunch of .txt files

DTD

The directory structure should look like

dtd/
|–– images/
|–– imdb/
|–– labels/
|–– split_zhou_DescribableTextures.json

EuroSAT

The directory structure should look like

eurosat/
|–– 2750/
|–– split_zhou_EuroSAT.json

UCF101

  • Create a folder named ucf101/ under $DATA.
  • Download the zip file UCF-101-midframes.zip from here and extract it to $DATA/ucf101/. This zip file contains the extracted middle video frames.
  • Copy split_zhou_UCF101.json from splits/split_zhou_UCF101.json to this folder.

The directory structure should look like

ucf101/
|–– UCF-101-midframes/
|–– split_zhou_UCF101.json

ImageNetV2

  • Create a folder named imagenetv2/ under $DATA.

The directory structure should look like

imagenetv2/
|–– imagenetv2-matched-frequency-format-val/
|–– classnames.txt

ImageNet-Sketch

  • Create a folder named imagenet-sketch/ under $DATA.
  • Download the dataset from https://github.com/HaohanWang/ImageNet-Sketch (if you have gdown installed, you can run gdown https://drive.google.com/uc?id=1Mj0i5HBthqH1p_yeXzsg22gZduvgoNeA).
  • Extract the dataset to $DATA/imagenet-sketch. Rename the folder sketch/ to images/.
  • Copy $DATA/imagenet/classnames.txt to $DATA/imagenet-sketch/.

The directory structure should look like

imagenet-sketch/
|–– images/ # contains 1,000 folders whose names have the format of n*
|–– classnames.txt

ImageNet-A

  • Create a folder named imagenet-adversarial/ under $DATA.
  • Download the dataset from https://github.com/hendrycks/natural-adv-examples (or run wget https://people.eecs.berkeley.edu/~hendrycks/imagenet-a.tar)
  • Extract it to $DATA/imagenet-adversarial/.
  • Copy $DATA/imagenet/classnames.txt to $DATA/imagenet-adversarial/.

The directory structure should look like

imagenet-adversarial/
|–– imagenet-a/ # contains 200 folders whose names have the format of n*
|–– classnames.txt

ImageNet-R

  • Create a folder named imagenet-rendition/ under $DATA.
  • Download the dataset from https://github.com/hendrycks/imagenet-r (or run wget https://people.eecs.berkeley.edu/~hendrycks/imagenet-r.tar)
  • Extract it to $DATA/imagenet-rendition/.
  • Copy $DATA/imagenet/classnames.txt to $DATA/imagenet-rendition/.

The directory structure should look like

imagenet-rendition/
|–– imagenet-r/ # contains 200 folders whose names have the format of n*
|–– classnames.txt

ESC-50

  • Create a folder named esc-50/ under $DATA.
  • Download the master.zip from https://github.com/karolpiczak/ESC-50 (or run wget https://github.com/karoldvl/ESC-50/archive/master.zip)
  • Extract it to $DATA/esc-50/.
  • Download AudioCLIP checkpoint with Frozen CLIP to this folder via wget https://github.com/AndreyGuzhov/AudioCLIP/releases/download/v0.1/AudioCLIP-Partial-Training.pt

The directory structure should look like

esc-50/
|–– ESC-50-master/ # contains ESC-50 original dataset
|–– AudioCLIP-Partial-Training.pt