Anomaly Detection vTool#
Anomaly detection is a form of binary classification in that it distinguishes normal (desired) from abnormal (undesired) data allowing you to sort your images into good and bad ones. In contrast to standard classification, it can handle highly imbalanced data, where anomalies are rare, not well-represented, or not existent at all in the training data set.
The Anomaly Detection vTool can classify images it receives via the Image input pin. It outputs the results via the Classes, Scores, Regions, Heatmaps, and InferenceImage output pins.
If you use the ROI Creator vTool to specify a region of interest before anomaly detection, the Anomaly Detection vTool accepts the ROI data via its Roi input pin. In that case, anomaly detection is only performed on the region of interest. As a side effect, this results in faster processing.
仕組み#
Assume that you want to check your PCB production line for anomalies.
This is your input image (image source: a) showing a PCB with a bent pin:
You configure the vTool by loading a model that has been trained to detect irregularities in PCBs.
Next, you configure the detection settings:
-
Visualize anomalies and output heatmap: The vTool includes a visualization feature, which is enabled by default. This allows you to view the data in the form of a heatmap. You can choose from a variety of color maps for the heatmap. Different color maps highlight anomalies more effectively depending on the data and context.
If you don't need this visualization and no further analysis of the image data is required, you can deselect the heatmap. This may increase the throughput. If you deselect this option, the Regions, Heatmaps, and InferenceImage output pins are disabled.Differentiation of InferenceImage, Heatmaps, and Regions
The InferenceImage is the input image with the heatmap overlay to visualize anomalies in the pin data view.
Heatmaps are not intended for visualizing anomalies in the pin data view. They are images of float values representing the anomaly score for each pixel and are used if further analysis in the application is desired.
Regions are computed by thresholding the heatmap values. Pixels with an anomaly score above a certain value are grouped into a region, thus separating normal from abnormal regions.
-
Anomaly threshold: The anomaly threshold defines the boundary between images classified as normal and those considered abnormal based on the score returned by the model selected. The default threshold value is selected during the model training based on the training data set. However, the optimum threshold depends on the specific requirements of your application and the trade-offs you're willing to accept. You can adjust it as required. A higher threshold means fewer anomalies are detected but the anomalies that are detected come with a higher confidence. A lower threshold means more anomalies are detected but some of them may be false alarms.
情報
Pixel intensity variations on non-anomalous inference images indicate slight deviations from the normal image. However, as long as these deviations stay below the predefined anomaly threshold, the image is classified as normal. This observation could be useful for manually adjusting the threshold if needed.
After configuring the vTool, you run the recipe that initiates the inference process. The vTool utilizes the model to analyze the image and classify the objects present. When the analysis has finished, the anomaly detection result is returned. You can then view the result in the pin data view.
Detailed Output with InferenceImage Pin Selected
InferenceImage: Four areas with anomalies have been detected and are highlighted in the image using pixel intensity heatmaps. However, only one of them exceeds the anomaly threshold, leading to the image being classified as "abnormal".
Scores: The highest anomaly score across the entire image is 52.5901. Even though four anomalous areas have been detected, only one is above the anomaly threshold and gets an anomaly score.
Classes: The image has been classed as abnormal as the score is above the threshold.
Detailed Output with Regions Pin Selected
Classes: The image has been classed as abnormal as the score is above the threshold.
Scores: The highest anomaly score across the entire image is 52.5901.
Regions: The anomalous region has been highlighted (indicated by the arrow in the screenshot). In contrast to the inference image output, the region output only marks parts of the image where the anomaly score is above a certain value.
vToolの設定#
To configure the Anomaly Detection vTool:
-
In the Recipe Management pane in the vTool Settings area, click Open Settings or double-click the vTool.
The Anomaly Detection dialog opens. -
In the Server Selection area, select the server you want to connect to.
The server must be running to be able to connect to it.- Option 1: Enter the IP address and port of your Triton Inference Server manually.
- Option 2: Select the IP address / host name and port of your server in the drop-down list.
-
Click Connect to establish a connection.
The vTool then loads the available models. -
ペインの Model Selection area, select the bundle that contains the desired model in the drop-down list.
After you have selected a bundle, the information below the drop-down list is populated with the bundle details allowing you to check that you have selected the correct bundle. -
If the desired bundle isn't listed, click Deploy New Model in the drop-down list.
This opens the pylon AI Agent that allows you to deploy more models.
After you have deployed a new model, you have to click the 更新 button. -
In the Detection Settings area, select the desired color map for your heatmap.
-
In the Detection Settings area, adjust the anomaly threshold if required.
The anomaly threshold is part of the model. Changing it may have undesired consequences.情報
The parameters available in this area depend on the model selected. Some parameters are only available after selecting a certain model. Default values are provided by the model.
-
OKをクリックします。
You can view the result of the anomaly detection in a pin data view. Here, you can select which outputs to display.
入力#
画像#
Camera vToolから、またはImage Format ConvertervToolなどの画像を出力するvToolから、直接画像を受け入れます。
- データ型:Image
- 画像形式:8ビットから16ビットのカラー画像
Roi#
Accepts a region of interest from the ROI Creator vTool or any other vTool that outputs rectangles. If multiple rectangles are input, the first one is used as a single region of interest.
- Data type: RectangleF, RectangleF Array
出力#
クラス#
Returns the classes (normal or abnormal) for each input image.
- データ型:String Array
スコア#
Returns the anomaly scores for the class. This indicates the severity of the anomaly detected, i.e., how likely it is that the image is abnormal. Note that this value is not a probability and, depending on the model, it can range from very small to very large numbers. It should be interpreted only in relation to the threshold defined.
- データ型:Float Array
Heatmaps#
Returns the heatmap. This output can be disabled. Heatmaps are not intended for visualizing anomalies in the pin data view. They are images of float values representing the anomaly score for each pixel and are used if further analysis in the application is desired.
- Data type: Image Array
領域#
Returns the region for each predicted anomaly. This output can be disabled. Regions are computed by thresholding the heatmap values. Pixels with an anomaly score above a certain value are grouped into a region, thus separating normal from abnormal regions.
- データ型:Region Array
InferenceImage#
Returns the input image with heatmap overlay to visualize anomalies in the pin data view. This output can be disabled.
- データ型:Image
Payload#
Returns additional information regarding the performance of the Inference Server for evaluation. This output pin only becomes available if you enable it in the Features - All pane in the Debug Settings parameter group.
- データタイプ:文字列
関連するvTools#
典型的な先行機#
-
Visual Anomaly (VisA) was accessed on DATE from https://registry.opendata.aws/visa. Zou, Yang, Jongheon Jeong, Latha Pemula, Dongqing Zhang, and Onkar Dabeer. "SPot-the-Difference Self-Supervised Pre-training for Anomaly Detection and Segmentation." arXiv preprint arXiv:2207.14315 (2022).