## 1 Introduction  
Railway infrastructure is one key aspect of enabling economic success in a country [1]. Moreover, railway services must be highly reliable to attract more passengers and freight from other ways of transportation. Railway switches and crossings (S&Cs), are essential components of railway infrastructure. To be able to make the railway infrastructure reliable, critical components such as the S&C should be reliable because a single failure of it could lead to a large delay and huge economic loss. At the same time, since S&Cs are composed of diverse movable parts and can be regarded as a discontinuous point from the rail geometry point of view, they tend to experience higher failure rates compared with a normal piece of rail [2]. Maintenance for S&Cs is costly with the current application. A previous study performed by [PERSON] et al. [3] stated that S&Cs have occupied more than 24% of the total budget for all the maintenance activities against only 5% of the corresponding track length. In 2018 alone in Sweden, the S&Cs consumed 530 million SEK, which corresponds to around 10% of their whole maintenance budget [4]. S&C failures also cause significant delays in the railway system. Network Rail reports that S&C failures caused 481,719 delay minutes for the British railway network between 2019 and 2020 [5]. Only 5.5% of the total track length is S&Cs in Swedish railway system and caused 14% of all the delays [6]. Without taking proper maintenance actions, such failures could even lead to a fatal accident that would cause not only economic loss but also endanger the passengers and goods. Due to the importance of S&Cs and their high maintenance costs, actions should be taken to prevent failures to happen. One approach to avoid failures is applying a condition-monitoring system to check the status of the S&C, using data analysis to provide early warning before the failure and performing preventive maintenance. There are many methods that can be utilised to inspect the status of S&Cs. One of the most common methods of rail and S&C inspection is applying manual on-site inspections, which means dedicated railway maintenance engineers needed to visit and inspect the rail at fixed intervals. They base their inspection on measuring tools, their vision, experience and insights to detect defects. However, this method is subjective and costly [7]. It sometimes can even put the inspectors in a dangerous situation [8]. Another way of inspecting the rails, including S&Cs, is using a dedicated track recording vehicle (TRV), where different optical sensors, accelerometers and gyro sensors are installed to measure different irregularities of the rails, according to European Standard EN 13848 [9]. This method might not be suitable for dedicated measuring an S&C [10]. It is both expensive and could even cause disruption to scheduled services [11]. Other non-destructive testing (NDT) techniques adopted to evaluate the rail defects include the vision-based techniques, ultrasound measurements, eddy current testing (ECT) systems, accelerometers, etc. [12]  
The vision-based technique is one common method in current rail-defect detection studies [13; 14]. The existing methods can be divided into two groups, namely, traditional image processing and image processing using machine learning. [PERSON] et al. [15] utilised the Otsu algorithm and extracted information about the rail surface. Then fuzzy logic was used to determine the defect types. [PERSON] et al. [16] proposed an extractor to detect rail defects. Recently, with the popularity of deep convolution neural networks (DCNN), many researchers have started to apply deep learning to improve the vision-based techniques. [PERSON] et al. [17] compared the SegNet algorithm with the manual and automatic threshold-segmentation algorithms and the results showed that the performance of the deep learning algorithm was 22.2% higher than manual threshold segmentation and was almost doubled compared with automatic threshold segmentation.