From f1ba071656c6ca3d7c157a81c9e765fe479f10de Mon Sep 17 00:00:00 2001 From: ze23 <44813608+ze23@users.noreply.github.com> Date: Thu, 25 Mar 2021 15:28:53 +0100 Subject: [PATCH] Fix run_ssd_live_demo.py issues Two issues fixed using int() function on box[i] values : - "function takes exactly 4 arguments (2 given)" - "only integer tensors of a single element can be converted to an index" --- run_ssd_live_demo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run_ssd_live_demo.py b/run_ssd_live_demo.py index 9a3fcfc3..52c0ae42 100644 --- a/run_ssd_live_demo.py +++ b/run_ssd_live_demo.py @@ -73,10 +73,10 @@ for i in range(boxes.size(0)): box = boxes[i, :] label = f"{class_names[labels[i]]}: {probs[i]:.2f}" - cv2.rectangle(orig_image, (box[0], box[1]), (box[2], box[3]), (255, 255, 0), 4) + cv2.rectangle(orig_image, (int(box[0]), int(box[1])), (int(box[2]), int(box[3])), (255, 255, 0), 4) cv2.putText(orig_image, label, - (box[0]+20, box[1]+40), + (int(box[0])+20, int(box[1])+40), cv2.FONT_HERSHEY_SIMPLEX, 1, # font scale (255, 0, 255),