# imagenet_lt

<br />

> [!WARNING]
> **Warning:** Manual download required. See instructions below.

- **Description**:

ImageNet-LT is a subset of original ImageNet ILSVRC 2012 dataset. The training
set is subsampled such that the number of images per class follows a long-tailed
distribution. The class with the maximum number of images contains 1,280
examples, whereas the class with the minumum number of images contains only 5
examples. The dataset also has a balanced validation set, which is also a subset
of the ImageNet ILSVRC 2012 training set and contains 20 images per class. The
test set of this dataset is the same as the validation set of the original
ImageNet ILSVRC 2012 dataset.

The original ImageNet ILSVRC 2012 dataset must be downloaded manually, and its
path should be set with --manual_dir in order to generate this dataset.

- **Additional Documentation** :
  [Explore on Papers With Code](https://paperswithcode.com/dataset/imagenet-lt)

- **Homepage** :
  <https://github.com/zhmiao/OpenLongTailRecognition-OLTR>

- **Source code** :
  [`tfds.datasets.imagenet_lt.Builder`](https://github.com/tensorflow/datasets/tree/master/tensorflow_datasets/datasets/imagenet_lt/imagenet_lt_dataset_builder.py)

- **Versions**:

  - **`1.0.0`** (default): Initial release.
- **Download size** : `5.21 MiB`

- **Dataset size** : `20.92 GiB`

- **Manual download instructions** : This dataset requires you to
  download the source data manually into `download_config.manual_dir`
  (defaults to `~/tensorflow_datasets/downloads/manual/`):  

  manual_dir should contain two files: ILSVRC2012_img_train.tar and
  ILSVRC2012_img_val.tar.
  You need to register on <http://www.image-net.org/download-images> in order
  to get the link to download the dataset.

- **Auto-cached**
  ([documentation](https://www.tensorflow.org/datasets/performances#auto-caching)):
  No

- **Splits**:

| Split | Examples |
|---|---|
| `'test'` | 50,000 |
| `'train'` | 115,846 |
| `'validation'` | 20,000 |

- **Feature structure**:

    FeaturesDict({
        'file_name': Text(shape=(), dtype=string),
        'image': Image(shape=(None, None, 3), dtype=uint8),
        'label': ClassLabel(shape=(), dtype=int64, num_classes=1000),
    })

- **Feature documentation**:

| Feature | Class | Shape | Dtype | Description |
|---|---|---|---|---|
|   | FeaturesDict |   |   |   |
| file_name | Text |   | string |   |
| image | Image | (None, None, 3) | uint8 |   |
| label | ClassLabel |   | int64 |   |

- **Supervised keys** (See
  [`as_supervised` doc](https://www.tensorflow.org/datasets/api_docs/python/tfds/load#args)):
  `('image', 'label')`

- **Figure**
  ([tfds.show_examples](https://www.tensorflow.org/datasets/api_docs/python/tfds/visualization/show_examples)):

![Visualization](https://storage.googleapis.com/tfds-data/visualization/fig/imagenet_lt-1.0.0.png)

- **Examples** ([tfds.as_dataframe](https://www.tensorflow.org/datasets/api_docs/python/tfds/as_dataframe)):

<button id="displaydataframe">Display examples...</button>

- **Citation**:

    \
    @inproceedings{openlongtailrecognition,
      title={Large-Scale Long-Tailed Recognition in an Open World},
      author={Liu, Ziwei and Miao, Zhongqi and Zhan, Xiaohang and Wang, Jiayun and Gong, Boqing and Yu, Stella X.},
      booktitle={IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
      year={2019},
      url={https://github.com/zhmiao/OpenLongTailRecognition-OLTR}
    }