Fix the neural network classifier and the TrainImagesClassifier tests
TrainImagesClassifier tests are broken (the
apTvClTrainMethodXXXImagesClassifierQB1 family of test), and are always successful. These tests are based on a ascii comparison of the computed confusion matrix, with a tolerance of 2 for numerical values in the tested files. The tolerance has been added in !224 (merged) to take into account the fact that Shark classifier use randomness, and that the random seed cannot be set for these tests, which is fixed by allowing an error of two misclassified samples. But the tolerance in --compare-ascii is relative ... which means that a tolerance of two is very large will always be verified
For example the ANN test produces the confusion matrix:
#Reference labels (rows):1,2,3,4 #Produced labels (columns):1,2,3,4 42,0,0,0 42,0,0,0 42,0,0,0 42,0,0,0
while the baseline is:
#Reference labels (rows):1,2,3,4 #Produced labels (columns):1,2,3,4 42,0,0,0 0,42,0,0 0,0,42,0 0,0,0,42
but the test is successful on CI. This hides bug #2191.
In this merge request the tolerance has been removed on this test, the produced confusion matrix should be the same as the one in the baseline. Additionally, the baseline checks for the Shark classifier tests in
TrainImagesClassifier have been removed, as it was the case before !224 (merged).
This merge request also fix #2191. When fetching values from an openCV matrix (cv::Mat) with the
template<typename T> at<T> method, the template parameter should be the type of data actually stored in the matrix, not the desired output type. Using the wrong type results in a reinterpretation of the stored value. In
NeuralNetworkMachineLearningModel, this was resulting in a reinterpretation of float values into int values when writing the output labels.
The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.
Check before merging:
- All discussions are resolved
- At least 2
👍votes from core developers, no 👎vote.
- The feature branch is (reasonably) up-to-date with the base branch
- Dashboard is green
- Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
- Optionally, run
git diff develop... -U0 --no-color | clang-format-diff.py -p1 -ion latest changes and commit