Counts cars in and out of a parking lot with YOLO11n on a Raspberry Pi 4, deployed on site at the Innovation Centre.
PROBLEM
Know whether the parking lot is full without walking out to check.
DID
YOLO11 car detection and the full Python pipeline, on a Raspberry Pi 4 with a webcam. Set up the on-site networking.
RESULT
Deployed on site during vacation work at the Innovation Centre.
Python
YOLO11
OpenCV
NCNN
Raspberry Pi
The counter watches the lot entrance with a USB webcam on a Raspberry Pi 4. Instead of running
detection on the whole frame, it only looks at two small zones marked with printed ArUco codes,
which keeps the model’s work small enough for the Pi’s CPU.
A car that passes zone A and then zone B is counted as an entry; B then A is an exit. The tally
is kept between zero and the lot’s capacity, and two LEDs show at a glance whether there is space.
fig. 1 How it counts cars. Two printed ArUco markers mark zones A and B. A car that crosses A then B is an entry (+1); B then A is an exit (−1). Only the two zone boxes are checked, not the whole frame.fig. 2 From two paper markers to a live tally. Setup runs once (calibrate.py finds the markers and saves zones.json); the live loop crops each zone, runs YOLO11n exported to NCNN on the Pi's CPU, debounces over 2 frames and decides direction before updating the tally.fig. 3 Wiring it up. Green LED on GPIO17 lights when there is space, red on GPIO27 when the lot is full, each with its own resistor; BCM numbering, driven with gpiozero.fig. 4 What the Pi shows while it runs. Which zone a car is in, crossings in progress, the tally against capacity, and recent events; every entry and exit is also saved to tally_log.csv.