## 4 Metro Track Geometry Defect Identification Model and Its Optimization Method
### Example Dataset Design
#### 4.1.1 Sample Generation Rules  
Considering that the longitudinal acceleration is directly affected by the acceleration and deceleration of the train, this parameter was not included in the sample generation in this study, and only the remaining five vibration signals are considered--the lateral and vertical acceleration and the longitudinal, lateral, and vertical angular rates of the car body, denoted as \(\mathbf{I}=\left[\ddot{y},\ddot{z},\dot{\mathbf{x}},\dot{\mathbf{p}},\dot{\gamma}\right]^ {\mathsf{T}}\), and the sampling frequency is denoted as \(f_{s}\). The CVD is highly correlated with the state of the track geometry variation [27], is significantly influenced by running speed [12], and is affected by the different vibration features under different vehicular conditions [41]. Therefore, the CVD (\(\mathbf{I}\)), running speed, and vehicle condition information were used to generate sample \(\mathbf{X}\) to account for the influence of these heterogeneous factors.  
To fit the input of the CNN model, a continuous \(\mathbf{I}\) must be segmented. The actual metro-line mileage length of a data segment is denoted as \(s\), and the data segment is denoted as \(\mathbf{I}_{s}\). Because \(\mathbf{I}\) is equal-time-interval (ETI) data with frequency, \(f_{s}\), the data count of \(\mathbf{I}_{s}\) varies, and the direct application of \(\mathbf{I}_{s}\) for sample generation results in different sample sizes, as indicated in Figure 5A. The reshaping technique, which depends on interpolation or downsampling, is a widely used strategy to address this situation in ML, such as difference-size image-processing tasks. Considering that equal-distance-interval (EDI) data (refer to Figure 5B) are usually leveraged in the field of track geometry detection, and the root mean square (RMS) value of the vibration signal is closely related to the track condition [15; 42], an RMS-based [11] method is utilized to replace the reshaping technique in this study, which converts \(\mathbf{I}\) to EDI data such that \(\mathbf{I}_{s}\) features the same data count. The minimum data interval in the EDI data is \(d\), which is affected by the operating speed and the general length of TGDs, and this interval is usually 0.25 m [1].  
As demonstrated in Figure 5C, let \(\mathbf{I}\) contain \(n\) points in the minimum mileage data interval, \(d\), and the RMS value of \(i\)th type of vibration signal of these points can be calculated using Equation (5).  
\[h_{i}^{\text{RMS}}=\sqrt{\frac{1}{n}\sum_{j=1}^{n}\left(h_{i}^{(j)}\right)^{2}}, \tag{5}\]  
where \(i=1,2,\ldots,5\) denotes the different types of vibration signals, \(j=1,2,\ldots n\) represents the \(j\)th point in mileage interval \(d\), \(h_{i}^{(j)}\) symbolizes the value of the \(j\)th point of \(i\)th type of vibration signal, and \(h_{i}^{\text{RMS}}\) indicates the RMS value of the \(i\)th type of vibration signal. The converted EDI \(\mathbf{I}\) is denoted as \(\mathbf{I}^{*}\), as indicated in Figure 5D. The data segment of \(\mathbf{I}\) within the mileage range, \(s\), is denoted as \(\mathbf{I}_{s}^{*}\), where the point count is \(n^{*}=S/d\). \(\mathbf{I}_{s}^{*}\) is combined as an \(n^{*}\times 5\) matrix by mileage arranged form the smallest to largest, which is denoted as \(\mathbf{\bar{I}}_{s}\). Finally, generating the sample \(X_{s}\) of the data segment with \(\mathbf{\bar{I}}_{s}\), average speed \(\overline{v}_{s}\) in the data segment and data-acquisition-train code, \(e\) (\(e=0,1,\ldots\)), as expressed in Equation (6).  
\[\mathbf{X}_{s}=\begin{bmatrix}\mathbf{\bar{I}}_{s}&\mathbf{\eta}.\overline{v}_{s}&\mathbf{ \eta}.e\end{bmatrix}, \tag{6}\]  
where \(\mathbf{\eta}=\begin{bmatrix}1&1&\cdots&1\end{bmatrix}_{1\times n^{*}}^{\text{T}}\).