3
The magic of the autoencoder
The heart of the solution is a type of neural network model termed an autoencoder, trained on a large number of images. The special feature of the method is that during the neural network training phase, only the images of non-defective products are used, with no defect categories involved. With this approach, the final model can therefore detect any type of deviation from the normal appearance of the product: both already identified defects and new defects.
An autoencoder, depicted schematically, is a special type of artificial neural network capable of codifying objects in an unsupervised learning context. When an item of data is supplied to the autoencoder without specifying its significance, the autoencoder autonomously learns which characteristics are typical of that data item and which are not. An autoencoder consists of an encoder and a decoder. The encoder receives the input data and transforms it into an internal representation. The decoder accepts this internal representation and builds the output from it. The layer containing the internal representation is generally smaller than the input and output layers and is termed the bottleneck layer.
Autoencoders are trained to generate output data that is as similar as possible to the input data. This is similar to a “copy and paste” operation with a small intermediate hidden stage. The secret of the autoencoder lies in the layers that contain the internal representation. These layers form a bottleneck for the information contained in the training data. Since the bottleneck layers are generally much smaller than the input layers, the autoencoder code is forced to gather only the essential features of the data. Such features can then be used to identify anomalies: when an anomaly occurs, the automated encoder will be unable to reconstruct it efficiently since, during the training process, no structure was developed within the neural network that could represent the anomaly itself. If the autoencoder’s output data is then compared with its input data and there is a large difference, it can be assumed that an anomaly exists.
The autoencoder automatically “subdivides” the defects shown in the image, such that the various data points indicate the type of defect involved. These deviations might provide more detailed information on the defect type (such as “break” versus “indentation”).