Deep Learning Model Package Inference

Attention

From Mech-Vision 1.7.2, the “Deep Learning Model Package CPU Inference” and “Deep Learning Model Package Inference (Mech-DLK 2.2.0+)” Steps are merged into the “Deep Learning Model Package Inference” Step, which supports both .dlkpackC and .dlkpack models.

Open the previous project with Mech-Vision 1.7.2, you can find the “Deep Learning Model Package CPU Inference” and “Deep Learning Model Package Inference (Mech-DLK 2.2.0+)” Steps are automatically replaced with “Deep Learning Model Package Inference” Step.

Function

This Step performs inference with single model packages and cascaded model packages exported by Mech-DLK and outputs the inference result. This Step only supports model packages exported by Mech-DLK 2.2.0 or above.

Note

From Mech-DLK 2.4.1, model packages can be divided into single model packages and cascaded model packages.

  • Single model package: There is only one deep learning model in the model package, such as an “Instance Segmentation” model.

  • Cascaded model package: Multiple models are cascaded in the model package, and the output result of the previous model is input to the next model. For example, there are two models, “Object Detection” and “Instance Segmentation” in the model package and the inference sequence is Object Detection ‣ Instance Segmentation. The output of “Object Detection” is input to the “Instance Segmentation” model.

When this Step performs inference with cascaded model packages, the Deep Learning Result Parser Step can parse the exported result.

Usage Scenario

This Step is usually used in classification, object detection, and defect segmentation scenarios. For a description of the compatibility of the Step, please refer to Compatibilities of Deep Learning Steps.

Input and Output

Object Detection

When importing a single model package, the input and output of this Step are shown below, using “Object Detection” as an example.

../../../../_images/deep_learning_model_package_inference_input_and_output_single.png

Object Detection+ Defect Segmentation + Classification

When importing a cascaded model package, the input and output of this Step are shown below, using “Object Detection+ Defect Segmentation + Classification” as an example.

../../../../_images/deep_learning_model_package_inference_input_and_output_multi.png

Parameter Description

Hint

When using this Step for inference with the cascaded model package, you can adjust the parameters in the next Step “Deep Learning Result Parser”.

General Parameters

Model Settings

Model Package Management Tool
Description: This parameter is used to open the deep learning model package management tool and import the deep learning model package. The model package file is a “.dlkpack” or “.dlkpackC” file exported by Mech-DLK.
Instruction: Please refer to Deep Learning Model Package Management Tool for the usage of the deep learning model package management tool.
Model Package Name
Description: This parameter is used to select the model package that has been imported for this Step.
Instruction: Once you have imported the deep learning model package, you can select the corresponding model package name in the drop-down list.
Model Package Type
Description: Once a Model Package Name is selected, the Model Package Type will be filled automatically, such as “Object Detection” (single model package) and “Object Detection + Defect Segmentation + Classification” (cascaded model package).
GPU ID
Description: This parameter is used to select the device ID of the GPU that will be used for the inference.
Instruction: Once you have selected the model package name, you can select the GPU ID in the drop-down list of this parameter.

ROI Settings

ROI File Name
Description: This parameter is used to set or modify the ROI.
Instruction:
  1. Once the deep learning model is imported, a default ROI will be applied. If you need to edit the ROI, click ROI File.

  2. Edit the ROI in the pop-up Set ROI window.

    ../../../../_images/set_roi.png
  3. Enter an ROI Name as shown below, and then click OK. If ROI Name is left empty, a Failed to save ROI error message will pop up.

    ../../../../_images/roi_file_name.png
  4. If you would like to use the default ROI again, please delete the ROI File Name below the ROI File button.

Visualization Settings

Hint

This parameter is not available for defect segmentation models.

Customized Font Size
Description: This parameter determines whether to customize the font size in the visualized output result. Once this option is selected, you should set the Font Size (0–10).
Default value: Unselected.
Instruction: Select according to the actual requirement.
Font Size (0–10)
Description: This parameter is used to set the font size in the visualized output result.
Default value: 2.0
Instruction: Set the value according to the actual requirement.
Example: The figure below shows the font sizes set to 3.0 and 5.0 respectively in an instance segmentation project.
../../../../_images/font_size_comparison.png
Show All Results
Description: This parameter is used to visualize all inference results of the cascaded model package. It can only be set when the “Deep Learning Model Package Inference” is used for cascaded model package inference.
Instruction: Set the value according to the actual requirement.

Model-Specific Parameters

Classification

Classification Confidence Threshold (0.0–1.0)
Description: This parameter is used to set the confidence threshold for classification. The results above this threshold will be displayed in green and the results below this threshold will be displayed in red.
Default value: 0.7000
Tuning recommendation: Please set the value according to the actual requirement.
Show Class Activation Map
Description: This parameter is used to display the class activation map for identifying the image regions that are most relevant to the classification. Blue indicates that the region contributes the least to the classification, while red indicates that the region contributes the most to the classification.
Tuning recommendation: Please right-click in the Step Parameters panel and select “Show all parameters” in the context menu.

Instance Segmentation

Visualization Settings

Draw Result on Image
Description: This parameter is used to determine whether to display the segmented mask and bounding box on the image.
Default value: Unselected.
Tuning recommendation: Set the parameter according to the actual requirement.
Method to Visualize Result
Description: This parameter is used to specify the method to visualize the objects in the visualized output result.
Default value: Instances
Value list: Threshold, Instances, Classes, CentralPoint

Method to Visualize Result

Description

Illusion

Threshold

The displayed color is determined by the confidence. If the computed confidence is above the threshold, the corresponding objects will be displayed in green, or else the objects will be displayed in red.

icon_1

Instances

Each detected object is displayed in an individual color.

icon_2

Classes

Objects with the same label will be displayed in the same color.

icon_3

CentralPoint

Display the original color of the object.

icon_4

Instance Segmentation Confidence Threshold (0.0–1.0)

Description: This parameter is used to set the confidence threshold for instance segmentation. The results above this threshold will be displayed in green and the results below this threshold will be displayed in red.

Default value: 0.7000

Tuning recommendation: Set the parameter according to the actual requirement.

Object Detection

Visualization Settings

Draw Result on Image
Description: This parameter is used to determine whether to display the mask and bounding box on the image.
Default value: Unselected.
Tuning recommendation: Set the parameter according to the actual requirement.
Method to Visualize Result
Default value: CentralPoint
Options: BoundingBox, CentralPoint
  • BoundingBox: Display the results with bounding boxes, as shown in figure 1.

  • CentralPoint: Display the results with center points, as shown in figure 2.

../../../../_images/box_and_central.png
Tuning recommendation: Set the parameter according to the actual requirement.

Object Detection Confidence Threshold (0.0–1.0)

Default value: 0.7000

Description: The results above this threshold will be kept.

Defect Segmentation

Visualization Settings

Draw Defect Mask on Image
Description: This parameter is used to determine whether to draw the defect mask on the image. If selected, a defect mask will be drawn on the input image.
Default value: Unselected.
Instruction: Select to draw a mask on the input image. The figure below shows the result before and after selecting this option.
../../../../_images/draw_mask.png

Attention

  • From Mech-Vision 1.7.2, the Defect Judgement Rules Settings, Quantity Threshold Settings, and Area Range Settings parameters are removed from the “Deep Learning Model Package Inference” Step. If you want to adjust these parameters, please configure them in Mech-DLK.

  • In Mech-Vision 1.7.2, when “Deep Learning Model Package Inference” Step is used for inference with model packages that are exported by Mech-DLK 2.2.0 or previous versions with Defect Judgement Rules Settings configured, the old defect judgement rules will not take effect. Please configure the defect judgement rules of the package model in Mech-DLK 2.4.1 or above and re-export the model package. Then you can use the model package for inference in the “Deep Learning Model Package Inference” Step.