## 2 Methodology  
### CNN Architecture  
To conduct semi-supervised anomaly detection effectively, an improved VGG-16 network model with the network architecture, as shown in Figure 2, is used. Here, we use the VGG-16 network model [37] as the backbone network mainly based on its several advantages, such as excellent performance in the task of transfer learning [19; 20] with simple architecture, strong generalization ability and flexibility but with relatively high training efficiency. However, the traditional VGG-16 still has some limitations. For example, in the classification task, only the label of the testing sample can be output, but not the visual feature map. To address this issue, some modifications are made. At first, the first four Conv blocks of the traditional VGG-16 model are frozen, and then the remaining part, which contains the fifth Conv block (including three convolution layers and one maximum pooling layer), three fully connected layers and one softmax layer, is replaced by a fully convolutional classifier, with its architecture shown in the red dashed box. In other words, both the traditional VGG-16 neural network model and the improved one have the same first four Conv blocks, and the latter one introduces a fully convolutional classifier to output the visual feature map and has random initialization and trainable convolutional layers. Figure 1: Diagram of DSVDD data division. In algorithm implementation, the procedure of the improved VGG-16 is summarized as follows. In the training stages, some normal crack images of the same size are used as the input, and their characteristics are extracted after passing through four Conv blocks in sequence. In this process, the model training only takes a short time, due to the pre-trained network layers being frozen and the model not needing to relearn the parameters. Subsequently, the feature map obtained by the first four Conv blocks is input into the \"fully convolutional classifier\", which includes nine layers, as shown in the red dashed box in Figure 2. In the first four layers, the characteristics are further extracted, and parameter learning and batch normalization on the feature map are performed. The fifth layer named Conv2D in the red dashed box is a \(1\times 1\) convolutional layer. In this layer, it compresses the network to output into a single channel of data. The sixth layer is a pseudo-Huber loss function [38], which limits the output heatmaps to positive numbers. An upsampling layer is followed by the loss function layer to resize the output heatmap to the same size as the input image. Then, the global average pool layer is employed to calculate the average thermal scores. Finally, the FCDD objective loss function [36] is evaluated in the FCDDLossLayer. The FCDD objective loss function [36] is calculated according to Equation (1), which is a variant of the Hypersphere Classifier objective [39], as given in Equation (2). \[\text{FCDD}_{loss}=\underset{w}{\text{min}}\frac{1}{n}\sum_{i=1}^{n}(1-y_{i} )\frac{1}{u\cdot v}\|A(X_{i})\|_{1}-y_{i}\log\biggl{(}1-exp\biggl{(}-\frac{1} {u\cdot v}\|A(X_{i})\|_{1}\biggr{)}\biggr{)} \tag{1}\]  
\[\text{HC}_{loss}=\underset{w}{\text{min}}\frac{1}{n}\sum_{i=1}^{n}(1-y_{i})h( \varphi(X_{i};W)-c)-y_{i}\log(1-exp(-h(\varphi(X_{i};W)-c))) \tag{2}\]  
Figure 2: The network architecture of improved VGG-16. The two-dimensional array denotes the convolution or pool kernel size, and the three-dimensional array denotes the size of the output image and the channels. where \(n\) is the number of samples, \(i\) denotes the \(i\)-th sample, \(X_{1}\),..., \(X_{n}\) represents a collection of samples and \(y_{1}\),..., \(y_{n}\) are their labels. \(y_{i}=1\) denotes an anomaly sample, and \(y_{i}=0\) denotes a normal sample. \(W\) is the weight of the neural network \(\varphi\), and \(c\) represents the feature center mapped by the training set. \(h\) is the pseudo-Huber loss, which is determined by \(h(a)=\sqrt{\|a\|_{2}^{2}+1-1}\).