# Automatic Detection of Ballast Unevenness Using Deep Neural Network
## 3 Experimental Results
### Training and Testing the YOLACT Network  
The YOLACT network was implemented using the Pytorch package in Python. Using the idea of transfer learning, two pre-trained networks were tested. The first uses Resnet51 as the backbone, while the second uses Resnet101. Each of the networks was trained for 400 epochs on a computer equipped with an Intel I5 CPU, NVIDIA GeForce GTX 1080 Ti GPU and 48 GB RAM. We used AdamOptimizer with a learning rate \(\mathrm{Lr}=0.0001\), weight decay \(\mathrm{w\_dec}=0.0005\) and momentum \(=0.9\) to minimize the loss function (loss error) defined by Formula (3). While training, two groups of data were used: _train_data_ for training and _valid_data_ for validation. After training, the performance of each network was verified on a _test_data_ set. The performance of the network was checked based on the same metrics as the Mask R-CNN network. Table 2 shows the obtained results. As for Mask R-CNN, the highest accuracy was obtained with the Resnet101 backbone, whereas the lowest processing time was obtained using Resnet51. Figure 9 shows examples of the detection and segmentation of sleepers from the intensity images of the track obtained using YOLACT with a Resnet101 backbone. The first column shows the image of the track, the second the image with the predicted bounding box and mask overlaid on it, the third the predicted bounding box and mask and the last, the target (truth) bounding box and mask. In order to compare the results of the Mask R-CNN network with those of the YOLACT network, Figure 9 contains the same test intensity images (column one) as Figure 8. The differences between the predicted bounding boxes (solid lines) and the predicted masks (colored areas) in column three and the corresponding truth bounding boxes (solid lines) and truth masks (colored areas) in column four are slightly larger than for the Mask R-CNN network. In addition, the YOLACT network did not detect the last lower sleeper found in the image from row two. It should be noted that this sleeper was detected by the Mask R-CNN network (Figure 8, row two). The YOLACT network is a one-stage network. It is less accurate than the two-stage Mask R-CNN network. This is particularly evident when detecting objects of a small size. In order to confirm the difference in the performance of the two models (Mask R-CNN with Resnet101 versus YOLACT with Resnet101), a statistical hypothesis test was performed. Because instance segmentation (Mask R-CNN and YOLACT) is composed of an object classification part (binary classification--sleepers and no sleepers) and a pixel classification part (binary classification--pixel belongs to the sleeper or pixel belongs to background), the test was conducted on both parts. The statistical test was selected based on the following criteria:  
* Models are deep neural networks that are very large and their training is time-consuming. We prefer a statistical hypothesis test that enables us to compare the models on a single test data set instead of performing multiple training (k-fold cross-validation with a modified paired Student's \(t\)-test);
* Models are binary classifiers;
* There are no assumptions about the type of data distribution;
* The test data for models are the same. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & **Mean Average** & **IoU** & **Dice** & **Pixel** & **Mean Processing** \\  & **Precision** & & **Coefficient** & **ACCURACY** & **Time [ms]** \\ \hline Resnet51 & 0.8214 & 0.7226 & 0.7668 & 0.7737 & 44 \\ Resnet101 & 0.8571 & 0.7380 & 0.7912 & 0.7956 & 61 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Detection and segmentation metrics for YOLACT with two different backbones. Figure 9: _Cont._  
Figure 9: Examples of detection and segmentation of sleepers from intensity images of the track obtained for YOLACT with Resnet101 backbone.