An Automatic Fault Recognition Method for Side Frame Key in TFDS

: Trouble of moving Freight car Detection System (TFDS) constitutes an important part of the railway safety warning systems. With TFDS, dynamic images of freight cars are captured by high-speed cameras, timely transmitted to the train inspection center by special optical fiber network and finally observed for fault recognition. In this paper, an automatic fault recognition method for side frame key in TFDS is proposed based on open source computer vision library (OpenCV) to overcome the disadvantages of manual fault recognition. At first, image preprocessing and segmentation are applied to eliminate the impact of the surrounding environment and further simplify images. Then the axle and through-hole are calibrated through Hough circle transformation and the side frame key is located indirectly according to the geometric relationship among the axle, through-hole and side frame key. Finally, the difference of mean gray values in the region of interest (ROI) is analyzed to judge whether the side frame key is missing or not. Featured by the high efficiency, reliability and practicability, the proposed method lays the foundation for engineering applications in automatic fault recognition of freight cars.


INTRODUCTION
In recent years, with steady and robust economic development, the railway as the main artery of national economy has undergone leapfrog development.Along with the increase of high-speed railways, the trains change into those of high speed, heavy loads and large density as well, which puts forward higher requirements for safe operation of trains.Therefore, a stable, accurate and efficient fault detection method is of great importance.At present, traditional manual fault detection is mainly applied in train inspection in China.However, manual fault detection is easily affected by many inevitable factors, such as the weather, occupational level and fatigue degree of the workers.Since traditional manual fault detection fails to meet the higher requirements for train operation safety, Trouble of moving Freight car Detection System (TFDS) takes aim at eliminating uncertain factors in manual fault detection [1].With TFDS, fault detection is accomplished automatically by computers or man-machines, thus the efficiency and reliability of fault recognition are greatly improved.TFDS plays an important role in improving train inspection quality, railway running safety and transport efficiency [2].
Nowadays there is still limited research on automatic fault detection in TFDS, though image processing has been widely applied in all aspects of human life and work.Chinese researchers mainly focus on fault detection for bolster snubber springs and heart-shaped plate bolts in TFDS.Zhou et al. [3] extracted Harr features of bolster snubber springs from sample images, adopted AdaBoost algorithm to train the classifier and finally achieved good results in detecting the fault of bolster snubber springs.While in other countries, train inspection modes are different and the high-speed imaging and non-destructive testing technology has been widely applied to safety monitoring [4][5][6].Velastin et al. [7] presented a safety warning system for the subway station based on dynamic image detection, which freed the workers from simultaneously observing hundreds of cameras and carelessly missing the faults due to slow reaction.Kim et al. [8] extracted the shaded regions of brake shoes and wheels, and fitted the boundaries of brake shoes and wheels with the constraint curve.Three parameters, namely the thickness of brake shoes, uneven wear and the distance of wheels, were measured for the automatic vision detection of brake shoes.However, this method was limited by the accuracy of boundary extraction.
As one of the key components of freight cars, the side frame key is used to ensure wheel sets and bogies do not separate and reduce the damages when the derailment happens.Important as the side frame key is, it is one of the most easily lost components of freight cars and it is difficult to calibrate its position directly due to its small size.In this paper, an automatic fault recognition method is proposed to calibrate the side frame key indirectly and judge whether the side frame key is missing or not, meanwhile it is proved to be highly effective and reliable, providing some reference for automatic recognition of other faults of freight cars.

AUTOMATIC FAULT DETECTION SCHEME FOR SIDE FRAME KEY
Effective fault detection for the side frame key in TFDS is very important, and the automatic fault detection scheme for the side frame key is as illustrated in Fig. (1).
Firstly, the images captured by TFDS, as shown in Fig. (2a, d), are preprocessed to eliminate the impact of the surrounding environment and noise, and image segmentation is applied to highlight the outlines of the region of interest (ROI).Then, Hough circle transformation is adopted to determine the position of the axle and through-hole, so the side frame key is located indirectly according to the geometric relationship among the axle, through-hole and side frame key.Finally, the difference of mean gray values in the ROI is analyzed to judge whether the side frame key is missing or not.

Image Pre-Processing
As CCD high-speed digital cameras in TFDS work in field, the gray values of images captured by these cameras are easily affected by many environmental factors such as the weather and illumination intensity.Besides, the resonance of the cameras and the train may cause noise in real-time detection.Due to the adverse effects of noise on image segmentation, the noise must be firstly eliminated.There are many typical methods to eliminate the noise in images, such as the median filter and the mean filter [9].
The median filter is a kind of non-linear spatial filter and it has a good denoising capability for most random noise.In particular, fuzzy edges caused by the median filter are less than those caused by the mean filter of the same size.Hence, the median filter is selected to eliminate the noise, and the denoising effect is shown in Fig. (2b, e).

Image Segmentation
Image segmentation is a critical step between image preprocessing and image analysis, and it is conducive to the further image processing.The parallel region technology is adopted for threshold segmentation, which can extract the grayscale differences between the target and the background and then divide the image into the ROI and the background according to different grayscales [10].The binary images produced by threshold segmentation are characterized by simple content, less data and simplified calculation.Nonoverlapping regions in the binary images can be defined with closed or connected boundaries and the ROI can be determined with highlighted outlines.
As Images obtained by TFDS may contain over and under exposure ones, the mean gray value of every image is selected as the adaptive threshold to segment the respective image.Fig. (2c, f) show the binary images without and with the fault of side frame key, respectively.By comparing the binary images, it can be found that a white region, similar to a triangle, is located at the position of the side frame key in Fig. (2c) but the white region doesn't exist in Fig. (2f).Therefore, after threshold segmentation, the approximately triangular white region at the location of the side frame key can be a key to judging whether the side frame key is missing or not.

CALIBRATION OF THE AXLE, THROUGH-HOLE AND SIDE FRAME KEY
Since the images in TFDS are captured from different angles and the side frame key is pretty small, it is difficult to calibrate the side frame key directly.Instead, the axle and through-hole are quite large and can be easily detected.Therefore, an indirect method for calibration of the side frame key is proposed according to the geometric relationship among the axle, through-hole and the side frame key.

Calibration of The Axle and Through-Hole
As is mentioned above, edge contours of images are particularly evident after image preprocessing and segmentation.Since the edge contours of the axle and through-hole must be circular, all the circular contours in the processed image can be detected and the centers of these circles can be determined through Hough circle transformation.The image resolution is 1400 by 1024, and each pixel represents 1.2353 mm.By defining the contour characteristics of the axle and through-hole, unnecessary circular contours are excluded and then the axle and throughhole are calibrated.The algorithm process is as shown in Fig. (

3).
Firstly, all the circular contours can be detected by Hough circle transformation after image segmentation.The experiment reveals that the radius of the axle R falls within the interval [120, 150] and the radius of through-hole R falls within the interval [20,40].Therefore, all the circles whose radii fall within the intervals [20, 40] or [120, 150] can be saved as candidate circles.And the structure named Circle is defined to store the No., coordinate of center and radius of candidate circles.
Once the radius of a circle falls within the intervals of [20,40] or [120, 150], a structure Circle will be created dynamically to store the key information of the circle.Subsequently, these candidate circles will be extracted and compared with each other.If the center distance of two circles d is within the interval [m+n, 2(m+n)], where m and n represent the radii of two circles respectively, the two circles will be defined as a pair.Then the angle θ between the centerline of two circles and the horizontal direction can be calculated.If 0 ≤ θ ≤ 5°, it can be concluded that the large circle is the axle and the small circle is throughhole.Therefore, the calibration of two reference circles of the axle and through-hole is eventually completed.The result is as shown in Fig. (4).

Calibration of The Side Frame Key
It can be seen from Fig. ( 4) that the side frame key is located between the axle and through-hole and is usually at the lower right side of the axle.For convenience and accurate calibration of the side frame key, a mathematical model is built according to the geometric relationship among the axle, through-hole and side frame key, as is shown in Fig. (5).where p 2 (x 2 , y 2 ) and p 1 (x 1 , y 1 ) denote the coordinates of two centers of the large and small circles respectively; m represents the radius of the large circle; d is the center distance between the large and small circles.
It is assumed that p(x, y) is the tangent point of the outer tangent line made from the center of the small circle to the large circle.In this model, a binary quadratic equation set is formed.
For the right triangle △pp 1 p 2 : For the right triangle △qpp 2 : Subtract equation (3) from equation ( 2), and Define two variables, and Substitute equations ( 5) and ( 6) into equation ( 4), and x = B − ky (7) Substitute equation ( 7) into equation ( 3), and a quadratic equation is obtained: Since the tangent point is always below both centers of the large and small circles, Equation ( 8) can be solved with the formula method and the unique root y which meets the conditions in formula ( 9) is obtained.When the root y is substituted into equation ( 7), the coordinate x can be calculated.Finally the coordinates of the tangent point p(x, y) can be accurately worked out.
Since the tangent point is close to the location of side frame key, the tangent point can be considered as the base point to determine the rectangular ROI.The size of the ROI is proportional to the pixel dimensions, and the side frame key contained in the ROI is positioned indirectly [11].

ROI GRAYSCALE ANALYSIS
After the calibration of the axle, through-hole and side frame key, the fault of side frame key can be judged according to the grayscales in the ROI.After image segmentation, gray values of the resultant images fall into only two categories: 0 and 255.To simplify the calculation, mean gray value in the ROI is selected as the only feature to analyze and judge the fault of side frame key.

Table 1. The comparison of mean gray values in ROI
between images with and without the fault of side frame key.

Types of Images Mean Gray Values
Image without the fault of side frame key More than 80 Image with the fault of side frame key Less than 10 As is shown in Table 1, after a lot of experiments and studies, it is found that in the image without the fault of side frame key, the side frame key region looks white, which indicates the gray values in ROI is mostly 255 and mean gray value is more than 80, but in the image with the fault of side frame key, the side frame key region appears black, which means the gray value in ROI is mostly 0 and mean gray value is less than 10.Since there is great difference in mean gray values of ROI between the images with and without the fault of side frame key, a reasonable threshold on mean gray value of ROI can be selected to accurately determine whether the side frame key is missing or not.If mean gray value of ROI is more than 80, it can be concluded that the fault of side frame key doesn't exist.However, if mean gray value of ROI is less than 80 and especially is close to 10, the fault of side frame key does exist.
As OpenCV library provides a wealth of programming functions for real-time computer vision and has the advantages of cross-platform, portability and high efficiency [12], an automatic recognition program has been carried out with the proposed method and OpenCV library, and the fault recognition rate is over 95%.

CONCLUSION
In this paper, an automatic fault recognition method is proposed for the side frame key in TFDS.Firstly, the median filter is used to eliminate the noise in the images captured by high-speed cameras, and image segmentation is to highlight the outlines of ROI.Then Hough circle transformation is applied to calibrate the axle and through-hole with the large and small radii, and the side frame key is calibrated indirectly according to the geometric relationship among the axle, through-hole and side frame key.Finally, the difference in mean gray values of ROI is analyzed to judge whether the side frame key is missing or not.An automatic recognition program based on OpenCV is performed to detect the fault of side frame key in TFDS and the result shows that the proposed method is simple, effective and reliable, which lays the foundation for engineering applications in automatic fault recognition of freight cars.

Fig
Fig. (6a, b) show two different forms of the axle and through-hole of freight cars and the tangent point is calibrated as the upper right and upper left endpoint of the rectangular ROI, respectively.The length and height of the rectangular ROI are respectively a half and one-third of the center distance between the axle and through-hole, so the endpoint can be determined with the tangent point and the dimensions of ROI.The calibration result is as shown in Fig.

( 6 )
and the region where side frame key should be is marked with the green rectangle.

Fig. ( 6 )
Fig. (6).The result of calibration of the side frame key: (a) The axle on the right; (b) The axle on the left.