File "/opt/conda/bin/retinanet-debug", line 8, in
sys.exit(main())
File "/opt/conda/lib/python3.7/site-packages/keras_retinanet/bin/debug.py", line 321, in main
run(generator, args, anchor_params=anchor_params, pyramid_levels=pyramid_levels)
File "/opt/conda/lib/python3.7/site-packages/keras_retinanet/bin/debug.py", line 228, in run
draw_annotations(image, annotations, color=(0, 0, 255), label_to_name=generator.label_to_name)
File "/opt/conda/lib/python3.7/site-packages/keras_retinanet/utils/visualization.py", line 105, in draw_annotations
draw_caption(image, annotations['bboxes'][i], caption)
File "/opt/conda/lib/python3.7/site-packages/keras_retinanet/utils/visualization.py", line 45, in draw_caption
cv2.putText(image, caption, (b[0], b[1] - 10), cv2.FONT_HERSHEY_PLAIN, 1, (0, 0, 0), 2)
TypeError: Expected Ptr
command run:
retinanet-debug --no-resize --show-annotations --no-gui --output-dir.... --> TypeError: Expected Ptrcv::UMat for argument 'img'
retinanet-debug --show-annotations --no-gui --output-dir.... --> No Error
-no-resize flag along with --show-annotations is throwing this error
Try converting to image format from array using
from PIL import Image
Image.fromarray(image)
Getting the same error when running evaluate. Images are 100x100 greyscale.
I'm getting the same error with evaluate.py , did someone solve the issue yet?
For greyscale, this worked for me:
At line 78:
raw_image = generator.load_image(i)
image = np.asarray(raw_image) (add this line)
I added the line image = np.asarray(image) in debug.py file. However, I'm getting the same error
In _debug.py_, I fixed this by adding:
image = np.float32(image)
in line 204, after generator.load_image(i)
@Sehjbir you need to reference "raw_image" not "image", @guidotrucco 's answer works too
@TimNagle-McNaughton yes thanks. I tried @guidotrucco solution. I can see the annotations now for --no-resize flag. Thanks :)
Hello Everyone, you know where I have to changes in evaluate.py the solution @guidotrucco
As he said:
"image = np.float32(image)
in line 204, after generator.load_image(i)"
Unless I'm missing something?
Hello TimNagle. Thanks for your answer. My problem is evaluate.py when I run keras-retinanet/keras_retinanet/bin/evaluate.py --gpu 0 --score-threshold 0.001 --convert-model --image-min-side 1296 --save-path "/Backup/home/jmlopez/retinanet/prediction/" --image-max-side 3000 csv "/home/jmlopez/RetinaNet/keras-retinanet/train_set.csv" "/home/jmlopez/RetinaNet/keras-retinanet/classes.csv" "/Backup/home/jmlopez/retinanet/snapshots/resnet50_csv_90.h5" > results/test_90_001.txt
So are you having the same problem but when you run evaluate? If so I would make a new issue.
No, it is about this issue because but in evaluate.py I call on evaluate.py -save-path and i got this error :
File "keras-retinanet/keras_retinanet/bin/../../keras_retinanet/utils/visualization.py", line 45, in draw_caption
cv2.putText(image, caption, (b[0], b[1] - 10), cv2.FONT_HERSHEY_PLAIN, 1, (0, 0, 0), 2)
TypeError: Expected Ptr
Then
white that image = np.float32(image) I solved this error but a the images don't have a bounding box and any annotations