From 9a4f9703370e4cc4af42b79e6a35409844a3d3ba Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Sat, 30 Sep 2023 06:38:15 -0600 Subject: [PATCH] Set default min score for attributes labels to 0.7 (#8001) * Set min score for attributes to 0.7 * Allow other fields to be set --- frigate/config.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frigate/config.py b/frigate/config.py index 847735b12..90740150c 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -13,6 +13,7 @@ from pydantic import BaseModel, Extra, Field, parse_obj_as, validator from pydantic.fields import PrivateAttr from frigate.const import ( + ALL_ATTRIBUTE_LABELS, AUDIO_MIN_CONFIDENCE, CACHE_DIR, DEFAULT_DB_PATH, @@ -473,7 +474,7 @@ class ZoneConfig(BaseModel): class ObjectConfig(FrigateBaseModel): track: List[str] = Field(default=DEFAULT_TRACKED_OBJECTS, title="Objects to track.") - filters: Optional[Dict[str, FilterConfig]] = Field(title="Object filters.") + filters: Dict[str, FilterConfig] = Field(default={}, title="Object filters.") mask: Union[str, List[str]] = Field(default="", title="Object mask.") @@ -1077,6 +1078,13 @@ class FrigateConfig(FrigateBaseModel): config.mqtt.user = config.mqtt.user.format(**FRIGATE_ENV_VARS) config.mqtt.password = config.mqtt.password.format(**FRIGATE_ENV_VARS) + # set default min_score for object attributes + for attribute in ALL_ATTRIBUTE_LABELS: + if not config.objects.filters.get(attribute): + config.objects.filters[attribute] = FilterConfig(min_score=0.7) + elif config.objects.filters[attribute].min_score == 0.5: + config.objects.filters[attribute].min_score = 0.7 + # Global config to propagate down to camera level global_config = config.dict( include={