Show FPS on demo video
Browse files- rtmo_demo.py +3 -1
- rtmo_demo_batch.py +3 -1
rtmo_demo.py
CHANGED
@@ -38,7 +38,8 @@ if __name__ == "__main__":
|
|
38 |
s = time.time()
|
39 |
keypoints, scores = body(frame)
|
40 |
det_time = time.time() - s
|
41 |
-
|
|
|
42 |
|
43 |
img_show = frame.copy()
|
44 |
|
@@ -51,5 +52,6 @@ if __name__ == "__main__":
|
|
51 |
kpt_thr=0.3,
|
52 |
line_width=2)
|
53 |
img_show = resize_to_fit_screen(img_show, 720, 480)
|
|
|
54 |
cv2.imshow(f'{model}', img_show)
|
55 |
cv2.waitKey(10)
|
|
|
38 |
s = time.time()
|
39 |
keypoints, scores = body(frame)
|
40 |
det_time = time.time() - s
|
41 |
+
fps = round(1.0 / det_time,1)
|
42 |
+
print(f'det: {fps} FPS')
|
43 |
|
44 |
img_show = frame.copy()
|
45 |
|
|
|
52 |
kpt_thr=0.3,
|
53 |
line_width=2)
|
54 |
img_show = resize_to_fit_screen(img_show, 720, 480)
|
55 |
+
cv2.putText(img_show, f'{fps:.1f}', (10, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 255, 0), 1, cv2.LINE_AA)
|
56 |
cv2.imshow(f'{model}', img_show)
|
57 |
cv2.waitKey(10)
|
rtmo_demo_batch.py
CHANGED
@@ -26,7 +26,8 @@ def process_video(video_path, body_estimator, batch_size=4):
|
|
26 |
s = time.time()
|
27 |
batch_keypoints, batch_scores = body_estimator(batch_frames)
|
28 |
det_time = time.time() - s
|
29 |
-
|
|
|
30 |
|
31 |
for i, keypoints in enumerate(batch_keypoints):
|
32 |
scores = batch_scores[i]
|
@@ -34,6 +35,7 @@ def process_video(video_path, body_estimator, batch_size=4):
|
|
34 |
img_show = frame.copy()
|
35 |
img_show = draw_skeleton(img_show, keypoints, scores, kpt_thr=0.3, line_width=2)
|
36 |
img_show = resize_to_fit_screen(img_show, 720, 480)
|
|
|
37 |
cv2.imshow(f'{video_path}', img_show)
|
38 |
cv2.waitKey(10)
|
39 |
|
|
|
26 |
s = time.time()
|
27 |
batch_keypoints, batch_scores = body_estimator(batch_frames)
|
28 |
det_time = time.time() - s
|
29 |
+
fps = round(batch_size / det_time, 1)
|
30 |
+
print(f'Batch det: {fps} FPS')
|
31 |
|
32 |
for i, keypoints in enumerate(batch_keypoints):
|
33 |
scores = batch_scores[i]
|
|
|
35 |
img_show = frame.copy()
|
36 |
img_show = draw_skeleton(img_show, keypoints, scores, kpt_thr=0.3, line_width=2)
|
37 |
img_show = resize_to_fit_screen(img_show, 720, 480)
|
38 |
+
cv2.putText(img_show, f'{fps:.1f}', (10, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 255, 0), 1, cv2.LINE_AA)
|
39 |
cv2.imshow(f'{video_path}', img_show)
|
40 |
cv2.waitKey(10)
|
41 |
|