mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-08 20:25:26 +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()
|
).read_text()
|
||||||
|
|
||||||
DEFAULT_TRACKED_OBJECTS = ["person"]
|
DEFAULT_TRACKED_OBJECTS = ["person"]
|
||||||
|
DEFAULT_ALERT_OBJECTS = ["person", "car"]
|
||||||
DEFAULT_LISTEN_AUDIO = ["bark", "fire_alarm", "scream", "speech", "yell"]
|
DEFAULT_LISTEN_AUDIO = ["bark", "fire_alarm", "scream", "speech", "yell"]
|
||||||
DEFAULT_DETECTORS = {"cpu": {"type": "cpu"}}
|
DEFAULT_DETECTORS = {"cpu": {"type": "cpu"}}
|
||||||
DEFAULT_DETECT_DIMENSIONS = {"width": 1280, "height": 720}
|
DEFAULT_DETECT_DIMENSIONS = {"width": 1280, "height": 720}
|
||||||
@ -512,6 +513,9 @@ class ZoneConfig(BaseModel):
|
|||||||
|
|
||||||
class ObjectConfig(FrigateBaseModel):
|
class ObjectConfig(FrigateBaseModel):
|
||||||
track: List[str] = Field(default=DEFAULT_TRACKED_OBJECTS, title="Objects to track.")
|
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.")
|
filters: Dict[str, FilterConfig] = Field(default={}, title="Object filters.")
|
||||||
mask: Union[str, List[str]] = Field(default="", title="Object mask.")
|
mask: Union[str, List[str]] = Field(default="", title="Object mask.")
|
||||||
|
|
||||||
|
|||||||
@ -113,7 +113,10 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
segment.detections.add(object["id"])
|
segment.detections.add(object["id"])
|
||||||
segment.objects.add(object["label"])
|
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
|
segment.severity = SeverityEnum.alert
|
||||||
|
|
||||||
if len(object["current_zones"]) > 0:
|
if len(object["current_zones"]) > 0:
|
||||||
@ -150,7 +153,11 @@ class ReviewSegmentMaintainer(threading.Thread):
|
|||||||
zones: set = set()
|
zones: set = set()
|
||||||
|
|
||||||
for object in active_objects:
|
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
|
has_sig_object = True
|
||||||
|
|
||||||
detections.add(object["id"])
|
detections.add(object["id"])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user