I’m having trouble running ImageRegression, after I have created a model using ANN in TrainImagesRegression. ImageRegression fails and gives the following error in the log:
(FATAL) ImageRegression: itk::ERROR: MultiThreader(000001D5109CC040): Exception occurred during SingleMethodExecute OpenCV(4.1.1) C:\build\otb\build\OPENCV\src\OPENCV\modules\ml\src\ann_mlp.cpp:350: error: (-215:Assertion failed) (type == CV_32F || type == CV_64F) && inputs.cols == layer_sizes in function ‘cv::ml::ANN_MLPImpl::predict’
My system:: Windows 10
Version of the OTB: 7.2.0
I installed the OTB with: the binaries
Description of my issue
In TrainImagesRegression, my input raster is a layerstack with 3 bands in Web mercator projection. I have made sure that the bands do not accidentally contain NoData.
My label raster is a single band raster with values on the cells where I have ground truth data, the other cells have the value -1. Again, I checked hat the raster does not accidentally contain NoData.
I used a polygon shapefile that contains features with the same size and location of the cells in the label raster that have ground truth data values. I did this to make sure that the model is only trained on the locations I have ground truth data.
I used the Artificial Neural Networks classifier, with the back-propagation algorithm as training method. I created 2 intermediate layers, with 100 neurons per layer. I’m not sure whether this is the right thing to do.
I left all the other parameters as default.
The tool does work, and does provide a RMSE and a model textfile, with a size of about 500Kb, but is finished rather quickly. After selecting training samples, the training is done in seconds.The total processing time of TrainImagesRegression is 47 seconds on my laptop.
But when I run the model in ImageRegression, with the same layerstack as input rasters, I get the fatal error and the tool stops.
The error notice refers to OpenCV on a pathname which does not exist on my system:
Should I have installed OpenCV? And should it be installed in this path? What am I doing wrong?
I have tried to do TrainImagesRegression using the random forest classifier, to see whether something was wrong with my input data. Using this classifier results in a working model, which also results in a prediction raster when used in ImageRegression. So it seems that the problem is with me using the ANN classifier.
Thank you for your help.