Predict Regression

Performs a prediction of the input image according to a regression model file.

Detailed description

This application predict output values from an input image, based on a regression model file produced by the TrainRegression application. Pixels of the output image will contain the predicted values fromthe 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 0 will be processed. The remaining of pixels will be given the value 0 in the output image.

Parameters

This section describes in details the parameters available for this application. Table [1] presents a summary of these parameters and the parameters keys to be used in command-line and programming languages. Application key is PredictRegression .

[1]Table: Parameters table for Predict Regression.
Parameter Key Parameter Type Parameter Description
in Input image Input image
mask Input image Input image
model Input File name Input File name
imstat Input File name Input File name
out Output image Output image
ram Int Int
inxml XML input parameters file XML input parameters file
outxml XML output parameters file XML output parameters file
  • Input Image: The input image to predict.
  • Input Mask: The mask allow restricting classification of the input image to the area where mask pixel values are greater than 0.
  • Model file: A regression model file (produced by TrainRegression application).
  • Statistics file: A XML file containing mean and standard deviation to center and reduce samples before prediction (produced by ComputeImagesStatistics application). If this file containsone more band than the sample size, the last stat of last band will beapplied to expand the output predicted value.
  • Output Image: Output image containing predicted values.
  • Available RAM (Mb): Available memory for processing (in MB).
  • Load otb application from xml file: Load otb application from xml file.
  • Save otb application to xml file: Save otb application to xml file.

Example

To run this example in command-line, use the following:

otbcli_PredictRegression -in QB_1_ortho.tif -imstat EstimateImageStatisticsQB1.xml -model clsvmModelQB1.svm -out clLabeledImageQB1.tif

To run this example from Python, use the following code snippet:

#!/usr/bin/python

# Import the otb applications package
import otbApplication

# The following line creates an instance of the PredictRegression application
PredictRegression = otbApplication.Registry.CreateApplication("PredictRegression")

# The following lines set all the application parameters:
PredictRegression.SetParameterString("in", "QB_1_ortho.tif")

PredictRegression.SetParameterString("imstat", "EstimateImageStatisticsQB1.xml")

PredictRegression.SetParameterString("model", "clsvmModelQB1.svm")

PredictRegression.SetParameterString("out", "clLabeledImageQB1.tif")

# The following line execute the application
PredictRegression.ExecuteAndWriteOutput()

Limitations

The input image must contain the feature bands used for the model training (without the predicted value). 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.

Authors

This application has been written by OTB-Team.

See Also

These additional ressources can be useful for further information:

TrainRegression, ComputeImagesStatistics