# Real-Time Detection of Hole-Type Defects on Industrial Components Using Raspberry Pi 5
## 3 Materials and Methods  
The study was carried out with an image dataset captured from industrial metal plate components under varied environmental conditions presented in Table 1. The dataset comprises images with various defects that were created. The dataset collection process was set based on a machine vision system consisting of a 0.35 megapixel (MP) industrial camera. The images were captured using the Wenglor B50M012 industrial smart camera (Tettrang, Germany), which possesses a monochrome image sensor. Images were captured with the aid of an external white light with a color temperature of 5000 K, which is a simulation of daylight and offers stable light for image taking. The camera lens settings are manually varied to ensure that the dataset images have different conditions used for training. The exposure times exhibited considerable variance, spanning from 120 us to 20,000 us, thereby influencing image brightness and potentially affecting the model's defect detection efficacy. Additional parameters, such as gain ranging from 16 to 30 and field of view (FOV), also played a role in generating subtle disparities among the varied conditions. These variations were deliberately implemented to replicate diverse environmental and lighting scenarios representative of the manufacturing context. Figure 1 illustrates a metal component that resembles a triangular metal plate featuring drilled holes, which is frequently utilized in industrial settings, such as in the manufacture of hinges. The triangular plate boasts equal sides of 110 mm, indicating it is both compact and robust, suitable for supporting the weight and movement. Its symmetrical dimensions are crucial for even distributing the mechanical forces encountered. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**External Light** & **Exposure Time** & **Gain** & **FOV (cm)** & **F-Stop** \\ \hline Yes & 120 & 16 & 53 & 3.5 \\ Yes & 9750 & 16 & 53 & 3.5 \\ Yes & 800 & 30 & 53 & 3.5 \\ No & 20,000 & 20 & 53 & 3.5 \\ No & 13,000 & 30 & 40 & 3.5 \\ No & 15,000 & 30 & 45 & 5.0 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Camera settings and imaging parameters employed in the experimental setup, detailing variations in external lighting, exposure time (ms), gain, field of view (cm), and F-stop configurations for optimal defect detection performance. Figure 1: Metal plate sheet, each side measuring 110 mm, featuring five evenly spaced holes with a diameter of 6.5 mm. The diagram in Figure 2 illustrates the workflow of a real-time defect detection system using deep learning methods, specifically applied to metal component inspection. Here is a clear textual description of the diagram:  
Image Acquisition:  
* Initially, images of metal components are captured using a dedicated imaging setup (Wenglor B50M012 camera, Tettnang, Germany). Preprocessing and Dataset Formation:  
* Captured images proceed to a structured preprocessing stage, where initial data exploration occurs, identifying key characteristics and potential anomalies. * Subsequently, the dataset undergoes systematic data processing, which includes cleaning, normalization, and potentially extracting relevant features to improve learning efficacy. * Data augmentation is implemented concurrently to enrich the training dataset, thereby addressing dataset imbalance and enhancing model generalization. Model Development and Training:  
* A robust deep learning model is developed and trained on the processed and augmented dataset. * Model validation steps ensure the trained model performs reliably by assessing its predictive capabilities on unseen data. Deployment and Output:  
* Once the trained model achieves satisfactory performance criteria, it is deployed for real-time detection and classification. * The output stage provides prompt, automated defect detection and classification results, facilitating timely quality control decisions in manufacturing environments.