Configuration Overview
RTSP Human Capture uses a two-tier configuration system:- config.cfg file - INI-style configuration with default values
- CLI arguments - Runtime overrides for individual values
CLI arguments always take precedence over config file values. This allows you to use a base configuration and adjust specific parameters per run.
Configuration File (config.cfg)
Default Configuration
The defaultconfig.cfg file contains all available settings:
Configuration Sections
[paths] - File Paths
[paths] - File Paths
Controls where the application reads model files and writes output.
Example:
[detection] - Detection Parameters
[detection] - Detection Parameters
Controls person detection sensitivity and performance.
Example:
Configuration Parameters in Detail
model_dir
string
default:"model"
Directory containing YOLO model files. Can be absolute or relative path.
- Relative path:
model,models/yolo,./weights - Absolute path:
/opt/models,/home/user/yolo
person_detector.py:44-45):
output_dir
string
default:"output"
Root directory where captured images and video clips are saved.
- Single stream: Files saved directly in
output_dir/ - Multiple streams: Sub-folders created as
output_dir/stream_<id>/
stream_processor.py:56-58):
confidence_threshold
float
default:"0.5"
required
Minimum detection confidence score (0.0 to 1.0). Detections below this threshold are discarded.
Low (0.3-0.4)
Use when:
- Distant cameras
- Low light conditions
- Prefer false positives over missed detections
Medium (0.5-0.6)
Use when:
- Standard conditions
- Balanced accuracy needed
- General purpose monitoring
High (0.7-0.9)
Use when:
- High confidence required
- Minimize false positives
- Clear, well-lit scenes
person_detector.py:131):
config.py:60-63):
person_area_threshold
integer
default:"1000"
Minimum bounding box area in pixels. Detections with smaller areas are filtered out.
- Distant/small detections
- Partial detections at frame edges
- Noise and false positives
Reference frame sizes:
- 1920×1080 (Full HD) = 2,073,600 pixels
- 1280×720 (HD) = 921,600 pixels
- 640×480 (SD) = 307,200 pixels
person_detector.py:147):
frame_skip
integer
default:"15"
Process every Nth frame. Higher values improve performance but reduce detection frequency.
- Performance: Processing every frame is CPU/GPU intensive
- Responsiveness: Skipping too many frames delays detection
Implementation (
stream_processor.py:113):
Additional throttling: Detection runs at most once per 0.5 seconds, even if
frame_skip triggers more frequently.- High Performance Needed
- Balanced (Default)
- High Responsiveness
- Running many streams
- CPU/GPU limited
- Slow detection acceptable
CLI Override Options
All configuration values can be overridden at runtime using command-line arguments.Configuration File Selection
string
default:"config.cfg"
Path to configuration file to load.
Detection Parameter Overrides
Override Implementation
Frommain.py:89-94:
Overrides only apply when explicitly provided. If a flag is omitted, the config file value is used.
Complete CLI Reference
Configuration Examples
High Security Monitoring
Scenario: Bank entrance, minimize false alarmsPerformance-Optimized Multi-Stream
Scenario: 16 camera warehouse monitoringParking Lot Monitoring
Scenario: Wide-angle distant detectionConfiguration Loading
The configuration loading process (fromconfig.py:30-77):
1
Check file exists
2
Parse INI file
3
Load values with fallbacks
4
Validate values
5
Return AppConfig object
Troubleshooting
Config file not found
Config file not found
Error:Solution:
Create a
config.cfg file in your working directory or specify a custom path:Invalid confidence threshold
Invalid confidence threshold
Error:Solution:
Ensure
confidence_threshold is between 0.0 and 1.0:Invalid frame_skip value
Invalid frame_skip value
Error:Solution:
Set
frame_skip to 1 or higher:CLI overrides not working
CLI overrides not working
Issue: Config file values are used instead of CLI arguments.Check:The values shown reflect the final configuration after CLI overrides.
- Ensure flag syntax is correct:
--confidence 0.7(not--confidence=0.7) - CLI args must come after positional arguments
- Use
=for some shells:--confidence=0.7
Best Practices
Use Config Files for Defaults
Keep common settings in
config.cfg and override specific values via CLI when needed.Create Environment-Specific Configs
Version Control Your Configs
Commit config files (except those with secrets) to track configuration changes over time.
Document Custom Values
Add comments in config files explaining why non-default values were chosen.
Next Steps
Single Stream Processing
Learn to process a single RTSP stream
Multi-Stream Processing
Monitor multiple cameras simultaneously
GPU Acceleration
Speed up detection with CUDA
Model Setup
Configure YOLO models