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

Add Mask R-CNN #25348

Closed
wants to merge 147 commits into from
Closed

Conversation

NielsRogge
Copy link
Contributor

@NielsRogge NielsRogge commented Aug 7, 2023

What does this PR do?

This PR is a further development of the Mask R-CNN framework. Supersedes #22973.

Updates:

  • improved variable names, docstrings (especially also for the configuration class)
  • removed specific __repr__ and __nice__ methods
  • favor ONNX-compatible code wherever possible, instead of if-else statements
  • torchvision was already leveraged for NMS

Regarding this:

In some of the model-side processing code, there's switching to CPU and casting back and forth between torch and numpy - it's not clear why.

=> this is because when placing masks on the GPU, this would cause OOM errors. Hence those are placed on the CPU.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@NielsRogge NielsRogge mentioned this pull request Aug 14, 2023
Copy link
Collaborator

@amyeroberts amyeroberts 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 iterating on this!

I've done an initial review - commenting on the things that caught my eye. It wasn't however, extensive and I expect this PR will still need several rounds of review.

General comments:

  • Could you add type hints to arguments in the functions?
  • Make sure all doc strings are filled out fully, including: descriptions of what the argument is, any shape information, shape information with explicit variable names
  • Given the complexity of this model, it needs a lot more tests beyond the defaults in the testing suite. In particular for implementations of loss averaging and NMS
  • N is used everywhere - it should be replaced with something more explicit
  • As this PR is so necessarily big, I would try to find ways to make it as small as possible and then have follow up PRs for additional functionality. In particular, it would be a lot easier to review without the conditional onnx logic. Could you remove this and then add in a separate PR please?

docs/source/en/model_doc/maskrcnn.md Outdated Show resolved Hide resolved
src/transformers/models/mask_rcnn/__init__.py Outdated Show resolved Hide resolved
src/transformers/models/mask_rcnn/modeling_maskrcnn.py Outdated Show resolved Hide resolved
src/transformers/models/mask_rcnn/modeling_maskrcnn.py Outdated Show resolved Hide resolved
src/transformers/models/mask_rcnn/modeling_maskrcnn.py Outdated Show resolved Hide resolved
src/transformers/models/mask_rcnn/modeling_maskrcnn.py Outdated Show resolved Hide resolved
src/transformers/models/mask_rcnn/modeling_maskrcnn.py Outdated Show resolved Hide resolved
src/transformers/models/mask_rcnn/modeling_maskrcnn.py Outdated Show resolved Hide resolved
src/transformers/models/mask_rcnn/modeling_maskrcnn.py Outdated Show resolved Hide resolved
src/transformers/models/mask_rcnn/modeling_maskrcnn.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@amyeroberts amyeroberts 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 iterating on this!

I've done an initial review - commenting on the things that caught my eye. It wasn't however, extensive and I expect this PR will still need several rounds of review.

General comments:

  • Could you add type hints to arguments in the functions?
  • Make sure all doc strings are filled out fully, including: descriptions of what the argument is, any shape information, shape information with explicit variable names
  • Given the complexity of this model, it needs a lot more tests beyond the defaults in the testing suite. In particular for implementations of loss averaging and NMS
  • N is used everywhere - it should be replaced with something more explicit
  • As this PR is so necessarily big, I would try to find ways to make it as small as possible and then have follow up PRs for additional functionality. In particular, it would be a lot easier to review without the conditional onnx logic. Could you remove this and then add in a separate PR please?

@NielsRogge NielsRogge force-pushed the add_maskrcnn_23_07 branch 2 times, most recently from 13a150a to 346b096 Compare September 4, 2023 11:38
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@NielsRogge NielsRogge mentioned this pull request Oct 23, 2023
@github-actions github-actions bot closed this Oct 25, 2023
@NielsRogge NielsRogge reopened this Oct 31, 2023
@github-actions github-actions bot closed this Nov 9, 2023
@NielsRogge NielsRogge reopened this Nov 12, 2023
@github-actions github-actions bot closed this Nov 21, 2023
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.

3 participants