mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Bug fixes (#6332)
* fix timeline delete * fix labelmap in config response * create cache dirs if needed
This commit is contained in:
parent
9bf98f908d
commit
19890310fe
@ -867,9 +867,9 @@ def config():
|
||||
config["plus"] = {"enabled": current_app.plus_api.is_active()}
|
||||
|
||||
for detector, detector_config in config["detectors"].items():
|
||||
detector_config["model"]["labelmap"] = current_app.frigate_config.detectors[
|
||||
detector
|
||||
].model.merged_labelmap
|
||||
detector_config["model"][
|
||||
"labelmap"
|
||||
] = current_app.frigate_config.model.merged_labelmap
|
||||
|
||||
return jsonify(config)
|
||||
|
||||
|
@ -141,7 +141,7 @@ class RecordingCleanup(threading.Thread):
|
||||
deleted_recordings.add(recording.id)
|
||||
|
||||
# delete timeline entries relevant to this recording segment
|
||||
Timeline.delete(
|
||||
Timeline.delete().where(
|
||||
Timeline.timestamp.between(
|
||||
recording.start_time, recording.end_time
|
||||
),
|
||||
|
@ -1,3 +1,5 @@
|
||||
import json
|
||||
import os
|
||||
import unittest
|
||||
import numpy as np
|
||||
from pydantic import ValidationError
|
||||
@ -6,7 +8,9 @@ from frigate.config import (
|
||||
BirdseyeModeEnum,
|
||||
FrigateConfig,
|
||||
)
|
||||
from frigate.const import MODEL_CACHE_DIR
|
||||
from frigate.detectors import DetectorTypeEnum
|
||||
from frigate.plus import PlusApi
|
||||
from frigate.util import deep_merge, load_config_with_no_duplicates
|
||||
|
||||
|
||||
@ -30,6 +34,35 @@ class TestConfig(unittest.TestCase):
|
||||
},
|
||||
}
|
||||
|
||||
self.plus_model_info = {
|
||||
"id": "e63b7345cc83a84ed79dedfc99c16616",
|
||||
"name": "SSDLite Mobiledet",
|
||||
"description": "Fine tuned model",
|
||||
"trainDate": "2023-04-28T23:22:01.262Z",
|
||||
"type": "ssd",
|
||||
"supportedDetectors": ["edgetpu"],
|
||||
"width": 320,
|
||||
"height": 320,
|
||||
"inputShape": "nhwc",
|
||||
"pixelFormat": "rgb",
|
||||
"labelMap": {
|
||||
"0": "amazon",
|
||||
"1": "car",
|
||||
"2": "cat",
|
||||
"3": "deer",
|
||||
"4": "dog",
|
||||
"5": "face",
|
||||
"6": "fedex",
|
||||
"7": "license_plate",
|
||||
"8": "package",
|
||||
"9": "person",
|
||||
"10": "ups",
|
||||
},
|
||||
}
|
||||
|
||||
if not os.path.exists(MODEL_CACHE_DIR) and not os.path.islink(MODEL_CACHE_DIR):
|
||||
os.makedirs(MODEL_CACHE_DIR)
|
||||
|
||||
def test_config_class(self):
|
||||
frigate_config = FrigateConfig(**self.minimal)
|
||||
assert self.minimal == frigate_config.dict(exclude_unset=True)
|
||||
@ -815,6 +848,40 @@ class TestConfig(unittest.TestCase):
|
||||
runtime_config = frigate_config.runtime_config()
|
||||
assert runtime_config.model.merged_labelmap[0] == "person"
|
||||
|
||||
def test_plus_labelmap(self):
|
||||
with open("/config/model_cache/test", "w") as f:
|
||||
json.dump(self.plus_model_info, f)
|
||||
with open("/config/model_cache/test.json", "w") as f:
|
||||
json.dump(self.plus_model_info, f)
|
||||
|
||||
config = {
|
||||
"mqtt": {"host": "mqtt"},
|
||||
"model": {"path": "plus://test"},
|
||||
"cameras": {
|
||||
"back": {
|
||||
"ffmpeg": {
|
||||
"inputs": [
|
||||
{
|
||||
"path": "rtsp://10.0.0.1:554/video",
|
||||
"roles": ["detect"],
|
||||
},
|
||||
]
|
||||
},
|
||||
"detect": {
|
||||
"height": 1080,
|
||||
"width": 1920,
|
||||
"fps": 5,
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert config == frigate_config.dict(exclude_unset=True)
|
||||
|
||||
runtime_config = frigate_config.runtime_config(PlusApi())
|
||||
assert runtime_config.model.merged_labelmap[0] == "amazon"
|
||||
|
||||
def test_fails_on_invalid_role(self):
|
||||
config = {
|
||||
"mqtt": {"host": "mqtt"},
|
||||
|
Loading…
Reference in New Issue
Block a user