mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-06-21 03:41:55 +03:00
sync top-level model with default detector's resolved model
when the user doesn't define a top-level `model:` block, `FrigateConfig.model` stayed at pydantic field defaults (320×320, /labelmap.txt) while the per-detector model picked up `DEFAULT_MODEL` for openvino on cpu (300×300, coco_91cl_bkgr.txt introduced in #23127), causing `RemoteObjectDetector` to fail with "buffer is too small for requested array" because the SHM was sized from the per-detector model but mapped using the top-level one. After the detector loop, copy the first detector's resolved model up to `self.model` so both sides agree on dimensions and labelmap
This commit is contained in:
parent
7bde6f4338
commit
6fa005fd56
@ -708,6 +708,14 @@ class FrigateConfig(FrigateBaseModel):
|
||||
detector_config.model = model
|
||||
self.detectors[key] = detector_config
|
||||
|
||||
# If the top-level model is unset, adopt the first detector's resolved
|
||||
# model so worker processes (which receive self.model) agree with the
|
||||
# dimensions used to size the detection shared memory in start_detectors.
|
||||
if not self.model.model_dump(exclude_unset=True, warnings="none") and self.detectors:
|
||||
first_detector = next(iter(self.detectors.values()))
|
||||
if first_detector.model is not None:
|
||||
self.model = first_detector.model
|
||||
|
||||
for name, camera in self.cameras.items():
|
||||
modified_global_config = global_config.copy()
|
||||
|
||||
|
||||
@ -964,8 +964,11 @@ class TestConfig(unittest.TestCase):
|
||||
},
|
||||
}
|
||||
|
||||
# With no model defined, the top-level model adopts the default
|
||||
# detector's resolved model (openvino + ssdlite_mobilenet_v2 with the
|
||||
# coco_91cl_bkgr labelmap, which has __background__ at index 0).
|
||||
frigate_config = FrigateConfig(**config)
|
||||
assert frigate_config.model.merged_labelmap[0] == "person"
|
||||
assert frigate_config.model.merged_labelmap[1] == "person"
|
||||
|
||||
def test_default_labelmap(self):
|
||||
config = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user