Detecting Rail Surface Contaminants Using a Combined Short-Time Fourier Transform and Convolutional Neural Network Approach
Abstract
1. Introduction
2. Materials and Methods
2.1. Test Rig
2.1.1. Testbed
2.1.2. Data Acquisition System
2.2. Experiment
2.2.1. Contaminants and Their Application
2.2.2. Application of Contaminants
2.2.3. The Experiments
2.3. Data Processing
2.3.1. Processing Steps
- Two 0.5-s samples were carefully collected from each train run. These samples were specifically selected when the train had already reached and was maintaining its maximum speed. This ensures that the captured data reflect stable operating conditions and are representative of train performance at its optimal state.
- Once the samples were obtained, they were processed using the Short-Time Fourier Transform (STFT). This technique is essential for analyzing the frequency variation of a signal over time, which is crucial for identifying patterns and features in the sample data that might not be evident in the pure time domain. STFT enables spectrographic representation of data.
- To improve the model’s robustness and generalization capabilities, a data augmentation strategy was implemented. Data augmentation helps prevent overfitting and the training of a model that exhibits greater resilience to data variability.
- A 2D CNN was used to analyze and classify the extracted features. CNNs are particularly effective at processing data with a grid structure, such as the spectrographic representations generated by the STFT. The 2D architecture allows the network to identify complex spatial and temporal patterns in the data, which is essential for accurate classification.
2.3.2. Short-Time Fourier Transform (STFT)
2.3.3. Data Augmentation
- Frequency Masking: A frequency band is randomly hidden. In this case, a 10 Hz band was used.
- Time Masking: A time segment is randomly hidden. In this case, a width of 15 was used, corresponding to 15 ms.
2.3.4. 2D Convolutional Neural Network (CNN) Architecture
- Next is Batch Normalization, which normalizes the activations from the previous layer to speed up training and improve stability.
- Data Augmentation Layers. The Freq Mask and Time Mask layers, described above, are only activated during training.
- The Convolutional Block 1 starts with a Conv2D layer (32 filters, 3 × 3 kernel, ReLU activation), followed by MaxPooling2D (2 × 2 window) to reduce dimensionality and complexity. Finally, Dropout (25%) prevents overfitting, promoting robust features.
- The Convolutional Block 2 uses a Conv2D layer (64 filters, 3 × 3 kernel, ReLU) to extract features. Then, MaxPooling2D (2 × 2 window) reduces dimensionality and improves robustness. Finally, Dropout (25%) prevents overfitting, forcing the network to learn diverse representations.
- The third convolutional block of the neural network includes a Conv2D layer with 128 3 × 3 filters and ReLU activation, followed by a 2 × 2 MaxPooling2D layer to reduce dimensionality and a 25% Dropout layer to prevent overfitting.
- Finally, the classifier uses a Flatten layer to convert the two-dimensional feature maps into a one-dimensional vector. This is followed by a Dense layer of 128 neurons with ReLU activation. To prevent overfitting, it incorporates a 50% Dropout layer. The output layer is another Dense layer with four neurons and Softmax activation, which generates a probability distribution for the classes.
- The first Block starts with 32 filters, optimized to capture low-level features.
- The second Block increases to 64 filters, allowing the detection of medium-complexity patterns.
- The third Block culminates with 128 filters, focused on the identification of high-level patterns and more abstract semantic representations.
2.3.5. Model of CNN for a Single Input Channel (Monochannel)
2.3.6. CNN Multichannel
2.3.7. CNN Training Process
2.3.8. Data Division and Preparation
- The data were divided into a training set (75%, 120 files) and a test set (25%, 40 files).
- Before splitting, the entire data set was randomly shuffled to avoid any bias introduced by the order of data collection. A fixed seed was used to ensure the split was always the same, allowing for reproducible results.
- The split was performed in a stratified manner. This ensures that the proportion of samples from each class (Water, Oil, Sand, Clean) is identical in both the training and test sets. This is a crucial step for small or unbalanced datasets.
- During the model training process, performance was monitored at each epoch. To achieve this, the test data set was used as the validation set. This practice allows us to visualize how the model generalizes to the data in real time, which in turn facilitates early detection of overfitting.
2.3.9. Model Evaluation Metrics
3. Results
Improving the CNN Mono-Channel Model
4. Discussion
4.1. Single-Channel CNN Model Discussion
4.2. Multi-Channel CNN Model Discussion
5. Conclusions
Limitations of the Study and Future Work Prospects
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Rahaman, M.L.; Bernal, E.; Spiryagin, M.; Bosomworth, C.; Sneath, B.; Wu, Q.; Cole, C.; McSweeney, T. An investigation into the effect of slip rate on the traction coefficient behaviour with a laboratory replication of a locomotive wheel rolling/sliding along a railway track. Tribol. Int. 2023, 187, 108773. [Google Scholar] [CrossRef]
- Zhao, Y.; Liang, B.; Iwnicki, S. Friction coefficient estimation using an unscented Kalman filter. Veh. Syst. Dyn. 2014, 52, 220–234. [Google Scholar] [CrossRef]
- Zirek, A.; Onat, A. A novel anti-slip control approach for railway vehicles with traction based on adhesion estimation with swarm intelligence. Railw. Eng. Sci. 2020, 28, 346–364. [Google Scholar] [CrossRef]
- Wu, B.; Xiao, G.; An, B.; Wu, T.; Shen, Q. Numerical study of wheel/rail dynamic interactions for high-speed rail vehicles under low adhesion conditions during traction. Eng. Fail. Anal. 2022, 137, 106266. [Google Scholar] [CrossRef]
- Wang, Y.; Zhao, Y.; Mao, X.; Yin, S. Impact of Climate Change on the Performance of Permafrost Highway Subgrade Reinforced by Concrete Piles. Future Transp. 2023, 3, 996–1006. [Google Scholar] [CrossRef]
- Al-Maliki, H.; Meierhofer, A.; Trummer, G.; Lewis, R.; Six, K. A new approach for modelling mild and severe wear in wheel-rail contacts. Wear 2021, 476, 203761. [Google Scholar] [CrossRef]
- Moreno, A.G.; López, A.A.; Carrasco García, M.G.; Turias, I.J.; Ruiz Aguilar, J.J. A novel application of computational contact tools on nonlinear finite element analysis to predict ground-borne vibrations generated by trains in ballasted tracks. Modelling 2024, 5, 1454–1468. [Google Scholar] [CrossRef]
- Singh, R.; Shindhe, M.; Rawat, P.; Srivastava, A.; Singh, G.; Verma, R.; Bhutto, J.; Hussein, H. The Effect of Various Contaminants on the Surface Tribological Properties of Rail and Wheel Materials: An Experimental Approach. Coatings 2023, 13, 560. [Google Scholar] [CrossRef]
- Khalladi, A.; Elleuch, K. Tribological Behavior of Wheel–Rail Contact Under Different Contaminants Using Pin-On-Disk Methodology. J. Tribol.-Trans. ASME 2017, 139, 011102. [Google Scholar] [CrossRef]
- Zani, N.; Petrogalli, C.; Battini, D. Optimizing Railway Tribology: A Systematic Review and Predictive Modeling of Twin-Disc Testing Parameters. Lubricants 2024, 12, 382. [Google Scholar] [CrossRef]
- Zhu, Y.; Yang, H.; Wang, W. Twin-disc tests of iron oxides in dry and wet wheel–rail contacts. Proc. Inst. Mech. Eng. Part F J. Rail Rapid Transit 2016, 230, 1066–1076. [Google Scholar] [CrossRef]
- Olofsson, U.; Lyu, Y.; Zhu, Y. Mapping the friction between railway wheels and rails focusing on environmental conditions. Wear 2015, 324, 122–128. [Google Scholar] [CrossRef]
- Zhu, Y.; Olofsson, U.; Nilsson, R. A field test study of leaf contamination on railhead surfaces. Proc. Inst. Mech. Eng. Part F J. Rail Rapid Transit 2014, 228, 71–84. [Google Scholar] [CrossRef]
- Gallardo-Hernández, E.; Lewis, R. Twin disc assessment of wheel/rail adhesion. Wear 2008, 265, 1309–1316. [Google Scholar] [CrossRef]
- Valena, M.; Omasta, M.; Kvarda, D.; Galas, R.; Křupka, I.; Hartl, M. An approach for the creep-curve assessment using a new rail tribometer. Tribol. Int. 2023, 191, 109153. [Google Scholar] [CrossRef]
- Harmon, M.; Santa, J.; Jaramillo, J.; Toro, A.; Beagles, A.; Lewis, R. Evaluation of the coefficient of friction of rail in the field and laboratory using several devices. Tribol.-Mater. Surf. Interfaces 2020, 14, 119–129. [Google Scholar] [CrossRef]
- Krishnan, J.; Yang, Z.; Li, Z. Wheel/Rail Adhesion and Coefficient of Friction Measurement using Downscaled Test Rig. In Proceedings of the Sixth International Conference on Railway Technology, Prague, Czech Republic, 1–5 September 2024; Civil-Comp Press: Edinburgh, UK, 2024. [Google Scholar] [CrossRef]
- Morin, X.; Olsson, N.O.; Lau, A. Managerial challenges in implementing European rail traffic management system, remote train control, and automatic train operation: A literature review. Future Transp. 2024, 4, 1350–1369. [Google Scholar] [CrossRef]
- Yin, N.; Yang, P.; Liu, S.; Pan, S.; Zhang, Z. AI for tribology: Present and future. Friction 2024, 12, 1060–1097. [Google Scholar] [CrossRef]
- Zhao, Y.; Shen, L.; Jiang, Z.; Zhang, B.; Liu, G.; Shu, Y.; Peng, B. Real-time wheel–rail friction coefficient estimation and its application. Veh. Syst. Dyn. 2023, 61, 2598–2612. [Google Scholar] [CrossRef]
- Onat, A.; Voltr, P.; Lata, M. A new friction condition identification approach for wheel–rail interface. Int. J. Rail Transp. 2017, 5, 127–144. [Google Scholar] [CrossRef]
- Wang, L.; Zhao, X.; Wu, J.; Xie, Y.; Zhang, Y. Motor Fault Diagnosis Based on Short-time Fourier Transform and Convolutional Neural Network. Chin. J. Mech. Eng. 2017, 30, 1357–1368. [Google Scholar] [CrossRef]
- Iqbal, M.; Madan, A. CNC Machine-Bearing Fault Detection Based on Convolutional Neural Network Using Vibration and Acoustic Signal. J. Vib. Eng. Technol. 2022, 10, 1613–1621. [Google Scholar] [CrossRef]
- Zhang, Q.; Deng, L. An Intelligent Fault Diagnosis Method of Rolling Bearings Based on Short-Time Fourier Transform and Convolutional Neural Network. J. Fail. Anal. Prev. 2023, 23, 795–811. [Google Scholar] [CrossRef]
- Pham, M.; Kim, J.; Kim, C. Accurate Bearing Fault Diagnosis under Variable Shaft Speed using Convolutional Neural Networks and Vibration Spectrogram. Appl. Sci. 2020, 10, 6385. [Google Scholar] [CrossRef]
- Jung, H.; Choi, S.; Lee, B. Rotor Fault Diagnosis Method Using CNN-Based Transfer Learning with 2D Sound Spectrogram Analysis. Electronics 2023, 12, 480. [Google Scholar] [CrossRef]
- Tong, R.; Xu, Z.; Qu, H.; Jiang, K. Kernel Based Open CNN Algorithm for Known and Unknown Fault Diagnosis of Train Traction Motor. In Proceedings of the 2024 Global Reliability and Prognostics and Health Management Conference (PHM-Beijing), Beijing, China, 1–13 October 2024; IEEE: New York, NY, USA, 2024; pp. 1–7. [Google Scholar]
- Bu, Q.; Lyu, P.; Sun, R.; Jing, J.; Lyu, Z.; Hou, S. Fault Diagnosis Method Using CNN-Attention-LSTM for AC/DC Microgrid. Modelling 2025, 6, 107. [Google Scholar] [CrossRef]
- Gonzalez-Jorge, H.; Ríos-Otero, E.; Aldao, E.; Balvís, E.; Veiga-López, F.; Fontenla-Carrera, G. Rail Maintenance, Sensor Systems and Digitalization: A Comprehensive Review. Future Transp. 2025, 5, 83. [Google Scholar] [CrossRef]
- Hurtado-Hurtado, G.; Morales-Velazquez, L.; Otremba, F.; Jáuregui-Correa, J.C. Railcar Dynamic Response during Braking Maneuvers Based on Frequency Analysis. Appl. Sci. 2023, 13, 4132. [Google Scholar] [CrossRef]
- Khan, A.; Sohail, A.; Zahoora, U.; Qureshi, A. A survey of the recent architectures of deep convolutional neural networks. Artif. Intell. Rev. 2019, 53, 5455–5516. [Google Scholar] [CrossRef]














| Physical Feature | Parameter | Value |
|---|---|---|
| Mass | Total mass | 4.4 kg |
| Traction bogie | 1.0 kg | |
| Towed bogie | 0.64 kg | |
| Vehicle body | 2.76 kg | |
| Dimensions | Total length | 506 mm |
| Total height | 100 mm | |
| Total width | 120 mm | |
| Wheel radius | 23 mm | |
| Suspension | Secondary | 5.82 N/mm |
| Center of mass | Measured from reference frame | x: 42 mm |
| y: 0 mm | ||
| z: 62 mm |
| Component | Feature |
|---|---|
| Accelerometer | 3-axis, MEMS sensor, model LSM6DS3, 4G |
| Gyroscope | 3-axis, MEMS sensor, model LSM6DS3, 143°/s |
| Optical sensor | IR sensor, model TCRT5000 |
| Rotary encoder | 600 ppr, model DC5-24V 600. |
| Control card | DUA, Spartan 3. |
| Bluetooth | Bluetooth UART RS232, model HC-05. |
| Current sensor | Hall Effect, Model ACS712 |
| LiPo battery | 4000 mAh, 14.8 V |
| Servomotor | Pololu 37D with gearmotor, 12 V, 5.5 A, 12 W DC motor. The gear ratio is 19:1 with a maximum speed of 530 RPM and a torque of 0.83 N·m. |
| Servomotor driver | H-bridge, model L298N, 2 A, 30 V |
| Order of Application | Contaminant | Coefficient of Friction |
|---|---|---|
| 1 | Clean rail | 0.25 |
| 2 | Water | 0.1 |
| 3 | Oil | 0.01 |
| 4 | Sand | 0.5 |
| Parameter | Configuration/Value | Description |
|---|---|---|
| Optimizer | Adam | This optimization algorithm is efficient and adaptively adjusts the learning rate for each parameter. |
| Learning Rate | 0.001 | Robust and commonly used initial value for the Adam optimizer. |
| Number of Epochs | 50 | The model was trained for 50 full passes through the entire training dataset. |
| Batch Size | 16 | The model updates its weights after processing 16 spectrograms. |
| Loss Function | cross-entropy | It is best suited for multiclass classification problems with integer labels |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Hurtado-Hurtado, G.; Sandoval-Valencia, T.E.; Morales-Velázquez, L.; Jáuregui-Correa, J.C. Detecting Rail Surface Contaminants Using a Combined Short-Time Fourier Transform and Convolutional Neural Network Approach. Modelling 2026, 7, 35. https://doi.org/10.3390/modelling7010035
Hurtado-Hurtado G, Sandoval-Valencia TE, Morales-Velázquez L, Jáuregui-Correa JC. Detecting Rail Surface Contaminants Using a Combined Short-Time Fourier Transform and Convolutional Neural Network Approach. Modelling. 2026; 7(1):35. https://doi.org/10.3390/modelling7010035
Chicago/Turabian StyleHurtado-Hurtado, Gerardo, Tania Elizabeth Sandoval-Valencia, Luis Morales-Velázquez, and Juan Carlos Jáuregui-Correa. 2026. "Detecting Rail Surface Contaminants Using a Combined Short-Time Fourier Transform and Convolutional Neural Network Approach" Modelling 7, no. 1: 35. https://doi.org/10.3390/modelling7010035
APA StyleHurtado-Hurtado, G., Sandoval-Valencia, T. E., Morales-Velázquez, L., & Jáuregui-Correa, J. C. (2026). Detecting Rail Surface Contaminants Using a Combined Short-Time Fourier Transform and Convolutional Neural Network Approach. Modelling, 7(1), 35. https://doi.org/10.3390/modelling7010035

