Skip to main content
Version: v1.4.0

Dataset format: Image metric learning

Dataset format

The data for an image metric learning experiment needs to be in a zip file (1) containing a CSV file (2) and an image folder (3).

folder_name.zip (1)
│ └───csv_name.csv (2)
│ │
│ └───image_folder_name (3)
│ └───name_of_image.image_extension
│ └───name_of_image.image_extension
│ └───name_of_image.image_extension
│ ...
Note

You can have multiple CSV files in the zip file that you can use as train, validation, and test dataframes:

  • A train CSV file needs to follow the format described above
  • A validation CSV file needs to follow the same format as a train CSV file
  • A test CSV file needs to follow the same format as a train CSV file, but does not require a label column
  1. The available dataset connectors require the data for an image metric learning experiment to be in a zip file.
    Note

    To learn how to upload your zip file as your dataset in H2O Hydrogen Torch, see Dataset connectors.

  2. A CSV file containing the following columns:
    • An image column containing the names of the images for the experiment, where each image has an image extension specified
      Note
      • Images can contain a mix of supported image extensions. To learn about supported image extensions, see Supported image extensions for image processing.
      • The names of the image files do not specify the data directory (location of the images in the zip file). You can specify the data directory (data folder) when uploading the dataset or before the dataset is used for an experiment. For more information, see Import dataset settings.
    • A label column containing the class names
      Note

      Similar images should have the same class name.

    • An optional fold column containing cross-validation fold indexes
      Note

      The fold column can include integers (0, 1, 2, … , N-1 values or 1, 2, 3… , N values) or categorical values.

  3. An image folder that contains all the images specified in the image column; H2O Hydrogen Torch uses the images in this folder to run the image metric learning experiment.
    Note

    All image file names need to specify image extension. Images can contain a mix of supported image extensions. To learn about supported image extensions, see Supported image extensions for image processing.

Example

The bicycle_image_metric_learning.zip file is a preprocessed dataset in H2O Hydrogen Torch and was formatted to solve an image metric learning problem. The structure of the zip file is as follows:

bicycle_image_metric_learning.zip
│ └───train.csv
│ │
│ images
│ └───181783211141_0.jpg
│ └───181596348104_1.jpg
│ └───171166528893_0.jpg
│ ...

The first three rows of the CSV file are as follows:

imagelabelfold
181783211141_0.JPG1817832111410
181596348104_1.JPG1815963481042
171166528893_0.JPG1711665288930
Note
  • In this example, the data directory in the image column is not specified. Therefore, it needs to be specified when uploading the dataset, and the images folder needs to be specify as the value for the Data folder setting. For more information, see Import dataset settings.
  • To learn how to access one of the preprocessed datasets in H2O Hydrogen Torch, see Demo (preprocessed) datasets.

Feedback