AI Binary Classification Tool

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

■ If you are not sure which version of the product you are currently using, please feel free to contact Mech-Mind Technical Support.

Introduction

The "AI Binary Classification Tool" is an efficient visual binary classification tool that supports custom training for OK and NG image categories. By completing the wizard-style configuration process, users can quickly implement the full workflow from image acquisition to model inference. This tool is typically used in scenarios such as front-back orientation verification or presence detection for a single type of target object.

overall workflow
  1. Acquire images: Acquire image data for training. It is recommended to cover typical conditions in the actual production environment to ensure image quality and diversity and improve the model’s judgment accuracy.

  2. Set ROI: Set the ROI on the acquired images, accurately selecting the target area to prepare for subsequent labeling and training.

  3. Label images: Label the target area, marking OK and NG classes respectively. It is recommended to label diverse images for each class to ensure comprehensive training content features.

  4. Train and validate model: Use the labeled images for model training. After training is completed, validate the model performance and observe whether the judgment results meet expectations. If the classification results are inaccurate, you can add more images and retrain until the model performance meets actual requirements.

Usage Workflow

After entering the tool, click New in the upper-right corner of the model list on the left to create and enter a new model configuration process.

Acquire Images

Acquire image data for training the model.

  1. Confirm that the input port of the current Step is connected to image data.

  2. When entering the tool, the camera will automatically acquire one image for model training. You can click the Acquire images button to acquire new image data for model training.

When acquiring images, it is recommended to cover typical variations at the production site, including:

  • Position and angle differences: Cover images where the target object is translated, rotated, or tilted within the field of view.

  • Lighting and background differences: Cover images with different brightness, shadows, and cluttered or color-changing backgrounds.

  • Appearance and shape differences: Cover images where the target object has slight deformation, stains, scratches, or batch color differences.

Diverse images help the model adapt to the actual environment and improve judgment accuracy.

Set ROI

After acquiring images, you need to set the ROI for subsequent labeling and training.

When the "2D Alignment Parameter Group" port has input, the ROI will transform in sync with the target pose. The ROI set here is the reference position, and during actual recognition, it will dynamically shift based on the alignment parameters.

  1. Click the Edit button to enter the ROI setting interface.

  2. Set the ROI.

    Select the "Rectangle" or "Circle" selection tool to drag and draw the ROI in the visualization area. Please accurately select the target area based on the actual position and shape of the target object, avoiding irrelevant backgrounds.

    • When selecting the target area, you can select only the area containing key features.

    • If you need to manually select multiple ROIs, it is recommended to draw one ROI first, then generate other ROIs by copying and pasting to ensure consistent size for each target area, improving the stability of model training and judgment accuracy.

    • When the "2D Alignment Parameter Group" port has input, there is no need to manually create multiple ROIs. The user only needs to draw one ROI, and the system will automatically generate the remaining ROIs based on the alignment parameters for recognition.

      If the automatically generated ROI positions are offset, you typically only need to move the first ROI to the correct target object position, and the remaining ROIs will automatically align to the corresponding target objects based on their respective alignment parameters, without the need to adjust each one individually.

      2d alignment roi
  3. Set mask region (optional).

    When there are irrelevant interferences such as reflections, shadows, or fixed backgrounds within the target area, you can set mask regions to exclude them, avoiding impact on model training and classification judgment results.

    Click the Set mask region button, and use the "Polygon" selection tool to draw the mask region in the visualization area: click the left mouse button to add polygon vertices, and double-click the right mouse button to close the polygon and complete the selection.

  4. After the setting is completed, click Save and apply to apply the ROI configuration.

When the masks of the target area and mask region completely overlap, only the topmost layer supports editing.

Right-click the mouse to quickly perform copy, paste, delete, bring to top, or send to bottom operations on areas.

Label Images

After acquiring images and setting the ROI, you need to label the images so that the model can learn the features of different classes.

  1. Click the Edit button to enter the image labeling process.

  2. In the visualization area, select the target ROI that has been outlined, and in the label class options on the right, click the Label images button for the OK or NG class to complete labeling of a single target.

    This tool uses fixed OK and NG classes for labeling. You can define their business meaning according to actual requirements. For example, you can label "front side" or "present" as the OK class, and "back side" or "absent" as the NG class.

  3. Click the Acquire images button to acquire new images, and repeat the above labeling steps. At least one image should be labeled for the OK class; if the NG class includes multiple situations, it is recommended to label at least one image for each situation to cover the typical cases of that class.

    • When labeling, it is recommended to label images for both OK and NG classes simultaneously, covering multiple shooting conditions (such as position offset, stains, scratches, deformation, color tone, or background differences). The more thorough the labeling, the stronger the model’s adaptability.

      samples
    • Avoid labeling images with ambiguous classes to prevent affecting the model’s learning performance.

    • If there is uncertainty in lighting or target object angles in the actual production scenario, you can enable the “Adapt to brightness changes” or “Adapt to rotation changes” options in Advanced settings. The system will automatically apply slight rotation and brightness adjustments to the labeled images to generate more virtual images under different conditions for model training, thereby helping to expand training content and improve the model’s generalization ability.

  4. After labeling is completed, click Save and apply to save the labeling results.

Train and Validate Model

  1. Train the model.

    After labeling is completed, click the Train button to start model training, and wait for the training completed prompt.

  2. Validate the model performance.

    Click the Validate button to enter the validation interface. You can view or set the following parameters in this interface, and observe whether the model’s recognition results meet expectations.

    Parameter Description

    Validation result

    Parameter description: Displays the classification judgment result. The result is displayed as OK or NG class based on the recognition result.

    Time

    Parameter description: Displays the single inference time (unit: ms).

    Confidence threshold

    Parameter description: The minimum confidence standard for the model to judge as the OK class. Images below this value will be judged as the NG class.
    Default value: 0.5
    Tuning instructions: It is recommended to use the default value.

    Judgment settings

    Parameter description: When there are multiple ROIs in the image, selecting "All OK" means the validation result is displayed as OK only when all ROIs are recognized as the OK class; selecting "At least one OK" means the validation result is displayed as OK as long as any one ROI is recognized as the OK class.
    Value list: All OK, At least one OK
    Default value: All OK
    Tuning instructions: Please select the appropriate judgment setting according to actual requirements.

    Heatmap

    Parameter description: When enabled, a visual heatmap of the model’s attention areas is overlaid on the image. The deeper (or warmer) the color, the higher the model’s attention to the features in that area.

    Default value: Off.

    Tuning instructions: Typically, the heatmap should be concentrated on feature positions within the target area, such as edges, defects, or textures. It can be used to help judge the model’s focus areas.

    If the heatmap distribution is too scattered or concentrated on irrelevant areas, it may indicate that the model has not correctly learned effective features. In this case, it is recommended to go back to the previous steps to supplement more diverse training images and retrain the model.

  3. Additional training (optional).

    If the judgment results do not meet expectations, you can use the "Additional training" function to supplement images that were incorrectly recognized or not covered during validation.

    1. Click Additional training to enter the image labeling process.

    2. In the visualization area, select incorrectly judged images or re-acquire images for labeling.

    3. After labeling is completed, click Save and apply, and the system will re-execute training and validation based on the new labeling data.

    4. You can repeat the "Train → Validate → Additional training" cycle until the model performance meets expectations.

      Additional training is incremental training that optimizes on the existing model basis without starting from scratch.

      If the performance does not improve after additional training, it is recommended to check the labeling accuracy, or return to the acquisition stage to supplement more typical images.

  4. Save and apply the model.

    After validation is passed, click the Save and apply button to save the model configuration.

At this point, the model configuration is completed. After closing the tool window, select the model from the "Model Name" parameter drop-down list to use it for classification judgment in subsequent inference Steps.

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.