mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-18 00:54:27 +03:00
Keep track of objects max review severity
This commit is contained in:
parent
d0cc8cb64b
commit
c90067b554
@ -210,6 +210,7 @@ class EventProcessor(threading.Thread):
|
|||||||
"top_score": event_data["top_score"],
|
"top_score": event_data["top_score"],
|
||||||
"attributes": attributes,
|
"attributes": attributes,
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"max_severity": event_data.get("max_severity"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -702,30 +702,7 @@ class TrackedObjectProcessor(threading.Thread):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# If the object is not considered an alert or detection
|
# If the object is not considered an alert or detection
|
||||||
review_config = self.config.cameras[camera].review
|
if obj.max_severity is None:
|
||||||
if not (
|
|
||||||
(
|
|
||||||
obj.obj_data["label"] in review_config.alerts.labels
|
|
||||||
and (
|
|
||||||
not review_config.alerts.required_zones
|
|
||||||
or set(obj.entered_zones) & set(review_config.alerts.required_zones)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
or (
|
|
||||||
(
|
|
||||||
not review_config.detections.labels
|
|
||||||
or obj.obj_data["label"] in review_config.detections.labels
|
|
||||||
)
|
|
||||||
and (
|
|
||||||
not review_config.detections.required_zones
|
|
||||||
or set(obj.entered_zones)
|
|
||||||
& set(review_config.detections.required_zones)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
):
|
|
||||||
logger.debug(
|
|
||||||
f"Not creating clip for {obj.obj_data['id']} because it did not qualify as an alert or detection"
|
|
||||||
)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|||||||
@ -13,6 +13,7 @@ from frigate.config import (
|
|||||||
CameraConfig,
|
CameraConfig,
|
||||||
ModelConfig,
|
ModelConfig,
|
||||||
)
|
)
|
||||||
|
from frigate.review.maintainer import SeverityEnum
|
||||||
from frigate.util.image import (
|
from frigate.util.image import (
|
||||||
area,
|
area,
|
||||||
calculate_region,
|
calculate_region,
|
||||||
@ -59,6 +60,27 @@ class TrackedObject:
|
|||||||
self.pending_loitering = False
|
self.pending_loitering = False
|
||||||
self.previous = self.to_dict()
|
self.previous = self.to_dict()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def max_severity(self) -> Optional[str]:
|
||||||
|
review_config = self.camera_config.review
|
||||||
|
|
||||||
|
if self.obj_data["label"] in review_config.alerts.labels and (
|
||||||
|
not review_config.alerts.required_zones
|
||||||
|
or set(self.entered_zones) & set(review_config.alerts.required_zones)
|
||||||
|
):
|
||||||
|
return SeverityEnum.alert
|
||||||
|
|
||||||
|
if (
|
||||||
|
not review_config.detections.labels
|
||||||
|
or self.obj_data["label"] in review_config.detections.labels
|
||||||
|
) and (
|
||||||
|
not review_config.detections.required_zones
|
||||||
|
or set(self.entered_zones) & set(review_config.detections.required_zones)
|
||||||
|
):
|
||||||
|
return SeverityEnum.detection
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
def _is_false_positive(self):
|
def _is_false_positive(self):
|
||||||
# once a true positive, always a true positive
|
# once a true positive, always a true positive
|
||||||
if not self.false_positive:
|
if not self.false_positive:
|
||||||
@ -232,6 +254,7 @@ class TrackedObject:
|
|||||||
"attributes": self.attributes,
|
"attributes": self.attributes,
|
||||||
"current_attributes": self.obj_data["attributes"],
|
"current_attributes": self.obj_data["attributes"],
|
||||||
"pending_loitering": self.pending_loitering,
|
"pending_loitering": self.pending_loitering,
|
||||||
|
"max_severity": self.max_severity,
|
||||||
}
|
}
|
||||||
|
|
||||||
if include_thumbnail:
|
if include_thumbnail:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user