mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 07:35:27 +03:00
Use the dynamic label map
This commit is contained in:
parent
0036a85523
commit
7931203261
@ -15,7 +15,7 @@ PLUS_API_HOST = "https://api.frigate.video"
|
|||||||
|
|
||||||
# Attribute & Object constants
|
# Attribute & Object constants
|
||||||
|
|
||||||
ATTRIBUTE_LABEL_MAP = {
|
DEFAULT_ATTRIBUTE_LABEL_MAP = {
|
||||||
"person": ["amazon", "face"],
|
"person": ["amazon", "face"],
|
||||||
"car": ["amazon", "fedex", "license_plate", "ups"],
|
"car": ["amazon", "fedex", "license_plate", "ups"],
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import requests
|
|||||||
from pydantic import BaseModel, ConfigDict, Field
|
from pydantic import BaseModel, ConfigDict, Field
|
||||||
from pydantic.fields import PrivateAttr
|
from pydantic.fields import PrivateAttr
|
||||||
|
|
||||||
from frigate.const import ATTRIBUTE_LABEL_MAP
|
from frigate.const import DEFAULT_ATTRIBUTE_LABEL_MAP
|
||||||
from frigate.plus import PlusApi
|
from frigate.plus import PlusApi
|
||||||
from frigate.util.builtin import generate_color_palette, load_labels
|
from frigate.util.builtin import generate_color_palette, load_labels
|
||||||
|
|
||||||
@ -130,7 +130,10 @@ class ModelConfig(BaseModel):
|
|||||||
self.model_type = model_info["type"]
|
self.model_type = model_info["type"]
|
||||||
|
|
||||||
# generate list of attribute labels
|
# generate list of attribute labels
|
||||||
self.attributes_map = model_info.get("attributes", ATTRIBUTE_LABEL_MAP)
|
self.attributes_map = {
|
||||||
|
**model_info.get("attributes", DEFAULT_ATTRIBUTE_LABEL_MAP),
|
||||||
|
**self.attributes_map,
|
||||||
|
}
|
||||||
unique_attributes = set()
|
unique_attributes = set()
|
||||||
|
|
||||||
for attributes in self.attributes_map.values():
|
for attributes in self.attributes_map.values():
|
||||||
|
|||||||
@ -16,7 +16,6 @@ from frigate.comms.config_updater import ConfigSubscriber
|
|||||||
from frigate.comms.inter_process import InterProcessRequestor
|
from frigate.comms.inter_process import InterProcessRequestor
|
||||||
from frigate.config import CameraConfig, DetectConfig, ModelConfig
|
from frigate.config import CameraConfig, DetectConfig, ModelConfig
|
||||||
from frigate.const import (
|
from frigate.const import (
|
||||||
ATTRIBUTE_LABEL_MAP,
|
|
||||||
CACHE_DIR,
|
CACHE_DIR,
|
||||||
CACHE_SEGMENT_FORMAT,
|
CACHE_SEGMENT_FORMAT,
|
||||||
REQUEST_REGION_GRID,
|
REQUEST_REGION_GRID,
|
||||||
@ -736,7 +735,7 @@ def process_frames(
|
|||||||
|
|
||||||
# group the attribute detections based on what label they apply to
|
# group the attribute detections based on what label they apply to
|
||||||
attribute_detections = {}
|
attribute_detections = {}
|
||||||
for label, attribute_labels in ATTRIBUTE_LABEL_MAP.items():
|
for label, attribute_labels in model_config.attributes_map.items():
|
||||||
attribute_detections[label] = [
|
attribute_detections[label] = [
|
||||||
d for d in consolidated_detections if d[0] in attribute_labels
|
d for d in consolidated_detections if d[0] in attribute_labels
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user