The Problem
Manual vehicle counting from traffic camera feeds is time‑consuming and error‑prone, especially when vehicles overlap or move at varying speeds. Agencies need an automated way to extract reliable counts for congestion analysis, incident detection, or tolling.
What This Does
The repository implements a proof‑of‑concept pipeline that detects cars with YOLOv8 and tracks them across frames using DeepSORT. The core logic lives in the notebook YOLOv8ObjectCountingSegmentationSpeed.ipynb, which:
Loads a pre‑trained YOLOv8 model, runs inference on each video frame, and extracts bounding boxes for the “car” class. Passes those detections to DeepSORT to assign persistent IDs, enabling per‑vehicle counting and speed estimation.
The accompanying README.md provides a brief description and the intended usage scenario but contains no detailed installation or execution instructions.
How To Use It
Environment – Install a Python 3.9+ environment (e.g., via venv or conda). The notebook imports ultralytics, deepsortrealtime, opencv-python, and torch. These packages must be installed manually:
pip install ultralytics deepsortrealtime opencv-python torch Data – Place the target video file (e.g., traffic.mp4) in the notebook’s working directory. The notebook expects a file path variable videopath that you can edit in the first code cell. Run the notebook – Open YOLOv8ObjectCountingSegmentationSpeed.ipynb in JupyterLab or VS Code and execute cells sequentially. The final cells display:
A video overlay with bounding boxes, track IDs, and speed vectors. A printed summary of total vehicle count and average speed.
No separate CLI or script entry point exists; the notebook itself is the execution harness.
Real‑World Use
A city traffic department could schedule a nightly Jupyter run on archived CCTV clips:
In the notebook
videopath = "2024-08-12intersection.mp4" rundetectionandcounting(videopath) # pseudo‑function defined in the notebook
The resulting CSV export (if added) could feed directly into a dashboard that visualises hourly traffic volumes and identifies congestion hotspots.
Code Health & Issues
Med – Untested code – No unit or integration tests are present; any change to model loading or tracker parameters is unverified. Med – Missing CI/CD – No .github/workflows or other pipeline files; automated linting or dependency checks are absent. Med – No license – Repository lacks a LICENSE file, leaving reuse and distribution rights ambiguous. Low – Incomplete documentation – README.md provides only a title; installation steps, required Python version, and hardware expectations (GPU vs CPU) are missing. Low – Dependency drift risk – Packages are not pinned to specific versions; future releases of ultralytics or deepsort_realtime could break the notebook. Low – Hard‑coded paths – The notebook uses absolute or relative file paths without validation, which may cause runtime errors on different file systems.
The Bottom Line
The repo delivers a functional, single‑notebook demo of YOLOv8 + DeepSORT for vehicle counting, suitable for quick experimentation or educational purposes. However, the lack of tests, CI, explicit licensing, and detailed setup instructions makes it a poor fit for production deployment without further engineering effort. Teams with Python expertise can adopt the notebook as a baseline and should add proper packaging, testing, and documentation before scaling.