Closed yusufcananar closed 1 year ago
box is a tensor type variable so run_ssd_example.py gives an error.
box = boxes[i, :] cv2.rectangle(orig_image, (box[0], box[1]), (box[2], box[3]), (255, 255, 0), 4) cv2.putText(orig_image, label, (box[0] + 20, box[1] + 40), cv2.FONT_HERSHEY_SIMPLEX, 1, # font scale (255, 0, 255), 2) # line type
Changing the box coordinates into numpy and int will fix the issue.
bbox1 = int(box[0].numpy()) bbox2 = int(box[1].numpy()) bbox3 = int(box[2].numpy()) bbox4 = int(box[3].numpy()) cv2.rectangle(orig_image, (bbox1, bbox2), (bbox3, bbox4), (255, 0, 0), 1) cv2.putText(orig_image, label, (bbox1 - 5 , bbox2 - 5), cv2.FONT_HERSHEY_SIMPLEX, 0.25, # font scale (255, 0, 0), 1) # line type
box is a tensor type variable so run_ssd_example.py gives an error.
Solution
Changing the box coordinates into numpy and int will fix the issue.