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

[fix] Add DeformableDetrFeatureExtractor #19140

Merged
merged 8 commits into from Sep 22, 2022

Conversation

NielsRogge
Copy link
Contributor

@NielsRogge NielsRogge commented Sep 21, 2022

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 using Copied from statements wherever possible.

To do:

  • update preprocessor_config.json of all repos on the hub
  • use from_pretrained in the code snippets for the feature extractor


return encoded_inputs

def post_process(self, outputs, target_sizes):
Copy link
Contributor Author

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.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Sep 21, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@sgugger sgugger left a 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.

Copy link
Collaborator

@sgugger sgugger left a 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!

@NielsRogge NielsRogge merged commit 9393f96 into huggingface:main Sep 22, 2022
oneraghavan pushed a commit to oneraghavan/transformers that referenced this pull request Sep 26, 2022
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants