-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IndexError: too many indices for tensor of dimension 1 #65
Comments
When there is no bounding box detected, ids.nonzero.squeeze() automatically squeeze the tensor into nothing, which makes the ids with tensor.shape([]) |
Thank you very much! I will try it! |
@gyfastas Thank you for comment. I also revised code, but still occur error. |
:) I found my solution did not work too. ids = score > CLS_THRESH is a booleen index [0,0,1,0....]. We can use ids.sum( ) to see whether there is 1 in ids (which means there is positive sample) . Try this: Also I recommend checking the dimension of these variables. |
@gyfastas Thank you for comment ! |
I use the function decode in the encoder.py, always have the fellowing question.
File "eval.py", line 281, in
test()
File "eval.py", line 238, in test
boxes, labels, scores = encoder.decode(loc_preds.data.squeeze(), cls_preds.data.squeeze(), (w, h))
File "/home/sunshine_zkf/RetinaNet/RetinaNet/encoder.py", line 127, in decode
keep = box_nms(boxes[ids], score[ids], threshold=NMS_THRESH)
File "/home/sunshine_zkf/RetinaNet/RetinaNet/utils.py", line 168, in box_nms
x1 = bboxes[:,0] # xmin
IndexError: too many indices for tensor of dimension 1
where's the problem? I use the pytorch-0.4
The text was updated successfully, but these errors were encountered: