Train a Defect Segmentation Model

The Defect Segmentation model can be used to judge whether there are defects on the objects and pinpoint the defects. This topic describes how to train a Defect Segmentation model to judge whether the network ports have defects and pinpoint the defects.

defect segmentation example

The workflow for training the Defect Segmentation model is as follows:

defect segmentation workflow

Preparations

Before you start training, make sure you have acquired and selected the images for training according to the data acquisition standard. In this example, you need to prepare images of network ports without defects (OK images) and images of network ports with defects (NG images).

Create a Project and Add a Module

  1. Create a project: Open Mech-DLK. In the upper-left corner of the startup interface, click New Project, name the project, and select a directory to save the project.

  2. Add a module: In the upper-right corner of the project interface, click icon create in the Modules section, and then select the Defect Segmentation module.

Import and Label the Image Data

  1. Import image data: On the upper part of the image list, click Import/Export  Import Folder, and import the image folder.

  2. Select an ROI:

    1. On the labeling toolbar, click the ROI Tool icon roi, and adjust the frame to select the bin containing rotors in the image. The ROI should exclude irrelevant background and cover the target objects in the image with an appropriate margin.

    2. Click icon OK in the lower-right corner of the ROI to apply the current ROI. The ROI settings will be applied to all images. Check that all network ports are consistently within the ROI. Otherwise, adjust the ROI again.

      defect segmentation roi
  3. Label images:

    • For OK images, select an image and click the OK Label OK label tool on the labeling toolbar. The image will be labeled as OK.

    • For NG images, right-click polygon icon, then click the Brush Tool pen icon to label the defects. During labeling, the brush should be close to the edge of the defects to avoid including excessive non-defective areas. You can also use the mask tools, eraser tools, and grid tools for different labeling scenarios. Click here to view how to use labeling tools.

      defect segmentation label
  4. Split the dataset: After all images are imported and labeled, click images divide icon and drag the slider to split 80% of the images in the dataset into the training set, and the rest 20% into the validation set.

    defect segmentation image divide

Train the Model

After the images are imported and labeled, you can start training the model.

In the Training tab, click the Train button to start training. You can click Training Center to view the training progress, or click Show chart to view training accuracy and loss parameters by epochs.

defect segmentation train

Validate and Export the Model

After the model is trained, in the Validation tab, click the Validate button, Mech-DLK will validate the model with the current data.

After the validation is complete, check the validation results for accuracy. A Defect Segmentation model is successfully trained to detect defects in network ports.

defect segmentation validate

In the lower-right corner of the Validation tab, click Export, and select a directory to save the exported model. The exported model can be used in Mech-Vision and Mech-DLK SDK. Click here to view the details.

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.