Skip To Main Content

Account

Settings

Logout

·placeholder

Account

Settings

Logout

Filter:

Submit Search

# ML - Train Object Classifier

This is an experimental module from the Xtra Library: https://xtras.amira-avizo.com.

This module trains an object classifier to associate a set of Measures (or features, as computed by the Label Analysis module) with a Material (or class), given the examples provided as inputs.

The module generates a trained model as a file on the disk, at specified location. This file is to be used with the associated module ML - Predict Object Class.

In addition, the module will also generates outputs in the project, that are named according to the input Data, with the following suffixes:

- .instances: a representation of the input label field, but where individual objects are assigned individual IDs.

- .features: a Label Analysis spreadsheet, as generated by Label Analysis, with the requested Measures and 2 additional columns to indicate the Class Name and Class ID.

The main input is expected to be a Label Image, which is typically manually generated in the following way:

- Given a binary image where each object is a connected component (e.g. the output from Separate Object). Typically, the kind of image you would use ‘Label Analysis’ on to obtain individual measurements.

- You may want to Duplicate this dataset first, to keep the binary image available in your project.

- Enter the Segmentation Editor to edit the binary image. Typically, the binary segmentation will be under the class ‘Material1’

- Create a set of new materials, to represent all your classes of interest and give them appropriate names and colors.

- Use the ‘Pick’ tool (with option Connected Component) to select individual objects and assign them to the appropriate target class.

- Once a sufficient number of representative examples are given for each target class, delete the ‘Material1’. As for any supervised learning, the notions of ‘sufficient’ and ‘representative’ are task-dependent and may require experimentation.

The implementation of this module is based on scikit-learn python package.

## Known Limitations

· The trained model is stored on the disk, relying on the pickle python package. It is unlikely that a model trained with a version of the Software will work with a future version.

· The set of measures the model relies on is specified in this module, and must remain the same when using the module for Prediction (i.e. if the measure group is modified between Training and Prediction, the prediction will fail).

· As a consequence, if you need to transfer the model to a different computer, you will need to ensure the Measure Group is defined on that computer (see “Export Custom Measure Groups”)

## Connections

Input | Description
Data: [required] | Label Image representing the masks of objects assigned to a Material that corresponds to the class. The notion of object is implicitly associated with the notion of connected components (see description above)
Intensity Image: [optional] | Grayscale image, the same size and shape as the Data, from which intensity features will be computed.

## Parameters (Ports)

Parameter | Description
Console: | Opens the Python Script Object console of the module as the active console window.
Mode: | Specify whether the input is interpreted as a 3D volume or a stack of 2D images for processing. 3D: the module configuration is set to 3D. The image will be processed as a whole in 3D. 2D (XY): the module configuration is set to 2D. The image will be processed slice by slice. Note: 2D measures will not be displayed in the analysis spreadsheet of a 3D volume and vice versa
Model: | Select one or multiple base classifier. An ensemble classifier is trained from the selection, using soft voting.
Measures: | Select the set of measures to be used for training. See ‘Label Analysis’ module for more information.
Feature Normalization: | If active, each feature is normalized – with respect to the set of objects in the training data – prior to training the classifier. When prediction will be performed, the same normalization will be applied.
Output Directory: | Folder where the trained model will be saved
Base Filename: | The name of the model file to be generated

## Outputs

The main output of the module is the model file in the Output Directory.

Additional outputs are generated in the Project: the label field of object instances, and the analysis spreadsheet with additional columns for Class Name and ID.

## See also

ML_Prediction_ObjectClassifier

MLObjectClassification_Tuto.pdf