mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-03 01:22:17 +03:00
Fix label check (#14610)
* Create config for parsing object * Use in maintainer
This commit is contained in:
committed by
Blake Blackshear
parent
c4ce7f9800
commit
711575736d
@@ -1,6 +1,6 @@
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
from pydantic import Field, field_serializer
|
||||
from pydantic import Field, PrivateAttr, field_serializer
|
||||
|
||||
from ..base import FrigateBaseModel
|
||||
|
||||
@@ -53,3 +53,20 @@ class ObjectConfig(FrigateBaseModel):
|
||||
default_factory=dict, title="Object filters."
|
||||
)
|
||||
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)
|
||||
|
||||
@@ -599,13 +599,8 @@ class FrigateConfig(FrigateBaseModel):
|
||||
verify_autotrack_zones(camera_config)
|
||||
verify_motion_and_detect(camera_config)
|
||||
|
||||
# get list of unique enabled labels for tracking
|
||||
enabled_labels = set(self.objects.track)
|
||||
|
||||
for camera in self.cameras.values():
|
||||
enabled_labels.update(camera.objects.track)
|
||||
|
||||
self.model.create_colormap(sorted(enabled_labels))
|
||||
self.objects.parse_all_objects(self.cameras)
|
||||
self.model.create_colormap(sorted(self.objects.all_objects))
|
||||
self.model.check_and_load_plus_model(self.plus_api)
|
||||
|
||||
for key, detector in self.detectors.items():
|
||||
|
||||
Reference in New Issue
Block a user