The Problem
Clients that need to measure vehicle or object speed from video often stitch together separate YOLO‑based detection, DeepSORT tracking, and custom kinematics code. Re‑implementing that pipeline from scratch consumes engineering time and introduces integration risk.
What This Does
The repository supplies a single Jupyter notebook – Copy_of_YOLOv8_object_tracking_counting_speed.ipynb – that runs end‑to‑end in Google Colab. It imports the official YOLOv8 segmentation model, patches the predict.py script in the upstream ultralytics package to expose bounding‑box centroids, feeds those detections to a DeepSORT tracker, and finally computes per‑track speed using frame‑to‑frame displacement and a user‑provided pixel‑to‑meter scale. The accompanying README.md gives a one‑sentence overview and the GitHub URL for cloning.
How It Is Wired
- Entry point – Opening the notebook in Colab and executing the first cell starts the workflow. No CLI script,
main.py, or package entry point exists. - Core steps inside the notebook – 1. Environment setup –
!pip install ultralytics(or similar) pulls the YOLOv8 code. 2. Model loading –model = YOLO('yolov8s-seg.pt')(the exact call lives in the notebook). 3. Predict‑script patch – The notebook editsultralytics/yolo/v8/segment/predict.py(runtime) to return raw segmentation masks and centroid coordinates. 4. DeepSORT integration – The patched predictions are fed toDeepSort(imported from the DeepSORT repository). 5. Speed calculation – For each track, pixel displacement between successive frames is multiplied by the user‑provided scale factor and divided by the frame‑interval to yield meters‑per‑second. - External effects – The notebook writes only local output files (e.g., annotated video, CSV of speeds). No database, network service, or persistent storage is touched.
- Responsibility map –
Copy_of_YOLOv8_object_tracking_counting_speed.ipynb– owns the entire data‑flow, model patching, tracking, and speed math.README.md– owns documentation only.- No additional modules or cycles are present; the wiring is confined to the single notebook.
How To Use It
- Clone the repo (required for Colab to fetch the notebook): ``
bash git clone https://github.com/moses-y/YOLOv8_Segmentation_DeepSORT_TRACKING_SpeedEstimation cd YOLOv8_Segmentation_DeepSORT_TRACKING_SpeedEstimation`` - Open the notebook in Google Colab – either upload the
.ipynbfile or use the “Open in Colab” button if added later. - Run the cells sequentially – the first cell installs dependencies, the second loads the model, subsequent cells perform inference on a user‑provided video path and output speed estimates.
- Provide inputs – supply the path to the video file and the pixel‑to‑meter conversion factor as prompted in the notebook.
Missing pieces: The repo does not contain a requirements.txt or explicit environment script, so the notebook’s pip install commands are the only source of dependency information. No command‑line interface or Docker image is provided.
Real‑World Use
A traffic‑monitoring service could schedule a nightly Colab run that points the notebook at a newly uploaded dash‑cam clip, extracts per‑vehicle speeds, and appends the results to a central CSV. The service would only need to automate the notebook execution (e.g., via the Colab API) and handle storage of the resulting CSV.
Code Health & Issues
- Medium – Strip notebook outputs before committing –
Copy_of_YOLOv8_object_tracking_counting_speed.ipynbis 14.2 MB, dominated by stored cell outputs. Large outputs bloat the repo and obscure diffs. - Medium – Move large binaries to Git LFS – The same notebook exceeds 5 MB, violating GitHub’s recommended size limits. Storing raw data (e.g., the 10.9 MB spreadsheet mentioned in the analysis) in LFS or external storage would keep clones lightweight.
- Medium – No test suite – No
tests/directory; code paths are unverified by automated tests. - Medium – No CI/CD pipeline – No
.github/workflow files or other build automation. - Medium – No LICENSE – Repository lacks a license, leaving usage and redistribution rights ambiguous.
The Bottom Line
The repo delivers a ready‑to‑run Colab notebook that stitches YOLOv8 segmentation, DeepSORT tracking, and simple kinematic math into a speed‑estimation pipeline. It is useful for quick prototyping or proof‑of‑concept work, but the single‑notebook architecture, missing dependency manifest, lack of tests, CI, and license make it unsuitable for production deployment without additional engineering effort.