How bamwani/car-counting-and-speed-estimation-yolo-sort-python works
This repository is a video-based traffic analysis application. A user supplies a video and YOLO model directory; the main script detects vehicles, tracks them across frames, derives lane and speed information, annotates the frames, and exports results. The README documents vehicle counting, lane segmentation, lane-change detection, speed estimation, and CSV output. The sampled code confirms the SORT implementation and CSV write; some internal stages are documented but their complete implementation was not sampled.
Main entry points: main.py Video processor · sort.py SORT tracking · final.csv Analysis CSV · yolov3.cfg YOLO configuration
Components 13
Video Input
- Video processor
code_and_output/main.py
Vehicle Analysis
- YOLO detection
code_and_output/main.py - SORT tracking
code_and_output/sort.py - Vehicle counting
code_and_output/main.py - Lane segmentation
code_and_output/main.py - Lane changes
code_and_output/main.py - Speed estimation
code_and_output/main.py
Outputs
- Frame annotation
code_and_output/main.py - Annotated video
- Analysis CSV
code_and_output/final.csv
Model Resources
- YOLO configuration
yolo/yolov3.cfg - COCO labels
yolo/coco.names
Other components
- Video analyst
Connections 12
- Video analyst → Video processor: runs with video
README.md - Video processor → YOLO detection: detects vehicles
README.md - Video processor → SORT tracking: uses tracker
README.md - Video processor → Vehicle counting: counts vehicles
README.md - Video processor → Lane segmentation: segments lanes
README.md - Video processor → Lane changes: detects changes
README.md - Video processor → Speed estimation: estimates speed
README.md - Video processor → Frame annotation: annotates frames
code_and_output/main.py - Video processor → Annotated video: writes video
README.md - Video processor → Analysis CSV: writes CSV
code_and_output/main.py - Video processor → YOLO configuration: loads model config
README.md - Video processor → COCO labels: uses class labels