Maskrcnn-benchmark: TypeError When running the demo.py

Created on 8 Mar 2020  路  2Comments  路  Source: facebookresearch/maskrcnn-benchmark

I have installed the program but when I try to run a demo:
Traceback (most recent call last):
File "demo.py", line 29, in
predictions = coco_demo.run_on_opencv_image(img)
File "/home/yudongran/pyd/mask-rcnn/maskrcnn-benchmark/demo/predictor.py", line 220, in run_on_opencv_image
result = self.overlay_class_names(result, top_predictions)
File "/home/yudongran/pyd/mask-rcnn/maskrcnn-benchmark/demo/predictor.py", line 403, in overlay_class_names
cv2.putText(
TypeError: only integer tensors of a single element can be converted to an index

Most helpful comment

I have found the reason:
When you try to put the label in the image using cv2.putTest()
x, y should be Integer. Add a int() to convert the type of x & y, so the program is working.

All 2 comments

image
The problem is about the methods: overlay_keypoints and overlay_class_names. When I deleted these two methods I got the results but the output image has no label and the accuracy.

I have found the reason:
When you try to put the label in the image using cv2.putTest()
x, y should be Integer. Add a int() to convert the type of x & y, so the program is working.

Was this page helpful?
0 / 5 - 0 ratings