Make sure you’ve completed the installation before proceeding.
Test with a Local Image
The fastest way to verify your setup is to test with a local image.Find or download a test image
Use any JPEG image containing people. For testing, you can download a sample image:Or use any photo from your computer.
Process a Single RTSP Stream
Now let’s process a live RTSP camera stream.Run detection with display
Process the stream and show a live display window:The tool will:
- Connect to the stream
- Display live video with detection overlays
- Save annotated snapshots when people are detected
Record Video Clips
Instead of snapshots, record MP4 video clips of detected presence.- Recording starts immediately
- Continues while person remains in frame
- Stops when person leaves
- Saves as MP4 file with timestamp
Process Multiple Streams
Monitor multiple cameras simultaneously with a grid display.Process all streams
- A grid window showing all camera feeds
- Each stream processed in a separate thread
- Individual output folders per stream
Customize Detection Settings
Override default configuration values at runtime.Adjust Confidence Threshold
Control detection sensitivity (0.0 to 1.0):- Lower values (0.3-0.5): More detections, more false positives
- Higher values (0.6-0.9): Fewer false positives, may miss some people
- Default: 0.5
Set Minimum Person Size
Filter out small detections (in pixels):- Lower values (500-1000): Detect people further away
- Higher values (2000-5000): Only detect people close to camera
- Default: 1000 pixels
Adjust Frame Skip Rate
Process every Nth frame for performance:- Lower values (5-10): More responsive, higher CPU/GPU usage
- Higher values (20-30): Lower resource usage, may miss quick movements
- Default: 15 (≈2 fps analysis on 30 fps stream)
Combine Multiple Overrides
Configuration File
For persistent settings, editconfig.cfg:
CLI flags always override config file values, allowing per-run customization without editing the file.
Expected Output Behavior
Image Mode (--save image)
- Captures a single annotated JPEG when a person first enters the frame
- One snapshot per entry event
- Fast processing, minimal storage
- Ideal for: alerts, logging entries, motion detection
Video Mode (--save video)
- Records an MP4 clip for the entire duration a person is present
- Starts recording on detection
- Continues while person remains in frame
- Stops and saves when person leaves
- Ideal for: security footage, event recording, detailed review
Understanding Detection Output
When a person is detected, you’ll see console output like:(x, y, w, h, confidence)
x, y: Top-left corner coordinatesw, h: Width and height of bounding boxconfidence: Detection confidence (0.0 to 1.0)
Troubleshooting
”Could not connect to RTSP stream”
- Verify the RTSP URL is correct
- Check network connectivity:
ping camera_ip - Test with VLC:
vlc rtsp://camera_ip/stream - Ensure firewall allows RTSP (port 554)
“No persons detected” (but people are visible)
- Lower confidence threshold:
--confidence 0.3 - Reduce area threshold:
--area-threshold 500 - Check if people are too far from camera
- Verify model files are loaded (check console output)
High CPU/GPU Usage
- Increase frame skip:
--frame-skip 30 - Reduce stream resolution at camera source
- Process fewer streams simultaneously
- Use video mode instead of image mode if you’re getting too many snapshots
Stream Keeps Disconnecting
The tool automatically reconnects up to 5 times per stream. If disconnections persist:- Check network stability
- Verify camera RTSP settings
- Look for camera firmware updates
- Review camera logs for errors
All Command-Line Options
| Flag | Description |
|---|---|
--config PATH | Config file to load (default: config.cfg) |
--rtsp URL | Single RTSP stream URL |
--rtsp-list URL ... | Multiple RTSP stream URLs |
--rtsp-file PATH | Text file with RTSP URLs (one per line) |
--test-image PATH | Test with local image file |
--save image|video | Required. Save mode: snapshots or MP4 clips |
--display | Show live grid window (multi-stream) |
--no-display | Suppress display window (single stream) |
--confidence FLOAT | Detection confidence threshold (overrides config) |
--area-threshold INT | Minimum bounding-box area in pixels (overrides config) |
--frame-skip INT | Analyze every Nth frame (overrides config) |