## 1 Introduction  
As an important component of railway tracks, the rail withstands long-term pressure from train wheels and external environmental effects, leading to problems such as defects and material degradation, causing safety hazards for railway transportation [1]. The timely and efficient detection of early minor defects in the rail surface is of great significance for improving safety and preventing accidents in railway transportation. Due to advantages such a high detection sensitivity, simple detection device structure, rapid detection speed, and non-contact detection, magnetic flux leakage (MFL) detection is frequently used for the non-destructive detection of surface defects in ferromagnetic materials, such as rails and steel pipes [2]. The MFL detection principle and the coordinates used in this article are shown in Figure 1. The detection probe moves above the rail, which is partially magnetized by the external magnetic field. When the rail surface is flat and undamaged, the magnetic lines will be constrained inside the rail, as Figure 1a shows. If a defect is in the rail surface or subsurface, as Figure 1b shows, due to the magnetic permeability of ferromagnetic materials being greater than that of air, some magnetic lines refract at the interface between the rail and air, creating a leakage magnetic field in the external space near the defect [3]. The defect can be detected by picking up the leakage magnetic field signal near the rail surface using a sensor. This article takes the filtering of the MFL detection signal in the x-direction as an example as an introduction. Early defects are often small, and the excitation magnetic field should not be too strong to prevent the rail from being permanently magnetized. So, the MFL signal is often weak and interfered with by various noise sources. The vertical distance from the sensor or yoke to the rail is called lift-off. When the probe moves, the lift-off of the sensor or yoke will change due to vehicle vibration, which will interfere with detection. Vibration noise is the strongest interference during detections. In addition, there are other interferences, such as system noise, noise caused by velocity effect, random interference, etc. [4]. High background noise and low signal-to-noise ratio (SNR) bring difficulties for subsequent defect assessment. Therefore, signal filtering is required. With the proposal and improvement of various filtering algorithms, many methods have been applied to filter MFL signals. [PERSON]. [5] proposed the method of wavelet transform (WT). For MFL signal processing, the algorithm improvements in WT are often made by modifying soft and hard thresholds, wavelet coefficients, and other methods, or combined with median filtering, adaptive filtering, and other methods to achieve better filtering results. For example, [PERSON] et al. [6] combined WT with adaptive filtering to filter the MFL signal of seamless steel pipes. The method has advantages such as adaptability and a fast convergence speed. [PERSON] [7] proposed a multi-level filtering method that combined median and wavelet filtering to improve the MFL detection accuracy. The experimental results show that the method has a good filtering effect. [PERSON] et al. [8] proposed a filtering method based on the wavelet packet and threshold algorithm for signals of crack defects in oil and gas pipelines. The high-frequency wavelet coefficients were organized into a tree structure, and the wavelet coefficient tree was trimmed by setting a threshold to suppress high-frequency noise while ensuring the  
Figure 1: The magnetic flux leakage (MFL) detection. (**a**) No defect in the rail surface. (**b**) A defect in the rail surface. integrity of the high-frequency signal. [PERSON] et al. [9] compared the filtering performance of improved wavelet packets processed using a hard, soft, and fuzzy threshold, and finally applied the fuzzy threshold to achieve MFL signal filtering. [PERSON] et al. [10] proposed empirical mode decomposition (EMD).