Skip to content
All projects

Computer-vision traffic counter

Vehicle Counting Agent

Counts vehicles in traffic footage with YOLO11 detection and multi-object tracking, so each vehicle is counted exactly once as it crosses a virtual line.

Status
Repository
Type
Experiment
Year
2026
Role
Solo project
IllustrationIllustrative graphic for Vehicle Counting Agent; not a product screenshot.

01Overview

A small agent that perceives a traffic scene, remembers each tracked vehicle, decides whether a genuine line crossing happened, and acts by updating the count and the video overlay.

02Goal

Count reliably — detection alone has no memory between frames, so a car on screen for three seconds produces 75 unrelated detections.

03Approach

  • YOLO11 detects vehicles in one forward pass; only car, motorcycle, bus and truck classes are kept.
  • BoT-SORT tracking gives every vehicle a stable ID, which is what makes counting once possible.
  • A dead band either side of the line stops jittery boxes on the line from flipping sides and double-counting.
  • A track must survive a minimum number of frames before it can count, filtering out flicker.

04Result on the sample clip

On the included 48-second, 1280×720 CCTV clip it counts 32 cars, 3 buses and 1 motorcycle — 36 in total. The single truck in frame is already past the line and moving away, so a count of zero trucks is correct.

05Outcome

Command-line tool with configurable model, line position, confidence, dead band and tracker; runs on video files or a webcam.

06Stack

  • Python
  • YOLO11
  • Ultralytics
  • BoT-SORT

Contact

Have a project or a role in mind? Let’s talk.

Send a message through the contact form, or email me directly.