"gcv.utils.viz.plot_bbox" for display is so slow

#1

When I use the following step to show the detection results, its speed is so slow that about 1s for showing a frame.

plt.cla()
axes = gcv.utils.viz.plot_bbox(frame, bounding_boxes[0], scores[0], class_IDs[0], class_names=net.classes, ax=axes)
plt.draw()
plt.pause(0.001)

So, is there another fast way to display the detection results?

#2

You can rewrite it using OpenCV it is a lot faster.
cv2.line cv2.circle cv2.rectangle for drawing and

cv2.namedWindow('image', cv2.WINDOW_NORMAL)
cv2.imshow('image', img)
cv2.waitKey(1)

for the window
Beware of the RGB/BGR difference between matplotlib and openCV.

#3

Follow your suggestion, I have tryed to use OpenCV for displaying, but its speed seems not faster than the given Gluoncv function (gcv.utils.viz.plot_bbox).

num_s = [i for i in scores[0] if i>0.6]
np_boxes = bounding_boxes[0].asnumpy() 

for j in range(len(num_s)):

	boxes = np_boxes[j]
	cv2.rectangle(frame, (boxes[0],boxes[1]), (boxes[2],boxes[3]), (0,0,255), 2)
		
	cv2.namedWindow('image', cv2.WINDOW_NORMAL)
	cv2.imshow('image', frame)
	cv2.waitKey(1)

The above step just draws the bounding boxes, not showing different colors of boxes and scores.