## 2 Methodology
### Framework of the Proposed Method  
For bridge condition monitoring, a method for crack detection in the images is proposed by combining CNN and GAT in this study. As shown in Figure 4, researchers [9] usually use a sliding window to scan a large-sized image, and each patch inside the window is input to a CNN model to decide whether it contains cracks. Such a traditional method pays attention to the information of a single patch while ignoring the features of its surroundings in images. In general, cracks are continuous, which indicates that if a patch contains cracks, its neighborhoods would be very likely to contain cracks. Thus, the features of neighborhoods can help decide whether the central patch contains cracks. As previously mentioned, GAT can learn the relationship among neighboring nodes and aggregate their features, which is appropriate for the situation of crack detection. To achieve better detection performance in a small patch, the GAT is adopted in this paper to capture more information about its neighboring patches.  
A CNN model is constructed to extract information and reduce the dimensions of the input patches. The layer size and corresponding operation in the CNN are listed in Table 1. When a square window with a side of 224 pixels slides over a test image, the central patch inside the window and its 8 same-sized neighboring patches will be input into the CNN model. Through the CNN, the dimensions of the input patches are reduced from \(224\times 224\times 3\) to \(1\times 1\times 96\), which condenses the key features and decreases computational costs. Then, the output features of these patches are reshaped into \(96\times 1\) vectors, which can be considered as nodes to construct a graph.  
After data preprocessing through the CNN, a graph structure is constructed by connecting the central node with itself and its 8 neighboring nodes. Then, this graph is input into a GAT model to update the node features. In the established GAT model, the dimensions of the input node features \(\mathbf{h}_{i}\) is \(96\times 1\), which is in correspondence with the output of the CNN, and the dimensions of output node features \(\mathbf{h}_{i}^{\prime}\) are set as \(64\times 1\). After aggregating  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Layer** & **Layer Size** & **Operation** & **Kernel Size** & **No.** & **Stride** \\ \hline Input & \(224\times 224\times 3\) & Convolution & \(20\times 20\times 3\) & \(24\) & \(2\) \\ Layer1 & \(103\times 103\times 24\) & ReLU & - & - & - \\ Layer 2 & \(103\times 103\times 24\) & Max-pooling & \(7\times 7\) & - & \(2\) \\ Layer 3 & \(49\times 49\times 24\) & Convolution & \(15\times 15\times 24\) & \(48\) & \(2\) \\ Layer 4 & \(18\times 18\times 48\) & ReLU & - & - & - \\ Layer 5 & \(18\times 18\times 48\) & Max-pooling & \(4\times 4\) & - & \(2\) \\ Layer 6 & \(8\times 8\times 48\) & Convolution & \(8\times 8\times 48\) & \(96\) & \(1\) \\ Layer 7 & \(1\times 1\times 96\) & ReLU & - & - & - \\ \hline \hline \end{tabular}
\end{table}
Table 1: Sizes and operations of layers.  
Figure 4: Flowchart of conventional CNN-based methods.  
the features of the neighborhoods through GAT, the output features of the central node are sent to a fully connected layer, which is used to classify the central node and figure out whether the original patch contains cracks. The whole procedure is shown in Figure 5.