Add field for alert labels

This commit is contained in:
Nicolas Mowen 2024-02-19 06:34:35 -07:00
parent 2e9669fbc2
commit f54bbf915c
2 changed files with 13 additions and 2 deletions

View File

@ -58,6 +58,7 @@ if os.path.isdir("/run/secrets"):
).read_text()
DEFAULT_TRACKED_OBJECTS = ["person"]
DEFAULT_ALERT_OBJECTS = ["person", "car"]
DEFAULT_LISTEN_AUDIO = ["bark", "fire_alarm", "scream", "speech", "yell"]
DEFAULT_DETECTORS = {"cpu": {"type": "cpu"}}
DEFAULT_DETECT_DIMENSIONS = {"width": 1280, "height": 720}
@ -512,6 +513,9 @@ class ZoneConfig(BaseModel):
class ObjectConfig(FrigateBaseModel):
track: List[str] = Field(default=DEFAULT_TRACKED_OBJECTS, title="Objects to track.")
alert: List[str] = Field(
default=DEFAULT_ALERT_OBJECTS, title="Objects to create alerts for."
)
filters: Dict[str, FilterConfig] = Field(default={}, title="Object filters.")
mask: Union[str, List[str]] = Field(default="", title="Object mask.")

View File

@ -113,7 +113,10 @@ class ReviewSegmentMaintainer(threading.Thread):
segment.detections.add(object["id"])
segment.objects.add(object["label"])
if object["has_clip"]:
if (
object["has_clip"]
and object["label"] in camera_config.objects.alert
):
segment.severity = SeverityEnum.alert
if len(object["current_zones"]) > 0:
@ -150,7 +153,11 @@ class ReviewSegmentMaintainer(threading.Thread):
zones: set = set()
for object in active_objects:
if not has_sig_object and object["has_clip"]:
if (
not has_sig_object
and object["has_clip"]
and object["label"] in camera_config.objects.alert
):
has_sig_object = True
detections.add(object["id"])