live people counting banner

live people counting

9 devlogs
15h 17m 49s

This program is designed to monitor and count the number of people entering and exiting a space in real time

This project uses AI

i have used github copilot for basic debugging and error solving

Demo Repository

Loading README...

adhikarisubodh999

Final polish: accurate-only pipeline + YOLOv11 custom backend support + clean compact UI.

What was improved in this update:

  • switched to accurate-only detection profile (removed Fast/Balanced selection)
  • added optional integration path for B4rtekk1 YOLOv11 backend when local repo+weights are present
  • kept safe automatic fallback to Ultralytics YOLO11 weights if custom backend is unavailable
  • boosted runtime smoothness with adaptive detection interval and OpenCV optimizations
  • fixed IN/OUT ambiguity by adding explicit IN-side selection during setup
  • improved line crossing logic to use the selected IN side instead of guessing
  • cleaned HUD back to a compact v07-style layout (small text, simple top-left panel)

Also removed temporary testing artifacts from final output:

  • removed local video test file and MJPEG helper server script
  • removed extra dependency used only for YouTube/file stream testing

Current final build is stable for webcam/RTSP inputs with manual door-line calibration and reliable IN/OUT counting.
Setup no longer asks for performance profile; accurate mode is always used.

Update: local video playback is now a core camera source for the final project.

What changed in this follow-up:

  • promoted Local Video File from test wording to full source option in setup
  • aligned setup/documentation so webcam, RTSP, and local video are all first-class sources
  • local video can now be used for regular counting workflows, demos, and offline validation
0
adhikarisubodh999

cleaned junk code.

Pre-release cleanup and merge stage.

Pulled in the polished app structure:

  • cleaner config + tracker behavior
  • more complete overlays and runtime logging
  • setup flow and counting logic aligned with final codebase

This stage is basically the last checkpoint before packaging docs/license and calling it done.

Attachment
0
adhikarisubodh999

improved code to make it smooth.

Performance-focused pass.

What I changed:

  • added frame skipping in config and main loop
  • reused last detection result between skipped frames
  • forced low buffer size and target FPS settings on camera

Tradeoff is obvious: a bit less accurate when people move fast, but much smoother on weak hardware. For this project, stable realtime view is more important than perfect per-frame detection.

Attachment
0
adhikarisubodh999

improved active track count and event log print format.

Worked on counting quality and visibility.

Changes in this stage:

  • added active track count to the overlay
  • improved event log print format with timestamps
  • kept tracker API a bit cleaner (get_active_persons, reset_counts)

Annoying part: when a few people cross together, nearest-neighbor still swaps IDs sometimes. Not fully solved yet, but output is easier to debug now because logs are clearer.

Attachment
0
adhikarisubodh999

camera selecting ability and door selecting ability.

Usability pass: removed hardcoded assumptions.

Implemented setup flow:

  • choose webcam or RTSP URL
  • test camera quickly
  • draw door line with mouse drag

Mouse callback logic was annoying at first (line would jump because drag state was wrong). Fixed by handling LBUTTONDOWN/MOVE/UP carefully.

This stage feels like a real app now, not just a dev prototype.

Attachment
0
adhikarisubodh999

In / out printed with fixed door line at mid-frame.

Built a basic nearest-neighbor tracker and connected it to a fixed door line at mid-frame.

Now it can print IN / OUT events and keep counters on screen.

Big issue today: jitter around the line created fake crossings. I didn’t fully solve it here, but at least track aging/removal is in place so stale IDs don’t pile up forever.

Attachment
0
adhikarisubodh999

person detection.

Added YOLO person detection. The first run looked like a hang, but it was just downloading model weights.

Current behavior:

  • reads webcam frame
  • runs detector
  • draws person boxes with confidence

Still rough. Box flicker is obvious and FPS drops on slower machines, but this is enough to visually verify detections before I touch tracking.

Attachment
1

Comments

bartoszkasyna
bartoszkasyna 3 days ago

Check this https://github.com/B4rtekk1/YOLO Custom self trained Yolo model

adhikarisubodh999

webcam opening.

Started from scratch and forced myself to keep it tiny: just open webcam, show frames, exit on ESC.

I wasted a bit of time because camera index 0 didn’t work on first try (USB cam was on 1). I added the index prompt so I don’t keep editing code every run.

No ML yet, no counting yet. Just confirmed OpenCV loop is stable and cleanup (release + destroyAllWindows) is working.

Attachment
0