Traffic Reducer ships with support for multiple YOLOv8 weight files and automatically selects the best available one at startup — no manual configuration required for the common case. The selection logic inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Xander44-4/traffic_reducer/llms.txt
Use this file to discover all available pages before exploring further.
app.py checks for weight files in the project root directory and falls back gracefully if none are found locally.
Auto-selection logic
At startup,app.py resolves the project root and checks for weight files in the following priority order:
yolov8m.pt first, then yolov8s.pt. If neither is found locally, Ultralytics will attempt to download yolov8m.pt from its model hub the first time the application starts. Ensure the machine has internet access on first run if no local weights are present.
Model comparison
| Weight file | Parameters | Best for |
|---|---|---|
yolov8s.pt | ~11M | Balanced speed and accuracy |
yolov8m.pt | ~26M | Best accuracy; GPU recommended |
Forcing a specific model
To pin the system to a particular weight file, use one of these approaches:- Remove unwanted files — delete or rename the
.ptfiles you do not want in the project root. The auto-selection logic will fall through to the next available file. - Set
YOLO_MODEL_PATHdirectly — editapp.pyand hard-code the path before theTrafficCameraconstructor is called:
Inference parameters
TrafficCamera exposes four constructor parameters that control how YOLOv8 filters detections. These are set once at construction time and apply to every frame throughout the session.
| Parameter | Default | Description |
|---|---|---|
conf | 0.25 | Minimum confidence score to accept a detection |
iou | 0.5 | IoU threshold for non-maximum suppression |
max_det | 300 | Maximum number of detections per frame |
local_speed | 1.0 | Playback speed multiplier for local video mode |
The inference image size is hardcoded to
imgsz=640 inside _run_yolo() and is not a constructor parameter. It cannot be changed without editing video_processor.py directly. Non-maximum suppression is run class-agnostically (agnostic_nms=True) so that vehicles near zone boundaries are not double-counted across overlapping detections.TrafficCamera is instantiated in app.py: