Maximum sample size in TrainImagesClassifier

Description

This bug was reported by a user on the forum.

The TrainImageClassifier application has a mechanism to balance the class representation on the training and validation set. This mechanism should be deactivated when the user sets sample.bm to 0.

The code related to this issue:

  • https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/blob/develop/Modules/Applications/AppClassification/include/otbTrainImagesBase.hxx#L169
  • https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/blob/develop/Modules/Applications/AppClassification/include/otbTrainImagesBase.hxx#L222
  • https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/blob/develop/Modules/Applications/AppClassification/app/otbMultiImageSamplingRate.cxx#L226

Steps to reproduce

Run TrainImageClassifier with options sampling.mt=-1, sampling.mv=-1, and sampling.bm=0. The log says:

(INFO) TrainImagesClassifier: Sampling strategy : fit the number of samples based on the smallest class

The expected log is

(INFO) TrainImagesClassifier: Sampling strategy : take all samples

Configuration information

The user on the forum uses QGIS

Assignee Loading
Time tracking Loading