Add label whitelist to filter detection types
DETECTION_LABELS env var accepts comma-separated list (e.g. "person,cat,dog"). Only matching detections are reported; others are ignored. Empty = report all. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -61,6 +61,7 @@ class MotionDetector:
|
||||
detection_labels_path: Optional[str] = None,
|
||||
detection_confidence: float = 0.5,
|
||||
detection_suppress_empty: bool = True,
|
||||
detection_labels: Optional[str] = None,
|
||||
):
|
||||
self.camera_id = camera_id
|
||||
self.collector_url = collector_url
|
||||
@@ -82,10 +83,14 @@ class MotionDetector:
|
||||
if detection_enabled and detection_model_path:
|
||||
try:
|
||||
from detector import ObjectDetector
|
||||
label_whitelist = None
|
||||
if detection_labels:
|
||||
label_whitelist = set(l.strip() for l in detection_labels.split(","))
|
||||
self._detector = ObjectDetector(
|
||||
model_path=detection_model_path,
|
||||
labels_path=detection_labels_path or "",
|
||||
confidence_threshold=detection_confidence,
|
||||
label_whitelist=label_whitelist,
|
||||
)
|
||||
logger.info(f"Object detection enabled (model: {detection_model_path})")
|
||||
except ImportError as e:
|
||||
|
||||
Reference in New Issue
Block a user