## 2 Methodology
### Detector  
The surface defects of CT mainly include corner cracks, edge cracks, delamination, cracks, scratches, lack of glaze, pinholes, soiling, and dripping ink, etc. [23], which have the characteristics of diverse types, large scale spans, and significant morphological differences. Therefore, it is challenging to characterize defects based on the targeted design characteristics of traditional image processing methods, and the method of DCNN has advantages in terms of effectiveness and robustness. The detector network structure in this paper is shown in Figure 3, in which the backbone adopts the residual block structure Resnet101 [24], which has more vital feature characterization ability, and then a variability convolution is added to adapt to the shape and size of defects. With the help of FPN [25] to achieve the multi-scale fusion of the defect space, Roi-align is used to reduce the quantization error caused by channel standardization. In order to improve the positioning and classification accuracy of defects, the Cascade R-CNN [26] inspection head is used for the second step of regression and classification. The detector trained on the labeled dataset can detect 14 types of surface defects for CTs. The defects in the area enclosed by the red rectangle box in the detection result image are the lack of glaze. Usually, DCNN-based defect detectors have high accuracy on the training set. If applied to an unknown texture image (not trained), especially when it has a texture that is very similar to the defects of the training set, the accuracy rate of the detector will be significantly reduced, which is also the actual problem that the algorithm of this paper needs to solve.  
At the same time, to obtain the reference rectangle, it is necessary to search on the corresponding reference image according to the coordinates of the resulting rectangle produced by the detector. Due to the deviation of angle and displacement between the image to be detected and the reference image, the first method is to find the affine transformation matrix of the two images through feature point matching and obtain the coordinates of the reference rectangle frame after the images are aligned. However, considering that the deviation of angle and displacement is relatively small and the accuracy and efficiency of feature matching must be balanced, this paper adopts a time-saving and effective method, as shown in Figure 4.  
Assume that the upper left corner of the red det_box is \(A\), and the lower right corner is \(B\). Obviously, if \(A=A^{\prime}\) and \(B=B^{\prime}\), the corresponding yellow false_ref_box obtained on the reference image is not the negative sample area corresponding to the defect. Using the midpoint of the line segment \(A^{\prime}B^{\prime}\) as the benchmark, enlarge the length and width by \(\beta\) times to obtain a green ref_enlarged_box with a diagonal \(A^{\prime\prime}B^{\prime\prime}\). Use det_box as a template to search for the best matching area on ref_enlarged_box. Based on the standard correlation coefficient matching method in Opencv3, the blue ref_box has the most significant correlation coefficient among all matches.  
Figure 4: Schematic diagram of the reference rectangle box matching. (**a**,**b**) respectively represent the image to be detected and the reference image. In (**b**), det_box is shown in the red rectangle box produced by the detector, it indicates the location of the defect, which is defined as lack of glaze. In (**a**), the yellow false_ref_box represents the rectangle box on the reference image with the coordinates of the det_box, obviously, and false_ref_box is not the negative sample area corresponding to det_box. The green box denotes the enlarged reference box according to det_box, the blue ref_box is searched from the ref_enlarge_box.  
Figure 3: Network structure diagram of the defect detector. Two red rectangle boxes produced by the detector indicates the location of defects, which is defined as lack of glaze.