My code is:
import gluoncv as gcv
net = gcv.model_zoo.get_model('ssd_512_mobilenet1.0_voc', pretrained=True)
windowName = "ssdObject"
cv2.namedWindow(windowName, cv2.WINDOW_NORMAL)
cv2.resizeWindow(windowName, 1280, 720)
cv2.moveWindow(windowName, 0, 0)
cv2.setWindowTitle(windowName, "SSD Object Detection")
while True:
# Check to see if the user closed the window
if cv2.getWindowProperty(windowName, 0) < 0:
# This will fail if the user closed the window; Nasties get printed to the console
break
ret_val, frame = video_capture.read()
frame = mx.nd.array(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)).astype('uint8')
rgb_nd, frame = gcv.data.transforms.presets.ssd.transform_test(frame, short=512, max_size=700)
# # Run frame through network
class_IDs, scores, bounding_boxes = net(rgb_nd)
displayBuf = frame
cv2.imshow(windowName, displayBuf)
cv2.waitKey(0)
I somehow need to draw the bounding_codes
, class_IDs
, and scores
onto the image and output it via imshow
.
How can I accomplish this?