mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-07-14 07:51:14 +03:00
prune object filters for unsupported labels when cleaning tracked objects
This commit is contained in:
parent
c218286a9f
commit
0be3aefe3d
@ -400,6 +400,9 @@ def verify_objects_track(
|
|||||||
)
|
)
|
||||||
camera_config.objects.track = valid_objects
|
camera_config.objects.track = valid_objects
|
||||||
|
|
||||||
|
for label in invalid_objects:
|
||||||
|
camera_config.objects.filters.pop(label, None)
|
||||||
|
|
||||||
|
|
||||||
def verify_lpr_and_face(
|
def verify_lpr_and_face(
|
||||||
frigate_config: FrigateConfig, camera_config: CameraConfig
|
frigate_config: FrigateConfig, camera_config: CameraConfig
|
||||||
|
|||||||
@ -397,6 +397,43 @@ class TestConfig(unittest.TestCase):
|
|||||||
assert "dog" in frigate_config.cameras["back"].objects.filters
|
assert "dog" in frigate_config.cameras["back"].objects.filters
|
||||||
assert frigate_config.cameras["back"].objects.filters["dog"].threshold == 0.7
|
assert frigate_config.cameras["back"].objects.filters["dog"].threshold == 0.7
|
||||||
|
|
||||||
|
def test_unsupported_tracked_object_pruned_from_track_and_filters(self):
|
||||||
|
# "unicorn" is not in the model labelmap, so it must be removed from the
|
||||||
|
# tracked objects AND from the object filters, otherwise a stale filter
|
||||||
|
# entry lingers in the parsed config.
|
||||||
|
config = {
|
||||||
|
"mqtt": {"host": "mqtt"},
|
||||||
|
"cameras": {
|
||||||
|
"back": {
|
||||||
|
"ffmpeg": {
|
||||||
|
"inputs": [
|
||||||
|
{"path": "rtsp://10.0.0.1:554/video", "roles": ["detect"]}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"detect": {
|
||||||
|
"height": 1080,
|
||||||
|
"width": 1920,
|
||||||
|
"fps": 5,
|
||||||
|
},
|
||||||
|
"objects": {
|
||||||
|
"track": ["person", "unicorn"],
|
||||||
|
"filters": {
|
||||||
|
"person": {"threshold": 0.7},
|
||||||
|
"unicorn": {"threshold": 0.7},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
frigate_config = FrigateConfig(**config)
|
||||||
|
objects = frigate_config.cameras["back"].objects
|
||||||
|
assert "unicorn" not in objects.track
|
||||||
|
assert "unicorn" not in objects.filters
|
||||||
|
# supported entries are left untouched
|
||||||
|
assert "person" in objects.track
|
||||||
|
assert "person" in objects.filters
|
||||||
|
|
||||||
def test_global_object_mask(self):
|
def test_global_object_mask(self):
|
||||||
config = {
|
config = {
|
||||||
"mqtt": {"host": "mqtt"},
|
"mqtt": {"host": "mqtt"},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user