Prerequisites
Python 3.12+
RTSP Human Capture requires Python 3.12 or higher. Check your Python version:uv Package Manager
This project uses uv for fast, reliable dependency management.Clone the Repository
Clone the RTSP Human Capture repository:Install Dependencies
Install all required dependencies using uv:pyproject.toml and installs:
numpy>=2.4.3opencv-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
Ifuv sync fails due to missing OpenCV CUDA wheels, install the CPU-only version:
Optional: CUDA GPU Acceleration
For hardware-accelerated inference on NVIDIA GPUs:1. Verify CUDA Installation
Check if CUDA is available on your system:2. Install OpenCV CUDA Wheels
Download the appropriate CUDA-enabled OpenCV wheel for your platform:- Visit opencv-python-cuda-wheels releases
-
Download the
opencv_contrib_python-*.whlfile matching your:- Python version (e.g.,
cp312for Python 3.12) - Platform (e.g.,
win_amd64,linux_x86_64) - CUDA version (e.g.,
cuda12x)
- Python version (e.g.,
-
Create a
deps/directory and place the wheel file there:
- Update
pyproject.tomlto reference your specific wheel:
- 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:Model Files Reference
| File | Size | Description |
|---|---|---|
yolov4.weights | ~245 MB | Pre-trained YOLOv4 model weights |
yolov4.cfg | ~12 KB | YOLOv4 network architecture configuration |
coco.names | ~1 KB | COCO dataset class labels (80 classes) |
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: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:- Verify NVIDIA drivers:
nvidia-smi - Check CUDA installation:
nvcc --version - Ensure OpenCV CUDA wheels are installed (not the CPU-only version)
- The application will print “CUDA available, using GPU” or “CUDA not available, using CPU” at startup
Import Errors
If you seeModuleNotFoundError:
Model Loading Errors
If model files fail to load:- Verify files exist in the
model/directory - Check file permissions:
ls -la model/ - Re-download corrupted files
- 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