Real-Time Anomaly Detection For Quality Control | by Anthony Cavin | Feb, 2024

Insights after two years in the

Anthony Cavin
Towards Data Science
Example of an and a in the latent space (image by author)

The scenario: a high-speed production line is producing thousands of products. Two are installed to continuously control the of each product.

The goal: develop an that can check each product as fast as possible.

The constraint: you have an device with limited resources.

In this blog post, we will divide and conquer the problem. First by extracting meaningful features out of the images and then by using anomaly models to detect outliers from those features.

The key idea is to learn a lower dimensional representation of the visual input and to use this representation to train a classifier that can distinguish between normal and anomalous inputs.

We will explore some interesting methods for feature extraction, including histograms of oriented gradients (HOG), wavelet edge detection, and convolutional neural networks (CNNs).

Finally, we will cover two libraries that I found particularly useful to benchmark and implement algorithms in streaming –PyOD and PySAD.

There are many ways to extract features from images. We won’t cover them all in this post, but we will focus on three methods that I found particularly interesting:

  • histogram of oriented gradients (HOG),
  • wavelet edge detection, and
  • convolutional neural networks.

Histogram of Oriented Gradients

The histogram of oriented gradients is a popular technique in image processing and computer . The HOG descriptor can capture the shape and aspect of an object in a picture.

HOG representation of a cup (image by author)

In a few words, the HOG descriptor is a vector of histograms built as follows:

  1. The image is divided into cells, e.g…

Source link