Skip to content
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

Dimension mismatch in box_coder.py #36

Open
chrisliu54 opened this issue Jul 11, 2018 · 0 comments
Open

Dimension mismatch in box_coder.py #36

chrisliu54 opened this issue Jul 11, 2018 · 0 comments

Comments

@chrisliu54
Copy link

chrisliu54 commented Jul 11, 2018

box = box_preds[mask.nonzero().squeeze()]

In normal cases, mask.nonzero().squeeze() squeezes out the non zero terms in mask, which makes box is of the same shape as box_preds(2d tensor).
However, when there is only one True element in mask, box turns out to be a 1d tensor, which leads to dimension mismatch error in the lines below.

x1 = bboxes[:,0]
y1 = bboxes[:,1]
x2 = bboxes[:,2]
y2 = bboxes[:,3]

I suggest to modify the mask operation like this below:

box = box_preds[mask] 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant