GK SOLUTIONS
AI β€’ IoT β€’ Arduino β€’ Projects & Tutorials
DEFEAT THE FEAR

Road Condition Monitoring

No description available

πŸ“Š Difficulty: Intermediate
⏱️ Varies
⭐ 0 stars
🍴 0 forks

πŸ› οΈ Technologies Used

Python Python
# Road Condition Monitoring – AI-Based Pothole Detection This project uses Artificial Intelligence to automatically detect road damages such as potholes from a standard camera feed. Using a YOLO-based deep learning model and OpenCV, the system analyzes each video frame to identify potholes and then generates a professional PDF report with material estimates and repair budget. The entire pipeline runs automatically on a laptop using Python. --- ## Features - YOLO-based pothole detection on road videos (e.g., dashcam footage). - Live detection window showing bounding boxes around potholes. - De-duplication logic so each pothole is counted only once across frames. - Automatic estimation per pothole: - Length and width (approximate) - Sand (kg), Cement (kg), Rocks (kg), Coal Tar (liters) - Individual pothole repair budget - Aggregated β€œMaterials & Cost Summary”: - Total sand, cement, rocks and coal tar required - Total material costs + labour cost - Final estimated repair budget - Professional letter-style PDF report addressed to road authorities. - Automatic email sending of the PDF report via Gmail. --- ## Project Structure (important files) ``` R_C_M/ β”œβ”€β”€ best.pt # Trained YOLO model for pothole detection β”œβ”€β”€ potholes_video.mp4 # Sample input video β”œβ”€β”€ auto_pothole_report.py # Main end-to-end pipeline (detect + report + email) β”œβ”€β”€ .env # Email credentials (not committed to Git) β”œβ”€β”€ venv/ # Python virtual environment (ignored) β”œβ”€β”€ README.md └── ... # Other helper scripts / logs ``` --- ## Requirements - Python 3.10+ - Windows (tested) with VS Code or any IDE - Gmail account with App Password enabled Python packages: ``` ultralytics opencv-python reportlab python-dotenv ``` --- ## Setup Instructions ### 1. Clone the repository ``` git clone https://github.com//road-condition-monitoring.git cd road-condition-monitoring/R_C_M ``` ### 2. Create and activate virtual environment (recommended) ``` python -m venv venv # Windows: venv\Scripts\activate ``` ### 3. Install dependencies ``` pip install ultralytics opencv-python reportlab python-dotenv ``` ### 4. Add your YOLO model and sample video Place the following in the `R_C_M` folder: - `best.pt` – your trained YOLOv8/YOLOv11 pothole detector. - `potholes_video.mp4` – sample road inspection video. ### 5. Create `.env` file for email Create a file named `.env` in `R_C_M` (same folder as `auto_pothole_report.py`): ``` SENDER_EMAIL=your_email@gmail.com GMAIL_APP_PASSWORD=xxxx xxxx xxxx xxxx ``` Use a Gmail **App Password**, not your normal password (from Google Account β†’ Security β†’ 2‑Step Verification β†’ App passwords). ### 6. Configure report details (optional) Open `auto_pothole_report.py` and adjust these variables near the top: ``` VIDEO_PATH = "potholes_video.mp4" MODEL_PATH = "best.pt" GUIDE_EMAIL = "road.authority@example.com" GUIDE_NAME = "Road Authority Officer" ROAD_NAME = "NH-44" AREA_NAME = "Bangalore-Chennai Highway Section" ``` --- ## How to Run (Single Command) From inside the activated virtual environment: ``` cd R_C_M python auto_pothole_report.py ``` The script will: 1. Open a live window showing pothole detections on the video. 2. Automatically de-duplicate detections and estimate materials per pothole. 3. Generate `pothole_detection_report.pdf` in the same folder. 4. Email the PDF report to `GUIDE_EMAIL` using the credentials from `.env`. --- ## Output Report The generated PDF contains: - Formal letter addressed to the specified road authority. - Short description of the inspected road segment. - Table of each pothole with: - ID, length, width, detection accuracy - Sand (kg), cement (kg), rocks (kg), coal tar (liters) - Individual pothole repair budget - β€œMaterials & Cost Summary” table with total quantities and costs. - Final total estimated budget for repairing all detected potholes. ```