-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
[fix] Add DeformableDetrFeatureExtractor #19140
[fix] Add DeformableDetrFeatureExtractor #19140
Conversation
|
||
return encoded_inputs | ||
|
||
def post_process(self, outputs, target_sizes): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, this is the only difference with DETR's feature extractor.
The documentation is not available anymore as the PR was closed or merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this new feature extractor! Left a couple of comments.
src/transformers/models/deformable_detr/modeling_deformable_detr.py
Outdated
Show resolved
Hide resolved
tests/models/deformable_detr/test_feature_extraction_deformable_detr.py
Outdated
Show resolved
Hide resolved
src/transformers/models/deformable_detr/feature_extraction_deformable_detr.py
Outdated
Show resolved
Hide resolved
src/transformers/models/deformable_detr/feature_extraction_deformable_detr.py
Outdated
Show resolved
Hide resolved
src/transformers/models/deformable_detr/feature_extraction_deformable_detr.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to rebase on main to fix the tests, but otherwise LGTM!
f52e104
to
038328d
Compare
* Add DeformableDetrFeatureExtractor * Fix post_process * Fix name * Add tests for feature extractor * Fix doc tests * Fix name * Address comments * Apply same fix to DETR and YOLOS as well Co-authored-by: Niels Rogge <nielsrogge@Nielss-MacBook-Pro.local>
What does this PR do?
As pointed out by @DeppMeng who is adding Conditional DETR in #18948, the postprocessing of Deformable DETR is actually different compared to regular DETR. Namely, a sigmoid activation function is used rather than softmax, and the no-object class is included, whereas DETR discards this class.
Hence, we'll need a new
DeformableDetrFeatureExtractor
which includes this custom postprocessing logic. As only the postprocessing of object detection is different, I'm usingCopied from
statements wherever possible.To do:
preprocessor_config.json
of all repos on the hubfrom_pretrained
in the code snippets for the feature extractor