Real-time people counting system built for bars and venues to track occupancy and stay within fire safety limits. Uses a camera pointed at a doorway with a virtual tripwire line, when someone crosses one direction the count goes up, the other way it goes down.
Built by Ilia Mazor and William Gore.
We're both bartenders and recently the LGCA came by our workplace. They mentioned they still manually count people to check fire code compliance — that's slow, error-prone, and easy to lose track of during a busy night. We wanted to automate it with a camera and some computer vision.
- A camera watches a doorway
- YOLOv8 detects people in each frame
- ByteTrack follows each person across frames
- A tripwire line is drawn across the entrance — when someone's bounding box center crosses it, we count them in or out
- The count is sent to a central server and displayed on a web dashboard
pip install -r requirements.txt
Requires Python 3.11+. First run will download the YOLOv8n model (~6MB).
The easiest way to get everything running:
Windows:
start.bat
Mac/Linux:
chmod +x start.sh
./start.sh
This starts the coordinator server and the web dashboard. Then open http://127.0.0.1:8001 in your browser to access the dashboard.
You can also start things manually:
python coordinator/cameraServer.py
Optionally pass a capacity limit:
python coordinator/cameraServer.py 50
python dashboard/webServer.py
You can add cameras through the web dashboard — click two points on the canvas to place the tripwire line, set your source and camera ID, then hit "Add Camera".
Or run the detector directly:
python node/detector.py
| Argument | Default | Description |
|---|---|---|
--source |
0 |
Camera index or path to a video file |
--camera-id |
entrance_cam |
Unique name for this camera |
--line-start |
320 50 |
Tripwire line start point (x y) |
--line-end |
320 430 |
Tripwire line end point (x y) |
--calibrate |
off | Click to place the tripwire line visually |
--flip |
off | Swap in/out direction for exit cameras |
--brightness |
0 |
Brightness boost (0=off, 1=light, 2=moderate, 3=max) |
--stream-port |
0 |
Port for MJPEG live stream (0=disabled) |
Use --calibrate to place the tripwire line on a live feed:
python node/detector.py --calibrate
Click two points, press r to reset, press q when done. The terminal prints the exact args to reuse next time.
You can also set the line through the web dashboard canvas — no CLI needed.
By default crossing left-to-right counts as "in". For exit cameras use --flip:
python node/detector.py --flip --camera-id "exit_cam"
The web dashboard at http://127.0.0.1:8001 lets you:
- See the current count in real time
- Set the venue capacity
- Add and remove cameras
- Draw the tripwire line on a canvas (no need to guess coordinates)
- View live camera feeds via MJPEG streams
Camera Node (detector.py) Coordinator (cameraServer.py)
+---------------------+ +----------------------+
| Webcam/Video | | Port 8069 (cameras) |
| -> YOLOv8n | crossing | -> updates COUNT |
| -> ByteTrack | ---------> | |
| -> Tripwire line | | Port 8067 (web) |
| -> MJPEG stream | | -> serves data |
+---------------------+ +----------+-----------+
|
+-----------+-----------+
| Dashboard (webServer) |
| Port 8001 |
| -> serves UI |
| -> proxies to coord |
+-----------------------+
devHacks2026/
├── node/
│ ├── detector.py # Camera node — detection, tracking, tripwire
│ ├── client.py # Sends crossing events to coordinator
│ └── config.py # Default configuration
├── coordinator/
│ └── cameraServer.py # Central server — tracks count
├── dashboard/
│ ├── webServer.py # Serves the web UI
│ ├── index.html # Dashboard page
│ ├── script.js # Dashboard logic + calibration canvas
│ └── style.css # Styling
├── start.bat # Start all servers (Windows)
├── start.sh # Start all servers (Mac/Linux)
├── requirements.txt
└── README.md
- Support for multiple cameras covering different entrances/exits
- Person re-identification to avoid double counting across cameras
- Persistent storage so counts survive server restarts
- Push notifications or alerts when approaching capacity
- Historical data and analytics for tracking peak hours
- Better handling of crowds and groups crossing at the same time
- Cloud-hosted dashboard for remote monitoring
- Authentication on the dashboard