mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Fix label check (#14610)
* Create config for parsing object * Use in maintainer
This commit is contained in:
parent
b72f341b89
commit
848654311b
@ -1,6 +1,6 @@
|
|||||||
from typing import Any, Optional, Union
|
from typing import Any, Optional, Union
|
||||||
|
|
||||||
from pydantic import Field, field_serializer
|
from pydantic import Field, PrivateAttr, field_serializer
|
||||||
|
|
||||||
from ..base import FrigateBaseModel
|
from ..base import FrigateBaseModel
|
||||||
|
|
||||||
@ -53,3 +53,20 @@ class ObjectConfig(FrigateBaseModel):
|
|||||||
default_factory=dict, title="Object filters."
|
default_factory=dict, title="Object filters."
|
||||||
)
|
)
|
||||||
mask: Union[str, list[str]] = Field(default="", title="Object mask.")
|
mask: Union[str, list[str]] = Field(default="", title="Object mask.")
|
||||||
|
_all_objects: list[str] = PrivateAttr()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def all_objects(self) -> list[str]:
|
||||||
|
return self._all_objects
|
||||||
|
|
||||||
|
def parse_all_objects(self, cameras):
|
||||||
|
if "_all_objects" in self:
|
||||||
|
return
|
||||||
|
|
||||||
|
# get list of unique enabled labels for tracking
|
||||||
|
enabled_labels = set(self.track)
|
||||||
|
|
||||||
|
for camera in cameras.values():
|
||||||
|
enabled_labels.update(camera.objects.track)
|
||||||
|
|
||||||
|
self._all_objects = list(enabled_labels)
|
||||||
|
@ -595,13 +595,8 @@ class FrigateConfig(FrigateBaseModel):
|
|||||||
verify_autotrack_zones(camera_config)
|
verify_autotrack_zones(camera_config)
|
||||||
verify_motion_and_detect(camera_config)
|
verify_motion_and_detect(camera_config)
|
||||||
|
|
||||||
# get list of unique enabled labels for tracking
|
self.objects.parse_all_objects(self.cameras)
|
||||||
enabled_labels = set(self.objects.track)
|
self.model.create_colormap(sorted(self.objects.all_objects))
|
||||||
|
|
||||||
for camera in self.cameras.values():
|
|
||||||
enabled_labels.update(camera.objects.track)
|
|
||||||
|
|
||||||
self.model.create_colormap(sorted(enabled_labels))
|
|
||||||
self.model.check_and_load_plus_model(self.plus_api)
|
self.model.check_and_load_plus_model(self.plus_api)
|
||||||
|
|
||||||
for key, detector in self.detectors.items():
|
for key, detector in self.detectors.items():
|
||||||
|
@ -64,7 +64,7 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
|
|
||||||
# set face recognition conditions
|
# set face recognition conditions
|
||||||
self.face_recognition_enabled = self.config.face_recognition.enabled
|
self.face_recognition_enabled = self.config.face_recognition.enabled
|
||||||
self.requires_face_detection = "face" not in self.config.model.all_attributes
|
self.requires_face_detection = "face" not in self.config.objects.all_objects
|
||||||
self.detected_faces: dict[str, float] = {}
|
self.detected_faces: dict[str, float] = {}
|
||||||
|
|
||||||
# create communication for updating event descriptions
|
# create communication for updating event descriptions
|
||||||
@ -76,7 +76,7 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
# set license plate recognition conditions
|
# set license plate recognition conditions
|
||||||
self.lpr_config = self.config.lpr
|
self.lpr_config = self.config.lpr
|
||||||
self.requires_license_plate_detection = (
|
self.requires_license_plate_detection = (
|
||||||
"license_plate" not in self.config.model.all_attributes
|
"license_plate" not in self.config.objects.all_objects
|
||||||
)
|
)
|
||||||
self.detected_license_plates: dict[str, dict[str, any]] = {}
|
self.detected_license_plates: dict[str, dict[str, any]] = {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user