vis4d.data.datasets.imagenet

ImageNet 1k dataset.

Classes

ImageNet(data_root[, keys_to_load, split, ...])

ImageNet 1K dataset.

class ImageNet(data_root, keys_to_load=('images', 'categories'), split='train', num_classes=1000, use_sample_lists=False, **kwargs)[source]

ImageNet 1K dataset.

Initialize ImageNet dataset.

Parameters:
  • data_root (str) – Path to root directory of dataset.

  • keys_to_load (list[str], optional) – List of keys to load. Defaults to (K.images, K.categories).

  • split (str, optional) – Dataset split to load. Defaults to “train”.

  • num_classes (int, optional) – Number of classes to load. Defaults to 1000.

  • use_sample_lists (bool, optional) – Whether to use sample lists for loading the dataset. Defaults to False.

NOTE: The dataset is expected to be in the following format:

data_root ├── train.pkl # Sample lists for training set (optional) ├── val.pkl # Sample lists for validation set (optional) ├── train │ ├── n01440764.tar │ ├── … └── val

├── n01440764.tar ├── …

With each tar file containing the images of a single class. The images are expected to be in “.JPEG” extension.

Currently, we are not using the DataBackend for loading the tars to avoid keeping too many file pointers open at the same time.

__getitem__(idx)[source]

Convert single element at given index into Vis4D data format.

Return type:

Dict[str, Any]

__len__()[source]

Return length of dataset.

Return type:

int