mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-12 09:42:47 +03:00
Fix LPR vehicle message for multiple models (#24119)
* use the camera's model for the lpr vehicle check `FrigateConfig.model` became `models[]` in the detector refactor, so this didn't compile on 0.19. Each camera has its own detector/model pair now, so the check resolves the camera's scene with `getModelForCamera` instead of looking at every model. * use camera config model * fix export test
This commit is contained in:
@@ -63,7 +63,7 @@ class CameraState:
|
|||||||
self.lpr_min_obj_area: int = 0
|
self.lpr_min_obj_area: int = 0
|
||||||
self.lp_objects = {
|
self.lp_objects = {
|
||||||
label
|
label
|
||||||
for label, attributes in config.model.attributes_map.items()
|
for label, attributes in self.model.attributes_map.items()
|
||||||
if "license_plate" in attributes
|
if "license_plate" in attributes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1530,7 +1530,7 @@ class TestHttpExport(BaseTestHttp):
|
|||||||
)
|
)
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory() as tmpdir:
|
with tempfile.TemporaryDirectory() as tmpdir:
|
||||||
video_path = os.path.join(tmpdir, "multibyte_export.mp4")
|
video_path = os.path.join(tmpdir, "現場カメラ.mp4")
|
||||||
with open(video_path, "wb") as handle:
|
with open(video_path, "wb") as handle:
|
||||||
handle.write(b"video")
|
handle.write(b"video")
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { getModelForCamera } from "@/utils/modelUtil";
|
||||||
import type { SectionConfigOverrides } from "./types";
|
import type { SectionConfigOverrides } from "./types";
|
||||||
|
|
||||||
const lpr: SectionConfigOverrides = {
|
const lpr: SectionConfigOverrides = {
|
||||||
@@ -21,12 +22,10 @@ const lpr: SectionConfigOverrides = {
|
|||||||
if (ctx.level !== "camera" || !ctx.fullCameraConfig) return false;
|
if (ctx.level !== "camera" || !ctx.fullCameraConfig) return false;
|
||||||
if (ctx.fullCameraConfig.type === "lpr") return false;
|
if (ctx.fullCameraConfig.type === "lpr") return false;
|
||||||
const tracked = ctx.fullCameraConfig.objects?.track ?? [];
|
const tracked = ctx.fullCameraConfig.objects?.track ?? [];
|
||||||
const vehicles = Object.entries(
|
const model = getModelForCamera(ctx.fullConfig, ctx.cameraName);
|
||||||
ctx.fullConfig.model?.attributes_map ?? {},
|
return !tracked.some((o) =>
|
||||||
)
|
model?.attributes_map?.[o]?.includes("license_plate"),
|
||||||
.filter(([, attributes]) => attributes.includes("license_plate"))
|
);
|
||||||
.map(([label]) => label);
|
|
||||||
return !tracked.some((o) => vehicles.includes(o));
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user