Skip to content

Fix NMS and IoU overflows for fp16 #3383

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

Merged
merged 4 commits into from
Feb 15, 2021

Conversation

datumbox
Copy link
Contributor

@datumbox datumbox commented Feb 11, 2021

Fixes #3371

@datumbox datumbox force-pushed the bugfix/nms_oveflow_fp16 branch from f289fae to 673fda8 Compare February 11, 2021 18:47
@datumbox datumbox changed the title [WIP] Fix NMS overfloat for fp16 [WIP] Fix NMS overflow for fp16 Feb 11, 2021
@codecov
Copy link

codecov bot commented Feb 11, 2021

Codecov Report

Merging #3383 (f1f2e45) into master (af97ec2) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3383      +/-   ##
==========================================
+ Coverage   74.80%   74.82%   +0.01%     
==========================================
  Files         105      105              
  Lines        9714     9719       +5     
  Branches     1561     1562       +1     
==========================================
+ Hits         7267     7272       +5     
  Misses       1960     1960              
  Partials      487      487              
Impacted Files Coverage Δ
torchvision/ops/boxes.py 87.77% <100.00%> (+0.71%) ⬆️

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 af97ec2...f1f2e45. Read the comment docs.

@datumbox datumbox changed the title [WIP] Fix NMS overflow for fp16 Fix NMS and IoU overflows for fp16 Feb 11, 2021
@datumbox datumbox requested a review from fmassa February 11, 2021 20:38
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.

Looks great, thanks a lot!

@fmassa fmassa merged commit f04e9cb into pytorch:master Feb 15, 2021
@datumbox datumbox deleted the bugfix/nms_oveflow_fp16 branch February 15, 2021 10:11
facebook-github-bot pushed a commit that referenced this pull request Feb 23, 2021
Summary:
* Replace type T with accumulator.

* Upcast tensors of box ops to avoid overflow in multiplications.

Reviewed By: NicolasHug

Differential Revision: D26605323

fbshipit-source-id: 443e2714bdf0c916834340b180a6ddfb0f55cb2e
@datumbox datumbox added the bug label Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NMS behaviour w.r.t. fp16 vs fp32
3 participants