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

ValueError: xyxy must be a 2D np.ndarray with shape (_, 4), but got shape (0, 0, 4) #342

Closed
1 of 2 tasks
FrankTseng168 opened this issue Nov 27, 2024 · 4 comments
Closed
1 of 2 tasks
Labels
bug Something isn't working

Comments

@FrankTseng168
Copy link

FrankTseng168 commented Nov 27, 2024

Search before asking

  • I have searched the Roboflow Notebooks issues and found no similar bug report.

Notebook name

how_to_finetune_florence_2_on_detection_dataset

Bug

image

Environment

win 11/ python3.11.10/ spyder

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@FrankTseng168 FrankTseng168 added the bug Something isn't working label Nov 27, 2024
@LinasKo
Copy link
Contributor

LinasKo commented Nov 27, 2024

Hi @FrankTseng168 👋

Thank you for the report! I'm failing to reproduce it so far. Do you know when this happens?

Any chance you could print out the shape of prediction.xyxy, before prediction = prediction[np.isin(...)]? Also, are there any matches in classes, for prediction["class_name"]?

@FrankTseng168
Copy link
Author

FrankTseng168 commented Nov 28, 2024 via email

@LinasKo
Copy link
Contributor

LinasKo commented Nov 28, 2024

Bug confirmed! Very peculiar. I'll let you know when I fix it.
Logged here: roboflow/supervision#1694

For now, try this:

if not predictions.is_empty():
    prediction = prediction[np.isin(prediction["class_name"], CLASSES)]

If it still fails, change to if len(predictions.xyxy) > 0:

@LinasKo
Copy link
Contributor

LinasKo commented Dec 4, 2024

The fix is now deployed to our develop branch. You can install it with pip install git+https://github.com/roboflow/supervision.git@develop.

Thank you for the report, @FrankTseng168!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants