Train a High-Quality Model

You are viewing an old version of the documentation. You can switch to the documentation of the latest version by clicking the top-right corner of the page.

This section introduces the factors that most affect the model quality and how to train a high-quality unsupervised segmentation model.

Ensure Image Quality

  • Do not use images in which objects have different shapes and size and are in different positions, or images with changing backgrounds. Such situations will greatly impact model performance. Therefore, it is necessary to ensure the used OK images have small but important differences.

Most images Incorrect examples

improve model accuracy normal

object of different size

different object shape

different image background

If the image backgrounds can bring some inference, you can add an Object Detection module before Unsupervised Segmentation; if the objects in images have different orientations, add a Fast Positioning module before it. See the Use Cascaded Modules section for detailed instructions.

Set a Proper Region of Interest (ROI)

Setting the ROI can effectively eliminate the interference of the background, and the ROI boundary should be as close to the outer contours of the objects as possible.

improve model accuracy roi
The same ROI setting will be applied to all images, so it is necessary to ensure that objects in all images are within the set ROI.

Set Appropriate Thresholds for OK and NG Results

Once thresholds are set for the defect confidence chart, the Unsupervised Segmentation module can judge accordingly whether an image is OK, NG, or Unknown. In addition, a greater threshold of OK results indicates a smaller defect area identified by the algorithm. It is necessary to set appropriate thresholds for OK and NG results according to actual situations to obtain the optimal performance of the trained model.

Original image Threshold of OK results: 0.10 Threshold of OK results: 0.20

original image

OK threshold 2

OK threshold 1

In the defect confidence chart, the y-coordinate of the green curve stands for the ratio of the number of OK images with defect confidence lower than the set threshold of OK results to the total number of OK images. The y-coordinate of the red curve stands for the ratio of the number of NG images with defect confidence greater than the set threshold of NG results to the total number of NG images. If the two curves do not intersect, the OK and NG images can be completely separated by thresholds. In other words, it is possible to leave no images labeled as Unknown. In this case, the farther apart the two lines are from each other, the better.

Good result Poor result

good model performance

poor model performance

Use Appropriate Data

  • Control the image quantity of training set

    When you first use the Unsupervised Segmentation module, it is recommended to use 30 to 50 images for model training. If the validation results are not up to standard, you can then add more data.

  • Comprehensive and balanced OK images in training set

    If OK images present multiple possible situations, please ensure all the possible situations are covered and evenly distributed in the training set.

  • Reduce inadequate data

    Ensure that every image imported can facilitate the model training process. Adding highly similar images and repeated images makes a slight difference to model training, and it may slow down the training process.

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.