## 4 YOLO v5 and Convolutional Neural Networks Approach in Railway Signal Detection  
In the last few years, numerous authors have dealt with the application of CNNs for the purpose of recognizing traffic signs. [PERSON] et al. [27] used YOLO v5 with balanced feature pyramid in order to detect traffic signs. According to the authors, one of the biggest challenges is the complex surroundings of traffic signs, as well as the small dimensions of the signal. They proposed an improved algorithm and presented comparison of the results obtained by the classic YOLO v5 and their proposed algorithm. [PERSON] et al. [28] applied YOLO v3 for detection of the small traffic signs. They proposed a new detection scheme--MAS_YOLOv3 for detection in real time. Measured detection speed of the algorithm they presented was 23.81 frames per second (FPS) and mean average precision (mAP) was 86%. YOLO algorithm in general was presented by [PERSON] et al. in [29]. This algorithm, based on convolutional neural networks, has received a new version year after year. Already YOLO v2 was able to detect over 9000 different objects and had higher speed and precision than the first version [30]. The current version of YOLO is v5. YOLO is characterized by exceptional speed, and compared to other state of the art algorithms, this is definitely a comparative advantage. With newer versions, the accuracy is significantly improved compared to the original version of the algorithm.  
In a broader sense, convolutional neural networks, as well as deep neural networks, belong to artificial neural networks and are associated with the term artificial intelligence. CNNs consist of one or more convolutional layers and optionally one or more fully connected layers [31].  
The algorithm that will be described in this paper, used for the purpose of detecting signals on railways, employs YOLO v5. This algorithm is trained to recognize the green light next to the track on which the train is currently moving and which is relevant for the train. The convolutional neural network is trained with input images of 1920 \(\times\) 1080 pixels. To save time and computer resources, the training was performed through Google Colab using graphical processing unit (GPU). Three custom datasets were used consisting of about 150, 500, and 1000 relevant images. The images were labeled with objects of interest (signals, and contact line masts) for the railway environment. The YOLO algorithm uses the Darknet as a framework, which was compiled using graphics cards. Training of a network with dataset of 150 images lasted 3 h 46 min, training of a network with dataset of 500 images lasted about 7.5 h, while training of a network of with dataset of 1000 images lasted around 12 h. Unlike classical neural networks, which are fully connected, CNNs are characterized by a larger number of layers for detecting the essential features of the input data. CNNs usually work with 2D structures, while in recent times they have shown good results with 3D structures. The output is characterized by the appearance of bounding boxes around the detected objects. Above each bounding box is the name of the class and the percentage value by which the algorithm tells us how certain it is that what is inside the bounding box really belongs to that class.  
Figure 6: Hough transform. (**a**) Initial set of the parameters. (**b**) Adjusted set of the parameters.