Skip to content

Commit

Permalink
Set default min score for attributes labels to 0.7 (#8001)
Browse files Browse the repository at this point in the history
* Set min score for attributes to 0.7

* Allow other fields to be set
  • Loading branch information
NickM-27 committed Sep 30, 2023
1 parent 22b9507 commit 9a4f970
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion frigate/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from pydantic.fields import PrivateAttr

from frigate.const import (
ALL_ATTRIBUTE_LABELS,
AUDIO_MIN_CONFIDENCE,
CACHE_DIR,
DEFAULT_DB_PATH,
Expand Down Expand Up @@ -473,7 +474,7 @@ def __init__(self, **config):

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.")


Expand Down Expand Up @@ -1077,6 +1078,13 @@ def runtime_config(self, plus_api: PlusApi = None) -> FrigateConfig:
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={
Expand Down

0 comments on commit 9a4f970

Please sign in to comment.