Real Time Identification of Railway Track Surface Faults using Canny Edge Detector and 2D Discrete Wavelet Transform

Ali Akbar Shah, Bhawani S. Chowdhry, Tayab D. Memon, Imtiaz H. Kalwar and J. Andrew Ware, “Real Time Identification of Railway Track Surface Faults using Canny Edge Detector and 2D Discrete Wavelet Transform”, Annals of Emerging Technologies in Computing (AETiC), Print ISSN: 2516-0281, Online ISSN: 2516-029X, pp. 53-60, Vol. 4, No. 2, 1st April 2020, Published by International Association of Educators and Researchers (IAER), DOI: 10.33166/AETiC.2020.02.005, Available: http://aetic.theiaer.org/archive/v4/v4n2/p5.html. Research Article


Introduction
Most train accidents are caused by derailments [1] [2] [3]. In 2019, Pakistan alone recorded over a hundred train accidents the majority of which were caused by derailment [4]. While there are many causes of these derailments, most are due to negligence in track condition monitoring [5] [6]. There is, therefore, a need for techniques that can effectively facilitate condition monitoring and hence enable the mitigation of the causes of derailment [6][7] [8]. One common technique involves determining track damage using Inertial Measurement Units (IMUs) [2] [9], mounted on the surface of Track Recording Vehicles [10] [11]. However, the problem with these types of sensors is their unpredictable nature in sensing the noise component as the track gets damaged.
While devices such as accelerometers, ultrasonic, and temperature sensors, can be used for determining track damage they are often slow in processing and can provide inaccurate data [9] [12].
Because of this, several other techniques are being developed such as Fiber Bragg Grating (FBG) and different types of image processing algorithms [13]. As the FBG technique are expensive and require the entire railway system to be renovated [14], its implementation is often not practical, particularly in developing countries, due to budget limitations. Therefore, in this research cost effective image processing algorithms are implemented (mainly for use in developing countries) using the Python programming language.
Various image processing techniques can be implemented for the diagnosis of rail damage, including wavelet transformation. Although such techniques allow for the severity of damage to be determined, they often cannot do so in real-time [15] [16]. Thus, a faster image processing algorithm is required. Various image processing algorithms were tested and it was noted that the most reliable amongst them is the Canny edge detector [17] [18], as it enables the edges of the railway track to be analyzed with almost zero delays [19]. Therefore, in this research a very effective two-stage process has been developed for overcoming this deficiency. Firstly, Canny edge detection was used for identifying track damage. Secondly, images of track where damage was identified were subsequently processed using 2D wavelet transformation. Implementation of this cost effective technique enabled the damage severity of the track to be determined in an accurate and timely fashion. Almost 10,000 different track images were tested, and the effectiveness of the two-stage process was demonstrated.
Images were collected in real-time using a motorized track recording vehicle over a one week time period.

Recent Developments in Railway Condition Monitoring
Railway track condition monitoring using track recording vehicles (TRV) is an important technical challenge. Worldwide, various track recording vehicles are still in development using IMUs and image processing [11]. The information gathered is recorded and the necessary steps are taken as per maintenance precautions [10]. Several parameters are detected and reported in the literature using the acquired acceleration data. Weston et al. used bogie mounted sensors for elaborating the track irregularity [20]. Alfi et al. similarly used onboard measurements for the estimation of the wavelength track irregularities [21]. Track faults are mostly analyzed using car body mounted sensors but most of those track faults are introduced due to track surface flaws such as squats and turn out frogs [22]. These track surface faults such as squat and turn out frog occur mostly due to the sudden brakes and lack of track ballast (the ballast filling under the track) that leads to a dip angle.
The dip angle is a major reason for train derailments. One effective methodology for obtaining optimal results when analyzing dip angle caused by track surface faults is Fiber Bragg Grating (FBG) [14]. The problem with FBG is its cost and fact that it is very hard to install because optical fiber needs to be passed underneath the track [13]. For a developing country, the cost can be unaffordable and hence other techniques need to be explored.
One such technique, involves recent advancements in image processing enabled by APIs such as TensorFlow and OpenCV.

Available Technologies
As most of the information in an image is retained in its grayscale format, which is also quicker to process, the RGB (Red, Green, Blue) image is first converted to grayscale, using Equation 1 [17]: The alteration between the pixels can be observed when using the gradient amplitude obtained using equation 5. Nonzero gradient amplitude is considered as an effective block texture feature.
Therefore, with the variation of gradient amplitude, the noise can be eradicated considering the smaller gradient amplitude as the noise by adjusting the Canny edge detector with a fixed threshold value. As per the research requirement, the threshold value of the gradient amplitude is kept between 0-and 200-pixel values so that valid texture features of the railway track can be retained.

Discrete 2D Wavelet Transformation of an Image
To analyze the severity of the surface damage of the railway track, the image of damage is processed with multilevel two-dimensional discrete wavelet transformation which decomposes the image into two sub bands namely: low frequency and high frequency. Almost all of the edge background details are classified into the high frequency sub band by the wavelet transformation whereas noises and approximated signal are classified into the low frequency sub band. The wavelet expansion [23] is denoted in equation 7.
( ) = ∑ , ∅ , ( ) + ∑ ∑ , , ( ) 7 Projection of the f(t) on the scale space is achieved using equation 7, whereas the decomposition This algorithm can be implemented in the camera module using a specially designed camera frame based on already defined research that includes the application of CAD, neural networks and IOT [24][25][26].

Discrete 2D Wavelet Transformation of an Image
In order to facilitate the real-time aspect of this research, a handheld Track Recording Vehicle was developed to which a camera module (see figure 1) was mounted in such a way that it captured the entire surface width of the track. The camera module was connected using the camera pins of the Raspberry Pi 3 B+ (see figure 2).

Results
The purpose of this real-time monitoring of the rail track using a handheld track recording vehicle is to avoid railway accidents such as derailment. Using an intact railway track, no damage was detected in the Canny edge detection processed image (see figure 3 (a) and (b)).    figure 6, the squat detection demonstrates the area that is most affected by the damage (using the red color, while the white portion represents the unaffected part of the track).

Conclusion
While wavelet transformation performs better than Canny edge detection in terms of determining the severity of track surface damage, it has processing overheads that become a bottleneck in real-time. The results achieved by the use of the Canny edge detector were found to be encouraging in the determination of the track damage having almost zero processing delay. Around 10,000 various track images were tested and the implementation of this algorithm for the damage detection was validated. This algorithm was tested using a live camera feed that was processed using the attached workstation. The damaged tracks after being analyzed by the Canny edge detection algorithm were captured in the form of images which were later processed using the 2D wavelet transformation. The implementation of this technique has resulted in identifying the damage severity of the track.
Further work is being carried out to develop a real-time neural network algorithm for identifying multiple railway track faults.