Show sub label in debug view when available (#7567)

* Show sub label in debug view if available

* Ensure sub label is printable to be used
This commit is contained in:
Nicolas Mowen
2023-09-01 06:03:47 -06:00
committed by GitHub
parent bbdf5e1bee
commit 45f7db5cf1
2 changed files with 16 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ from frigate.util.image import (
calculate_region,
draw_box_with_label,
draw_timestamp,
is_label_printable,
)
logger = logging.getLogger(__name__)
@@ -509,13 +510,21 @@ class CameraState:
# draw the bounding boxes on the frame
box = obj["box"]
text = (
obj["label"]
if (
not obj.get("sub_label")
or not is_label_printable(obj["sub_label"][0])
)
else obj["sub_label"][0]
)
draw_box_with_label(
frame_copy,
box[0],
box[1],
box[2],
box[3],
obj["label"],
text,
f"{obj['score']:.0%} {int(obj['area'])}",
thickness=thickness,
color=color,