Skip to content

Experiment settings: Image classification

Besides having certain common experiment settings with other problem types, the specific settings for an image classification experiment are listed and described below.

Dataset settings

Data folder

Defines the folder location of the images to use for the experiment. When the experiment is running, H2O Hydrogen Torch will load images from this folder.

Data folder test

Defines the folder location of the images H2O Hydrogen Torch will use to test the model. H2O Hydrogen Torch will load images from this folder when testing the model. This setting is only available if a test dataframe is selected.

Note

The Data Folder Test setting will appear when you specify a test dataframe using the Test Dataframe setting.

Image column

Defines the dataframe column storing the names of images that H2O Hydrogen Torch will load from the data folder and data folder test when training and testing the model.

Image settings

Image width

Defines the width H2O Hydrogen Torch will use to rescale the images for training and predictions.

Note

Depending on the original image size, a bigger width can generate a higher accuracy value.

Image height

Defines the height H2O Hydrogen Torch will use to rescale the images for training and predictions.

Note

Depending on the original image size, a bigger height can generate a higher accuracy value.

Image channels

Defines the number of channels the train images contain.

Note

  • Typically images have three input channels (red, green, and blue (RGB)), but grayscale images have only 1. When you provide image data in a NumPy data format, any number of channels is allowed. For this reason, data scientists can specify the number of channels.

  • The defined number of channels will also refer to the provided validation and test datasets.

Image normalization

Grid search hyperparameter

Defines the transformer to normalize the image data before training the model.

Note

Usually, state-of-the-art image models normalize the training images by scaling values of each of the input channels to predefined means and standard deviations.

Augmentation settings

Augmentations strategy

Grid search hyperparameter

Defines the augmentation strategy to apply to the input images. Soft, Medium, and Hard values correspond to the strength of the augmentations to apply.

Options
  • Soft: The Soft strategy applies image Resize and random HorizontalFlip during model training while applying image Resize during model inference.

  • Medium: The Medium strategy adds ShiftScaleRotate and CoarseDropout to the list of the train augmentations.

  • Hard: The Hard strategy applies RandomResizedCrop (instead of Resize) during model training while adding RandomBrightnessContrast to the list of train augmentations.

  • Custom: The Custom strategy allows users to use their own augmentations that can be defined in the following two settings:

Note

Augmentations are ways to modify train images while keeping the target values valid, such as flipping the image or adding noise. Distorting training images do not influence the expected prediction of the model but enrich the training data. Augmentations help generalize the model better and improve its accuracy.

Custom train augmentations

Defines a list of augmentations to use for the train data. The format is a resulting .json of the albumentations.save() function call from Albumentations library. IMAGE_HEIGHT and IMAGE_WIDTH placeholders can be used to utilize image dimensions from the experiment configuration.

Note

Augmentations are ways to modify train images while keeping the target values valid, such as flipping the image or adding noise. Distorting training images do not influence the expected prediction of the model but enrich the training data. Augmentations help generalize the model better and improve its accuracy. Augmentations are applied to every image at each epoch with the provided probability.

Custom inference augmentations

Defines a list of inference augmentations to be applied to the test and validation data. The format is a resulting .json of the albumentations.save() function call from Albumentations library. IMAGE_HEIGHT and IMAGE_WIDTH placeholders can be used to utilize image dimensions from the experiment configuration.

Note

Inference augmentations serve the same purpose as training augmentations, but the difference is that inference augmentations are applied to validation and test data. Typically, inference augmentations only contain resizing or very simple augmentations.

Mix image

Grid search hyperparameter

Defines the image mix augmentation to use during model training. If this setting has Disabled selected, no mix augmentation is applied. Mixup and Cutmix options correspond to the mix augmentation to apply:

Options

Mix target

Grid search hyperparameter

Defines the target (label) mix augmentation to apply during model training. Ratio is used as the mixed target if disabled is selected. Mix target is only available when the Mix Image setting is not disabled.

Options
  • Ratio: Two classification targets will be averaged based on the sample ratio during model training.

  • *Min: The minimum of both targets will be taken while ignoring the ratio during model training.

  • *Max: The maximum of both targets will be taken while ignoring the ratio during model training.

Cutmix Corner

Grid search hyperparameter

Determines whether, during Cutmix augmentation, H2O Hydrogen Torch will patch corners of an image with areas of another. Cutmix corner is only available if selected in the Mix Image setting.

Mix Concentration

Grid search hyperparameter

Defines the concentration parameter value of the Beta probability distribution to generate mix ratios. A larger value will lead to more equal ratios (50% - 50%) for mixing. Mix concentration is only available when Mixup is selected in the Mix Image setting.

Mix Probability

Grid search hyperparameter

Defines the probability value to apply mix augmentation. The mix probability value is used for each batch or mix iteration. Mix probability is available when Mixup is selected in the Mix Image setting.

Example

If the mixing probability is specified as 0.3, mix augmentation will be applied to each batch (or mix iteration) with a probability of 0.3.

Mix Iterations

Grid search hyperparameter

Defines the number of times to apply mix augmentation on each batch. The larger the value, the more images are mixed into a single train sample. Mix iterations is available when you select Mixup in the Mix Image setting.

Architecture settings

Backbone

Grid search hyperparameter

Defines the backbone neural network architecture to train the model.

Note

H2O Hydrogen Torch provides several backbone state-of-the-art neural network architectures for model training. H2O Hydrogen Torch accepts backbone neural network architectures from the timm library (enter the architecture name).

Tip

Usually, it is good to use simpler architectures for quicker experiments and larger models when aiming for the highest accuracy.

Pool

Grid search hyperparameter

Defines the global pooling method before the final fully connected layer that H2O Hydrogen Torch will use in the model architecture. Instead of adding a fully connected layer on top of the feature maps, global pooling is applied to each feature map beforehand.

Dropout

Grid search hyperparameter

Defines the dropout rate before the final fully connected layer that H2O Hydrogen Torch will apply during model training. The dropout rate will help the model generalize better by randomly dropping a share of the neural network connections.

Training settings

An image classification experiment does not have specific training settings besides those specified in the training settings section of the common experiment settings page.

Prediction settings

Probability Threshold

Define a threshold for threshold-dependent Classification Metrics (e.g. F1). For multi-class classification argmax will be used.

Note

This threshold is used as a default threshold when showing all other threshold-dependent metrics in the validation plots.

Test Time Augmentations

Defines the test time augmentation(s) to apply during inference. Test time augmentations are applied when the model makes predictions on new data. The final prediction is an average of the predictions for all the augmented versions of an image.

Note

This technique can improve the model accuracy.

Environment settings

An image classification experiment does not have specific environment settings besides those specified in the environment settings section of the common experiment settings page.

Logging settings

Number of images

This setting defines the number of images to show in the experiment Insights tab.


Back to top