# A Defect Detection Method Based on YOLOv7 for Automated Remanufacturing
## 3 Training and Results  
### Datasets  
Since YOLOv7 was trained and tested on the Microsoft COCO dataset, the model's behavior on the metal defect datasets has not yet been studied by researchers. Therefore, this paper investigates the behavior of the YOLOv7 model on metal defect detection tasks. An optimal approach for this study is to use public datasets for standard benchmarks and replication of the same results in the future. In addition, a comparison of the YOLOv7 performance with previously reported results is conducted. A list of the available public datasets is mentioned in Table 1.  
There are many public datasets available for the metal defect detection task; however, investigating the YOLOv7 model performance on all of them is time and resource-consuming and adds a minimal contribution to the study. Thus, three of the easily available and frequently cited datasets listed in Table 1, are selected to perform this investigation and obtain a general performance of the YOLOv7 model on the defect detection task. Those are NEU-DET, NRSD, and KolektorSDD2 datasets. Samples of the annotated datasets are shown in Figures 2-4.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Dataset** & **Set Size** & **Raw Image Size (Pixels)** & **\# of Classes** \\ \hline Several defect dataset [47] & 18,074 & \(1600\times 256\) & 4 \\ No-service rail surface defect (NPSD) [48] & 4101 & \(600\times 600\) & 1 \\ Kolektor surface-defect dataset 2 (KSDD2) [49] & 3335 & \(230\times 630\) & 1 \\ DAGM 2007 [50] & 2300 & \(512\times 512\) & 10 \\ GC10 defect dataset (GC10-DET) [51] & 2294 & \(415\times 416\) & 10 \\ Northeastern University defect dataset (NEU-DET) [52] & 1800 & \(200\times 200\) & 6 \\ Ball screw drive surface defect dataset (BSData) [53] & 1104 & \(1130\times 460\) & 1 \\ Kolektor surface-defect dataset (KSDD) [54] & 399 & \(500\times\) (1240–1270) & 1 \\ Rail surface discrete defect (RSDD) [55] & 167 & various & 1 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Public metal defect datasets.  
The NEU-Det dataset contains grayscale images collected from real-life industrial settings, specifically from the inspection of metal surfaces in manufacturing and remanufacturing environments. These images are representative of common defects found in such contexts, including but not limited to cracks, scratches, inclusions, corrosion spots, and other anomalies typically encountered IN metal surfaces during production and post-production processes. In addition, the NEU-Det dataset is annotated for an object detection task meaning only bounding boxes of the defect exist, whereas NRSD and KSDD2 are annotated for both object detection and segmentation tasks containing bounding boxes and masks. Furthermore, NRSD and KSDD2 consist of colored (i.e., RBG) images of planned and unplanned defects. Furthermore, it is important to note that the NRSD dataset contains some synthetic segmentation of the collected images generated by MCnet. Therefore, annotation is not accurate and might cause difficulty for the model to perform. Further data preprocessing is required to address these annotation inaccuracies.