# imagenet_v2

<br />

- **Description**:

ImageNet-v2 is an ImageNet test set (10 per class) collected by closely
following the original labelling protocol. Each image has been labelled by at
least 10 MTurk workers, possibly more, and depending on the strategy used to
select which images to include among the 10 chosen for the given class there are
three different versions of the dataset. Please refer to section four of the
paper for more details on how the different variants were compiled.

The label space is the same as that of ImageNet2012. Each example is represented
as a dictionary with the following keys:

- 'image': The image, a (H, W, 3)-tensor.
- 'label': An integer in the range \[0, 1000).
- 'file_name': A unique sting identifying the example within the dataset.

- **Homepage** :
  <https://github.com/modestyachts/ImageNetV2>

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

- **Versions**:

  - `1.0.0`: Initial version.
  - `2.0.0`: Files updated.
  - **`3.0.0`** (default): Fix file_name, from absolute path to path relative to data directory, ie: "class_id/filename.jpg".
  - `3.1.0`: New URLs for resources from Hugging Face.
- **Auto-cached**
  ([documentation](https://www.tensorflow.org/datasets/performances#auto-caching)):
  No

- **Splits**:

| Split | Examples |
|---|---|
| `'test'` | 10,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')`

- **Citation**:

    @inproceedings{recht2019imagenet,
      title={Do ImageNet Classifiers Generalize to ImageNet?},
      author={Recht, Benjamin and Roelofs, Rebecca and Schmidt, Ludwig and Shankar, Vaishaal},
      booktitle={International Conference on Machine Learning},
      pages={5389--5400},
      year={2019}
    }

## imagenet_v2/matched-frequency (default config)

- **Download size** : `1.18 GiB`

- **Dataset size** : `1.16 GiB`

- **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_v2-matched-frequency-3.0.0.png)

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

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

## imagenet_v2/threshold-0.7

- **Download size** : `1.16 GiB`

- **Dataset size** : `1.15 GiB`

- **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_v2-threshold-0.7-3.0.0.png)

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

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

## imagenet_v2/topimages

- **Download size** : `1.16 GiB`

- **Dataset size** : `1.14 GiB`

- **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_v2-topimages-3.0.0.png)

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

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