Use the Classification Module

Please click here to download an image dataset of condensers, an example project in Mech-DLK. In this topic, we will use the Classification module to train a model that can distinguish between the front and back sides of the condensers.

You can also use your own data. The usage process is overall the same, but the labeling part is different.

Workflow

  1. Create a New Project and add the Classification module: Click New Project in the interface, name the project, and select a directory to save the project. Click example projects icon create in the upper right corner of the Modules panel and add the Classification module.

    example projects add project
  2. Import the image data of condensers: Unzip the downloaded file. Click the Import/Export button in the upper left corner, select Import Folder, and import the image folder.

    When you select Import Dataset, you can only import datasets in the DLKDB format (.dlkdb), which are datasets exported from Mech-DLK.
    example projects import images
  3. Create Labels: Select Labeling and click the + button to create labels based on the type or feature of different objects. In this example, the labels are named front and back to distinguish between the front and back sides of the condenser.

    When you select a label, you can right-click the label and select Merge Into to change the current data type to another type. If you perform the Merge Into operation after you trained the model, it is recommended that you train the model again.
  4. Label images: Classify the images with corresponding labels. You can select multiple images and label them together. Please make sure that you have labeled the images accurately. Click here to view how to use labeling tools.

    example projects classification label
    The Classification module supports selecting multiple images for labeling in batches.
  5. Split the dataset into the training set and validation set: By default, 80% of the images in the dataset will be split into the training set, and the rest 20% will be split into the validation set. Please make sure that both the training set and validation set include images in all different classes, which will guarantee that the model can learn all the different features and validate the images of different classes properly. If the default training set and validation set cannot meet this requirement, please right-click the name of the image and then click Switch to training set or Switch to validation set to adjust the set to which the image belongs.

    example projects move image
  6. Train the model: Keep the default training parameter settings and click Train to start training the model.

    example projects training chart
  7. Show Class Activation Maps: After the training of the Classification model is completed, click Generate CAM to generate the class activation maps, and click Class activation maps (CAM). The class activation maps show the feature regions in the images that are paid attention to when training the model, and they help check the classification performance, thus providing references for optimizing the mode.

    improve model accuracy class activatation maps
  8. Validate the model: After the training is completed, click Validate to validate the model and check the results. You can also click process filter images > Wrong results > OK to filter the results and check the wrong ones.

    After you validate a model, you can import new image data to the current module and use the pre-trained labeling feature to perform auto-labeling based on this model. For more information, see Pre-trained labeling.

    example projects training verify
  9. Export the model: Click Export, set the Class activation mapping (CAM) option of the model to be exported in the pop-up window, and then click Export and select a directory to save the exported model.

    By default, the Class activation mapping (CAM) option is disabled. The inference will slow down when the model saved with CAMs is used in Mech-Vision.
    example projects model files

    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.