Overview
This project presents a Convolutional Autoencoder (CAE) based anomaly detection system designed for the inspection of flap wheels during production or maintenance. The model automatically flags structural defects or wear, such as tears, excessive wear, or missing flaps, relying entirely on unsupervised learning techniques.
Approach & Pipeline
The anomaly detection pipeline is composed of two primary stages designed to clean the data and identify defects.
- Smart Cropping Logic: A custom computer vision pipeline utilizing OpenCV processes raw images by removing the background and isolating the flap wheel. It leverages per-image best-thresholding and left-shaft trimming to enforce a uniform canvas size, preparing the inputs for the autoencoder.
- Autoencoder Reconstruction: A Convolutional Autoencoder (CAE) architecture was developed to compress input images into a lower-dimensional latent representation, and then reconstruct them.
Unsupervised Learning & Error Calculation
The CAE was trained exclusively on images of healthy (Neuzustand) flap wheels. By only observing flawless examples during the training phase, the network learns to accurately reconstruct healthy patterns while struggling to reconstruct anomalous features like defects or wear.
To determine anomalies, the system calculates a Hybrid Reconstruction Error combining the Structural Similarity Index (SSIM) and Mean Squared Error (MSE). A threshold is established based on the maximum error observed in a validation set of healthy images. Any image yielding a reconstruction error above this threshold is automatically flagged as anomalous.
Reconstruction Results
The model successfully reconstructs healthy flap wheels but leaves artifacts or blurs around anomalous areas, generating a noticeable spike in reconstruction error.
Validation Performance
Evaluation on a dataset containing anomalies revealed that the autoencoder successfully identified major structural defects. While it correctly flagged many significant issues, further fine-tuning could improve its sensitivity to more subtle anomalies that were sometimes missed in early validation batches.