fu4ll/Vehicle_Detection
0
Vehicle Detection API
...
vehicle-detection-api
REST API for detecting and tracking vehicles in images and videos using YOLOv8.
<img width="1258" height="860" alt="Снимок экрана 2026-04-21 в 19 34 41" src="https://github.com/user-attachments/assets/a970938e-6e3f-4430-b18c-517dd7fdb63e" />
Features
- Detects cars, trucks, buses and motorcycles
- Returns bounding boxes and confidence rate
- Responses with annotated image
- Simple web interface
Stack
- Python
- YOLOv8
- FastAPI
- OpenCV
Instalation
''' bash \ git clone https://github.com/s-dinmukhamed/vehicle-detection-api.git \ cd vehicle-detection-api \ python -m venv venv \ Mac: source venv/bin/activate Windows: venv\Scripts\activate \ pip install -r requirements.txt \ '''
Run
'''bash \ uvicorn main:app --reload \
Open http://localhost:8000
### POST /detect
Upload an image and get vehicle detections.
Request: multipart/form-data with `file` field
Response:
json
{
"filename": "test.jpg",
"total": 3,
"detections": [
{
"class": "car",
"confidence": 0.95,
"bbox": [191, 857, 5477, 2862]
}
],
"image": ""
}Project Structure
vehicle-detection-api/
├── main.py # FastAPI app
├── detector.py # YOLOv8 inference
├── static/
│ └── index.html # Web interface
├── uploads/ # Temporary uploaded files
└── requirements.txt