A safety-focused room occupancy monitoring system for industrial environments, leveraging Ultralytics YOLOv8 for person detection.
Repository: https://cnb.cool/MindDockAI/yolo-room-occupancy-safety
IMPORTANT
SAFETY CRITICAL WARNING: This software is a PROTOTYPE. In a real industrial setting, this must be redundant to physical interlocks (e.g., light curtains, pressure mats). Do NOT rely solely on Computer Vision for life-safety applications unless using certified hardware/software compliant with ISO 13849 / IEC 61508.
git clone https://cnb.cool/MindDockAI/yolo-room-occupancy-safety.git
cd yolo-room-occupancy-safety
Open a terminal and run:
# Create a virtual environment
python3 -m venv venv
# Activate the environment
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
Open PowerShell or Command Prompt and run:
# Create a virtual environment python -m venv venv # Activate the environment (PowerShell) .\venv\Scripts\Activate.ps1 # OR for Command Prompt: # venv\Scripts\activate.bat # Install dependencies pip install -r requirements.txt
Note for macOS Users: If you encounter errors related to
ultralyticsortorch, ensure you have the latest version of pip:pip install --upgrade pip.
Edit config.yaml to match your physical setup.
cameras:
- id: 0
source: "0" # Webcam ID (0) or RTSP URL ("rtsp://...")
line_start: [100, 200]
line_end: [500, 200] # Define the virtual door line (x, y)
direction_in: "down" # Detection direction logic (currently vector based)
0, 1 for USB webcams, or an RTSP stream URL.true to see the video feed with detection overlays.Ensure your virtual environment is activated, then run:
python -m src.main
The system will start monitoring. Press q to exit if debug window is open.
You can test the logic without a camera by generating a mock video.
python tests/mock_generator.py
# Creates mock_video.mp4
config.yaml, set source: "mock_video.mp4".python -m src.main
no module named lap): The project uses lapx instead of lap. Ensure you run pip install -r requirements.txt.system.max_missing_frames in config.yaml (e.g., to 60 or higher).MIT (or specify your license)