mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-18 17:14:26 +03:00
Add migration to migrate to model_path
This commit is contained in:
parent
38e098ca31
commit
c2e3938ec0
@ -13,7 +13,7 @@ from frigate.util.services import get_video_properties
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
CURRENT_CONFIG_VERSION = "0.15-0"
|
CURRENT_CONFIG_VERSION = "0.15-1"
|
||||||
DEFAULT_CONFIG_FILE = "/config/config.yml"
|
DEFAULT_CONFIG_FILE = "/config/config.yml"
|
||||||
|
|
||||||
|
|
||||||
@ -77,6 +77,13 @@ def migrate_frigate_config(config_file: str):
|
|||||||
yaml.dump(new_config, f)
|
yaml.dump(new_config, f)
|
||||||
previous_version = "0.15-0"
|
previous_version = "0.15-0"
|
||||||
|
|
||||||
|
if previous_version < "0.15-1":
|
||||||
|
logger.info(f"Migrating frigate config from {previous_version} to 0.15-1...")
|
||||||
|
new_config = migrate_015_1(config)
|
||||||
|
with open(config_file, "w") as f:
|
||||||
|
yaml.dump(new_config, f)
|
||||||
|
previous_version = "0.15-1"
|
||||||
|
|
||||||
logger.info("Finished frigate config migration...")
|
logger.info("Finished frigate config migration...")
|
||||||
|
|
||||||
|
|
||||||
@ -267,6 +274,20 @@ def migrate_015_0(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]
|
|||||||
return new_config
|
return new_config
|
||||||
|
|
||||||
|
|
||||||
|
def migrate_015_1(config: dict[str, dict[str, any]]) -> dict[str, dict[str, any]]:
|
||||||
|
"""Handle migrating frigate config to 0.15-1"""
|
||||||
|
new_config = config.copy()
|
||||||
|
|
||||||
|
for detector, detector_config in config.get("detectors", {}).items():
|
||||||
|
path = detector_config.get("model", {}).get("path")
|
||||||
|
|
||||||
|
if path:
|
||||||
|
new_config["detectors"][detector]["model_path"] = path
|
||||||
|
del new_config["detectors"][detector]["model"]
|
||||||
|
|
||||||
|
return new_config
|
||||||
|
|
||||||
|
|
||||||
def get_relative_coordinates(
|
def get_relative_coordinates(
|
||||||
mask: Optional[Union[str, list]], frame_shape: tuple[int, int]
|
mask: Optional[Union[str, list]], frame_shape: tuple[int, int]
|
||||||
) -> Union[str, list]:
|
) -> Union[str, list]:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user