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 transform for rcnns so original images list is unchanged #1084

Merged
merged 4 commits into from
Jul 4, 2019

Conversation

buoyancy99
Copy link
Contributor

@buoyancy99 buoyancy99 commented Jul 3, 2019

Maskrcnn or fastrcnn pass input image list into the transform module in torchvision/models/detection/transform.py. However, the method modifies content in the list where transformed images are pasted back to corresponding entries of the input list.

As a result, user may meet unintended behavior when they hold reference to the original input list outside the maskrcnn call. The proposed change leave user input image list to the maskrcnn call unchanged.

@codecov-io
Copy link

codecov-io commented Jul 3, 2019

Codecov Report

Merging #1084 into master will increase coverage by 0.74%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1084      +/-   ##
==========================================
+ Coverage   63.92%   64.67%   +0.74%     
==========================================
  Files          68       68              
  Lines        5406     5407       +1     
  Branches      829      829              
==========================================
+ Hits         3456     3497      +41     
+ Misses       1707     1661      -46     
- Partials      243      249       +6
Impacted Files Coverage Δ
torchvision/models/detection/transform.py 78.3% <100%> (+0.2%) ⬆️
torchvision/datasets/cityscapes.py 70% <0%> (+50%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6c56029...44157a4. Read the comment docs.

Copy link
Member

@fmassa fmassa 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 the PR!

I have a few comments.

Also, could you add tests for this case? Maybe in tests/test_models.py

torchvision/models/detection/transform.py Outdated Show resolved Hide resolved
torchvision/models/detection/transform.py Outdated Show resolved Hide resolved
buoyancy99 added 3 commits July 4, 2019 02:37
transform does not change input list anymore. Improve code according to reviewer comment
transform for maskrcnn no longer modify input list. improve code according to comment
@buoyancy99
Copy link
Contributor Author

buoyancy99 commented Jul 4, 2019

Thanks for the PR!

I have a few comments.

Also, could you add tests for this case? Maybe in tests/test_models.py

fixed and added test in #1085, however #1085 will fail auto check since this is not merged yet. Please rerun the check after merging

Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fmassa fmassa merged commit e8e9bdb into pytorch:master Jul 4, 2019
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