**2. Materials and Methods**

In this section, the proposed two-stage surface defects detection method will be introduced in detail. Since there is no similar defect database, at the beginning of the project, we need to preliminarily detect the area of interest and collect defect samples. Therefore, we cannot use the end-to-end network which needs a large number of labeled defect images; instead, we design a two-stage target detection method. As shown in Figure 4, the proposed method has two main components: (1) ROI extraction based on the combination of MGRTS, DoG, and similar area merge, and (2) defect ROI classification.

**Figure 4.** Overview of the defect detection method applied to a real production line. DOG: Difference of Gaussian, MGRTS: mask gradient response-based threshold segmentation, ROI: region of interest.
