ImageRegression¶
Performs a prediction of the input image according to a regression model file.
Description¶
This application predict output values from an input image, based on a regression model file produced either by TrainVectorRegression or TrainImagesRegression. Pixels of the output image will contain the predicted values from the regression model (single band). The input pixels can be optionally centered and reduced according to the statistics file produced by the ComputeImagesStatistics application. An optional input mask can be provided, in which case only input image pixels whose corresponding mask value is greater than zero will be processed. The remaining of pixels will be given the value zero in the output image.
Parameters¶
Input Image -in image
Mandatory
The input image to predict.
Input Mask -mask image
The mask restrict the classification of the input image to the area where mask pixel values are greater than zero.
Model file -model filename [dtype]
Mandatory
A regression model file (produced either by TrainVectorRegression application or the TrainImagesRegression application).
Statistics file -imstat filename [dtype]
An XML file containing mean and standard deviation to center and reduce samples before prediction (produced by the ComputeImagesStatistics application). If this file contains one more band than the sample size, the last stat of the last band will beapplied to expand the output predicted value.
Output Image -out image [dtype]
Mandatory
Output image containing predicted values
Available RAM (MB) -ram int
Default value: 256
Available memory for processing (in MB).
Examples¶
From the command-line:
otbcli_ImageRegression -in QB_1_ortho.tif -imstat EstimateImageStatisticsQB1.xml -model clsvmModelQB1.svm -out clLabeledImageQB1.tif
From Python:
import otbApplication
app = otbApplication.Registry.CreateApplication("ImageRegression")
app.SetParameterString("in", "QB_1_ortho.tif")
app.SetParameterString("imstat", "EstimateImageStatisticsQB1.xml")
app.SetParameterString("model", "clsvmModelQB1.svm")
app.SetParameterString("out", "clLabeledImageQB1.tif")
app.ExecuteAndWriteOutput()
Limitations¶
The input image must contain the feature bands used for the model training. If a statistics file was used during training by the TrainRegression, it is mandatory to use the same statistics file for prediction. If an input mask is used, its size must match the input image size.