TextureClassificationTrain
Enriches a texture model by training it on a gray level image that has been labeled.
Access to parameter description
As an introduction:
Following the computation mode of the associated texture classification model (2D or 3D) initialized with TextureClassificationCreate, the input image can be considered as a series of 2D images or as a series of 3D images.
For all the labeled pixels of the training image, this algorithm extracts the texture features defined by the groups selected in the texture classification model. These newly extracted features increase the training-set and enrich the model.
Note: All the pixels within the analysis radius of a labeled pixel are considered for the feature extraction. It means that the number of pixels used for training is greater than the number of the labeled pixels.
See also
Access to parameter description
As an introduction:
- section Image Segmentation
- section Supervised Texture Classification
Following the computation mode of the associated texture classification model (2D or 3D) initialized with TextureClassificationCreate, the input image can be considered as a series of 2D images or as a series of 3D images.
For all the labeled pixels of the training image, this algorithm extracts the texture features defined by the groups selected in the texture classification model. These newly extracted features increase the training-set and enrich the model.
Note: All the pixels within the analysis radius of a labeled pixel are considered for the feature extraction. It means that the number of pixels used for training is greater than the number of the labeled pixels.
See also
Function Syntax
This function returns inputOutputModel.
// Function prototype
TextureClassificationModel::Ptr textureClassificationTrain( std::shared_ptr< iolink::ImageView > inputImage, std::shared_ptr< iolink::ImageView > inputTrainingImage, double minSeparationPercentage, bool finalizeTraining, TextureClassificationModel::Ptr inputOutputModel = NULL );
This function returns inputOutputModel.
// Function prototype. texture_classification_train( input_image, input_training_image, min_separation_percentage = 5, finalize_training = True, input_output_model = None )
This function returns inputOutputModel.
// Function prototype. public static TextureClassificationModel TextureClassificationTrain( IOLink.ImageView inputImage, IOLink.ImageView inputTrainingImage, double minSeparationPercentage = 5, bool finalizeTraining = true, TextureClassificationModel inputOutputModel = null );
Class Syntax
Parameters
Class Name | TextureClassificationTrain |
---|
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
inputImage |
The input grayscale image. | Image | Grayscale | nullptr | |
inputTrainingImage |
The input label image.
Each label represents a class sample for the training. |
Image | Label | nullptr | |
minSeparationPercentage |
This parameter controls the rejection criteria of the feature selection algorithm (FS).
A measure is rejected if its contribution does not increase the separation power of the classification model enough. This ratio indicates the minimal relative growth required to keep a measure. More information is available in the Feature Selection section. This value must be greater than or equal to 0.0. |
Float64 | [0, 100] | 5 | |
finalizeTraining |
This parameter indicates whether the algorithm must finalize the training. This parameter must be set to true since the retraining is currently not allowed. | Bool | true | ||
inputOutputModel |
The input and output texture classification model. | TextureClassificationModel | nullptr |
Object Examples
auto classification_input = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "classification_input.vip" ); auto classification_input_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "classification_input_label.vip" ); TextureClassificationModel::Ptr modelToTrain= TextureClassificationModel::read( std::string( IMAGEDEVDATA_OBJECTS_FOLDER ) + "modelToTrain.vip" ); TextureClassificationTrain textureClassificationTrainAlgo; textureClassificationTrainAlgo.setInputImage( classification_input ); textureClassificationTrainAlgo.setInputTrainingImage( classification_input_label ); textureClassificationTrainAlgo.setMinSeparationPercentage( 5 ); textureClassificationTrainAlgo.setFinalizeTraining( true ); textureClassificationTrainAlgo.setInputOutputModel( modelToTrain ); textureClassificationTrainAlgo.execute(); std::cout << "computeMode: " << textureClassificationTrainAlgo.inputOutputModel()->computeMode( ) ;
classification_input = imagedev.read_vip_image(imagedev_data.get_image_path("classification_input.vip")) classification_input_label = imagedev.read_vip_image(imagedev_data.get_image_path("classification_input_label.vip")) model_to_train = imagedev.TextureClassificationModel.read(imagedev_data.get_object_path("modelToTrain.vip")) texture_classification_train_algo = imagedev.TextureClassificationTrain() texture_classification_train_algo.input_image = classification_input texture_classification_train_algo.input_training_image = classification_input_label texture_classification_train_algo.min_separation_percentage = 5 texture_classification_train_algo.finalize_training = True texture_classification_train_algo.input_output_model = model_to_train texture_classification_train_algo.execute() print( "computeMode: ", str( texture_classification_train_algo.input_output_model.compute_mode( ) ) )
ImageView classification_input = Data.ReadVipImage( @"Data/images/classification_input.vip" ); ImageView classification_input_label = Data.ReadVipImage( @"Data/images/classification_input_label.vip" ); TextureClassificationModel modelToTrain = TextureClassificationModel.Read( @"Data/objects/modelToTrain.vip" ); TextureClassificationTrain textureClassificationTrainAlgo = new TextureClassificationTrain { inputImage = classification_input, inputTrainingImage = classification_input_label, minSeparationPercentage = 5, finalizeTraining = true, inputOutputModel = modelToTrain }; textureClassificationTrainAlgo.Execute(); Console.WriteLine( "computeMode: " + textureClassificationTrainAlgo.inputOutputModel.computeMode( ) );
Function Examples
auto classification_input = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "classification_input.vip" ); auto classification_input_label = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "classification_input_label.vip" ); TextureClassificationModel::Ptr modelToTrain= TextureClassificationModel::read( std::string( IMAGEDEVDATA_OBJECTS_FOLDER ) + "modelToTrain.vip" ); auto result = textureClassificationTrain( classification_input, classification_input_label, 5, true, modelToTrain ); std::cout << "computeMode: " << result->computeMode( ) ;
classification_input = imagedev.read_vip_image(imagedev_data.get_image_path("classification_input.vip")) classification_input_label = imagedev.read_vip_image(imagedev_data.get_image_path("classification_input_label.vip")) model_to_train = imagedev.TextureClassificationModel.read(imagedev_data.get_object_path("modelToTrain.vip")) result = imagedev.texture_classification_train( classification_input, classification_input_label, 5, True, model_to_train ) print( "computeMode: ", str( result.compute_mode( ) ) )
ImageView classification_input = Data.ReadVipImage( @"Data/images/classification_input.vip" ); ImageView classification_input_label = Data.ReadVipImage( @"Data/images/classification_input_label.vip" ); TextureClassificationModel modelToTrain = TextureClassificationModel.Read( @"Data/objects/modelToTrain.vip" ); TextureClassificationModel result = Processing.TextureClassificationTrain( classification_input, classification_input_label, 5, true, modelToTrain ); Console.WriteLine( "computeMode: " + result.computeMode( ) );