add area to face and license_plate attributes in debug and snapshots

This commit is contained in:
Josh Hawkins 2025-05-17 07:25:59 -05:00
parent ebae6cb1ed
commit 8057106b71
2 changed files with 4 additions and 2 deletions

View File

@ -172,6 +172,7 @@ class CameraState:
# draw any attributes # draw any attributes
for attribute in obj["current_attributes"]: for attribute in obj["current_attributes"]:
box = attribute["box"] box = attribute["box"]
box_area = int((box[2] - box[0]) * (box[3] - box[1]))
draw_box_with_label( draw_box_with_label(
frame_copy, frame_copy,
box[0], box[0],
@ -179,7 +180,7 @@ class CameraState:
box[2], box[2],
box[3], box[3],
attribute["label"], attribute["label"],
f"{attribute['score']:.0%}", f"{attribute['score']:.0%}{' ' + str(box_area) if attribute['label'] in ['license_plate', 'face'] else ''}",
thickness=thickness, thickness=thickness,
color=color, color=color,
) )

View File

@ -474,6 +474,7 @@ class TrackedObject:
# draw any attributes # draw any attributes
for attribute in self.thumbnail_data["attributes"]: for attribute in self.thumbnail_data["attributes"]:
box = attribute["box"] box = attribute["box"]
box_area = int((box[2] - box[0]) * (box[3] - box[1]))
draw_box_with_label( draw_box_with_label(
best_frame, best_frame,
box[0], box[0],
@ -481,7 +482,7 @@ class TrackedObject:
box[2], box[2],
box[3], box[3],
attribute["label"], attribute["label"],
f"{attribute['score']:.0%}", f"{attribute['score']:.0%}{' ' + str(box_area) if attribute['label'] in ['license_plate', 'face'] else ''}",
thickness=thickness, thickness=thickness,
color=color, color=color,
) )