From 24e1a7d50e02e9eb5d96cf04716a3a9e81bd3393 Mon Sep 17 00:00:00 2001 From: cnn Date: Mon, 31 May 2021 15:28:09 +0800 Subject: [PATCH] fix bug of predict video (#3158) (#3218) --- deploy/python/infer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deploy/python/infer.py b/deploy/python/infer.py index 6ea92ed3d..99d5424c0 100644 --- a/deploy/python/infer.py +++ b/deploy/python/infer.py @@ -534,6 +534,8 @@ def predict_video(detector, camera_id): capture = cv2.VideoCapture(FLAGS.video_file) video_name = os.path.split(FLAGS.video_file)[-1] fps = 30 + frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT)) + print('frame_count', frame_count) width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH)) height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT)) # yapf: disable @@ -550,7 +552,7 @@ def predict_video(detector, camera_id): break print('detect frame:%d' % (index)) index += 1 - results = detector.predict(frame, FLAGS.threshold) + results = detector.predict([frame], FLAGS.threshold) im = visualize_box_mask( frame, results, -- GitLab