Pothole & Road Sign Detection Backend
This project implements a Two-Stage Detection Pipeline using YOLOv8 (for detection & tracking) and CLIP (for zero-shot classification).
Setup
-
Install Dependencies:
pip install -r backend/requirements.txt -
Training YOLO (Crucial Step): You MUST train a YOLO model on your custom dataset (Pothole, Manhole, Traffic Signs) for this to work effectively.
- Prepare your
dataset.yaml. - Run the training script:
from backend.models.train_yolo import train_yolo train_yolo("path/to/dataset.yaml", epochs=50)- This will generate
best.pt. Move this file tobackend/models/best.pt.
- Prepare your
Running the API
Start the FastAPI server:
cd backend
python main.py
The server will start at http://0.0.0.0:8000.
API Usage
Endpoint: POST /detect/video
- Body:
multipart/form-data, keyfile(Video file). - Response: JSON summary of unique objects detected.
Configuration
- Modify
backend/pipelines/video_processor.pyto change theyolo_model_pathto your trained model path (e.g.,backend/models/best.pt). - You can also adjust the CLA candidate labels in
VideoProcessor.__init__.