Gap Measurement Method for Railway Switch Machines Based on the Fusion of Deep Vision and Geometric Features
Abstract
1. Introduction
- A cascaded visual processing workflow consisting of ROI localization and edge perception is constructed to achieve stable key region extraction and edge representation under complex background and illumination disturbance conditions;
- A vision and geometric feature fusion modeling mechanism is designed. By introducing structured geometric descriptors into the regression process, the model gains certain physical constraints during learning, thereby improving fitting stability at the sub-pixel scale;
- The measurement precision, stability, and cross-batch consistency of the method were verified on the constructed dataset and experimental conditions. The results show that the method can reach the expected precision level in the current scenario and maintain relatively stable performance within a certain range.
2. Experimental Acquisition System and Dataset Construction
2.1. Experimental Environment and Data Acquisition
2.2. Dataset Representation and Annotation Protocol
3. Sub-Pixel Measurement Framework Based on the Fusion of Vision and Geometric Residuals
3.1. Improved YOLOv8 Localization Strategy
3.1.1. Staged Curriculum Training Strategy
3.1.2. Confidence-Aware Loss Optimization
3.1.3. Adaptive Threshold Scheduling Mechanism
3.2. ROI Spatial Alignment and Multi-Channel Edge Perception Model
3.2.1. ROI Extraction and Isotropic Affine Alignment
3.2.2. Improved Multi-Channel U-Net Architecture
3.2.3. Pixel-Level and Boundary-Aware Hybrid Loss
3.3. Structured Geometric Feature Extraction Pipeline and Descriptor Construction
3.3.1. Dynamic Calibration of the Physical Scale Factor
3.3.2. Physical Meaning of the 20-Dimensional Geometric Feature Vector
- Central abscissa (): Represents the sub-pixel horizontal position of the edge in the image coordinate system;
- Central ordinate (): Represents the vertical position of the overall edge distribution;
- Orientation angle (): Represents the tilt posture of the edge in space;
- Normal projection width (): The equivalent probability width, representing the overall response intensity and degradation degree of the edge.
3.3.3. Sub-Pixel Geometric Quantity Extraction Algorithm
3.3.4. Local Environmental Statistics and Feature Standardization
3.4. Visual Geometric Fusion Regression and Error Calibration
3.4.1. Dual-Stream Residual Fusion Architecture and Zero-Initialization Constraint
3.4.2. Dynamic Piecewise Weighting and Huber Robust Loss
3.4.3. Long-Tail Boundary Optimization and Piecewise Physical Calibration
4. Experimental Results and Analysis
4.1. Evaluation Metrics
- Mean Absolute Error (MAE): Reflects the overall average degree to which the measured values deviate from the true values, used to measure the system’s measurement accuracy within the global sampling space.
- Root Mean Square Error (RMSE): Due to its higher penalty weight for large outlier errors, this metric is primarily used to evaluate the dispersion of measurement results and the stability of the system.
- Maximum Absolute Error (Max Error): Records the peak error in the testing set. In the stringent scenarios of railway turnout safety monitoring, this metric is a key boundary parameter for measuring the upper limit of the algorithm’s reliability and “worst-case performance”.
- Qualified Rate (QR): Integrating the precision tolerance requirements of railway operation and maintenance, this paper sets an allowable error threshold . If the measurement residual , it is determined to be qualified. This metric directly reflects the feasibility of the algorithm in practical engineering delivery. Its definition is:
4.2. Performance Verification of the Preprocessing Module
4.2.1. ROI Localization Stability Analysis
4.2.2. Quality Assessment of Fine-Grained Edge Extraction
4.3. Core Method Comparison and Sub-Pixel Mechanism Analysis
4.3.1. Quantitative Accuracy Evaluation
4.3.2. Sub-Pixel Advantage and Mapping Consistency Analysis
4.4. Ablation Study of Key Modules
4.5. System Error Analysis and Piecewise Calibration Mechanism
4.5.1. Calibration Protocol and Comparative Evaluation
4.5.2. Prediction Residual Distribution and Mechanism Analysis
4.6. System Robustness and Measurement Reliability Evaluation Under Complex Operating Conditions
5. Discussion
5.1. Computational Overhead and Actual Deployment Evaluation
5.2. Algorithm Generalization Discussion and Cross-Model Transfer Analysis
6. Conclusions and Prospect
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Ristić-Durrant, D.; Franke, M.; Michels, K. A Review of Vision-Based On-Board Obstacle Detection and Distance Estimation in Railways. Sensors 2021, 21, 3452. [Google Scholar] [CrossRef]
- Kisilowski, J.; Kowalik, R. Railroad Turnout Wear Diagnostics. Sensors 2021, 21, 6697. [Google Scholar] [CrossRef] [PubMed]
- Li, C.; Zhao, L. A Railway Turnout Closeness Monitoring Method Based on Switch Gap Images. IEEE Intell. Transp. Syst. Mag. 2022, 14, 214–229. [Google Scholar] [CrossRef]
- Chen, R.; Chen, J.; Wang, P.; Xu, J.; Chen, M.; Wang, J. Impact of wheel profile evolution on wheel-rail dynamic interaction and surface initiated rolling contact fatigue in turnouts. Wear 2019, 438, 203109. [Google Scholar] [CrossRef]
- Chen, J.; Wang, P.; Xu, J.; Wang, J.; Chen, M.; Gao, Y. Simulation of vehicle-turnout coupled dynamics considering the flexibility of wheelsets and turnouts. Veh. Syst. Dyn. 2023, 61, 739–764. [Google Scholar] [CrossRef]
- Wang, P.; Han, L.; Wei, X.; Yang, D.; Si, D.; Zhang, M.; Wang, S.; Jing, G. Assessing Impact of Wheel–Rail Force on Insufficient Displacement of Switch Rail in High-Speed Railway. Lubricants 2025, 13, 497. [Google Scholar] [CrossRef]
- Xiao, Q.; Yang, Y.; Chang, C.; Li, D. Monitoring and Evaluation of High-Speed Railway Turnout Grinding Effect Based on Field Test and Simulation. Appl. Sci. 2023, 13, 9177. [Google Scholar] [CrossRef]
- Wang, Q.; Li, D.; Zeng, J.; Luo, R.; Wu, P. A diagnostic method of freight wagons hunting performance based on wayside hunting detection system. Measurement 2024, 227, 114274. [Google Scholar] [CrossRef]
- Hu, X.; Tang, T.; Tan, L.; Zhang, H. Fault Detection for Point Machines: A Review, Challenges, and Perspectives. Actuators 2023, 12, 391. [Google Scholar] [CrossRef]
- Oh, K.; Yoo, M.; Jin, N.; Ko, J.; Seo, J.; Joo, H.; Ko, M. A Review of Deep Learning Applications for Railway Safety. Appl. Sci. 2022, 12, 10572. [Google Scholar] [CrossRef]
- Umar, M.; Siddique, M.F.; Ullah, N.; Kim, J.-M. Milling Machine Fault Diagnosis Using Acoustic Emission and Hybrid Deep Learning with Feature Optimization. Appl. Sci. 2024, 14, 10404. [Google Scholar] [CrossRef]
- Zheng, Y.; Chen, W.; Zhang, Y.; Bai, D. Prediction of the Remaining Useful Life of a Switch Machine, Based on Multi-Source Data. Sustainability 2022, 14, 14517. [Google Scholar] [CrossRef]
- Hu, X.; Zhang, X.; Wang, Z.; Chen, Y.; Xia, J.; Du, Y.; Li, Y. Railway Switch Machine Fault Diagnosis Considering Sensor Abnormality Scenarios. In Proceedings of the 2023 IEEE 26th International Conference on Intelligent Transportation Systems (ITSC), Bilbao, Spain, 24–27 September 2023; IEEE: New York, NY, USA, 2023; pp. 4834–4839. [Google Scholar]
- Li, W.; Xu, Z.; Mei, M.; Lan, M.; Liu, C.; Gao, X. A Semi-Supervised Adaptive Matrix Machine Approach for Fault Diagnosis in Railway Switch Machine. Sensors 2024, 24, 4402. [Google Scholar] [CrossRef]
- Lei, Y.; Yang, B.; Jiang, X.; Jia, F.; Li, N.; Nandi, A.K. Applications of machine learning to machine fault diagnosis: A review and roadmap. Mech. Syst. Signal Process. 2020, 138, 106587. [Google Scholar] [CrossRef]
- Zheng, Y.; Li, W.; He, G.; Wang, Y.; Cheng, J.; Yang, Y. Mechanism-informed neural network: An interpretable method for gearbox impulsive fault feature extraction. IEEE Internet Things J. 2024, 12, 8992–9003. [Google Scholar] [CrossRef]
- Li, J.; Zhao, B. Leveraging the Object Detection Paradigm for Temporal Signals: A Keypoint-Guided Approach to Stage Analysis for Railway Turnout System. Meas. Sci. Technol. 2026, in press. [Google Scholar] [CrossRef]
- Wang, Z.; Sun, D.; Zhou, J.; Guo, K.; Zhang, J.; Kou, X. Health Monitoring Analysis of an Urban Rail Transit Switch Machine. Sustainability 2024, 16, 3527. [Google Scholar] [CrossRef]
- Feng, Q.; Xiao, S.; Liu, W.; Li, H. Research on Object Detection and Combination Clustering for Railway Switch Machine Gap Detection. Chin. J. Electron. 2025, 34, 186–203. [Google Scholar] [CrossRef]
- He, Y.; He, D.; Lao, Z.; Yao, Z.; Sun, H.; He, C.; Yuan, Z. A Class-Center Fine-Tuning Prototypical Network for Few-Shot Fault Diagnosis of Turnout Switch Machine Driven by Multi-Source Signals. Measurement 2025, 242, 115920. [Google Scholar] [CrossRef]
- Zhuang, Z.; Zhang, G.; Dong, W.; Sun, X.; Wang, C. Intelligent Fault Detection of High-Speed Railway Turnout Based on Hybrid Deep Learning. In AI 2018: Advances in Artificial Intelligence; Mitrovic, T., Xue, B., Li, X., Eds.; Springer: Cham, Switzerland, 2018; Volume 11320, pp. 118–130. [Google Scholar]
- Choi, J.-Y.; Han, J.-M. Deep Learning (Fast R-CNN)-Based Evaluation of Rail Surface Defects. Appl. Sci. 2024, 14, 1874. [Google Scholar] [CrossRef]
- Yan, F.; Gu, Y.; Sun, Y. Deep Learning-Based Train Obstacle Detection Technology: Application and Testing in Metros. Electronics 2025, 14, 1318. [Google Scholar] [CrossRef]
- Kang, S.; Hu, Z.; Liu, L.; Zhang, K.; Cao, Z. Object Detection YOLO Algorithms and Their Industrial Applications: Overview and Comparative Analysis. Electronics 2025, 14, 1104. [Google Scholar] [CrossRef]
- Ali, M.L.; Zhang, Z. The YOLO Framework: A Comprehensive Review of Evolution, Applications, and Benchmarks in Object Detection. Computers 2024, 13, 336. [Google Scholar] [CrossRef]
- Li, A.; Li, D.; Wang, A. A Two-Stage YOLOv5s–U-Net Framework for Defect Localization and Segmentation in Overhead Transmission Lines. Sensors 2025, 25, 2903. [Google Scholar] [CrossRef]
- Zhukov, A.; Rivero, A.; Benois-Pineau, J.; Zemmari, A.; Mosbah, M. A Hybrid System for Defect Detection on Rail Lines through the Fusion of Object and Context Information. Sensors 2024, 24, 1171. [Google Scholar] [CrossRef]
- Yu, C.; Lu, Z. YOLO-VSI: An Improved YOLOv8 Model for Detecting Railway Turnouts Defects in Complex Environments. Comput. Mater. Contin. 2024, 81, 369–389. [Google Scholar] [CrossRef]
- Wei, D.; Zhang, W.; Li, H.; Jiang, Y.; Xian, Y.; Deng, J. RTINet: A Lightweight and High-Performance Railway Turnout Identification Network Based on Semantic Segmentation. Entropy 2024, 26, 878. [Google Scholar] [CrossRef]
- Cabral, R.; Santos, R.; Correia, J.A.F.O.; Ribeiro, D. A Hybrid YOLO and Segment Anything Model Pipeline for Multi-Damage Segmentation in UAV Inspection Imagery. Sensors 2025, 25, 6568. [Google Scholar] [CrossRef]
- Tao, T.; Dong, D.; Huang, S.; Chen, W. Gap Detection of Switch Machines in Complex Environment Based on Object Detection and Image Processing. J. Transp. Eng. Part A Syst. 2020, 146, 04020083. [Google Scholar] [CrossRef]
- Pu, M.; Huang, Y.; Liu, Y.; Guan, Q.; Ling, H. Edter: Edge Detection with Transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), New Orleans, LA, USA, 19–24 June 2022; IEEE: New York, NY, USA, 2022; pp. 1402–1412. [Google Scholar]
- Cheng, B.; Misra, I.; Schwing, A.G.; Kirillov, A.; Girdhar, R. Masked-Attention Mask Transformer for Universal Image Segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), New Orleans, LA, USA, 19–24 June 2022; IEEE: New York, NY, USA, 2022; pp. 1290–1299. [Google Scholar]
- Wang, Y.; Chen, Q.; Ding, M.; Li, J. High Precision Dimensional Measurement with Convolutional Neural Network and Bi-Directional Long Short-Term Memory (LSTM). Sensors 2019, 19, 5302. [Google Scholar] [CrossRef] [PubMed]
- Lv, T.; Sheng, K.; Qiao, L. A Geometry-Driven Quantitative Modeling Framework for Image-Based Human Motion Evaluation: Application to Sub-Pixel Posture Analysis and Feature Attribution. Mathematics 2026, 14, 746. [Google Scholar]
- Nogueira, V.V.E.; Barca, L.F.; Pimenta, T.C. A Cost-Effective Method for Automatically Measuring Mechanical Parts Using Monocular Machine Vision. Sensors 2023, 23, 5994. [Google Scholar] [CrossRef]
- Kong, X.; Yi, J.; Wang, X.; Luo, K.; Hu, J. Full-Field Mode Shape Identification Based on Subpixel Edge Detection and Tracking. Appl. Sci. 2023, 13, 747. [Google Scholar] [CrossRef]
- Wang, Y.; Liang, J.; Xiao, Y.; Liu, X.; Li, J.; Cui, G.; Zhang, Q. Placido Sub-Pixel Edge Detection Algorithm Based on Enhanced Mexican Hat Wavelet Transform and Improved Zernike Moments. J. Imaging 2025, 11, 267. [Google Scholar] [CrossRef] [PubMed]
- Haibing, H.; Zheng, X.; Yin, J.; Wang, Y. Research on O-ring Dimension Measurement Algorithm Based on Cubic Spline Interpolation. Appl. Sci. 2021, 11, 3716. [Google Scholar] [CrossRef]
- He, L.; Tan, J.; Hu, Q.; He, S.; Cai, Q.; Fu, Y.; Tang, S. Non-Contact Measurement of the Surface Displacement of a Slope Based on a Smart Binocular Vision System. Sensors 2018, 18, 2890. [Google Scholar] [CrossRef] [PubMed]
- Hao, Y.; Tang, T.; Gao, C. Train Distance Estimation in Turnout Area Based on Monocular Vision. Sensors 2023, 23, 8778. [Google Scholar] [CrossRef]
- Jocher, G.; Chaurasia, A.; Qiu, J. Ultralytics YOLOv8; Ultralytics: Houston, TX, USA, 2023; Available online: https://github.com/ultralytics/ultralytics (accessed on 18 May 2026).















| Gap Category | Gap Size (mm) | Total Samples | Training Set | Validation Set | Testing Set |
|---|---|---|---|---|---|
| 1 | 0.50 | 108 | 76 | 16 | 16 |
| 2 | 0.95 | 302 | 211 | 45 | 46 |
| 3 | 1.05 | 135 | 95 | 20 | 20 |
| 4 | 1.50 | 111 | 78 | 17 | 16 |
| 5 | 1.75 | 132 | 94 | 19 | 19 |
| 6 | 1.95 | 194 | 136 | 29 | 29 |
| 7 | 2.05 | 208 | 146 | 31 | 31 |
| 8 | 2.50 | 297 | 207 | 44 | 46 |
| 9 | 3.00 | 50 | 36 | 8 | 6 |
| Total | - | 1537 | 1079 | 229 | 229 |
| Parameter Name | Symbol | Stage I | Stage II | Stage III |
|---|---|---|---|---|
| Initial Learning Rate | 0.0001 | 0.0005 | 0.001 | |
| Weight Decay | 0.0005 | 0.0005 | 0.0001 | |
| Confidence Adjustment Coefficient | - | - | 0.5 | |
| Initial Confidence Threshold | - | 0.85 (Fixed) | 0.90 | |
| Terminal Confidence Threshold | - | - | 0.95 |
| Method | Detection Rate | Avg Center Shift (px) | Max Center Shift (px) | Stability Assessment |
|---|---|---|---|---|
| YOLOv8 (Baseline) | 100.0% | 27.07 | 1090.30 | Unstable |
| Ours (Improved) | 100.0% | 7.05 | 21.42 | High Stability |
| Method | S-Dice | S-HD95 (px) | Topological Quality |
|---|---|---|---|
| Canny | 0.0520 | 140.62 | Discontinuous/Noisy |
| U-Net (Baseline) | 0.8478 | 22.62 | Jagged/Artifacts |
| Ours (Improved) | 0.8473 | 19.86 | Smooth/Clean |
| Technical Paradigm | Core Model (Baselines) | MAE (mm) | RMSE (mm) | Max Error (mm) | Qualified Rate (QR < 0.02 mm) |
|---|---|---|---|---|---|
| Traditional | Canny | 2.3149 | 3.1036 | 6.0927 | 0.0% |
| Segmentation | Unet++ | 0.2672 | 0.3232 | 0.6841 | 3.49% |
| DeepLabv3+ | 0.2493 | 0.3051 | 0.6927 | 3.49% | |
| Improved U-Net | 0.2827 | 0.3396 | 0.7367 | 2.6% | |
| Regression | ResNet50 | 0.0136 | 0.0175 | 0.0524 | 77.73% |
| Swin-Transformer | 0.0190 | 0.0238 | 0.0669 | 59.83% | |
| Proposed | Ours G-VFM | 0.0076 | 0.0089 | 0.0193 | 100.0% |
| Model ID | Configuration | MAE (mm) | RMSE (mm) | Max Error (mm) | Relative Improvement (vs. Prev) |
|---|---|---|---|---|---|
| M0 | Baseline (Full Image) | 0.2948 | 0.4526 | 1.8838 | - |
| M1 | +ROI Cropping | 0.0331 | 0.0419 | 0.1085 | +88.8% |
| M2 | +Geometric Residual Fusion | 0.0231 | 0.0308 | 0.1180 | +30.2% |
| M3 | +Piecewise Calibration | 0.0076 | 0.0089 | 0.0193 | +67.1% |
| Calibration Method | Type | MAE (mm) | RMSE (mm) | Max Error (mm) | Safety Check (<0.02 mm) |
|---|---|---|---|---|---|
| M2 (Raw) | Uncalibrated | 0.0231 | 0.0308 | 0.1180 | Fail |
| Global Linear | Parametric | 0.0231 | 0.0308 | 0.1183 | Fail |
| Polynomial (Deg = 3) | Parametric | 0.0235 | 0.0311 | 0.1192 | Fail |
| Isotonic (SOTA) | Non-parametric | 0.0094 | 0.0147 | 0.0836 | Fail |
| Ours M3 (Per-bin) | Physics-aware | 0.0076 | 0.0089 | 0.0193 | Pass |
| Test Condition | Physical Scenario Simulation | MAE (mm) | Max Error (mm) | Qualified Rate (QR < 0.02 mm) |
|---|---|---|---|---|
| Standard (Clean) | Baseline environment | 0.0076 | 0.0193 | 100.0% |
| Sensor Noise | Gaussian thermal noise | 0.0078 | 0.0232 | 99.6% |
| Over-exposure | Strong light/metal reflection | 0.0084 | 0.0292 | 96.1% |
| Low-light | Nighttime/shadows | 0.0100 | 0.0767 | 94.8% |
| Collection Batch (Session) | Sample Count | MAE (mm) | Std. Dev (mm) | Max Error (mm) |
|---|---|---|---|---|
| Session 1 | 57 | 0.0082 | 0.0044 | 0.0164 |
| Session 2 | 25 | 0.0090 | 0.0040 | 0.0166 |
| Session 3 | 56 | 0.0073 | 0.0046 | 0.0177 |
| Session 4 | 42 | 0.0070 | 0.0046 | 0.0193 |
| Session 5 | 24 | 0.0056 | 0.0050 | 0.0164 |
| Session 6 | 25 | 0.0087 | 0.0054 | 0.0162 |
| Overall Statistics | 229 | 0.0076 | -- | 0.0193 |
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
Zhi, W.; Feng, Q.; Xiao, S.; He, X.; Liu, H.; Zou, Y.; Li, H. Gap Measurement Method for Railway Switch Machines Based on the Fusion of Deep Vision and Geometric Features. Sensors 2026, 26, 3280. https://doi.org/10.3390/s26113280
Zhi W, Feng Q, Xiao S, He X, Liu H, Zou Y, Li H. Gap Measurement Method for Railway Switch Machines Based on the Fusion of Deep Vision and Geometric Features. Sensors. 2026; 26(11):3280. https://doi.org/10.3390/s26113280
Chicago/Turabian StyleZhi, Wenxuan, Qingsheng Feng, Shuai Xiao, Xilong He, Haowei Liu, Yiyang Zou, and Hong Li. 2026. "Gap Measurement Method for Railway Switch Machines Based on the Fusion of Deep Vision and Geometric Features" Sensors 26, no. 11: 3280. https://doi.org/10.3390/s26113280
APA StyleZhi, W., Feng, Q., Xiao, S., He, X., Liu, H., Zou, Y., & Li, H. (2026). Gap Measurement Method for Railway Switch Machines Based on the Fusion of Deep Vision and Geometric Features. Sensors, 26(11), 3280. https://doi.org/10.3390/s26113280

