Creating a basic single ROI classifier
  • 30 Jul 2024
  • PDF

Creating a basic single ROI classifier

  • PDF

Article summary

Download the sample recipe here

Step 1 :

To create your first new Classifier model, you must navigate to your all-recipes page and select "New Recipe". After that, you will need to click on the "Edit" button to initiate the process of creating your first Classifier model.

Step 2 :

Rename your recipe to something that reflects the specific application you are working on. Once you've done that, click on "configure imaging" to begin setting up your OV20i camera for that particular application.

Step 3 :

When setting up the camera, it's essential to take the time to configure all of the camera settings correctly. This includes focusing the camera on the region of interest, which is the specific area in the image that contains the object or feature you want to analyze. You can adjust the focus using the slider or enter the value manually.

Another critical camera setting to get right is the exposure, which controls how much light enters the camera. You can adjust the exposure using the slider or enter the value manually.

Optimizing lighting conditions is also crucial for obtaining accurate and reliable results. You need to make sure that the lighting conditions are appropriate for the type of analysis you want to perform. For example, if you're analyzing a reflective surface, you may need to use the lighting to avoid glare or reflections. This can be selected under the LED light pattern. In addition to these camera settings, you can configure in-house designed lights for the camera and obtain various patterns to identify defects that may be visible under different reflective conditions.

Getting the gamma just right is also important. Gamma is a measure of the contrast between the light and dark areas of an image. Adjusting the gamma correctly can help you see more detail in the image and make it easier to identify defects or features of interest.

Once all of these settings are configured, simply hit "save" to apply them and start using the camera for your analysis.

Step 3.5 : Clicking on the name of the recipe would take you back to this screen where you can then navigate to the alignment block to set up the alignment of the camera.

Step 4 : Once you are on the alignment page, you can capture the latest image and align the page to your desired condition. However, since you don't require this step for your current task, you can skip it. Once you have made any necessary adjustments, simply click "save" to apply the changes and move on to the next step.

Step 4.5 : Now we navigate to the Region of Interest block or the RIO block.

Step 5 : For this particular case, the inspection will be focused on a type of drill bit. However, you can select a different inspection type for your specific use case and adjust the region accordingly.

Once you have selected the appropriate inspection type, you can adjust the region of interest to ensure that the camera is focused on the correct area. This can be done by dragging the corners of the region of interest box to adjust its size and position. It's crucial to ensure that the region of interest is correctly aligned with the object you want to analyze to obtain the most accurate results.

Once you have adjusted the region of interest, simply hit "save" to apply the changes and continue with the inspection process.

Step 5.5 : We now navigate to the classification block.

Step 6 : In the Classification block you take a minimum of 5 different images of the type of inspection you are performing, in this case are different sizes of the drill bits.

Note

The model would be more accurate if you do not repeat two same images.

Step 7 : Do the same for the second inspection type.

Step 8 : Do the same for the third inspection type.

Step 9 :

Once all the inspection types are labeled, it's essential to double-check them to ensure that everything is correctly labeled. Once you've verified everything, click on the "train classification model" button. This will take you to the model training page, where you can choose the type of model you want to train.

The "Fast" version of the model is great for trial and testing, such as testing out a proof of concept. However, for production use, you will want to use the "accurate" version of the model. Keep in mind that the more epoch numbers you choose, the better the model's accuracy will be. However, the downside is that the more epoch numbers you choose, the longer it takes to train the model.

It's important to balance the need for accuracy with the amount of time you have available for training the model. Once you've selected the appropriate settings, hit the "train" button to begin the training process. The system will start training the model, and you can monitor its progress and make any necessary adjustments as needed.

Step 10 : After clicking on the "train" button, you will be taken to the model training progress page, where you can monitor the progress of the training. Here, you can see the current epoch number and the accuracy value.

If you need to stop the training for any reason, you can click on the "abort" button. If the training accuracy is already up to the mark, you can finish the training early by clicking on the "finish" button.

Note

It automatically finishes training if the training accuracy is met.

Once the training is complete, you can check the training accuracy and evaluate the model's performance on the validation data. If you're satisfied with the results, you can save the model and use it for your analysis. If not, you can go back and adjust the settings as needed and retrain the model until you're satisfied with the performance.

Step 11: Once the training is completed, you can view the live preview of the trained model.

Step 12 : Congratulations, you have trained your first classification model.

Configure pass/fail logic using NODE RED for a classification recipe

  1. Activate and edit a classification recipe.

  1. Make sure all the AI blocks are trained before you edit the Node-RED logic.  Click Configure IO to enter the Node-RED flow editor.

    1. Locate the Classification Block Logic Node in the default flow, or add it to your flow from the nodes menu on the left.  All purple nodes in Node-RED represent Overview Logic Blocks. These blocks are integral to the overall classification logic. For a comprehensive understanding of each block, refer to the manual page IO Block and Node-RED Logic.

  1. From the dropdown menu on the left, select the ROI you wish to include in the logic.  You may also set a confidence threshold for the inspection.  You can use the confidence to tune sensitivity, but generally it is not required.

  1. Choose the target class that the model should identify. For example, select the corresponding target class if you want the model to pass items with a "pass" classification.

  1. If the model requires additional regions of interest, you can add more ROIs to the logic. Additionally, you may select if any or all of the rules must be true in order for the inspection to pass.  By default all rules must pass.

  1. After configuring all necessary settings, click on the "Deploy" button in the upper right corner of the Node-RED editor to save and deploy the logic. Verify that the model operates as expected by testing with sample data from the HMI page.


Was this article helpful?

What's Next
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence