v2.5.0
Datasets ⭐
EXAMPLE CODE
ImageNet Dataset
Load the ImageNet dataset with one line of code in Python. Stream ImageNet while training models in PyTorch and TensorFlow. Visualize the ImageNet dataset.
Visualization of the ImageNet Dataset on the Activeloop Platform.

ImageNet dataset

What is ImageNet Dataset?

The ImageNet dataset contains over a million images with labels and bounding boxes. The dataset was created based on the Wordnet hierarchy. Every important concept in WordNet is called a "synonym set" or "synset". The majority of synsets in ImageNet are nouns (80,000+) and there are more than 100,000 synsets in total. Each image in the dataset is annotated by humans and is quality controlled.

Download ImageNet Dataset in Python

Instead of downloading the ImageNet dataset in Python, you can effortlessly load it in Python via our open-source package Hub with just one line of code.

Load ImageNet Dataset Training Subset in Python

1
import hub
2
ds = hub.load("hub://activeloop/imagenet-train")
Copied!

Load ImageNet Dataset Validation Subset in Python

1
import hub
2
ds = hub.load("hub://activeloop/imagenet-val")
Copied!

Load ImageNet Dataset Testing Subset in Python

1
import hub
2
ds = hub.load("hub://activeloop/imagenet-test")
Copied!

ImageNet Dataset Structure

ImageNet Data Fields

  • images: tensor containing the images of the dataset.
  • labels: tensor containing the labels of the dataset.
  • boxes: tensor containing bounding boxes of respective image.

ImageNet Data Splits

  • The ImageNet dataset training set is composed of 1,281,167 images with 1000 object classes.
  • The ImageNet dataset validation set is composed of 50,000 images with 1000 object classes.
  • The ImageNet dataset testing set was composed of 100,000 images with 1000 object classes.

How to use ImageNet Dataset with PyTorch and TensorFlow in Python

Train a model on ImageNet dataset with PyTorch in Python

Let's use Hub's built-in PyTorch one-line dataloader to connect the data to the compute:
1
tform = transforms.Compose([
2
transforms.ToPILImage(), # Must convert to PIL image for subsequent operations to run
3
transforms.RandomRotation(20), # Image augmentation
4
transforms.ToTensor(), # Must convert to pytorch tensor for subsequent operations to run
5
transforms.Lambda(lambda x: x.repeat(int(3/x.shape[0]), 1, 1)), # Some images are grayscale, so we need to add channels
6
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
7
])
8
9
10
dataloader = ds.pytorch(num_workers=0, batch_size=4, transform = {'images': tform, 'labels': None}, shuffle = True)
Copied!

Train a model on ImageNet dataset with TensorFlow in Python

1
dataloader = ds.tensorflow()
Copied!

Additional Information about ImageNet Dataset

ImageNet Dataset Description

ImageNet Dataset Licensing Information

Hub users may have access to a variety of publicly available datasets. We do not host or distribute these datasets, vouch for their quality or fairness, or claim that you have a license to use the datasets. It is your responsibility to determine whether you have permission to use the datasets under their license.
If you're a dataset owner and do not want your dataset to be included in this library, please get in touch through a GitHub issue. Thank you for your contribution to the ML community!
Note: Hub users will be prompted to sign ImageNet Terms of Access when trying to load the dataset.

ImageNet Dataset Citation Information

1
@article{russakovsky2015imagenet,
2
title={Imagenet large scale visual recognition challenge},
3
author={Russakovsky, Olga and Deng, Jia and Su, Hao and Krause, Jonathan and Satheesh, Sanjeev and Ma, Sean and Huang, Zhiheng and Karpathy, Andrej and Khosla, Aditya and Bernstein, Michael and others},
4
journal={International journal of computer vision},
5
volume={115},
6
number={3},
7
pages={211--252},
8
year={2015},
9
publisher={Springer}
10
}
Copied!

ImageNet Dataset FAQs

What is the ImageNet dataset for Python?

The ImageNet dataset played a large part in advancing deep learning and computer vision research. This dataset is an image database organized according to the WordNet hierarchy. In this hierarchy, each node is represented by thousands of images.

What is the ImageNet dataset used for?

The ImageNet dataset is a large dataset of annotated pictures. The objective of making the dataset was to create a resource to encourage the research and development of better methods for computer vision. This dataset is often used for computer vision research.
How to download the ImageNet dataset in Python?
The ImageNet dataset can quickly be loaded using the open-source package Activeloop Hub in Python with just one line of code. See detailed instructions on how to load the ImageNet dataset training subset, the ImageNet dataset validation subset, and the ImageNet dataset testing subset in Python.

How can I use ImageNet dataset in PyTorch or TensorFlow?

You are able to stream the ImageNet dataset while training a model in TensorFlow or PyTorch with a single line of code using the Activeloop Hub open-source package in Python. See detailed instructions on how to train a model on the ImageNet dataset with PyTorch in Python or train a model on the ImageNet dataset with TensorFlow in Python.

Should I work with ImageNet dataset in CSV?

No. Especially for machine learning workflows, CSV is not optimized for working with image data. Instead of downloading the ImageNet dataset, you can easily load, version-control, query, and manipulate ImageNet for machine learning purposes using Activeloop Hub.

How to create an Image Dataset like ImageNet dataset?

Making image datasets like ImageNet is simple with Activeloop Hub. Simple datasets like ImageNet can be created automatically by allowing Hub to parse the legacy files into Hub dataset format. More complex datasets can be created manually.