## 3 Proposed Method
### Rail Track Detection  
As said in Section 1, the presented ODA integrates autonomous rail track detection using DL-based object detection. More precisely, CenterNet that is used for OD in the SMART/SMART2 system is also used for the detection of rail tracks. For the purpose of training CenterNet to detect rail track parts, 234 images with rail tracks in the SMART dataset were annotated so that the visible rail tracks were annotated with multiple bounding boxes. The number of bounding boxes used for annotation depended on the length of the rail tracks in the image. An example of annotation of straight rail tracks with six bounding boxes is given in Figure 3a.  
During the annotation process, when selecting the parameters of the annotation bounding boxes, the following criteria were applied:  
* The bottom left and the bottom right corners of each bounding box have to lie exactly on the outer edge of the left and right rail track, respectively;
* The ratios of height and width of the individual bounding boxes are approximately constant.  
The 234 original images were selected so that the annotated dataset contained diverse data: images with different backgrounds as captured in different weather and illumination conditions, and images with different structure of the rail tracks terrain. The CenterNet model, originally trained on the COCO dataset, was retrained with annotated rail track images using the following hyperparameters: learning rate: \(2.5\times 10^{-4}\), number of epochs: 230, batch size: 4, learning rate drop at epoch 180 and epoch 210, input resolution: 1024.  
An example of the CenterNet model detection is given in Figure 3b. As can be seen, the corner points of the bottom sides of all bounding boxes lie very precisely on the rail tracks, so that linear regression lines obtained by curve-fitting through these points represent the rail tracks reliably.  
The left/right regression line is formed starting from the left/right bottom corner of the lowest bounding box in the image (\(y_{max}\) coordinate) to the left/right upper corner of the uppermost bounding box (\(y_{min}\) coordinate). Firstly, the average \(x\)- and \(y\)-coordinates of bottom corners of all bounding boxes, \(\overline{x}\) and \(\overline{y}\), and the standard deviations, \(\sigma_{x}\) and \(\sigma_{y}\), are determined. The correlation factor \(r\) is assumed to be 1 for the sake of simplicity. The slope of the regression line \(m\) can be determined using the equation:  
\[m=r\cdot\frac{\sigma_{x}}{\sigma_{y}} \tag{2}\]  
While the coordinates \(y_{max}\) and \(y_{min}\) for both regression lines are known through the coordinates of the bounding boxes obtained as the outcome of the CenterNet-based rail track detection, corresponding \(x\)-coordinates have to be calculated from the Equations (3) and (4) for the left regression line as well as (5) and (6) for the right regression line:  
\[x_{L,max}=\overline{x}+\frac{\overline{y}-y_{min}}{m} \tag{3}\]  
\[x_{L,min}=\overline{x}-\frac{y_{max}-\overline{y}}{m} \tag{4}\]  
\[x_{R,max}=\overline{x}+\frac{y_{max}-\overline{y}}{m} \tag{5}\]  
Figure 3: (**a**) Annotation of rail tracks with multiple bounding boxes (BB) along the visible length of the rail track. (**b**) CenterNet detection result of detected rail track parts as marked with purple bounding boxes.  
\[x_{R,min}=\overline{x}+\frac{\overline{y}-y_{max}}{m} \tag{6}\]  
An example of calculated regression lines drawn onto the original image of rail tracks is given in Figure 4a. As can be seen, the calculated regression lines map the courses of the left and right rail track accurately so that they can be used for the definition of a region of intrusion (RoI) and the obstacle scaling factor (OSF), as explained in the following.