Add interference speed

This commit is contained in:
proitlab committed 2026-07-02 16:28:12 +07:00
1 parent cdf8e98228
commit 641da193d1
1 file changed
+6 -3
+6 -3
View File
@@ -854,12 +854,12 @@ def draw_hud(
)
def draw_footer(img, w, h, frame_idx, live_tag):
def draw_footer(img, w, h, frame_idx, live_tag, inf_ms=0.0):
bar_h = 28
overlay_rect(img, 0, h - bar_h, w, h, C_PANEL, alpha=0.55)
cv2.putText(
img,
f"{live_tag} | Frame {frame_idx}",
f"{live_tag} | Frame {frame_idx} | Inf {inf_ms:.1f}ms",
(12, h - 9),
cv2.FONT_HERSHEY_SIMPLEX,
0.45,
@@ -1014,6 +1014,7 @@ def run():
session_start = time.time()
frame_idx = 0
inf_ms = 0.0
video_writer = None
cap, w, h, fps = connect_stream(SOURCE)
@@ -1061,7 +1062,9 @@ def run():
mono = time.monotonic()
ayam_crossed_frame = batch_closed_frame = batch_started_frame = False
inf_start = time.time()
detections = model(frame)
inf_ms = inf_ms * 0.9 + (time.time() - inf_start) * 1000 * 0.1
if detections:
ayam_boxes_xyxy = []
@@ -1233,7 +1236,7 @@ def run():
)
draw_batch_banner(frame, w, batch_num, batch_pulse)
draw_footer(
frame, w, h, frame_idx, "LIVE-RKNN-BT" if IS_LIVE else "FILE-RKNN-BT"
frame, w, h, frame_idx, "LIVE-RKNN-BT" if IS_LIVE else "FILE-RKNN-BT", inf_ms
)
popups = draw_popups(frame, popups, frame_idx)