OwlViT/Owlv2 post processing standardization - #34929
Conversation
…cate post_process_object_detection
|
Hey @molbap! Please review if you have bandwidth! |
There was a problem hiding this comment.
Not related changes, just refactoring
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
molbap
left a comment
There was a problem hiding this comment.
Nice standardization, just added a comment related to documentation :) also wondered if you could get away with a is_grounded boolean arg and just have one method, or even an Enum with either grounded, guided or default values, if that makes sense
There was a problem hiding this comment.
would it make sense to add some documentation for post_process_image_guided_detection as well in addition to post_process_grounded_object_detection, just to show usage? Also, the underlying method isn't deprecated IIUC, so would need to still be documented
There was a problem hiding this comment.
Yes, thanks for the suggestion! Added documentation for the method in b13c68c
|
I would prefer to leave it as separate methods. This way, it is more consistent with other post-processing methods like |
|
@ArthurZucker please review when you have bandwidth |
ArthurZucker
left a comment
There was a problem hiding this comment.
LGTM sorry for putting it off for so long! 🤗
| label = l[s > threshold] | ||
| box = b[s > threshold] | ||
| results.append({"scores": score, "labels": label, "boxes": box}) | ||
| for scores, labels, boxes in zip(batch_scores, batch_labels, batch_boxes): |
There was a problem hiding this comment.
cool to move away from single letter variables
* Refactor owlvit post_process_object_detection + add text_labels * Fix copies in grounding dino * Sync with Owlv2 postprocessing * Add post_process_grounded_object_detection method to processor, deprecate post_process_object_detection * Add test cases * Move text_labels to processors only * [run-slow] owlvit owlv2 * [run-slow] owlvit, owlv2 * Update snippets * Update docs structure * Update deprecated objects for check_repo * Update docstring for post processing of image guided object detection
* Refactor owlvit post_process_object_detection + add text_labels * Fix copies in grounding dino * Sync with Owlv2 postprocessing * Add post_process_grounded_object_detection method to processor, deprecate post_process_object_detection * Add test cases * Move text_labels to processors only * [run-slow] owlvit owlv2 * [run-slow] owlvit, owlv2 * Update snippets * Update docs structure * Update deprecated objects for check_repo * Update docstring for post processing of image guided object detection
What does this PR do?
Standardize OwlViT and Owlv2 post-processing
post_process_grounded_object_detectionmethod for Processor (+ deprecation forpost_process_object_detectionmethod)text_labelsfor post-processed output (iftext_labelsare provided as a keyword argument forpost_process_grounded_object_detection). It's already mapped text names for detected bounding boxes.For a full description regarding standardization see #34926
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.