mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-01 19:17:41 +03:00
Check for existence of model.path & model.labelmap_path on config save.
This commit is contained in:
parent
63f9689b0e
commit
1762f3524a
@ -511,6 +511,10 @@ class FrigateConfig(FrigateBaseModel):
|
||||
elif detector_config.type == "edgetpu":
|
||||
model_config["path"] = "/edgetpu_model.tflite"
|
||||
|
||||
# Verify that the model path points to an existing file.
|
||||
if not os.path.exists(model_config["path"]):
|
||||
raise ValueError(f"Model path '{model_config['path']}' does not exist.")
|
||||
|
||||
model = ModelConfig.model_validate(model_config)
|
||||
model.check_and_load_plus_model(self.plus_api, detector_config.type)
|
||||
model.compute_model_hash()
|
||||
|
||||
@ -103,6 +103,12 @@ class ModelConfig(BaseModel):
|
||||
def __init__(self, **config):
|
||||
super().__init__(**config)
|
||||
|
||||
# Verify that the labelmap path points to an existing file.
|
||||
if not os.path.exists(config.get("labelmap_path", "/labelmap.txt")):
|
||||
raise ValueError(
|
||||
f"Model labelmap_path '{config.get('labelmap_path', '/labelmap.txt')}' does not exist."
|
||||
)
|
||||
|
||||
self._merged_labelmap = {
|
||||
**load_labels(config.get("labelmap_path", "/labelmap.txt")),
|
||||
**config.get("labelmap", {}),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user