Case 1 - Surface Defect Detection on Flat Plates

Contents

Case 1 - Surface Defect Detection on Flat Plates#

This website hosts notebooks based on the methodologies presented in the thesis: “Development and Validation of a Surface Defect Detection Algorithm for Flat Plates”.

There are four main sections:

  1. Dataset Generation: Generating a dataset in various formats for different models ensures consistency across all training sessions and enables an objective comparison between models. This is based on the “Decospan dataset”. Additionally, two problematic features of the dataset are addressed: high-resolution images are converted to lower-resolution using slicing aided hyperinference (SAHI), and a methodology to correct the imbalanced nature of the dataset is implemented.

  2. Anomaly Detection: Unsupervised anomaly detection is used to explore the potential of training solely on backgrounds. This approach can be useful in scenarios where defects are rare and hard to detect. The algorithm used is PaDiM.

  3. Binary Classification: A binary model is trained to simply provide a “yes/no” answer based on a window of the dataset. A pretrained backbone such as ResNet is employed to handle the limited number of images in the dataset and achieve plausible performance.

  4. Multi-Class Classification: Going a step beyond point 3, the window can now be classified into one of 11 categories. The YOLO framework is utilized for this purpose, which also allows for segmentation.

  5. Pipeline: an example pipline is proposed, as a proof of concept. It simulates the proces starting from the linescan camera and ends with multi-clas segmentation.

Abstract#

Quality control at the end of a production line is crucial, as it provides the last opportunity to identify defective products before they reach the consumer. This thesis specifically addresses the quality control processes at Decospan, a producer of veneer sheets. Currently, the company relies on manual inspections by operators, who manage to identify 70% of the defective sheets. However, the remaining 30% results in increased costs and reduced customer satisfaction. This master’s thesis investigates the implementation of machine vision for automatic fault detection, with a specific focus on the use of deep learning via a convolutional neural network (CNN). The goal is to develop a model based on the Decospan dataset, emphasizing both performance and inference time. The dataset is characterized by a limited number of images and associated errors, combined with high-resolution images. Given that a CNN typically requires a balanced dataset with sufficient examples in low resolution, specific methodologies are implemented to meet these requirements. Due to the time-intensive nature of sample collection, a proof of concept for unsupervised learning is developed, where samples are automatically collected. Additionally, the use of pretrained models compensates for the limited size of the dataset. Furthermore, augmentation techniques and sampling methods are applied to adequately represent each error category. To limit the resolution of the samples but retain detail, the Slicing Aided Hyperinference (SAHI) method is used. This research then experiments with different network architectures and subsets of the dataset to achieve optimal performance. The initial focus is on detection, which shows that a binary CNN with a Resnet 18 backbone trained on all types of wood delivers the best results with an accuracy of 98.9% and a recall of 75.9%. Subsequently, the focus shifts to classification, where the Yolov8 model, trained only on errors in all wood types, achieves an accuracy of 72.7%. A “2-stage approach” is then proposed, where a binary CNN only passes defective windows to the Yolov8 network. This approach realizes the lowest inference time for both detection and classification. Implemented on an embedded device, a sheet is processed in a maximum of 2.75 seconds. Finally, a financial analysis shows that the AI system yields an annual return of 32.8%, with a payback period of less than two years.