YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Simple YOLO vehicle-count server
Two endpoints (upload image → get counts):
POST /count_totalreturns total vehicles only.POST /count_by_typereturns car/motorcycle/bus/truck + total.POST /priority_decisionaccepts two images and returns which lane has priority + gate open time.
Setup
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
Run
python app.py
Example request (PowerShell)
$img = "C:\path\to\frame.jpg"
Invoke-RestMethod -Method Post `
-Uri "http://127.0.0.1:8000/count_by_type" `
-Form @{ image = Get-Item $img }
Example request (2 images, priority)
$a = "C:\path\to\laneA.jpg"
$b = "C:\path\to\laneB.jpg"
Invoke-RestMethod -Method Post `
-Uri "http://127.0.0.1:8000/priority_decision" `
-Form @{ image_a = Get-Item $a; image_b = Get-Item $b }
Notes
- Vehicle classes are: car, motorcycle, bus, truck (COCO ids: 2, 3, 5, 7).
- The first run will download a YOLO model (
yolov8n.pt) automatically. - Set detection threshold with
CONF(default0.25) and model withYOLO_MODEL. - Gate time policy is configurable with
CAR_SEC,MOTORCYCLE_SEC,BUS_SEC,TRUCK_SEC, plusMIN_GATE_SECandMAX_GATE_SEC. - If you have custom models for winner/time, place them in
Model/models/:winner_classifier.pklgate_seconds_regressor.pkl
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support