# imagenet2012_fewshot

<br />

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

- **Description**:

Imagenet2012Fewshot is a subset of original ImageNet ILSVRC 2012 dataset. The
dataset share the *same* validation set as the original ImageNet ILSVRC 2012
dataset. However, the training set is subsampled in a label balanced fashion. In
`5shot` configuration, 5 images per label, or 5000 images are sampled; and in
`10shot` configuration, 10 images per label, or 10000 images are sampled.

- **Homepage** : <http://image-net.org/>

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

- **Versions**:

  - `2.0.0`: Fix validation labels.
  - `2.0.1`: Encoding fix. No changes from user point of view.
  - `3.0.0`: Fix colorization on \~12 images (CMYK -\> RGB). Fix format for
    consistency (convert the single png image to Jpeg). Faster generation
    reading directly from the archive.

  - `4.0.0`: (unpublished)

  - `5.0.0`: New split API (<https://tensorflow.org/datasets/splits>)

  - **`5.0.1`** (default): No release notes.

  - `5.1.0`: Added test split.

- **Download size** : `Unknown size`

- **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 <https://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

- **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')`

- **Citation**:

    @article{ILSVRC15,
      Author = {Olga Russakovsky and Jia Deng and Hao Su and Jonathan Krause and Sanjeev Satheesh and Sean Ma and Zhiheng Huang and Andrej Karpathy and Aditya Khosla and Michael Bernstein and Alexander C. Berg and Li Fei-Fei},
      Title = { {ImageNet Large Scale Visual Recognition Challenge} },
      Year = {2015},
      journal   = {International Journal of Computer Vision (IJCV)},
      doi = {10.1007/s11263-015-0816-y},
      volume={115},
      number={3},
      pages={211-252}
    }

## imagenet2012_fewshot/1shot (default config)

- **Config description**: 1shot of total ImageNet training set.

- **Dataset size** : `6.46 GiB`

- **Splits**:

| Split | Examples |
|---|---|
| `'train'` | 1,000 |
| `'tune'` | 1,000 |
| `'validation'` | 50,000 |

- **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/imagenet2012_fewshot-1shot-5.0.1.png)

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

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

## imagenet2012_fewshot/5shot

- **Config description**: 5shot of total ImageNet training set.

- **Dataset size** : `6.88 GiB`

- **Splits**:

| Split | Examples |
|---|---|
| `'train'` | 5,000 |
| `'tune'` | 1,000 |
| `'validation'` | 50,000 |

- **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/imagenet2012_fewshot-5shot-5.0.1.png)

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

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

## imagenet2012_fewshot/10shot

- **Config description**: 10shot of total ImageNet training set.

- **Dataset size** : `7.42 GiB`

- **Splits**:

| Split | Examples |
|---|---|
| `'train'` | 10,000 |
| `'tune'` | 1,000 |
| `'validation'` | 50,000 |

- **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/imagenet2012_fewshot-10shot-5.0.1.png)

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

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