Image Classification datasets

You can find herafter a short description of the dataset supported in image classification and their structure.

Available datasets

Dataset

# classes

# images

details

cifar10

10

60000

50000 training images and 10000 test images. 6,000 images per class. Each image is 32 × 32 pixels in RGB.

cifar100

100

60000

50000 training images and 10000 test images, for each class 500 for training and 100 for testing. Each image is 32 × 32 pixels in RGB.

emnist_byclass

62

814255

697932 for training, 116323 for test. Each image is 28 × 28 pixels in grayscale. Classes: 10 digits, 26 uppercase letters, and 26 lowercase letters. Unlike CIFAR-10 and CIFAR-100, the classes are not balanced.

imagenet

1000

1431167

(ILSVRC 2012), 1281167 for training, 50000 for validation, 100000 for test, RGB, varying dimensions.

food101

101

101000

each containing 1,000 images: 750 for training and 250 for testing. Images are RGB with varying dimensions.

plant_leaf_diseases

39

55448

no predefined split, (256x256x3) RGB

tf_flowers

5

3670

no predefined split, varying widths and heights, RGB

Cifar10

The structure of the dataset is the following:

cifar-10-batches-py/
    data_batch_1       # 10,000 training images
    data_batch_2       # 10,000 training images
    data_batch_3       # 10,000 training images
    data_batch_4       # 10,000 training images
    data_batch_5       # 10,000 training images
    test_batch         # 10,000 test images
    batches.meta       # Class names
    readme.html

Cifar100

The structure of the dataset is the following:

cifar-100-python/
    train/    # 50,000 training images
    test/     # 10,000 test images
    meta/     # Fine and coarse class names

Emnist_byclass

The original IDX file structure:

    emnist-byclass-train-images-idx3-ubyte.gz
    emnist-byclass-train-labels-idx1-ubyte.gz
    emnist-byclass-test-images-idx3-ubyte.gz
    emnist-byclass-test-labels-idx1-ubyte.gz
    emnist-byclass-mapping.txt

Common structure of Imagenet, food101, plant_leaf_diseases and tf_flowers type

They are all structured so that the folder names must match the class labels provided to the model. However there are two possibilities. The dataset may already be split in train/, validation/ and test/ sub-directories like in the following example:

dataset_root_directory/
    train/      # if provided or created
        class_1/
            a_image_1.jpg
            a_image_2.jpg
        class_2/
            b_image_1.jpg
            b_image_2.jpg
    validation/ # if provided or created
    test/       # if provided or created

It can also happen that there is no predefined split like in the following example:

dataset_root_directory/
   class_a/
      a_image_1.jpg
      a_image_2.jpg
   class_b/
      b_image_1.jpg
      b_image_2.jpg

As well-known example, is the tf_flowers dataset:

tf_flowers/
   daisy/
   dandelion/
   roses/
   sunflowers/
   tulips/

Configure dataset paths

When validation_path is empty (which is the case in particular when there is no predefined split), the service takes validation_split from the training set. When test_path is empty, validation data is used for evaluation. When quantization_path is empty, the service randomly draws quantization_split inputs from the training set for calibration of layers input/ouputs (necessary step of post-training quantization). For more details, have a look to STM32 model quantization guide.

dataset:
  dataset_name: #imagenet, food101, plant_leaf_diseases, tf_flowers, cifar10, cifar100, emnist_byclass
  class_names: # example [airplane, automobile, bird, cat, deer, dog, frog, horse, ship, truck] # or a path to .txt containing the list of class names
  training_path: # example: ./datasets/food101/train
  validation_path: # path to validation images if any
  validation_split: # example: 0.2, 20% of the train set taken randomly
  test_path: #example: ./datasets/food101/test
  quantization_path: #example: ./datasets/food101/quant if defined
  quantization_split: # example: 0.15, 15% of the train set taken randomly

Keep the class order consistent with the model’s training configuration. For training configuration details, see Training.