mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-08 12:15:25 +03:00
Add field for alert labels
This commit is contained in:
parent
2e9669fbc2
commit
f54bbf915c
@ -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.")
|
||||
|
||||
|
||||
@ -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"])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user