Anomaly Detector

The Anomaly Detector module is the unsupervised deep-learning method available, where detailed annotations are not required and the end-user is only required to assign the ok class to at least 1 image.

This module looks for anomalies in images according to a model which was previously trained.

The model is trained using defect-free images as a reference. Therefore, finding defects in the remaining images.

Find a video below demonstrating the overall functionality of this module:

 

Tutorial

Alternatively, if you would like a step-by-step tutorial example for this module:

Open the application > Create new project > Start Tutorial

You will be guided through the main functionalities of our software, using this module.

You can enable running the tutorial with project start at any time using:

Open the application > Start the project > Settings > Show tutorial dialog

show tutorial.png

The tutorial dialog opens only if there are no images in the project.

Training

The input for training involves classifying at least 1 image as an ok class.

There are 3 options to perform this classification:

1. [CLICKING] - When the image is selected, click on the option ok within the ‘Annotations’ box.

2. [NUMPAD] - When the image is selected, press numpad key ‘1’, it then categorizes it as an ok image.

3. [SMART SORTING] - Click on the ‘SMART SORTING’ button, and type what’s the prefix for the ok images within the field. There is also an option to use regular expressions instead of prefixes if you check the ‘Regex’ checkbox or you can filter images by their tags.

anomaly smart show.png

Tip: It is also possible to select multiple images at once using the ‘Shift’ key and classify them in bulk, by selecting the first image, then holding 'Shift' and selecting the last image from the range.

Attention: For 3. [SMART SORTING], please note that if the filename standard is, for instance, ‘testpart_OK52’, you would have to type ‘testpart_OK' - if you type only ‘OK’ as part of the name it won’t classify, as it classifies literally by prefix.

Another approach is to check the Regex checkbox which allows you to write regular expressions instead of prefixes - then if you write only ‘OK’ it matches all images which contain ‘OK’ anywhere in their name.

Feature size

The https://pekatvision.atlassian.net/wiki/spaces/KB3/pages/703266836 option configures the expected and also allowed size of defect features that the trained model is going to be able to find in an image. This acts as optimalization for training and evaluation.

For small annotations set small feature size, for bigger annotations higher feature size is better.

There is no general rule, it is necessary to tweak the values for optimal results.

Detection Results - Heatmap

The result of the detection is a heatmap. When validating, heatmaps are plotted in the image for better illustration. The heatmap detected areas that are defective can be highlighted by rectangles. These rectangles are added to the detectedRectangles item in the https://pekatvision.atlassian.net/wiki/spaces/KB3/pages/698058893.

Automatic sensitivity

This function helps you set the correct threshold, a value separating ok and ng images. Changing the threshold simultaneously changes how sensitive the model is.

After training, the threshold is only calculated based on training images. For better separation of ok and ng images, you should click on Recalculate threshold and classify both ok and ng (Not Good/defective) images in the dialog window that will be used for the calculation of the new threshold.

As a result, you get a graph containing two curves. The green curve shows how many ok images are wrongly classified as ng for a given threshold value. The red curve shows how many ng images are wrongly classified as ok for a given threshold value. Ideally, you want to choose a threshold at which both curves are minimized. It is possible to choose the threshold by clicking on the graph.