A full pothole analysis stack that combines segmentation, depth estimation, rule-based logic, and machine learning in a single workflow.
| Resource | Link |
|---|---|
| Live Website (Frontend) | https://web-ui-sage-five.vercel.app |
| Live API (Backend) | https://atharvahonparkhe77-vision-based-pothole-detection-api.hf.space |
| RDD2022 GitHub Repository | https://github.com/sekilab/RoadDamageDetector |
| Pothole-600 Dataset Page | https://sites.google.com/view/pothole-600/dataset |
| Kaggle Pothole Segmentation Dataset | https://www.kaggle.com/datasets/farzadnekouei/pothole-image-segmentation-dataset |
Dataset note: RDD2022 is linked from GitHub (as used in
scripts/convert_rdd2022.py). Pothole-600 is linked from its official dataset page (as used inscripts/convert_pothole600.py).
- 1. What This Project Does
- Quick Access Links
- 2. Current Directory Structure
- 3. How It Works
- 4. First-Time Setup (Detailed)
- 5. Run the Project
- 6. Training and Evaluation
- 7. API Endpoints
- 8. Frontend Overview
- 9. Deployment Overview
- 10. Troubleshooting
This project analyzes road images and estimates pothole severity by combining:
- YOLO-based pothole segmentation
- Depth estimation from monocular images
- Rule-based severity logic
- ML model predictions and comparison reports
- A web dashboard for detection and insights
Typical output includes:
- Pothole-level severity predictions
- Overlay visualizations
- Schematic JSON output
- Model insights from
ml_results/
This README now reflects the directory structure you shared as the active/current project layout.
vyankateshd206-vision-based-pothole-detection/
|-- README.md
|-- api.py
|-- classifier.py
|-- Dockerfile
|-- features.py
|-- inference.py
|-- main.py
|-- ml_classifier.py
|-- PIPELINE.md
|-- report.tex
|-- requirements.txt
|-- road_segment_analysis.py
|-- segmentation.py
|-- test_pipeline.py
|-- .dockerignore
|-- .env.example
|-- depth/
| |-- generate_depth.py
| `-- global_normalize.py
|-- ml_models/
| |-- feature_scaler.pkl
| |-- logistic_regression.pkl
| `-- naive_bayes.pkl
|-- ml_results/
| |-- ablation_study.csv
| |-- classification_report_ensemble.txt
| |-- classification_report_knn.txt
| |-- classification_report_lightgbm.txt
| |-- classification_report_Logistic Regression.txt
| |-- classification_report_mlp.txt
| |-- classification_report_Naive Bayes.txt
| |-- classification_report_Random Forest.txt
| |-- classification_report_SVM.txt
| `-- classification_report_xgboost.txt
|-- model_insights_1/
| |-- code.html
| `-- DESIGN.md
|-- scripts/
| |-- convert_pothole600.py
| |-- convert_rdd2022.py
| |-- dataset_summary.py
| |-- deduplicate.py
| |-- extract_gps.py
| |-- retrain_yolo.py
| |-- verification_report.txt
| `-- verify_dataset.py
|-- web-ui/
| |-- README.md
| |-- eslint.config.js
| |-- index.html
| |-- package.json
| |-- vercel.json
| |-- vite.config.js
| |-- .env.example
| `-- src/
| |-- App.jsx
| |-- index.css
| |-- main.jsx
| |-- mockData.js
| `-- components/
| |-- AccuracyChart.jsx
| |-- ClassifierTable.jsx
| |-- FeatureStrip.jsx
| |-- ImagePanels.jsx
| |-- InsightsHub.jsx
| |-- LoadingSkeleton.jsx
| |-- SeverityBadge.jsx
| `-- UploadPanel.jsx
|-- yolo-segmentation/
| |-- README.md
| `-- road_damage_assessment_app.py
`-- .hf-space-src/
|-- api.py
|-- classifier.py
|-- Dockerfile
|-- features.py
|-- inference.py
|-- requirements.txt
|-- segmentation.py
|-- ml_models/
| |-- feature_scaler.pkl
| |-- logistic_regression.pkl
| `-- naive_bayes.pkl
`-- ml_results/
|-- ablation_study.csv
|-- classification_report_ensemble.txt
|-- classification_report_knn.txt
|-- classification_report_lightgbm.txt
|-- classification_report_Logistic Regression.txt
|-- classification_report_mlp.txt
|-- classification_report_Naive Bayes.txt
|-- classification_report_Random Forest.txt
|-- classification_report_SVM.txt
`-- classification_report_xgboost.txt
flowchart TD
A[Upload road image] --> B[YOLO segmentation]
B --> C[Extract pothole masks]
A --> D[Depth estimation]
C --> E[Feature extraction]
D --> E
E --> F[Rule-based severity]
E --> G[ML model severity]
F --> H[Consensus/result packaging]
G --> H
H --> I[FastAPI response]
I --> J[React UI: Detection + Insights]
segmentation.py- Handles pothole mask extraction from images.
features.py- Computes geometry and depth features used in classification.
classifier.py- Applies rule-based severity logic.
inference.py- Unifies depth estimation + feature extraction + model inference.
api.py- Exposes HTTP endpoints used by the web app.
ml_classifier.py- Training and evaluation pipeline for machine learning models.
Install these first:
- Python 3.10 or newer
- Node.js 18 or newer
- Git
- PowerShell (recommended on Windows)
From project root:
python -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
copy .env.example .envSome runtime assets are not guaranteed to be in this structure by default.
- Depth-Anything-V2 repository
git clone https://github.com/DepthAnything/Depth-Anything-V2.git- Depth checkpoint
Place this file at:
Depth-Anything-V2/checkpoints/depth_anything_v2_vits.pth
- YOLO segmentation weights
Create folder and place your trained model:
mkdir yolo-segmentation\modelRequired file:
yolo-segmentation/model/best.pt
cd web-ui
copy .env.example .env
npm installSet frontend API URL in web-ui/.env:
VITE_API_BASE_URL=http://localhost:8000Use .env in project root (created from .env.example). Typical values:
FRONTEND_ORIGINS=http://localhost:5173,http://127.0.0.1:5173
PORT=8000
UVICORN_RELOAD=falseFrom project root:
python api.pyBackend health check:
Invoke-RestMethod -Uri "http://localhost:8000/healthz" -Method GetFrom web-ui/:
npm run devOpen:
- Frontend: http://localhost:5173
- Backend: http://localhost:8000
python inference.py <path_to_image> --output_dir output --no_showpython main.py <path_to_image> --output_dir output --no_showExpand training workflow
Dataset is not guaranteed to be bundled in this structure. You can:
- place data in your preferred folder
- update dataset paths in training scripts accordingly
python depth/generate_depth.pypython ml_classifier.pypython test_pipeline.pyml_models/for saved artifactsml_results/for reports and study files
Backend health endpoint.
- Input: image file upload (
multipart/form-data, field namefile) - Output: severity decisions, per-pothole information, and visualization payload
Returns insights data consumed by InsightsHub.jsx.
Serves allowed artifacts from ml_results/.
Key frontend entry points:
web-ui/src/App.jsxweb-ui/src/components/UploadPanel.jsxweb-ui/src/components/ImagePanels.jsxweb-ui/src/components/InsightsHub.jsxweb-ui/src/components/ClassifierTable.jsxweb-ui/src/components/FeatureStrip.jsx
The UI has two major experiences:
- Detection flow (image upload and severity output)
- Insights flow (metrics, charts, reports)
Current deployment style in this repository:
- Frontend on Vercel from
web-ui/ - Backend on Hugging Face Spaces Docker using
.hf-space-src/staging
Main deployment assets:
Dockerfilerequirements.txt.dockerignore.hf-space-src/web-ui/vercel.json
Check that both are present:
Depth-Anything-V2/checkpoints/depth_anything_v2_vits.pthyolo-segmentation/model/best.pt
- Verify
VITE_API_BASE_URLinweb-ui/.env - Verify CORS values in root
.env(FRONTEND_ORIGINS)
- Ensure token has repository write permission under your namespace
- Free-tier spaces may sleep and need warm-up time
If you are a first-time user, start with Section 4 and Section 5, then move to Section 6 when you want to retrain or evaluate models.