Instance Optimization Guide
About 690 wordsAbout 2 min
Instance Optimization is mainly used to optimize the instance Mask inferred by the vision model. It corrects issues such as incomplete masks or masks deviating from the actual object that may appear in the first inference results of general models or models trained through One-click Integration, making the instance Mask closer to the complete contour of the actual workpiece and solving poor vision model inference results.
1. Operation Guide
- When the instance Mask inferred by the vision model is incomplete or deviates from the actual workpiece, click
Editin the Feature Options module on the main page, checkInstance Optimization, and then clickSave.

- After checking
Instance Optimization, instance optimization-related parameters will appear in Visual Parameters - 2D Recognition, as shown below.


2. Tuning Guide
Adjust the instance optimization-related parameters according to the current detection results.

| Function | Parameter | Description | Default Value | Value Range | Tuning Suggestion |
|---|---|---|---|---|---|
| Optimize Model Detection Results | IOU Threshold | When the vision model detects a workpiece, it generates a bounding box - the initial bounding box. The SAM model segments the instance Mask within this initial bounding box, and then generates a minimum bounding box based on the instance Mask. If the overlap of the two bounding boxes is greater than the IOU threshold, it indicates that the instance Mask segmentation is good and should be retained; if the overlap of the two bounding boxes is less than the IOU threshold, it indicates that the instance Mask segmentation is poor and should be discarded. | 0.8 | [0, 1.0] | If the workpiece shape is complex and causes some instances to generate masks while others do not, this threshold can be appropriately reduced; if the instance Mask segmentation is poor (for example, deviating from the actual workpiece or incorrectly recognizing the Background), this threshold can be appropriately increased. |
| Bounding Box Expansion Size | Enlarge or shrink the bounding box generated when the vision model detects the workpiece - the initial bounding box. A positive value means enlarging the length and width of the initial bounding box by a certain number of pixels; a negative value means shrinking the length and width of the initial bounding box by a certain number of pixels. | 7 | [-100, 100] | If the instance Mask exceeds the workpiece range, this parameter can be reduced to shrink the size of the initial bounding box; if the instance Mask segmentation is incomplete, this parameter can be increased to enlarge the size of the initial bounding box. | |
| Generate Instance Bounding Box | Bounding Box Type | The SAM model segments the instance Mask within the initial bounding box and then generates a minimum bounding box based on the instance Mask. This minimum bounding box supports two types - AABB (axis-aligned bounding box) and OBB (oriented bounding box). If Bounding Box Type is checked, an AABB bounding box is generated; if it is unchecked, an OBB bounding box is generated. | Checked | / | AABB (axis-aligned bounding box) is a rectangle whose edges are parallel to the X and Y axes of the image, and is suitable for scenarios where the workpiece is placed horizontally/vertically; OBB (oriented bounding box) is a rectangle whose edges fit the workpiece contour more closely, and is suitable for scenarios where the workpiece is placed at an angle. |