-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
[Bug] Owlv2 Zero-Shot Object Detection #30131
Comments
Hi, Thanks for your interest in OWLv2. As shown in my demo notebook, you need to visualize the bounding boxes on the padded image rather than the original image. This is also shown here: https://huggingface.co/docs/transformers/en/model_doc/owlv2#transformers.Owlv2ForObjectDetection.forward.example |
Thanks, Niels. I saw your demo notebook and it works fine there. |
Did you visualize results on the unnormalized image? |
Yes. If you can try to run the example I mentioned as it is, the final bboxes are not what are shown in the result image. |
Yes that example only works as it is for OWLv1. Perhaps we could add a disclaimer for OWLv2 that results need to be shown on the preprocessed image. Would you be up for opening a PR for that? The docs is here: https://github.com/huggingface/transformers/blob/main/docs/source/en/tasks/zero_shot_object_detection.md |
@NielsRogge @nisyad-ms I managed to show the preprocessed image with the correct boxes. Below is the full code.
Is there an easy way to remove the grey area? |
Thanks @jla524 for the example. @NielsRogge also pointed to this.
|
Yes there's an easy way to remove the padding, see https://discuss.huggingface.co/t/owl-v2-bounding-box-misalignment-problem/66181/6?u=nielsr |
Thanks @NielsRogge! This worked for me:
|
System Info
transformers==4.39.3
python==3.10.14
Who can help?
No response
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Expected behavior
Expected behavior should be as shown in the second official example here: https://huggingface.co/docs/transformers/main/en/tasks/zero_shot_object_detection
However, the final bounding boxes are still shifted. Please refer to the code above (taken from the official example)
The text was updated successfully, but these errors were encountered: