Development of dark field illumination algorithm for railway dip angle detection using machine learning approach
Pakistan ranks 22nd in the world where passengers prefer to travel by train due to its cost and safety but over the past decade, the country has faced several fatal train accidents and it seems to have increased in recent years and it effects the economy of the country. Below are some
2025-06-28 16:26:39 - Adil Khan
Development of dark field illumination algorithm for railway dip angle detection using machine learning approach
Project Area of Specialization Artificial IntelligenceProject SummaryPakistan ranks 22nd in the world where passengers prefer to travel by train due to its cost and safety but over the past decade, the country has faced several fatal train accidents and it seems to have increased in recent years and it effects the economy of the country.
Below are some accidents that happened because of minor failures in which major casualties occurred.
| 1. | On March 7th, 2021: Atleast one person was killed and 30 people were injured, when several coaches of the Lahore-bound Karachi Express derailed at Sanghi railway stations near Rohri. |
| 2. | On October 4, 2019: Atleast two passengers were injured when two bogies of Peshawar-bound Rehman Baba Express derailed at the Taxila Railway Station. |
According to statistics, rail transportation accidents are primarily caused by impediments on the rail, human congestion, vandalism, and signal system failures, but the primary issue with railway analysis is the detection of dip angles in the railway track. If these flaws are not addressed early on, they could lead to derailments, resulting in a significant loss of life and property. The goal of this project is to overcome the cause of derailment in Pakistan by using railway track dip angle detection using image processing based dark field illumination algorithm. Usually dipped angle is created, when ballast replaced from their positions.
Our solution enables real-time identification of railway track. Accuracy of this algorithm will increase at evening and at night. At that time, clear results will be observed. Now a days, the resources we use to monitor the railway track are insufficient, workers in Pakistan manually inspect railway tracks using railway push trollies, and this process is known as "Visual Inspection" so human error is more likely. We will use motorized railway trolley to collect the samples because it has specific speed limit.
We will accurately detect dipped angle by mounting frame on motorized railway trolley which consists of 2 Red Lasers, Camera, GPS module and 12Volts of battery.
Samples are categorized in four stages, namely:
| 1. | Perfect (Non-Defective) |
| 2. | Mild (Defective) |
| 3. | Moderate (Defective) |
| 4. | Severe (Defective) |
We will collect 200 samples of each like 200 samples for Perfect, mild, moderate and severe. We have selected Jetson Nano as processing unit (Controller) because it has high speed and it is CUDA supported. We will develop code on Jetson Nano and perform onboard inspection. GPS will be used to detect the location of dipped angle.
This project is based on Artificial Intelligence. By using ordinary image processing, it is very difficult to diagnose dipped angle because we cannot get the exact view of dipped angle, that’s why we will use the algorithm of Dark Field Illumination using machine learning. Once the model is ready, we will compare human inspection results which our results which we will collect through the proposed optical device.
1.
2.
1.
2.
3.
4.
Project ObjectivesThe aim of this project is to detect the Dipped Angle and its severity using Image Processing Based Dark Field Illumination methodology so that we can mitigate those railways accidents that are caused by the lack of railway track condition monitoring.
Objective 1: To create a novel railway frame that can be mounted on existing railway trolley used by Pakistan Railway and build a railway frame design for the dark field illumination to operate.
Objective 2: To incorporate Dark Field Illumination Algorithm which is used to diagnose the dipped angle and check the severity of the dipped angle.
Objective 3: To validate the product in collaboration with Pakistan Railway so that it can be commercialized.
Objective 4: To cover SDGs.
(SDG 8) When we overcome the cause of dip angle, in this way, we can save many lives and Pakistan’s economic growth will increase.
(SDG 9) As this is novel approach, Pakistan’s industry infrastructure will increase.
(SDG 11) Make cities safe and sustainable, as this project involves investment in public transport.
Frame Design on Fusion 360 software:

Measurements of frame:

Dark Field Illumination: As we pass laser light over dipped angle so that particular area will become bright and its sides appear dark then camera will capture sample images of railway track.

Our Project is based on efficient solution of machine learning that detects damages and faults like dipped angles in railway tracks in real-time.
- We will design a frame on Fusion 360 software and then we will design it on hardware, the parameters of both frames would be same. It would be a metallic frame which will consist of 2 red lasers, GPS module, one camera and 12 volts of battery, in order to diagnose the dipped angle on railway track.
- Illumination source has been selected which is Dark Field Illumination.
- Jetson Nano is selected as processing unit and we will develop machine learning code on Jetson Nano.
- Integrate GPS module on designed frame and integrate that frame on motorized railway trolley then connect it with Jetson Nano in order to process the captured samples of railway surface of track and get the location of dipped angle.
- Supervisory machine learning will be use, apply image processing algorithms of captured samples of railway track, this data will be divided into two parts:
Training Testing - Compare the results of original samples with the samples on which image processing applied and get the final output.
- Now, we will check everything is working properly without any error.
- Write the thesis for this project and handover this designed device to Pakistan’s Railway.
Flow Chart of implementation process of project

| Socio-economic Benefits |
- By implementing this type of monitoring systems in Pakistani Railway tracks, we can prevent the occurrence of disastrous accidents.
- Faster track maintenance due to most efficient detection technique.
- Help to ease the technicians for monitoring the faults.
- It will avoid the human errors.
- This project will avoid accidents which are caused by derailment.
- This device will give the indication before the train reach to the place where dip angle is there and GPS module will be use.
| Industrial Benefits |
- Make railway track system smart.
- Our model will also reduce the labor cost.
- This project is cost efficient.
| Environmental Benefits |
- This project will check the severity of dip angle.
- We will collect the data and give the separate identity to each sample like Perfect, Mild, Moderate, Severe using supervisory machine learning.
- Red Laser will be used to detect the dipped angle because it has high wavelength.
- We will compare the human inspection results with our results which we will collect through the proposed optical device to check the accuracy.
- Image processing algorithm of Dark Field Illumination will be use and it will give the clear picture of dipped angle.
- COCO and YOLO will be used to identify the faults of dipped angle in images because dipped angle is one of the major causes of derailment of train on railway track.
The final product will be in the form of hardware model like frame which consists of Camera, 2 red lasers, and GPS module and it will be installed on inspection vehicle like motorized railway trolley because it has specific speed that fetch the images of the railway track surface using image processing based dark filed illumination algorithm for dipped angle detection. Coding will be on Jetson Nano and we will perform onboard inspection of railway track to collect the samples. Captured footage will be enhanced by using COCO and YOLO, these object image detection techniques will be apply. This technique is based on large scale dataset of objects, it will enhance the efficiency of dipped angle on railway track.
Final Deliverable of the Project HW/SW integrated systemCore Industry TransportationOther Industries Transportation , Others Core Technology Artificial Intelligence(AI)Other Technologies Artificial Intelligence(AI), OthersSustainable Development Goals Decent Work and Economic Growth, Industry, Innovation and Infrastructure, Sustainable Cities and CommunitiesRequired Resources| 1. | Perfect (Non-Defective) |
| 2. | Mild (Defective) |
| 3. | Moderate (Defective) |
| 4. | Severe (Defective) |