This guide will help you deploy the Realtime Crowd Counting & Detection system on a Raspberry Pi.
- Hardware: Raspberry Pi 4 or 5 (recommended 4GB+ RAM).
- Camera: Raspberry Pi Camera Module 3 or similar (Picamera2 compatible) OR USB Webcam.
- OS: Raspberry Pi OS (64-bit Bookworm or newer recommended).
-
Transfer Files: Copy the entire project folder to your Raspberry Pi Desktop.
/home/pi/Desktop/Realtime-Crowd-Counting-Detection
-
Run Setup Script: Open a terminal in the project folder and run:
cd /home/pi/Desktop/Realtime-Crowd-Counting-Detection chmod +x setup_rpi.sh ./setup_rpi.shThis script will:
- Update system packages.
- Install dependencies (Python, OpenCV, Picamera2).
- Install the systemd service.
The application is set to start automatically on boot.
- Start:
sudo systemctl start crowd_counting.service - Stop:
sudo systemctl stop crowd_counting.service - Restart:
sudo systemctl restart crowd_counting.service - Check Status:
sudo systemctl status crowd_counting.service - View Logs:
sudo journalctl -u crowd_counting.service -f
To run the server manually for debugging:
python3 app.pyAccess the web dashboard at: http://<YOUR-PI-IP>:5000
- Zone Setup: Go to
http://<YOUR-PI-IP>:5000/settingsto adjust the counting zone size. - Camera Selection: The system automatically prioritizes the Pi Camera. If not found, it falls back to USB Webcam (index 0).
- Camera not detected? Ensure camera cable is seated correctly and legacy camera stack is disabled (if using libcamera/picamera2).
- Performance issues?
Use a smaller model (already using
yolo11n.pt) or reduce resolution inapp.py.