Git Product home page Git Product logo

potholes_detector's Introduction

Pothole Detector Project

Road maintenance is a critical aspect of urban management, directly influencing safety and comfort for all traffic participants. One of the common issues that plague drivers, cyclists, and even pedestrians are potholes. Potholes can cause accidents, damage vehicles, and even impede emergency services. Addressing this issue promptly is essential for a safe and efficient transportation system.

The goal is straightforward and quantifiable: to develop a multi-agents system capable of detecting potholes in real time with a high degree of accuracy and with a sufficiently high processing speed, marking detected potholes as dangerous or relatively safe by their width in the image. This system should be capable of being deployed in a vehicle or roadside monitoring equipment to identify and report the location of potholes to a central database.

To achieve this goal, we need to accomplish several tasks:

  1. Collect and curate a dataset of road images that include various pothole conditions.

  2. Train the YOLOv8 model to recognize and accurately pinpoint potholes in these images.

  3. Develop a FastAPI backend capable of receiving image data from the detection system, processing it, and updating the central database in real-time.

  4. Carry out the necessary testing to ensure that the system is reliable and can work under different lighting and weather conditions.

  5. Show the ability to manage the system via Telegram bot and serve various clients such as other bots, web applications or simple clients connected to the server through a single API.

image

Using a multi-agent system for pothole detection is smart because:

  • It's Faster: Many scouts can check different areas at the same time.

  • It's Scalable: You can start with a few scouts and add more as you need them.

  • It's Flexible: Scouts can be on different vehicles and use different routes every day.

  • It's Robust: If one agent fails, the others will still be able to do their job.

  • It's Efficient: The manager can organize the information and make sure it's used well.

By fulfilling these tasks, we aim to create a tool that not only improves road conditions but also enhances public safety and potentially saves on long-term road maintenance costs.

In each case, these agents work independently but contribute to a central system that collects, analyzes, and responds to the data on potholes, which helps the city fix roads faster and more efficiently. This can lead to safer driving, fewer accidents, and happy citizens.


Use Cases

Here's how and where we could use a multi-agent system for detecting potholes:

  • In City Buses: They travel all around the city every day. Each bus can have a camera that sends pictures to the server when it sees a pothole.

  • In Taxi Fleets: Taxis can have an app that lets drivers report potholes with a button click, and the location is sent to the server.

  • With Delivery Drones: As drones fly overhead, they can take pictures and report back potholes from a bird's eye view.

  • On Garbage Trucks: They cover nearly every street once a week, making them great for scouting potholes.

  • By Common People: Ordinary people can install a simple application on their phones. If they notice a pothole, they can take a picture, and it will immediately go to the server with the geolocation of the place and with all the necessary details in a single database.

  • By Various equipment of Road Services: Vehicles and road maintenance equipment such as wipers and snow plows or dedicated drones can be equipped with cameras and sensors. As they drive through the city to perform their usual maintenance tasks, they can simultaneously detect potholes and report them. This integration improves the efficiency of road services by combining maintenance with pothole detection.

  • By Google Glasses: People wearing Google Glasses or similar augmented reality devices can contribute to pothole detection and be instantly alerted to potential hazards. When a pit is detected, the glasses can automatically capture an image and send it to the server. This method is especially effective in low-light conditions, as glasses can improve visibility, making it easier to detect potholes and report them at night or in poorly lit places, saving people from possible injury.

  • Future Integration in Modern Cars: Looking ahead, modern cars equipped with advanced sensors and cameras can be utilized for pothole detection. These vehicles, especially those with features like heads-up displays, can project signs and information about the road surface, including potholes, directly onto the driver's windshield. This not only contributes to the pothole detection database but also immediately informs drivers about potential road hazards, enhancing safety.


Main Components of FastAPI:

  • Pydantic for Data Handling: It's used for data validation and settings management, which simplifies parsing and validating JSON data.

  • Path Operations: FastAPI uses path operations like GET, POST, PUT, and DELETE, which are essential for building APIs.

  • Dependency Injection System: FastAPI has a powerful, but easy-to-use dependency injection system. It allows you to have reusable dependencies that you can inject into your route functions.

  • Starlette for the Web Layer: This handles all the web interactions - routes, requests, and responses. It's what allows FastAPI to be a fully-functional web framework.

  • Background Tasks: FastAPI allows you to run functions in the background. This is useful for operations that need to happen after returning a response.

  • WebSockets Support: FastAPI also supports WebSockets, which allows for real-time communication between the client and the server.

  • Testing: FastAPI provides easy testing with Pytest, making it simple to check the behavior of your applications.

  • Swagger UI: Swagger UI is a great tool for anyone developing or using an API. It's like an instruction manual and control panel for your API, all in one.

image

Conclusion

When reflecting on a project like the Pothole Detection using YOLOv8 and FastAPI, it's important to consider both the successes and challenges, as well as the insights gained and future plans.

Successful Implementations

  • Effective Pothole Detection: We successfully integrated the YOLOv8 model, enabling accurate and efficient detection of potholes in various road conditions. This was a key achievement, as it forms the core of our project's functionality.

  • User-Friendly Interface: The creation of an intuitive interface through a Telegram bot and a web application was another significant success. These platforms allow users to easily interact with our system, upload images or videos, and receive processed results.

  • Real-Time Processing and Feedback: Implementing FastAPI for real-time image processing and immediate feedback was a crucial aspect we managed to achieve. This ensures that the system operates efficiently and responds quickly to user requests.


Challenges and Unsuccessful Attempts

  • Handling Varied Lighting and Weather Conditions: One of the problems we faced was the inconsistency of the model's characteristics under different lighting and weather conditions. Achieving consistent accuracy in all scenarios remains a work in progress and requires more careful selection of the dataset and image labeling.

  • Scalability Issues: As our user base has grown, we have encountered some scalability issues, especially when processing simultaneous requests for large images and videos, which we intend to eliminate in future updates. At the very beginning, we mentioned that the project provides for scaling and load balancing on multiple servers with an increase in the number of requests.

Insights Gained

  • Importance of Data Quality: The learning curve was steep regarding data quality and diversity. The effectiveness of the model hinges significantly on these factors, shaping our approach towards future data collection and model training processes. Through training YOLOv8 on various datasets, we discovered the profound impact of data quality, quantity, and the balance between different types of objects. Focusing on the single class of 'potholes', we observed that the model's ability to detect typical or specific types of potholes varied based on the dataset composition. For example, skewing the dataset towards images of wet or snow-covered roads altered the model's detection capabilities, clearly demonstrating how the weights in the model training are influenced. We also realized the importance of avoiding unnatural augmentations, such as 180-degree flipped images of vehicles or road surfaces, which can detrimentally affect the model's learning process. The more precise and balanced the image selection and annotation are, the higher the quality of the results and the confidence level of the detections.

  • Importance of API in Progressive Development: The project underscored the significance of using APIs for phased designing and incremental functionality additions, especially after the system becomes operational. In the initial stages, the server could be accessed using simple methods like command-line tools (e.g., curl), basic Python scripts in Google Colab or an IDE, and even through Swagger UI without writing a single line of code. This flexibility proved highly advantageous for team collaboration, system debugging, and developing the client-side of the application.

  • User-Centric Design: User feedback illuminated the crucial role of a user-friendly interface and the necessity for results to be easily comprehensible. This insight has profoundly influenced our design approach and feature implementations, ensuring that the system is not only efficient but also accessible and intuitive for users.

Future Plans and Developments

  • Enhancing Model Robustness: We plan to retrain the model with a more diverse dataset, including images under various environmental conditions, to improve its accuracy and reliability. There is also an idea to use various trained models on highly specialized datasets - in winter with priority on snow-covered roads, in rainy weather. weather with priority on wet asphalt and puddle pits, and we also plan to consider the option of night roads in poor lighting.

  • Scaling the System: To address scalability, we aim to optimize our server infrastructure and explore more efficient data processing techniques. One of the possible options may be effective in sending a short video to the processing model instead of a single image to pre-select a frame with better characteristics and clarity.

  • Expanding Functionality: Future developments include adding additional features to the bot, such as custom alerts when serious potholes are detected, and integration with mapping services for better geographical tracking of road conditions. It is also planned to use additional sensors to measure the depth of potholes on roads.

In summary, while we have achieved key milestones in pothole detection and user interaction, we acknowledge the challenges faced, particularly in model consistency and system scalability. The insights gained from this project are invaluable and will significantly shape our future endeavors to enhance the system's effectiveness and expand its capabilities.

image

Links

potholes_detector's People

Contributors

dmpanf avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

aantonov23

potholes_detector's Issues

Project Final Presentaion

Project Final Presentation ๐ŸŽ“

  • Task Brief: Crafted a comprehensive and engaging final presentation of our project, encapsulating key insights, methodologies, and outcomes. Aimed to effectively communicate our project's significance and findings to an academic audience.
  • Outcome: Delivered a successful presentation, receiving positive feedback and demonstrating a deep understanding of the project topic. ๐ŸŒŸ

Python Templates for API Requests

๐Ÿ Python Templates for API Requests ๐Ÿ’ป

๐Ÿ” Task Brief:
Created a suite of concise Python scripts for seamless interaction with FastAPI. These templates are designed for use in Python IDEs, Google Colab, and via Linux CLI using curl.

๐Ÿ› ๏ธ Key Components:

  • IDE Integration: Scripts tailored for Python IDEs to facilitate easy API calls. ๐Ÿ–ฅ๏ธ
  • Google Colab Compatibility: Ready-to-use notebooks for executing requests in Colab environments. ๐Ÿ““
  • CLI Support: Simplified curl commands for Linux command-line interactions. ๐Ÿ–ฅ๏ธ

๐Ÿš€ Outcome:
Efficient and versatile templates enhancing our FastAPI interaction capabilities across diverse platforms. โœจ

FastAPI Server

๐Ÿš€ FastAPI Server for YOLOv8 Pothole Detection Integration ๐Ÿ•ณ๏ธ

๐ŸŒŸ Overview:
This repository hosts an ultra-efficient ๐Ÿš— FastAPI server designed specifically for integrating with the powerful YOLOv8 model. Our goal is to revolutionize pothole detection on roads, enhancing safety and driving experience. ๐Ÿ›ฃ๏ธ

๐Ÿ” Features:

  • YOLOv8 Integration: Utilizes the cutting-edge YOLOv8 model for real-time, accurate pothole detection.
  • FastAPI Backend: Leverages the speed and scalability of FastAPI, ensuring rapid responses and high concurrency.
  • Real-Time Analysis: Processes live feeds ๐Ÿ“น from road surveillance for immediate pothole identification.
  • RESTful API Design: Easy integration with various frontend technologies and third-party applications.

๐Ÿค– Tech Stack:

  • FastAPI: For building efficient, scalable server-side applications.
  • YOLOv8: The latest in object detection, offering unparalleled accuracy and speed.
  • Python ๐Ÿ: Our primary programming language, ensuring ease of development and maintenance.
  • Docker ๐Ÿณ: For containerization, ensuring consistent environments across deployments.

๐Ÿ› ๏ธ Installation & Usage:

  1. Clone the repository
  2. Set up the environment with Docker
  3. Deploy the FastAPI server
  4. Integrate with your existing road surveillance systems or test with provided sample data

๐Ÿ”— Endpoints:

  • /predict: Real-time pothole detection from image input
  • /models: List of Trained Models based on YOLOv8
  • /status: Health check and server status

๐Ÿค Contributing:
Contributions are welcome! Whether it's feature enhancements, bug fixes, or documentation, feel free to fork this repository and submit your pull requests. Let's make our roads safer, together! ๐ŸŒ

YOLOv8 Dataset Preparation

๐Ÿš€ YOLOv8 Dataset Preparation Guide

Welcome to the YOLOv8 Dataset Preparation Guide! This README provides step-by-step instructions for preparing a new dataset for training with the YOLOv8 model, following the annotation process of the video files! ๐ŸŒŠ

Step 1: Split Video into Frames ๐Ÿ–ผ๏ธ

After annotating all video files, the first step is to split these videos into individual frames.

Requirements:

  • Python
  • OpenCV library (opencv-python)

Instructions:

  1. Install OpenCV if not already installed:

    pip install opencv-python
  2. Use the provided Python script to split videos into frames. The script will save each frame as a PNG file in a specified directory.

Step 2: Rename Files (Optional) ๐Ÿท๏ธ

If required, rename the frames for consistency.

Instructions:

  1. Use the Bash script in the terminal to rename files in desired format.

Step 3: Remove Odd Frames ๐Ÿ—‘๏ธ

To balance or reduce the dataset, you might want to remove odd-numbered frames.

Instructions:

  1. Run the provided Python script to delete all odd-numbered image files from the images directory.

Step 4: Sync Labels with Images ๐Ÿ”„

Ensure that each image in the dataset has a corresponding label file.

Instructions:

  1. Use the Python script to check all files in the labels folder and delete those without a corresponding image file in the images folder.

Step 5: Split Dataset into Train and Validation Sets ๐Ÿš‚๐Ÿ”„

Divide your dataset into training (90%) and validation (10%) sets.

Instructions:

  1. Run the Python script to automatically split all images and labels into train and val directories, ensuring a random and fair distribution.

Step 6: Final Checks and Backup ๐Ÿ”๐Ÿ’พ

Before proceeding with training:

  1. Double-check the dataset for any inconsistencies.
  2. Make sure to backup the dataset.

Conclusion and Next Steps ๐ŸŽฏ

Thus we have successfully prepared dataset for training with YOLOv8. ๐ŸŽ‰

Next steps include setting up YOLOv8 training environment and starting the training process! ๐Ÿค–๐Ÿ’ช

DataSet-2 Images Annotation

๐Ÿ“Œ DataSet-2 Images Annotation Using CVAT ๐ŸŽž๏ธ

๐Ÿ” Task Overview:
This task involves the meticulous annotation of DataSet-2, consisting of segmented video clips, utilizing CVAT (Computer Vision Annotation Tool). Our aim is to ensure high-quality data labeling for enhanced model training. ๐ŸŽฏ

๐Ÿ‘ฅ Team Collaboration & Distributed Workload:

  • Collaborative Annotation: Engaged multiple team members in the annotation process to distribute the workload effectively. ๐Ÿค
  • CVAT Platform: Utilized CVAT for its advanced features and collaborative tools, allowing seamless team coordination. ๐Ÿ’ป
  • Segmented Videos: Focused on carefully annotated segmented video clips to ensure detailed and accurate labeling. ๐ŸŽฌ

๐Ÿš€ Goals & Progress:

  • Quality Assurance: Prioritized high accuracy in annotations to provide reliable data for training sophisticated models. ๐Ÿ“ˆ
  • Efficient Workflow: Established a streamlined workflow for team members to annotate, review, and validate data efficiently. โฑ๏ธ

๐Ÿ“Š Outcome:

  • Successfully annotated a significant portion of DataSet-2 with high accuracy, contributing to the robustness of our training datasets. ๐Ÿ†
  • Documented the annotation process and guidelines for future reference and consistency in team efforts. ๐Ÿ“

YOLOv8 Models on DataSet-1

๐ŸŽฏ YOLOv8 Models on DataSet-1 ๐Ÿ“Š

๐Ÿ” Task Overview:
Successfully implemented and tested YOLOv8 models on DataSet-1, focusing on optimizing accuracy and efficiency in object detection tasks. ๐ŸŽฏ

๐Ÿ”‘ Key Achievements:

  • Model Training: Trained YOLOv8 models using the comprehensive DataSet-1, ensuring robust detection capabilities. ๐Ÿ‹๏ธโ€โ™‚๏ธ
  • Accuracy Improvement: Achieved significant improvements in detection accuracy compared to previous iterations. ๐Ÿ“ˆ
  • Efficiency Optimization: Optimized the model for faster processing without compromising accuracy. โฑ๏ธ
  • Validation: Thoroughly validated the models on a variety of scenarios within DataSet-1. ๐Ÿงช

๐Ÿ“ Results:
Documented detailed results, showcasing the performance enhancement and reliability of the YOLOv8 models on DataSet-1. ๐Ÿ“‘

Project Final Report

Project Final Report ๐Ÿ“„

  • Task Brief: Compiled a detailed final report on our project, covering all aspects from conception to conclusion. The report includes research, development processes, results, and analysis.
  • Outcome: Produced a thorough and well-structured report, showcasing the project's scope and depth, serving as a valuable document for academic evaluation. โœ๏ธ

Project Scope

๐ŸŽฏ Project Scope: Completed โœ…

๐Ÿ” Overview:
This section outlines the successfully completed scope of our project. We've achieved remarkable milestones in developing a state-of-the-art solution that addresses key challenges in our domain. ๐Ÿš€

๐Ÿ‘ท What We Accomplished:

  • Innovative Feature Development: Implemented several groundbreaking features that set our project apart in terms of functionality and user experience. ๐ŸŒŸ
  • Performance Optimization: Significantly enhanced the speed and efficiency of our solution, ensuring it operates smoothly under various conditions. ๐Ÿš„
  • Robust Testing: Conducted comprehensive testing phases, covering all critical aspects of our project to ensure reliability and stability. ๐Ÿ› ๏ธ
  • User-Friendly Design: Focused on user experience, creating an intuitive and accessible interface for all users. ๐Ÿ–Œ๏ธ
  • Documentation and Guides: Prepared detailed documentation and user guides, making it easier for new users and developers to understand and utilize our project. ๐Ÿ“š

๐Ÿ”‘ Key Technologies Used:

  • Detailed the core technologies, frameworks, and tools that played a vital role in the completion of this project. This might include programming languages, software libraries, or specific development tools. ๐Ÿ› ๏ธ

๐Ÿ“ˆ Impact and Metrics:

  • Highlighted the positive impact our project has made, including any measurable improvements, user feedback, or other metrics that reflect the project's success. ๐Ÿ“Š

๐Ÿ“… Timeline:

  • Provided a timeline of the project's development phases, major milestones, and how we adhered to or adapted our initial project schedule. โณ

๐ŸŽ‰ What's Next:

  • Outlined the next steps or potential future developments that could stem from this project. This could include scaling up, adding new features, or exploring related projects. ๐ŸŒฑ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.