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

Implemented GIoU #347

Merged
merged 54 commits into from
Dec 20, 2020
Merged

Implemented GIoU #347

merged 54 commits into from
Dec 20, 2020

Conversation

briankosw
Copy link
Contributor

@briankosw briankosw commented Nov 9, 2020

What does this PR do?

Implements Generalized Intersection over Union as mentioned in #251

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together? Otherwise, we ask you to create a separate PR for every change.
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

PR review

  • Is this pull request ready for review? (if not, please submit in draft mode)

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@codecov
Copy link

codecov bot commented Nov 9, 2020

Codecov Report

Merging #347 (1e0b2d1) into master (4309cab) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #347      +/-   ##
==========================================
+ Coverage   80.44%   80.52%   +0.07%     
==========================================
  Files         101      103       +2     
  Lines        5687     5710      +23     
==========================================
+ Hits         4575     4598      +23     
  Misses       1112     1112              
Flag Coverage Δ
cpu 25.36% <100.00%> (+0.30%) ⬆️
pytest 25.36% <100.00%> (+0.30%) ⬆️
unittests 80.08% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pl_bolts/losses/object_detection.py 100.00% <100.00%> (ø)
pl_bolts/metrics/object_detection.py 100.00% <100.00%> (ø)

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 4309cab...1e0b2d1. Read the comment docs.

@akihironitta
Copy link
Contributor

@briankosw Thank you for your contribution! Let us know if you need help :]

@briankosw
Copy link
Contributor Author

Hi @akihironitta! I'm trying to write tests for GIoU, but I don't have experience with unittest (I'm more used to pytest) and it seems that the majority of the tests in this repo weren't fully setup. I'll submit a commit soon, and could you take a look at review it for me?

@akihironitta
Copy link
Contributor

@briankosw Sure! Mark this PR as ready for review when you're ready :]

@briankosw briankosw marked this pull request as ready for review November 15, 2020 10:45
pl_bolts/losses/giou.py Outdated Show resolved Hide resolved
tests/losses/test_giou.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ydcjeff ydcjeff left a comment

Choose a reason for hiding this comment

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

Great to see GIoU loss in bolts!
Can you add the docs?

Copy link
Contributor

@akihironitta akihironitta left a comment

Choose a reason for hiding this comment

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

Thank you for the swift action! Would you mind having a look?

pl_bolts/losses/giou.py Outdated Show resolved Hide resolved
Copy link
Contributor

@akihironitta akihironitta left a comment

Choose a reason for hiding this comment

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

LGTM!

@briankosw
Copy link
Contributor Author

I'm going to add a little bit more to the docstring and fix that isort failure, but that should be the final touches!

@Borda Borda added the enhancement New feature or request label Nov 16, 2020
pl_bolts/losses/giou.py Outdated Show resolved Hide resolved
tests/losses/test_giou.py Outdated Show resolved Hide resolved
@briankosw briankosw requested a review from Borda November 17, 2020 11:44
@akihironitta
Copy link
Contributor

akihironitta commented Nov 17, 2020

@briankosw Also, please remember to add the summary of your change to the changelog.

Copy link
Member

@Borda Borda left a comment

Choose a reason for hiding this comment

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

pls follow @akihironitta suggestions

pl_bolts/losses/giou.py Outdated Show resolved Hide resolved
@annikabrundyn
Copy link
Contributor

This is awesome! Does it make sense to also add this to the PL metrics?

@Borda
Copy link
Member

Borda commented Nov 18, 2020

This is awesome! Does it make sense to also add this to the PL metrics?

I would keep it here for a little while and later like any other metric we may move them to PL, we just need to try they are stable and kind of standard :]

@briankosw briankosw requested a review from Borda November 18, 2020 10:14
@ananyahjha93
Copy link
Contributor

@annikabrundyn @briankosw @Borda let's add this to PL as a class metric + the current functional form.

@briankosw
Copy link
Contributor Author

briankosw commented Nov 19, 2020

I'd be happy to close this PR and open a new one in PL as soon as I'm given the go ahead 🙂. If so, I'm assuming #370 and part of #251 should be migrated over as well?

@Borda
Copy link
Member

Borda commented Nov 19, 2020

I'd be happy to close this PR and open a new one in PL as soon as I'm given the go ahead 🙂. If so, I'm assuming #370 and part of #251 should be migrated over as well?

hi, the point is that we shall merge it here, and later (let's say a few weeks) we add it in PL and eventually drop from here

@briankosw
Copy link
Contributor Author

I think this PR is ready for a final review. Would love your reviews @Borda @ydcjeff.

@ydcjeff
Copy link
Contributor

ydcjeff commented Dec 4, 2020

Thank you for your work @briankosw
Is there any difference between this and this one from torchvision except that we extract giou from 1 in this?

@briankosw
Copy link
Contributor Author

Thank you for your work @briankosw
Is there any difference between this and this one from torchvision except that we extract giou from 1 in this?

Ah I didn't realize torchvision has its own implementation. You're correct in that we subtract giou from 1. Should I change it to use torchvision's giou?

@ydcjeff
Copy link
Contributor

ydcjeff commented Dec 11, 2020

Thank you for your work @briankosw
Is there any difference between this and this one from torchvision except that we extract giou from 1 in this?

Ah I didn't realize torchvision has its own implementation. You're correct in that we subtract giou from 1. Should I change it to use torchvision's giou?

I think both are right. in giou loss, we subtract giou from 1. Since torchvision has giou, we only need to 1 - giou to get giou loss... So it can be said this PR is unneeded, Thank you for your work btw.

But let's see core members' thoughts too!

@akihironitta
Copy link
Contributor

@briankosw @ydcjeff
Thank you for your work! In my opinion, it's still nice to have the loss here or in PL as the current function and also a subclass of pl.metrics.Metric like pl.metrics.Accuracy as @ananyahjha93 suggested.

@annikabrundyn @briankosw @Borda let's add this to PL as a class metric + the current functional form.

I think it's reasonable to have the loss in Bolts and later migrate it to PL like @Borda mentioned.

@Borda @ananyahjha93 So, how shall we move on?

@pep8speaks
Copy link

pep8speaks commented Dec 20, 2020

Hello @briankosw! Thanks for updating this PR.

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-12-20 23:19:48 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants