Overview
RTSP Human Capture supports multiple detection models with automatic fallback. The system tries to load models in this order:- YOLOv4 (recommended for best accuracy)
- YOLOv3 (fallback if YOLOv4 not found)
- HOG (OpenCV built-in, no files required)
The HOG detector runs automatically when no YOLO model files are found. While less accurate than YOLO, it requires no additional downloads and works immediately.
Model Directory Structure
By default, model files should be placed in themodel/ directory:
Downloading YOLOv4 Files
YOLOv4 provides the best detection accuracy. Download these three files:Download yolov4.weights
Download yolov4.cfg
Download coco.names
Downloading YOLOv3 Files (Alternative)
If you prefer YOLOv3 or want it as a fallback:- YOLOv3 Weights
- YOLOv3 Config
- COCO Names
HOG Fallback Detector
The Histogram of Oriented Gradients (HOG) detector is OpenCV’s built-in person detection method.When HOG is Used
HOG activates automatically when:- No
yolov4.weightsfile is found - No
yolov3.weightsfile is found - YOLO model loading fails
HOG Characteristics
Advantages
- No model files required
- Lightweight and fast
- Works immediately after installation
Limitations
- Lower accuracy than YOLO
- More false positives/negatives
- Less robust to varying poses
HOG Implementation
Fromperson_detector.py:53-60:
Verifying Model Installation
Model Loading Logic
ThePersonDetector class attempts to load models in this sequence (from person_detector.py:42-60):
COCO Classes
Thecoco.names file contains 80 object classes. RTSP Human Capture only detects class 0: person.
From person_detector.py:130-131:
Full COCO Class List
Full COCO Class List
The COCO dataset includes 80 classes:
- person
- bicycle
- car
- motorbike
- aeroplane
- bus
- train
- truck
- boat
- traffic light … (and 70 more)
Troubleshooting
Model files not loading
Model files not loading
Symptoms:Solutions:
- Verify files are in the correct directory (default:
model/) - Check file names are exactly:
yolov4.weights,yolov4.cfg,coco.names - Ensure files aren’t corrupted (check file sizes)
- Verify read permissions on model files
OpenCV DNN errors
OpenCV DNN errors
Symptoms:Solution:
This is just a warning. The system will automatically fall back to CPU inference. See GPU Acceleration for CUDA setup.
coco.names not found
coco.names not found
Behavior:
System uses fallback class list (from Impact: Detection still works, but only first 8 classes are named.Solution: Download
person_detector.py:79-81):coco.names as shown above.Wrong model directory
Wrong model directory
Symptoms:
Files exist but system reports they’re not found.Solution:
Check your Or override at runtime:
config.cfg file:Performance Comparison
| Model | Accuracy | Speed (CPU) | Speed (GPU) | File Size |
|---|---|---|---|---|
| YOLOv4 | Excellent | ~100-300ms/frame | ~10-30ms/frame | 245 MB |
| YOLOv3 | Very Good | ~80-250ms/frame | ~8-25ms/frame | 248 MB |
| HOG | Fair | ~50-150ms/frame | N/A | 0 MB |
Times are approximate and vary based on image resolution, hardware, and scene complexity.