- 07 Mar 2023
- 2 Minutes to read
- Updated on 07 Mar 2023
- 2 Minutes to read
Anomaly Detection is used to identify any deviations from the norm. These Models only train on "normal" images. This method allows the Model to detect abnormalities in an image. Let's see how this works in an example.
Let's say you work for a company that manufactures hardwood floors and want to train your Model to detect scratches and stains on these floors. You can train your Model by showing it "normal" images, like in the screenshot below.
The Model will learn from the patterns on the normal images during training. When you deploy your Model, the Model will be shown new images. If those images display patterns outside the norm (like the images below), the images will trigger the Model and be classified as abnormal.
When to Use Anomaly Detection
Here are some important notes to consider to help you determine if Anomaly Detection is right for you:
- Anomaly Detection Models can only be trained with normal images. You cannot train with abnormal images.
- Anomaly Detection does not use Classes. If you have multiple items that you want to detect with Anomaly Detection—like both hardwood floors and carpet floors—then create a separate Anomaly Detection Project for each item.
- Anomaly Detection Models can have great performance with fewer than 300 training images.
Anomaly Detection is commonly used in these situations:
- You are launching a new product and unsure what deviations from the norm to expect.
- You do not have many images for Model training.
Anomaly Detection vs. Classification
Classification Models are supervised, whereas Anomaly Detection Models are unsupervised.
Supervised Learning is when you give instructions to the Model—these instructions are generally in the form of labels. For Classification, you train a Model to recognize Class A and Class B by labeling and training many examples of each Class. Anomaly Detection, however, does not require any labels. Instead, Anomaly Detection Models are trained on unlabeled, normal images. This process is called Unsupervised Learning.
Anomaly Detection Limitations
- The performance of an Anomaly Detection Model stagnates if you are training with more than 300 images; it is important to note that adding more images will likely not improve your Model.
- Anomaly Detection models are very sensitive, so you should expect a high number of abnormal detections. For example, a Model may detect an image as abnormal if it has a slightly higher brightness than the images it was trained on.
- Anomaly Detection Models are generally less flexible than Supervised Learning Models.
- To help prevent a high number of abnormal detections, ensure that you train the Model on highly regular images. Do not use Augmentations to modify the images.
Upload Images for Anomaly Detection
Anomaly Detection has two sections for you to upload images to: Upload Normal Media and Upload Abnormal Media. The platform will automatically categorize the images based on the section you upload images to.
You may recall that Anomaly Detection only trains on normal images—so why is there an option to upload abnormal images? When you train a Model, the images you provide are split into three sets: a Train Set, a Dev Set, and a Test Set. Each Set serves a different purpose. In this case, the Test Set is comprised of both normal and abnormal images that you've uploaded. This method serves these purposes:
- This allows the Model to test itself on abnormal images to see how well it performs.
- This allows the Model to create an accurate error analysis against your Ground Truth, which allows you to analyze your Models better. (Ground Truth is the "true" identified object. For Anomaly Detection, Ground Truth refers to the uploaded normal and abnormal images.)