Inference Configuration Tool

You are currently viewing the documentation for a pre-release version (2.2.0). To access documentation for other versions, click the "Switch Version" button located in the upper-right corner of the page.

■ If you're unsure about the version of the product you are using, please contact Mech-Mind Technical Support for assistance.

This section introduces the Inference Configuration tool for post-processing in deep learning Steps, and explains how to use it.

Introduction

The Inference Configuration tool is a dedicated tool for configuring and optimizing post-process parameters in Steps such as "Deep Learning Model Package Inference". With this tool, you can flexibly adjust inference parameters for different types of model packages (such as Image Classification, Defect Segmentation, Object Detection, etc.), configure validation rules for multi-model packages, and thereby improve the accuracy and applicability of inference results. The Inference Configuration tool supports parameter group management and visual parameter tuning.

Start the Feature

In the Step parameters panel of the "Deep Learning Model Package Inference" Step or the "Pick Anything V2" Step, click the Open the editor button of the Inference Configuration parameter to open the Inference Configuration tool.

entrance vision

Interface Description

The interface of the Inference Configuration tool is shown below.

interface intro

The functional areas in the above interface are described in the following table.

No. Area Description

1

Parameter group list

Displays all created parameter groups. You can create, delete, duplicate, and switch parameter groups to manage inference configurations for different scenarios.

2

Image visualization area

Displays the model inference results. You can configure label font colors and mask colors for different label classes in "Visualization Settings". If a multi-model package is used for inference, you can also switch the visualization scope by selecting All models or Selected model at the top of the visualization area.

3

Inference configuration area

Used to configure the processing logic for inference results, including post-process settings and validation rule settings.

  • Post-process settings is used to configure post-process parameters for the inference results of the selected model.

  • Validation rule settings is shown only when a multi-model package is used for deep learning inference. It is used to validate the inference results (i.e., OK/NG judgment).

Inference Configuration Procedure

You can follow the procedure below to configure inference:

  1. After opening the tool, create a new parameter group or select an existing parameter group for editing.

  2. In the Post-process settings tab of the inference configuration area on the right, adjust the key parameters according to the current model type. While adjusting parameters, you can observe the changes in the visualization area on the left to verify the parameter adjustment results in real time.

  3. If a multi-model package is being used, switch to the Validation rule settings tab to define the logical relationships between the results of multiple models.

  4. At the top of the visualization area, click Visualization Settings to set mask colors for different label classes or adjust label font colors to improve the distinction between results.

  5. After the configuration is complete, click Save. The system will automatically apply the current parameter group configuration to the inference Steps that use this parameter group.

Post-Process Settings

The post-process settings page is shown below.

post processing intro

The functional areas in the above interface are described in the following table.

No. Area Description

1

Model navigation

Displays the models included in the imported model package. If a multi-model package is used, you can click different models to switch to the corresponding post-process parameters for adjustment.

2

Parameter adjustment

Used to configure the post-process parameters of the currently selected model. After adjustment, you can click Infer current image in the visualization area to view the adjustment results in real time. Click Reset to restore the default parameter configuration.

3

Image inference

Infer images based on the set parameters and view the inference results in the visualization area. The "Automatic inference" function is enabled by default. Click Infer current image to process a single image with the current parameters. Click Infer next image to automatically load and process the next image in the sequence.

The following sections describe the post-process parameters for different model package inference tasks. You can select the corresponding section based on the type of model package you use.

Image Classification

The adjustable post-process parameters for an Image Classification model package are as follows.

Parameter Description

Confidence threshold

This parameter is used to set the confidence threshold for image classification. Results with confidence above this threshold will be retained.
Adjustment: Set this parameter based on actual requirements.

Generate class activation maps

This parameter is used to view which pixel regions in the image contribute more to the image classification result. Blue represents lower contribution and red represents higher contribution.

Enabling Generate class activation maps will slow down the model package inference speed. It is recommended to use this function only for debugging and analysis, not in production environments.

This parameter is shown only when the class activation map function was enabled when exporting the model package in Mech-DLK.

Defect Segmentation

The adjustable post-process parameters for a Defect Segmentation model package are as follows.

Morphological transformation

Parameter Description

Morphological transformation

Enabling this parameter will apply morphological processing to the defect segmentation masks.
Adjustment: Set this parameter based on actual requirements.

Morphological transformation type

This parameter is used to select the morphological post-processing method for masks.

Options: Dilation, Erosion, Opening, Closing

  • Dilation: Increases the mask area. Suitable for cases where the mask is smaller than the actual area, to avoid missing point cloud data.

  • Erosion: Reduces the mask area. Suitable for cases where the mask covers too large an area or contains noise.

  • Opening: Performs erosion first, then dilation on the mask. Removes small noise regions while maintaining the overall size and shape of the target.

  • Closing: Performs dilation first, then erosion on the mask. Fills small holes while maintaining the overall size and shape of the target.

Adjustment: Set this parameter based on actual requirements.

Parameter Description

Label classes

Displays the list of defect classes labeled during training in Mech-DLK.

If the imported model package is a multi-class defect model package, you can select any defect class and configure the filtering rule parameters for it separately.

Enable filtering

This parameter specifies whether to enable filtering rules for the corresponding label class.
When enabled, the configured filtering rules will be applied to the corresponding defect class.

Filtering rule settings

Parameter Description

Apply parameters to

Used to select whether to apply the configured filtering rule parameters to a specified class or all classes.

Distribution area filter

A general filtering rule. After setting the distribution area, only inference results within the distribution area will be retained. Configure this through the "Set distribution area" button.
When enabled, click Set distribution area, and draw the area to be retained in the pop-up image window.

Per-image result count filter

A general filtering rule. Used to set the minimum number of inference results in a single image. Only when the number of results is greater than or equal to this value will the inference results of the image be retained.
Adjustment: Set this parameter based on actual requirements.

Noise filter

A general filtering rule. Used to set the minimum area of a single inference result. Results with an area smaller than the set value will be filtered out.
Adjustment: Set this parameter based on actual requirements.

Logic between conditions

A logic filtering rule. Used to uniformly set the logic between conditions (AND/OR) for multiple added filtering conditions (such as area, aspect ratio of bounding rectangle, circularity, etc.). Different condition items are combined according to the "Logic between conditions" setting (AND/OR); when the same condition item is added multiple times, it is always combined with OR logic, regardless of the "Logic between conditions" setting.
Options: AND, OR
Click Add condition, select the conditions to filter from the drop-down list, and set the logic between conditions. For the definitions and descriptions of conditions, see Filtering Condition Descriptions in this section. You can set the "Filter value range" based on the "Reference value range". Additionally, you can enable/disable filtering or delete each condition individually.

  • When setting filtering rules, it is recommended to set general rules first to meet most filtering needs, and then add logic rules for fine-tuning based on actual conditions.

  • After enabling filtering rules, it is recommended to verify inference results multiple times to ensure that valid defects are not incorrectly filtered out.

Instance Segmentation

The adjustable post-process parameters for an Instance Segmentation model package are as follows.

Parameter Description

Morphological transformation

Enabling this parameter will apply morphological processing to the instance segmentation masks.
Adjustment: Set this parameter based on actual requirements.

Morphological transformation type

This parameter is used to select the morphological post-processing method for masks.

Options: Dilation, Erosion, Opening, Closing

  • Dilation: Increases the mask area. Suitable for cases where the mask is smaller than the actual area, to avoid missing point cloud data.

  • Erosion: Reduces the mask area. Suitable for cases where the mask covers too large an area or contains noise.

  • Opening: Performs erosion first, then dilation on the mask. Removes small noise regions while maintaining the overall size and shape of the target.

  • Closing: Performs dilation first, then erosion on the mask. Fills small holes while maintaining the overall size and shape of the target.

Adjustment: Set this parameter based on actual requirements.

Confidence threshold

This parameter is used to set the confidence threshold for instance segmentation. Results with confidence above this threshold will be retained.

Adjustment: Set this parameter based on actual requirements.

Object Detection

The adjustable post-process parameters for an Object Detection model package are as follows.

Parameter Description

Confidence threshold

This parameter is used to set the confidence threshold for object detection. Results with confidence above this threshold will be retained.

Adjustment: Set this parameter based on actual requirements.

Fast Positioning

This model package does not require post-process parameter configuration.

Text Detection

The adjustable post-process parameters for a Text Detection model package are as follows.

Parameter Description

Text sorting order

This parameter specifies the sorting order of text detection results, which affects the order of subsequent text recognition or display.
Options: Left to right, Top to bottom
Adjustment: Set this parameter based on actual requirements.

Filtering rule settings

Parameter Description

Filtering rule settings

Used to further filter text detection results, including general rules and logic rules. By properly configuring filtering rules, you can improve the accuracy of text detection and reduce false detections and missed detections.

Confidence threshold

A general filtering rule. Used to set the confidence threshold for text detection. Results with confidence above this threshold will be retained.
Adjustment: Set this parameter based on actual requirements.

Logic between conditions

A logic filtering rule. Used to uniformly set the logic between conditions (AND/OR) for multiple added filtering conditions (such as area, aspect ratio of bounding rectangle, circularity, etc.). Different condition items are combined according to the "Logic between conditions" setting (AND/OR); when the same condition item is added multiple times, it is always combined with OR logic, regardless of the "Logic between conditions" setting.
Options: AND, OR
Click Add condition, select the conditions to filter from the drop-down list, and set the logic between conditions. For the definitions and descriptions of conditions, see Filtering Condition Descriptions in this section. You can set the "Filter value range" based on the "Reference value range". Additionally, you can enable/disable filtering or delete each condition individually.

  • When setting filtering rules, it is recommended to set general rules first to meet most filtering needs, and then add logic rules for fine-tuning based on actual conditions.

  • After enabling filtering rules, it is recommended to verify inference results multiple times to ensure that valid text regions are not incorrectly filtered out.

Text Recognition

The adjustable post-process parameters for a Text Recognition model package are as follows.

Parameter Description

Text connection

Enabling this parameter allows the recognized text to be concatenated.
Default: Disabled.

Text concatenation

This parameter is used to select the method for concatenating text.
Options: None, ,, ;, Space, |, -, _, ., :, Line break, Tab
Default: None

Text modification

This parameter is used to perform custom modifications on the text in recognition results. Multiple modification methods are supported to meet different text processing needs.

Options: Character replace, Fixed-position replace

  • Character replace: Replaces a specified single character or a type of characters (such as digits, symbols, letters) uniformly with a target character, or deletes them directly.

  • Fixed-position replace: Replaces the character at a specified position in the text with a target character.

Click + to select a text modification method.

  • To use character replace, enter the single character to be replaced, or select the type of characters to be replaced from the drop-down list, and then enter the target character for replacement or deletion.

  • To use fixed-position replace, enter the position of the character to be replaced (e.g., the 3rd character), and then enter the target character (only a single character is supported). The system will automatically replace the character at that position in the text with the target character.

You can add multiple text modification items and adjust their order. The order of modification items affects the final result. You can adjust the order to achieve the desired text processing logic.

Unsupervised Segmentation

The adjustable post-process parameters for an Unsupervised Segmentation model package are as follows.

Parameter Description

Confidence threshold

This parameter is used to set the confidence threshold for unsupervised segmentation. Drag the slider to adjust the threshold. The red portion represents the NG (not good) range, and the green portion represents the OK (good) range. If the segmentation confidence is lower than the OK threshold, the result is OK. If it is higher than the NG threshold, the result is NG.
Adjustment: Set this parameter based on actual requirements.

Multi-Model Package

A multi-model package is a combination of multiple single model packages connected in series, parallel, or a combination of both. You can click a model in the model navigation area to select the model whose parameters you want to adjust, and then configure the corresponding settings in the parameter adjustment area. The parameter settings for each model are the same as those of the corresponding single model package. For details, see the parameter descriptions of the respective single model packages above.

Pick Anything V2

The adjustable post-process parameters for a Pick Anything V2 model package are as follows.

Morphological transformation

Parameter Description

Morphological transformation

Enabling this parameter will apply morphological processing to the surface segmentation masks.
Adjustment: Set this parameter based on actual requirements.

Morphological transformation type

This parameter is used to select the morphological post-processing method for masks.

Options: Erosion by ratio, Erosion by pixels

  • Erosion by ratio: Set the erosion ratio. The system will shrink inward from the edge based on the ratio of the mask area to its perimeter at the set ratio. Suitable for scenarios where the target size varies significantly.

  • Erosion by pixels: Set the number of erosion pixels. The system will shrink inward from the edge by the set number of pixels. Suitable for scenarios where the target size is consistent or precise pixel control is required.

Adjustment: Set this parameter based on actual requirements.

Parameter Description

Label classes

Displays the surface classes labeled during training in Mech-DLK, which are graspable surfaces and occluded surfaces.
You can select any label class and configure the filtering rule parameters for it separately.

Enable filtering

This parameter specifies whether to enable filtering rules for the corresponding label class.
When enabled, the configured filtering rules will be applied to the corresponding surface class.

Filtering rule settings

Parameter Description

Apply parameters to

Used to select whether to apply the configured filtering rule parameters to a specified class or all classes.

Distribution area filter

A general filtering rule. After setting the distribution area, only inference results within the distribution area will be retained. Configure this through the "Set distribution area" button.
When enabled, click Set distribution area, and draw the area to be retained in the pop-up image window.

Logic between conditions

A logic filtering rule. Used to uniformly set the logic between conditions (AND/OR) for multiple added filtering conditions (such as area, aspect ratio of bounding rectangle, circularity, etc.). Different condition items are combined according to the "Logic between conditions" setting (AND/OR); when the same condition item is added multiple times, it is always combined with OR logic, regardless of the "Logic between conditions" setting.
Options: AND, OR
Click Add condition, select the conditions to filter from the drop-down list, and set the logic between conditions. For the definitions and descriptions of conditions, see Filtering Condition Descriptions in this section. You can set the "Filter value range" based on the "Reference value range". Additionally, you can enable/disable filtering or delete each condition individually.

  • When setting filtering rules, it is recommended to set general rules first to meet most filtering needs, and then add logic rules for fine-tuning based on actual conditions.

  • After enabling filtering rules, it is recommended to verify inference results multiple times to ensure that valid surfaces are not incorrectly filtered out.

Validation Rule Settings (Multi-Model Package)

In scenarios where multiple models work together, the results of a single model may not be sufficient to make a final judgment. "Validation rule settings" allows you to define the logical relationships between the results of multiple models to generate the final judgment result (OK or NG).

Validation rules only need to be configured in scenarios where a multi-model package is used for deep learning inference. If a single model package is used for inference, this configuration interface will not be shown.

Validation Rule Description

In the Validation rule settings area, set the validation rules. The judgment results can be combined using AND/OR logic. OK indicates that the item meets the expectation, and NG indicates that it does not.

  • AND: The final judgment result is OK only when all selected rules meet their respective judgment criteria.

  • OR: The final judgment result is OK as long as one of the selected rules meets its own judgment criterion.

Judgment criterion: Set whether a certain situation is expected or not expected when it occurs.

Judgment result: Displays the actual result based on the configured judgment criterion.

Validation process: The system first independently evaluates each selected validation rule to obtain the corresponding judgment result. Then, based on the configured logic (AND/OR), the results of each rule are combined to output the final judgment result for the current image.

Validation Rule Configuration Procedure

  1. Click the Validation rule settings tab in the inference configuration area.

  2. Select the logical relationship between the models (AND or OR).

  3. Select the rules from the list that should participate in the judgment, and define the judgment criterion for each rule.

  4. Verify that the final judgment result meets the expectation based on the configured judgment criteria. After confirmation, click Save to save the validation rules to the parameter group.

To help you understand, the following two scenario examples demonstrate the above procedure.

Scenario Example 1

As shown in the figure, the following example shows how to set validation rules, with the expectation of detecting both the D1 connector housing and D1 connector housing scratches in the image.

  1. Set the validation rules and select "AND" logic for combining judgment results.

  2. Set the judgment criterion for each model and verify the judgment result.

    1. Set the judgment criterion of the Image Classification model to "All = D1, then OK", meaning that when all classification results of the current image are D1 connector housing, the expectation is met, and the judgment result is OK.

    2. Set the judgment criterion of the Defect Segmentation model to "OK", meaning that when connector housing scratches are detected in the current image, the expectation is met, and the judgment result is OK.

      rules ok
  3. When the judgment results of both models are OK, the final judgment result displayed in the upper-left corner of the visualization area should be OK.

    example for validation ok

Scenario Example 2

As shown in the figure, the following example shows how to set validation rules, with the expectation of detecting the D1 connector housing in the image but not expecting D1 connector housing scratches.

  1. Set the validation rules and select "AND" logic for combining judgment results.

  2. Set the judgment criterion for each model and verify the judgment result.

    1. Set the judgment criterion of the Image Classification model to "All = D1, then OK", meaning that when all classification results of the current image are D1 connector housing, the expectation is met, and the judgment result is OK.

    2. Set the judgment criterion of the Defect Segmentation model to "NG", meaning that when connector housing scratches are detected in the current image, the expectation is not met, and the judgment result is NG.

      rules ng
  3. When the judgment result of the Image Classification model is OK and the judgment result of the Defect Segmentation model is NG, the final judgment result displayed in the upper-left corner of the visualization area should be NG.

    example for validation ng

Reference Information

Filtering Condition Descriptions

Condition Description

Basic options

Area

The total number of pixels in a single recognized target region. Used to filter targets that are too large or too small.

Total area

The sum of the pixel counts of all recognized targets in the current detection region. Used to control the total coverage of targets and avoid excessive or large-area target clusters.

Bounding rectangle height

The height (in pixels) of the axis-aligned bounding rectangle of the target, i.e., the height of the smallest rectangle parallel to the coordinate axes. Used to filter the maximum or minimum vertical span of a target. Suitable for non-tilted or aligned targets; the value may be larger than the actual height for tilted targets.

Bounding rectangle width

The width (in pixels) of the axis-aligned bounding rectangle of the target, i.e., the width of the smallest rectangle parallel to the coordinate axes. Used to filter the maximum or minimum horizontal span of a target. Suitable for non-tilted or aligned targets; the value may be larger than the actual width for tilted targets.

Aspect ratio of bounding rectangle

The ratio of the longer side to the shorter side of the axis-aligned bounding rectangle of the target. Used to distinguish targets of different shapes, such as distinguishing elongated scratches from round pits.

Principal axis angle

The angle (in degrees) between the principal axis of the target and the horizontal direction. Used to filter targets with a specific orientation.

Advanced options

Circularity

Measures how close the shape of the target is to a perfect circle. A value closer to 1 indicates a rounder shape. Used to distinguish circular targets (such as screw holes) from irregularly shaped targets (such as cracks and stains).

Bounding rectangle center X

The X coordinate of the center of the axis-aligned bounding rectangle. Used to filter the horizontal position of a target in the image.

Bounding rectangle center Y

The Y coordinate of the center of the axis-aligned bounding rectangle. Used to filter the vertical position of a target in the image.

Inradius

The radius of the largest circle that can be completely contained within the target. Used to evaluate the "solidity" of the target or the minimum through-hole size, and to exclude targets with hollows or that are not compact.

Circumradius

The radius of the smallest circle that can completely enclose the target. Used to filter the maximum enclosing size of a target. Commonly used for rough positioning of circular workpieces or upper limit size filtering.

Inscribed rectangle width

The width of the largest rectangle that can be completely contained within the target. Used to filter the horizontal dimension of the effective area inside the target and to exclude objects with severe edge damage.

Inscribed rectangle height

The height of the largest rectangle that can be completely contained within the target. Used to filter the vertical dimension of the effective area inside the target and to exclude objects with severe edge damage.

Centroid X

The horizontal position of the grayscale or geometric centroid of the target region in the image coordinate system. Compared to the geometric center, it better reflects the position of the actual core. Used to filter targets that appear in a specific horizontal region of the image.

Centroid Y

The vertical position of the grayscale or geometric centroid of the target region in the image coordinate system. Compared to the geometric center, it better reflects the position of the actual core. Used to filter targets that appear in a specific vertical region of the image.

Bounding rectangle top-left X

The X coordinate of the top-left corner of the axis-aligned bounding rectangle of the target. Used to filter the starting horizontal position of a target in the image.

Bounding rectangle top-left Y

The Y coordinate of the top-left corner of the axis-aligned bounding rectangle of the target. Used to filter the starting vertical position of a target in the image.

Bounding rectangle bottom-right X

The X coordinate of the bottom-right corner of the axis-aligned bounding rectangle of the target. Used to filter the ending horizontal position of a target in the image.

Bounding rectangle bottom-right Y

The Y coordinate of the bottom-right corner of the axis-aligned bounding rectangle of the target. Used to filter the ending vertical position of a target in the image.

Rotated bounding rectangle width

The width (in pixels) of the minimum-area bounding rectangle of the target, which can be rotated to any angle. It fits the actual shape of the target more closely. Suitable for filtering the width of tilted targets.

Rotated bounding rectangle height

The height (in pixels) of the minimum-area bounding rectangle of the target, which can be rotated to any angle. It fits the actual shape of the target more closely. Suitable for filtering the height of tilted targets.

An axis-aligned bounding rectangle is the smallest enclosing rectangle whose four sides are strictly parallel to the image coordinate axes (horizontal/vertical directions).

Is this page helpful?

You can give a feedback in any of the following ways:

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.