Skip to main content
The config.py module contains all configurable parameters for the EVM Vital Signs Monitor system. These constants control signal processing, ROI detection, and video processing behavior.

Import

from src.config import (
    ALPHA_HR, LOW_HEART, HIGH_HEART,
    ALPHA_RR, LOW_RESP, HIGH_RESP,
    TARGET_ROI_SIZE, FPS, YOLO_MODELS
)

Heart Rate Parameters

Parameters controlling heart rate signal processing and validation.
ALPHA_HR
int
default:"30"
Amplification factor for heart rate magnification in Eulerian Video Magnification.
LOW_HEART
float
default:"0.83"
Lower frequency bound for heart rate bandpass filter (Hz). Corresponds to ~50 BPM (0.83 Hz × 60 = 49.8 BPM).
HIGH_HEART
float
default:"3.0"
Upper frequency bound for heart rate bandpass filter (Hz). Corresponds to 180 BPM (3.0 Hz × 60 = 180 BPM).
MAX_HEART_BPM
int
default:"250"
Maximum physically plausible heart rate (beats per minute). Measurements exceeding this are considered invalid.
MIN_HEART_BPM
int
default:"40"
Minimum physically plausible heart rate (beats per minute). Measurements below this are considered invalid.

Respiratory Rate Parameters

Parameters controlling respiratory rate signal processing and validation.
ALPHA_RR
int
default:"50"
Amplification factor for respiratory rate magnification. Higher than heart rate due to smaller motion amplitude.
LOW_RESP
float
default:"0.18"
Lower frequency bound for respiratory rate bandpass filter (Hz). Corresponds to ~11 BPM (0.18 Hz × 60 = 10.8 BPM).
HIGH_RESP
float
default:"0.5"
Upper frequency bound for respiratory rate bandpass filter (Hz). Corresponds to 30 BPM (0.5 Hz × 60 = 30 BPM).
MAX_RESP_BPM
int
default:"35"
Maximum physically plausible respiratory rate (breaths per minute). Measurements exceeding this are considered invalid.
MIN_RESP_BPM
int
default:"8"
Minimum physically plausible respiratory rate (breaths per minute). Measurements below this are considered invalid.

ROI Parameters

Parameters controlling Region of Interest (ROI) extraction and processing.
LEVELS_RPI
int
default:"3"
Number of levels for ROI pyramid processing in Laplacian pyramid decomposition.
ROI_PADDING
int
default:"10"
Padding (in pixels) added around the detected face bounding box for ROI extraction. Ensures the entire facial region is captured.
TARGET_ROI_SIZE
tuple
default:"(320, 240)"
Target size for ROI processing (width, height) in pixels. All extracted face ROIs are resized to this dimension for consistent processing.
An alternative size (640, 480) is available in the source but commented out. The smaller size reduces computational load.

Video Parameters

Parameters controlling video capture and frame processing.
FPS
int
default:"30"
Assumed video frame rate (frames per second). Used for temporal frequency calculations in signal processing.

YOLO Model Paths

Paths to pre-trained YOLO face detection models.
YOLO_MODELS
dict
Dictionary mapping YOLO model names to their file paths.
YOLO_MODELS = {
    "yolov8n": "src/weights_models/yolov8n-face.pt",   # YOLOv8 nano
    "yolov12n": "src/weights_models/yolov12n-face.pt"  # YOLOv12 nano
}
Access specific models:
from src.config import YOLO_MODELS

yolov8_path = YOLO_MODELS["yolov8n"]
yolov12_path = YOLO_MODELS["yolov12n"]

ROI Stabilization Parameters

Parameters for stabilizing ROI position across frames to reduce jitter.
ROI_CHANGE_THRESHOLD
int
default:"20"
Threshold for significant ROI position change (pixels). Changes smaller than this threshold may be smoothed to reduce jitter.
ROI_WEIGHTS
list
default:"[0.1, 0.15, 0.2, 0.25, 0.3]"
Weights for ROI smoothing filter applied to recent ROI positions. Most recent position has highest weight (0.3), oldest has lowest (0.1).
# Weights sum to 1.0 for weighted average
# Applied to last 5 ROI positions: [oldest ... newest]
ROI_WEIGHTS = [0.1, 0.15, 0.2, 0.25, 0.3]

Configuration Example

from src.config import (
    ALPHA_HR, LOW_HEART, HIGH_HEART,
    TARGET_ROI_SIZE, FPS, ROI_PADDING
)

# Use configuration in processing
print(f"Heart rate filter band: {LOW_HEART}Hz - {HIGH_HEART}Hz")
print(f"ROI target size: {TARGET_ROI_SIZE}")
print(f"Video FPS: {FPS}")
print(f"EVM amplification factor: {ALPHA_HR}")

# Output:
# Heart rate filter band: 0.83Hz - 3.0Hz
# ROI target size: (320, 240)
# Video FPS: 30
# EVM amplification factor: 30

Parameter Relationships

Modifying these parameters can significantly affect measurement accuracy:
  • Bandpass filter bounds (LOW_HEART, HIGH_HEART, LOW_RESP, HIGH_RESP) must match expected physiological ranges
  • Amplification factors (ALPHA_HR, ALPHA_RR) affect signal visibility but can introduce noise if too high
  • ROI size (TARGET_ROI_SIZE) impacts processing speed and memory usage
  • FPS must match the actual video frame rate for accurate frequency analysis

Validation Ranges

ParameterMinMaxUnitPhysiological Basis
Heart Rate40250BPMResting to maximum exercise
Respiratory Rate835BPMNormal breathing to hyperventilation
HR Filter0.833.0Hz50-180 BPM range
RR Filter0.180.5Hz11-30 BPM range

Build docs developers (and LLMs) love