# A Defect Detection Method Based on YOLOv7 for Automated Remanufacturing
## 5 Conclusions  
Deep learning architectures have shown promising results in surface defect detection. One of those is the YOLOv7 model, which is state-of-the-art in the object detection field and outperforms real-time detectors in terms of speed and accuracy. In this study, an investigation of the YOLOv7 model is conducted on a metal defect detection task using a publicly available dataset. Some of the datasets are selected for this study according to specific criteria. The selected datasets are NEU-DET, NRSD, and KolektorSDD2. Further, each variant of the YOLOv7 model is studied on the NEU-DET. The mAP_0.5 achieved on this dataset was about 65-73%, with the base model coming with the optimal balance between accuracy and speed. In addition, object detection and semantic segmentation of the base variant of the YOLOv7 model were tested on the NRSD dataset. The YOLOv7 model achieved a higher accuracy of about 88% on mAP_0.5 with this dataset for its larger set size, higher resolution, and larger defect/background ratio. In the last dataset, the model was trained for some extra time to compensate for the fewer defect samples; however, the model achieved the worst accuracy among all tested datasets. This is due to the higher similarity of the defect to the background texture. All variants of the model have accomplished a real-time inference process. For industrial applications, deploying the defect detection model requires more fine-tuning to the specific problem for reliable and accurate results. This tunning process is achieved by training the detection model on real-life defect samples. The performance of the detection model is sensitive and biased to the collected dataset, which might raise some challenges in achieving the desired results. For future development of this pipeline, a custom real-life dataset needs to be collected. Further, a comparative analysis with results obtained by [PERSON] et al. [61] underscores the potential advantages of custom modifications to the YOLOv7 model, as their tailored enhancements led to higher detection accuracy of mAP 81.9% on the NEU-DET database. This highlights an avenue for future research to explore and implement specific model adjustments for improved performance in defect detection tasks. In addition, it is important to mention that hybrid methods such as improving YOLO with Swin Transformers also enable achieving higher accuracy results [26]. Adopting pixel-level supervision could also significantly improve the model's precision by allowing it to learn more granular details of defects, such as small cracks and minute surface variations that are often missed by conventional inspection methods [62; 63]. This approach could be particularly beneficial for detecting early-stage defects that typically do not affect the larger visual appearance of the metal surface but may lead to significant issues if not addressed promptly. This work can be used as a base for future studies and comparison of the enhanced models based on YOLOv7.  
Figure 15: Defect detection on the generated stitched map.  
**Author Contributions:** G.R.S.: writing--original draft, writing--review and editing; H.A.-M.: investigation, formal analysis, writing--original draft; R.A.: supervision, writing--review and editing, project administration, funding acquisition. All authors have read and agreed to the published version of the manuscript.  
**Funding:** We express our gratitude to the Minister of Economic Development, Trade, and Tourism for funding this project through Major Innovation Funds. We also acknowledge NSERC (grant nos. NSERC RGPIN-2017-04516 and NSERC CRDPJ 537378-18) for further funding of this project.  
**Data Availability Statement:** The raw data supporting the conclusions of this article will be made available by the authors on request.  
**Conflicts of Interest:** We declare that the authors have no competing interests, or other interests that might be perceived to influence the results and/or discussion reported in this paper.