-
Notifications
You must be signed in to change notification settings - Fork 7.1k
IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1) #2192
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
Comments
@fmassa Could we add a check to avoid the out of range problem? |
Hi, This is an issue with your dataset implementation. You can fix this by doing boxes = torch.as_tensor(boxes, dtype=torch.float32)
boxes = boxes.reshape(-1, 4) in order to guarantee your boxes will always have two dimensions. But I agree with @zhangguanheng66 and we could add another check in the model to validate that the inputs have the correct shapes. |
I propose to add a check in |
Hello, I would like to work on this issue. |
@mmcenta go for it! |
Hello, couldn't this be done more easily than with extensive tests?
in
This is simple, fixes the issue and is consistent with the actual check for background image in
It's the I've checked that this works and this would be more consistent with how a background class is determined. The network will then accept empty boxes tensors and boxes tensors of size |
@hakontonne the issue with this approach is that we are propagating "unexpected" tensor shapes, which might work in some cases but is prone to failure. I think it's ok to ask users to format their dataset in a way which is uniform -- providing boxes which are of shape 0 sometimes is not as uniform as if they have always Nx4 shape (with N potentially being 0). |
Facing the same issue. Applying the
fix does lead to better results but makes a second error popup :
|
@datumbox In the end i switched and went with Detectron2, not planing to retest anytime soon sorry 😞 |
@fmassa I propose |
When coco dataset has empty bbox annotation
following error occured.
How should I handle the empty bbox dataset in cocodataset
IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)
The text was updated successfully, but these errors were encountered: