Skip to main content

Prerequisites

Python 3.12+

RTSP Human Capture requires Python 3.12 or higher. Check your Python version:
If you need to install or upgrade Python, visit python.org.

uv Package Manager

This project uses uv for fast, reliable dependency management.
Verify the installation:

Clone the Repository

Clone the RTSP Human Capture repository:

Install Dependencies

Install all required dependencies using uv:
This command reads pyproject.toml and installs:
  • numpy>=2.4.3
  • opencv-contrib-python (from local CUDA wheels if available)
The uv sync command creates a virtual environment automatically and installs all dependencies in one step.

Fallback for CPU-Only Systems

If uv sync fails due to missing OpenCV CUDA wheels, install the CPU-only version:
The CPU-only version will work but won’t benefit from GPU acceleration. For best performance, use the CUDA-enabled wheels.

Optional: CUDA GPU Acceleration

For hardware-accelerated inference on NVIDIA GPUs:

1. Verify CUDA Installation

Check if CUDA is available on your system:
If this command fails, install NVIDIA CUDA Toolkit.

2. Install OpenCV CUDA Wheels

Download the appropriate CUDA-enabled OpenCV wheel for your platform:
  1. Visit opencv-python-cuda-wheels releases
  2. Download the opencv_contrib_python-*.whl file matching your:
    • Python version (e.g., cp312 for Python 3.12)
    • Platform (e.g., win_amd64, linux_x86_64)
    • CUDA version (e.g., cuda12x)
  3. Create a deps/ directory and place the wheel file there:
  1. Update pyproject.toml to reference your specific wheel:
  1. Reinstall dependencies:
The application will automatically detect CUDA at runtime and use GPU acceleration if available. No code changes needed!

Download Model Files

For YOLOv4 detection (recommended), download these files:
1

Create model directory

2

Download YOLOv4 weights

3

Download YOLOv4 config

4

Download COCO class names

Model Files Reference

Model files are optional! If not provided, the tool automatically falls back to OpenCV’s built-in HOG person detector. YOLOv3 files are also supported as a fallback before HOG.

Verify Installation

Verify that everything is installed correctly:
You should see the command-line help output:

Project Structure

After installation, your directory should look like this:

Troubleshooting

CUDA Not Detected

If you have a NVIDIA GPU but CUDA is not detected:
  1. Verify NVIDIA drivers: nvidia-smi
  2. Check CUDA installation: nvcc --version
  3. Ensure OpenCV CUDA wheels are installed (not the CPU-only version)
  4. The application will print “CUDA available, using GPU” or “CUDA not available, using CPU” at startup

Import Errors

If you see ModuleNotFoundError:

Model Loading Errors

If model files fail to load:
  1. Verify files exist in the model/ directory
  2. Check file permissions: ls -la model/
  3. Re-download corrupted files
  4. The tool will automatically fall back to HOG detection

Next Steps

Quick Start Guide

Get your first detection working in 5 minutes with a test image and RTSP stream