Final_major_report(1)
Final_major_report(1)
Belagavi – 590018
A Project Report on
CERTIFICATE
Certified that the project work entitled “TRACK VISION- REAL TIME OBSTRUCTION
TRACKING AND PEDESTRIAN ALERT SYSTEM” is a bonfide work carried out by
1.
2.
ACKNOWLEDGEMENT
We are very grateful to our guide Mrs. Shreekshitha, Assistant Professor,
Department of Information Science and Engineering, who has been a great mentor
and guide at all times. The project wouldn’t have been a success without her help.
We also express our heartfelt gratitude to our Principal Dr. Shrinivasa Mayya D. for
his kind co-operation and encouragement which helped us in the completion of this
project.
We would like to place on record our gratitude to our Management for providing a
wonderful academic atmosphere.
We would like to thank all the Teaching and Non-Teaching staff for their help
during the course of the project.
Lastly, we would like to thank our Parents for their moral support and our Friends
with whom we shared our day-to-day experiences and received lots of suggestions that
improved our quality of work
-DHANUSH(4SN20IS006)
-T VAISHNAV(4SN20IS018)
-YAJNESH J KULAL(4SN20IS020)
ABSTRACT
The advancement of computer vision and deep learning technologies has ushered in a new era of
innovation by entering the railway industry. Traditional train control systems rely on fixed infrastructure
and human operators, which can be inflexible and prone to errors. A new age technological solution for
problems faced in efficient railway transportation is in need that also safeguards the passenger’s life.
One such approach is this project that helps ai assisted driving of passenger trains using computer vision
along with deep-learning for efficient decision makings and prevent negligence of loco-pilot resulting in
life risks. This project contains the design, implementation, and testing of a robust system that can detect
obstacles on the track, pedestrians crossing the track and effective decision-making system that can
decide any collision or pedestrian accidents enabling loco pilots to make informed decisions about when
and where to apply emergency breaks etc. The integration of computer vision technology enables real-
time data acquisition, and deep learning algorithms empower trains to adapt to dynamic and complex
environments. Improved safety, reduced human error, increased operational efficiency, and enhanced
scheduling flexibility are some of the key advantages. While exploring the applications of AI in the field
of railways this approach can subsequently help the railway authorities to enable the existing safety
system “Kavach” and implement it to safeguard citizens at risk.
TABLE OF CONTENTS
CHAPTER TITLE PAGE
No No
1 INTRODUCTION 1-4
1.1 Problem Statement 2
1.2 Proposed Solution 2
1.3 Scope Of The Project 3
1.4 System Requirements 3
2 LITERATURE SURVEY 5-9
2.1 Computer Vision And Image Processing: A Paper 5
Review
2.2 Yolov4: Optimal Speed And Accuracy Of Object 5
Detection
2.3 A Computer Vision System For Detection And 6
Avoidance For Automotive Vehicles
2.4 Computer Vision Based Obstacle Identification 6
Using Real-Time Illumination Sensor Data
2.5 Development Of Computer Vision Based Obstacle 6
Detection And Human Tracking On Smart
Wheelchair For Disabled Patient
2.6 Application Of Computer Vision And Deep 7
Learning In The Railway Domain For
Autonomous Train Stop Operation
2.7 Iot Based Vehicle Tracking And Monitoring 7
System Using Gps And Gsm
2.8 Automatic Obstacle Detection Method For The 7
Train Based On Deep Learning
2.9 An Intelligent Depth-Based Obstacle Detection 8
System For Visually-Impaired Aid Applications
2.10 Object Detection Using Deep Learning, CNNs 8
And Vision Transformers: A Review
3 SYSTEM DESIGN 10-16
3.1 Use case diagram 10
3.2 Sequence diagram 11
3.3 Data flow diagram 13
3.4 Activity diagram 14
4 IMPLEMENTATION 17-27
4.1 Visual Studio Code 17
4.2 Convolutional Neural Network 18
4.3 TensorFlow and Keras 19
4.4 Matplotlib 19
4.5 OpenCV 20
4.6 Pseudo codes 21
4.6.1 Pseudo code for Image Classification 21
1. Pseudo code for Data Preparation 21
2. Pseudo code for load and preprocess data 22
3. Pseudo code for Model Development 23
4. Pseudo Code for Model Evaluation 24
5. Pseudo code for Model Deployment 24
4.7 Algorithms 25
4.7.1 Algorithm for Data Preparation 25
4.7.2 Algorithm for Load and Preprocess Data 25
4.7.3 Algorithm for Model Development 26
4.7.4 Algorithm for Model Evaluation 26
4.7.5 Algorithm for Model Deployment 27
5 SYSTEM TESTING 28-33
5.1 Testing objective 28
5.2 Testing levels 29
5.2.1 Unit testing 29
5.2.2 Integration testing 29
5.2.3 System testing 30
5.2.4 Acceptance testing 30
5.3 Testing methods 30
5.3.1 Black box testing 30
5.3.2 White box testing 31
5.4 Test cases 32
6 SCREENSHOTS 34-38
6.1 Convolutional Neural Network Graph 34
6.2 Obstacle Detected 35
6.3 No Obstacle Detected 36
6.4 Training Data-Clear Track 37
6.5 Training Data-Obstacles in Tracks 37
CONCLUSION 39
REFERENCES
LIST OF FIGURES
FIGURE NO FIGURE NAME PAGE NO
3.1 Use case diagram for system and user 10
3.2 Sequence diagram for user and System 12
3.3 Data flow diagram for Real time object and 13
pedestrian detection
3.4 Activity diagram for storing details 15
5.1 Object Detection Image 32
5.2 No Object Detection Image 32
5.3 Edge Case Detection Image 33
6.1 Convolutional Neural Network Graph 34
6.2 Obstacle Detection 35
6.3 No Obstacle Detected 36
6.4 Training Data-clear Tracks 37
6.5 Training Data-Obstacles in Track 37
CHAPTER 1
INTRODUCTION
Track Vision- Real Time Obstruction Tracking And Pedestrian Alert System Introduction
Chapter 1
INTRODUCTION
The railway industry is undergoing a transformative shift propelled by the integration of
computer vision and deep learning technologies. Traditional train control systems reliant
on fixed infrastructure and human operators often encounter limitations, including
inflexibility and susceptibility to errors. To address these challenges and ensure both
efficient transportation and passenger safety, there's a pressing need for innovative
technological solutions. The advancement of computer vision and deep learning
technologies has ushered in a new era of innovation by entering the railway industry.
Traditional train control systems rely on fixed infrastructure and human operators, which
can be prone to errors.
A new age technological solution for problems faced in efficient railway transportation is
in need that also safeguards the passenger’s life. This project contains the design,
implementation, and testing of a robust system that can detect obstacles on the track,
pedestrians crossing the track and effective decision-making system that can decide any
collision or pedestrian accidents enabling loco pilots to make informed decisions about
when and where to apply emergency breaks. Leveraging computer vision and deep
learning technologies, this project endeavors to enhance decision-making capabilities,
mitigating the risk of accidents due to negligence or unforeseen obstacles on the tracks.
The project entails the design, implementation, and rigorous testing of a robust system
capable of detecting track obstacles and pedestrians, thereby enabling an AI-driven
decision-making process. By empowering train operators with real-time information and
insights, the system aims to prevent collisions and pedestrian accidents
2. Data Acquisition and Processing: Implement mechanisms for real-time data acquisition
from sensors, cameras, and other relevant sources along the railway track. Develop data
processing pipelines to analyze and interpret the acquired data system, integrating
computer vision-based object detection and deep learning-based decision-making
components.
4. Deep Learning Models: Develop deep learning models, including convolutional neural
networks (CNNs) and recurrent neural networks (RNNs), for decision-making. Train and
fine-tune these models to take decisions based on detected objects analyzing the dynamic
environment.
5. Scalability and Integration: Design the system to be scalable and adaptable for
integration into existing railway infrastructure. Plan for a phased deployment approach to
accommodate different rail networks.
6. Testing and Validation: Conduct extensive testing, including simulations and real-
world testing, to validate the system's performance, accuracy, and safety. Continuously
monitor and improve the system's capabilities
Chapter 2
LITERATURE SURVEY
Literature survey is the documentation of a comprehensive review of the published and unpublished
work from secondary sources data in the areas of specific interest to the researcher. It is important
for gathering the secondary data for the research which might be proved very helpful in the research.
The literature survey can be conducted for several reasons. The literature review can be in any area
of the business. Below are the few papers referred.
combine some of them to achieve state-of-the-art results: 43.5% AP (65.7% AP50) for the MS
COCO dataset at a real time speed of ∼65 FPS on Tesla V100.
compared to linear regression which is 2.508 cm. The average accuracy of human guide detecting
algorithm also showed acceptable result, which yield over 80% of accuracy.
system and lacks the extra equipment to perceive the environment. To further enhance the efficiency
and safety of the widely deployed fully automatic operation (FAO) systems of the train, this study
proposes an intelligent obstacle detection system based on deep learning. It collects perceptual
information from industrial cameras and light detection and ranging (LiDAR), and mainly
implements the functionality including rail region detection, obstacle detection, and visual–LiDAR
fusion. Specifically, the first two parts adopt deep convolutional neural network (CNN) algorithms
for semantic segmentation and object detection to pixel-wisely identify the rail track area ahead and
detect the potential obstacles on the rail track, respectively. The visual–LiDAR fusion part
integrates the visual data with the LiDAR data to achieve environmental perception for all weather
conditions. It can also determine the geometric relationship between the rail track and obstacles to
decide whether to trigger a warning alarm. Experimental results show that the system proposed in
this study has strong performance and robustness. The system perception rate (precision) is
99.994% and the recall rate reaches 100%. The system, applied to the metro Hong Kong Tsuen Wan
line, effectively improves the safety of urban rail train operation.
underlying concepts behind these methods. We classify these methods into three main groups:
anchor-based, anchor-free, and transformer-based detectors. Those approaches are distinct in the
way they identify objects in the image. We discuss the insights behind these algorithms and
experimental analyses to compare quality metrics, speed/accuracy tradeoffs, and training
methodologies. The survey compares the major convolutional neural networks for object detection.
It also covers the strengths and limitations of each object detector model and draws significant
conclusions. We provide simple graphical illustrations summarising the development of object
detection methods under deep learning. Finally, we identify where future research will be
conducted.
Chapter 3
SYSTEM DESIGN
3.1 Use case diagram
A use case diagram in software development illustrates how users interact with a system to
accomplish tasks. It comprises actors (users or external systems), use cases (system
functionalities), and their connections. This visual representation clarifies the relationships
between actors and use cases, aiding in understanding system behavior. By providing a
structured overview, it facilitates collaboration and ensures the system meets user
requirements. In essence, use case diagrams are essential for capturing and conveying
system functionality, promoting collaboration, and user satisfaction.
• System: The system is depicted as a rectangle.
• Actor: Each actor is shown as a stick man.
• Use case: Each use case is shown as a solid bordered oval labeled with the
name of the use case.
1) Initialization
a) Set up system parameters, such as camera settings and detection thresholds.
b) Initialize necessary variables and data structures.
2) Live Video Capture
i) Continuously capture live video from a camera (e.g., mounted on a vehicle or
surveillance system).
ii) The video frames serve as input for subsequent processing.
3) Data Stream Task
i) Process the live video frames to create a continuous data stream.
ii) This involves tasks like frame extraction, noise reduction, and feature
extraction.
iii) The resulting data stream contains relevant information about the
environment.
Figure 3.3: Data flow diagram for Real time object and pedestrian detection
Department of ISE, SIT, Mangaluru Page 13
Track Vision- Real Time Obstruction Tracking and Pedestrian Alert System System Design
• Activity: Represents specific actions or operations within the system, which could
be tasks, processes, or operations occurring sequentially or concurrently.
• Transition: Signifies the flow of control from one activity to another, typically
depicted as an arrow indicating the direction of flow. Transitions may have
conditions or triggers determining their activation.
• Initial Node: Marks the starting point of the activity diagram, representing the
initial state or the process's beginning.
• Final Node: Marks the ending point of the activity diagram, indicating the final
state or completion of the process.
• Decision Node: Also known as a branching point, it represents a decision point
within the process where the flow of control can follow different paths based on
certain conditions.
• Merge Node: Merges multiple control paths into a single path, symbolizing the
convergence of different flows within the process.
• Fork Node: Splits the flow of control into multiple concurrent paths, representing
parallel or concurrent execution of activities.
• Join Node: Synchronizes multiple concurrent control paths into a single path,
representing the point where concurrent activities converge back into a single
flow.
• Action Flow: Illustrates transitions from one action state to another, usually
depicted with an arrowed line, also known as edges or paths.
• After training, the model is evaluated and tested to see how well it performs. This
involves running the model on a separate set of test images that were not used
during training to assess its accuracy and ability to generalize.
• The model's performance is measured in terms of success or failure rate. This step
involves calculating metrics such as accuracy, precision, recall, and F1 score to
quantify the model's effectiveness.
• The overall accuracy of the model is calculated, combining the results from
various evaluations to give a comprehensive performance metric.
• The final step involves using the model's accuracy to trigger an LED blink. This
could be an indicator of the model's success, where the LED blinks based on the
accuracy threshold met by the model. For instance, a certain number of blinks
might indicate a high accuracy, while fewer blinks might indicate a lower
accuracy.
Chapter 4
IMPLEMENTATION
During system implementation, the theoretical design is realized into a functional system
using Visual Studio Code as the development environment. This system incorporates
advanced machine learning models like CNN. Whether it replaces manual processes,
automates existing systems, or introduces modifications, this implementation maximizes
Visual Studio Code's flexibility alongside the powerful capabilities of these algorithms.
• Free and Open Source: Available for free and its source code is accessible on
GitHub under the MIT License.
layer with sigmoid activation provides a probability indicating the input image's
likelihood of belonging to one of two classes.
On the contrary, Keras serves as a high-level neural networks API built on top of
TensorFlow (as well as other deep learning frameworks like Theano and Microsoft
Cognitive Toolkit). Keras presents users with a user-friendly and intuitive interface for
model construction, fostering rapid prototyping and experimentation. It furnishes a uniform
and straightforward API for defining neural networks, catering to both novices and
seasoned deep learning practitioners.
4.4 Matplotlib
Matplotlib is a comprehensive data visualization library in Python that enables users to
create high-quality plots, charts, and graphs to visualize their data effectively. Developed
by John D. Hunter in 2003, Matplotlib has since become one of the most widely used
plotting libraries in the Python ecosystem. It provides a flexible and intuitive interface for
generating a wide variety of plots, ranging from simple line plots and scatter plots to
complex 3D plots and interactive visualizations. Matplotlib is designed to work seamlessly
with other Python libraries such as NumPy and pandas, making it a versatile tool for data
analysis and exploration.
One of the key features of Matplotlib is its extensive customization options, allowing
users to tailor every aspect of their plots to suit their specific needs and preferences. Users
can customize the appearance of plot elements such as colors, line styles, markers, fonts,
and annotations, as well as adjust the layout and formatting of the plot axes and labels.
Matplotlib also supports the creation of multi-panel plots, enabling users to visualize
multiple datasets or plots side by side for comparison or analysis.
Matplotlib offers a wide range of plot types and styles to accommodate various data
visualization requirements. In addition to basic 2D plots like line plots, scatter plots, and
bar charts, Matplotlib supports advanced plot types such as histograms, heatmaps, contour
plots, box plots, violin plots, and more. Furthermore, Matplotlib provides support for
creating interactive plots using tools like zooming, panning, and tooltips, as well as saving
plots in various file formats including PNG, PDF, SVG, and EPS. Overall, Matplotlib
provides a powerful and flexible platform for creating publication-quality visualizations for
both exploratory data analysis and presentation purposes, making it an essential tool for
data scientists, researchers, and analysts.
4.5 OpenCV
OpenCV (Open Source Computer Vision Library) stands as a cornerstone in the field of
computer vision, offering an extensive suite of tools and functionalities for image and
video analysis. Initially developed by Intel in 1999, OpenCV has evolved into a
collaborative effort driven by a global community of developers, researchers, and
enthusiasts. Its open-source nature fosters innovation and facilitates the development of
cutting-edge computer vision applications across a myriad of domains. With support for
multiple programming languages including C++, Python, Java, and MATLAB, OpenCV
caters to a diverse audience, enabling developers to harness its capabilities irrespective of
their preferred programming environment.
At its core, OpenCV empowers developers to tackle a wide range of image and video
processing tasks with ease and efficiency. From basic operations such as resizing and
Department of ISE, SIT, Mangaluru Page 20
Track Vision- Real Time Obstruction Tracking and Pedestrian Alert System Implementation
cropping to more advanced functionalities like object detection, feature extraction, and
camera calibration, OpenCV provides a comprehensive toolkit for transforming raw
visual data into meaningful insights. Moreover, its integration with machine learning
frameworks such as TensorFlow and PyTorch opens up avenues for developing custom
models and algorithms, further expanding its utility and versatility.
OpenCV's impact extends far beyond academia and research, finding applications in
real-world scenarios across various industries. In automotive, OpenCV plays a pivotal
role in autonomous vehicles, enabling tasks such as lane detection, pedestrian detection,
and obstacle avoidance. In healthcare, it aids in medical image analysis for diagnosis and
treatment planning. In surveillance and security, OpenCV facilitates video analytics for
monitoring and threat detection. Its broad adoption and continuous development make
OpenCV a vital tool for driving innovation and advancing the frontier of computer vision
technology.
CALL plt.show()
CALL fig = plt.figure()
CALL plt.plot(hist.history['accuracy'], color='teal', label='accuracy')
SET fig.suptitle('Accuracy', fontsize=20)
CALL plt.legend(loc='upper left')
CALL plt.show()
4.7 Algorithms
4.7.1 Algorithm for Data Preparation
Step 1: Import Libraries
- Import necessary libraries for file handling, image processing, data visualization, and
deep learning.
- Check each image for valid file extensions (e.g., jpeg, jpg, bmp, png).
- Scale image pixel values to the range 0-1 for better model performance.
- Divide the dataset into training, validation, and testing sets based on specified ratios.
- Add dense (fully connected) layers, with a final output layer suitable for classification
(e.g., sigmoid for binary classification).
- Compile the model with an optimizer (e.g., adam), a loss function (e.g., binary
crossentropy for binary classification), and evaluation metrics (e.g., accuracy).
- Use validation data to monitor the training process and prevent overfitting (e.g., through
early stopping or callbacks).
- Plot training and validation loss and accuracy over epochs to visualize model
performance.
Chapter 5
SYSTEM TESTING
Software testing is an essential procedure that evaluates the accuracy, comprehensiveness,
security, and overall excellence of computer software. It entails methodically running the
program or application to detect errors or flaws, ensuring it adheres to predetermined
specifications. Because quality is subjective and varies among stakeholders, testing
cannot guarantee flawless software but offers a crucial comparison against expectations.
Testing serves as the primary stage in detecting errors, relying heavily on the
quality of test cases. Since code is the sole executable product, testing serves as the
frontline for identifying remaining errors from earlier phases. Testers execute the program
with a set of test cases and assess its output against anticipated behavior to ascertain if the
software operates as intended.
Unit testing marks the outset of the testing process in software development, during
which developers scrutinize individual components or units of the software separately.
The aim is to validate that each unit operates accurately in line with its planned design.
Usually, developers conduct unit testing, utilizing dedicated tools and frameworks to
automate procedures. Through examining each unit autonomously, developers can detect
any potential issues at an early stage, thus bolstering the dependability and effectiveness
of the overall software system.
Acceptance testing represents the final validation step before software deployment,
focusing on verifying that the software meets user requirements and supports business
objectives. Its primary aim is to determine whether the software meets the predefined
acceptance criteria set by stakeholders. This testing phase typically involves end-users,
clients, or other key stakeholders who evaluate the software's functionality, usability, and
overall suitability for their needs. By actively engaging these stakeholders, acceptance
testing ensures that the software aligns with their expectations and business requirements.
Any discrepancies or issues identified during acceptance testing are resolved before the
final deployment, guaranteeing that the software meets quality standards and provides
value to its users.
This method is particularly valuable for assessing the system from an end-user
standpoint, focusing on how the software functions and behaves without needing insight
into its internal workings. Black box testing empowers testers to uncover defects, errors,
or inconsistencies in the system's behavior without being influenced by its underlying
codebase. It fosters thorough testing of all potential inputs and pathways through the
system, ensuring the software meets its functional requirements and delivers a satisfactory
user experience.
This approach provides insights into the system's internal behavior, enabling testers
to formulate tests that target critical areas of the codebase and verify its accuracy and
resilience. Through techniques such as statement coverage, branch coverage, and path
coverage, white box testing offers a deeper understanding of the software's execution flow
and assists in pinpointing potential areas for optimization or enhancement. By integrating
white box testing with other testing methodologies, organizations can attain extensive test
coverage and guarantee the reliability and integrity of their software systems.
Output: Success
Test case 2:
Given input: Image containing no obstacles being placed on the track
Test case 3:
Given input: Image containing obstacles placed on the edge of the track and edge of the
video frame
Output: Failure, fluctuating output between obstacles detected and no obstacles detected
Chapter 6
SCREENSHOTS
6.1 Convolutional Neural Network Graph
Figure 6.2 presents the output from the "obstacleDetection" program, which has
successfully identified an obstacle on a set of toy train tracks. This output illustrates the
system's proficiency in detecting obstructions in real-time, a crucial feature for
applications where safety and collision prevention are paramount. The image highlights
the system's capability to recognize and signal the presence of obstacles in the trajectory
of a moving object, such as a train. This functionality demonstrates the potential of the
system to significantly enhance safety operations across various sectors, including
transportation and robotics. In automated systems, where precise and dependable
detection mechanisms are necessary for safe navigation, this technology proves especially
beneficial. By ensuring accurate and timely identification of obstructions, the system
supports the seamless operation of autonomous vehicles and robotic systems, mitigating
risks associated with collisions and improving overall safety.
Figure 6.5 training data for obstacle detection on railway tracks, we create synthetic
images representing various scenarios. These images include railway tracks, backgrounds
and strategically placed obstacles (debris, animals, structures, people, and vehicles).
Annotations indicate the obstacle type and location. Data augmentation techniques
enhance diversity by varying orientation, scale, and introducing realistic imperfections.
This comprehensive dataset enables machine learning models to learn and accurately
detect obstacles, ensuring safety and efficiency in rail transport systems.
CONCLUSION
The development of an AI-assisted obstruction tracking and pedestrian alert system for
the Indian railway system represents a significant advancement in railway safety and
efficiency. By leveraging computer vision and deep learning technologies, this project
addresses critical challenges faced by traditional train control systems, such as
inflexibility and human error. The integration of real-time data acquisition, accurate
object detection, and robust decision-making models ensures that train operators are
equipped with timely and precise information to prevent collisions and accidents. The
scalability and adaptability of the system further enhance its potential for widespread
implementation across various railway networks. Through rigorous testing and
continuous improvement, this innovative solution promises to transform the railway
industry, providing safer and more reliable transportation for passengers and goods.
2. Bochkovskiy, A., Wang, C. Y., & Liao, H. Y. M. (2020). Yolov4: Optimal speed and accuracy
of object detection. arXiv preprint arXiv:2004.10934.
3. A. Alam and Z. A. Jaffery,” A computer vision system for detection and avoidance for
automotive vehicles,” 2015 Annual IEEE India Conference(INDICON), New Delhi, India, 2015,
pp. 1-6, doi: 10.1109/INDI- CON.2015.7443366.
4. Ghosh, P. K. Kundu and G. Sarkar,” Computer Vision based Obstacle Identification using Real-
Time Illumination Sensor Data,” 2021 IEEE Second International Conference on Control,
Measurement and Instrumentation (CMI), Kolkata, India, 2021, pp. 190-195,
doi:10.1109/CMI50323.2021.9362734.
5. F. Utaminingrum et al.,” Development of computer vision based obstacle detection and human
tracking on smart wheelchair for disabled patient,” 2017 5th International Symposium on
Computational and Business Intelligence (ISCBI), Dubai, United Arab Emirates, 2017, pp. 1-5,
doi: 10.1109/ISCBI.2017.8053533.
8. Zhang, Qiang Yan, Fei Song, Weina Wang, Rui Li, Gen. (2023). Automatic Obstacle Detection
Method for the Train Based on Deep Learning. Sustainability. 15. 1184. 10.3390/su15021184.
10. A. B. Amjoud and M. Amrouch,” Object Detection Using Deep Learn- ing, CNNs and Vision
Transformers: A Review,” in IEEE Access, vol. 11, pp. 35479-35516, 2023, doi:
10.1109/ACCESS.2023.3266093.