Skip to content Skip to footer

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


Insights after two years in the industry

Example of an encoder and a graph in the latent space (image by author)

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

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

The constraint: you have an edge 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 detection 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 data–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 vision. 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