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

Adds Backbones to FRCNN Take 2 #475

Merged
merged 25 commits into from Jan 18, 2021
Merged

Conversation

oke-aditya
Copy link
Contributor

@oke-aditya oke-aditya commented Dec 24, 2020

What does this PR do?

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?
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests? [not needed for typos/docs]
  • 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 🙃

Redo #382 . Closes #340

@pep8speaks
Copy link

pep8speaks commented Dec 24, 2020

Hello @oke-aditya! Thanks for updating this PR.

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

Comment last updated at 2021-01-18 08:49:20 UTC

@oke-aditya oke-aditya changed the title Adds Backbones to FRCNN Adds Backbones to FRCNN Take 2 Dec 24, 2020
@codecov
Copy link

codecov bot commented Dec 24, 2020

Codecov Report

Merging #475 (0596744) into master (42cfa8f) will decrease coverage by 0.34%.
The diff coverage is 57.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #475      +/-   ##
==========================================
- Coverage   79.30%   78.96%   -0.35%     
==========================================
  Files         107      112       +5     
  Lines        6224     6299      +75     
==========================================
+ Hits         4936     4974      +38     
- Misses       1288     1325      +37     
Flag Coverage Δ
cpu 26.22% <35.55%> (+0.11%) ⬆️
pytest 26.22% <35.55%> (+0.11%) ⬆️
unittests 78.45% <53.33%> (-0.39%) ⬇️

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

Impacted Files Coverage Δ
...dels/detection/components/torchvision_backbones.py 20.45% <20.45%> (ø)
...models/detection/faster_rcnn/faster_rcnn_module.py 79.03% <88.88%> (ø)
pl_bolts/models/detection/faster_rcnn/backbones.py 92.30% <92.30%> (ø)
pl_bolts/datasets/dummy_dataset.py 100.00% <100.00%> (ø)
pl_bolts/models/detection/__init__.py 100.00% <100.00%> (ø)
pl_bolts/models/detection/components/__init__.py 100.00% <100.00%> (ø)
...s/models/detection/components/_supported_models.py 100.00% <100.00%> (ø)
pl_bolts/models/detection/faster_rcnn/__init__.py 100.00% <100.00%> (ø)
... and 3 more

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 42cfa8f...0596744. Read the comment docs.

@akihironitta akihironitta added this to In progress in Object detection via automation Dec 24, 2020
@oke-aditya
Copy link
Contributor Author

oke-aditya commented Dec 24, 2020

CI Test failure unrrelated cc @akihironitta Needs review cc @Borda

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.

@oke-aditya Sorry for the delay! I left some suggestions mainly on formatting. They should be resolved by just clicking in your browser :] Would you mind having a look at them?

pl_bolts/models/detection/components/_supported_models.py Outdated Show resolved Hide resolved
pl_bolts/models/detection/faster_rcnn/backbones.py Outdated Show resolved Hide resolved
Comment on lines 135 to 137

parser.add_argument("--data_dir", type=str, default=".")
parser.add_argument("--batch_size", type=int, default=1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we decouple these data-related arguments from the model? Related: #207

Copy link
Contributor Author

@oke-aditya oke-aditya Jan 5, 2021

Choose a reason for hiding this comment

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

Yes, let's discuss #207 as well. I too think we should decouple data, transforms, models and keep them independent.

Copy link
Contributor

Choose a reason for hiding this comment

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

@akihironitta where do you suggest we put the data dir and batch size arguments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's keep this for now to keep backward compatibility. Let's discuss and keep this consistent for all models.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ananyahjha93 @oke-aditya In my opinion, --data_dir and --batch_size args should be added to parser (in cli_main()) via datamodules, but not via models as previously #206 removed those args from GAN.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ananyahjha93 I'd love to know what you think of my suggestion :] (We could probably resolve this later in another PR since the related issue #207 is still an open issue though.)

Object detection automation moved this from In progress to in Review Jan 5, 2021
@oke-aditya
Copy link
Contributor Author

Also, this introduces new detection components (which is becoming like virus). Marking discussion for #427

@oke-aditya
Copy link
Contributor Author

oke-aditya commented Jan 6, 2021

As of now, isort and black both don't go well together and hence I'm getting these errors Marking for #482 . Isort and black seem to have different way of keeping imports. I'm keeping the sort way.

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.

@oke-aditya Sorry for the delay and thank you for your contribution! Other than the above comment #475 (comment), lgtm. cc: @ananyahjha93

@akihironitta
Copy link
Contributor

akihironitta commented Jan 7, 2021

@oke-aditya Forgot to mention in the above comment, can you merge master (which should fix argparse errors on Python 3.6) and resolve the failing isort tests?

@oke-aditya
Copy link
Contributor Author

oke-aditya commented Jan 7, 2021

Yes I will. I propose to have linear commit history enabled from repository settings cc @Borda . It makes such sync easier and blocks non linear merges to master. Contributor and Maintainer can just click on update branch to do this..

@oke-aditya
Copy link
Contributor Author

Fixed the above issues. Let's merge this so that I can add #391 Retina Net 😄

@oke-aditya
Copy link
Contributor Author

oke-aditya commented Jan 8, 2021

CI Failure unrelated cc @Borda @ananyahjha93 hope we can merge 😄

@akihironitta
Copy link
Contributor

akihironitta commented Jan 9, 2021

CI Failure unrelated cc @Borda @ananyahjha93 hope we can merge smile

@oke-aditya You're right that the failing tests are not related to the changes in this PR. They may be caused by the same as #409 which is still an open issue.

tests/models/self_supervised/test_scripts.py::test_cli_run_self_supervised_simclr[--data_dir /home/runner/work/pytorch-lightning-bolts/pytorch-lightning-bolts/datasets --gpus 0 --fp32 --max_epochs 1 --max_steps 3 --fast_dev_run 1 --batch_size 2 --online_ft] 
Error: Process completed with exit code 137.

@oke-aditya
Copy link
Contributor Author

oke-aditya commented Jan 10, 2021

I reformmated with yapf, to pass the check. 👍

Can we merge this 😅 @Borda @ananyahjha93

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 update imports to use If available...

@oke-aditya
Copy link
Contributor Author

oke-aditya commented Jan 11, 2021

For documentation, we have no docs for detection currently. Let's add RetinaNet and then build comprehensive documentation?
Since it would be too much to add in this PR can we leave it?

CI Failure is unrelated.

@oke-aditya oke-aditya requested a review from Borda January 11, 2021 17:26
@oke-aditya
Copy link
Contributor Author

@Borda @akihironitta can we merge this ?

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.

@oke-aditya I left some minor suggestions. I think we are ready to go once these comments are resolved.

@@ -0,0 +1,3 @@
from pl_bolts.models.detection.components.torchvision_backbones import create_torchvision_backbone
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why flake8 doesn't complain about this line without # noqa: F401.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But why should flake8 complain ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since it is inlcuded in __all__. Flake does not complain

pl_bolts/models/detection/components/_supported_models.py Outdated Show resolved Hide resolved
pl_bolts/models/detection/__init__.py Outdated Show resolved Hide resolved
Comment on lines +1 to +2
from pl_bolts.models.detection.faster_rcnn.backbones import create_fasterrcnn_backbone
from pl_bolts.models.detection.faster_rcnn.faster_rcnn_module import FasterRCNN
Copy link
Contributor

Choose a reason for hiding this comment

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

Also here, I don't know why flake8 is happy about these lines without # noqa: F401 cc: @Borda

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same commoent, __all__ blocks flake8 😅

pl_bolts/models/detection/faster_rcnn/backbones.py Outdated Show resolved Hide resolved
except ModuleNotFoundError:
warn_missing_pkg('torchvision') # pragma: no-cover

from pl_bolts.models.detection.faster_rcnn import create_fasterrcnn_backbone
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should place from pl_bolts.models.detection.faster_rcnn import create_fasterrcnn_backbone outside if/else since it should be possible to import create_fasterrcnn_backbone even when torchvision is not available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so it is possible to import / use create_faster_rcnn_backbone without torchvision, as it uses torchvision models and resnet_fpn_bakcbone from torchvision. So safer side let's warn before

@oke-aditya
Copy link
Contributor Author

oke-aditya commented Jan 18, 2021

Let me update, I think it would be good to go then

@Borda Borda added the ready label Jan 18, 2021
@Borda Borda merged commit 523699a into Lightning-Universe:master Jan 18, 2021
Object detection automation moved this from in Review to Done Jan 18, 2021
@oke-aditya oke-aditya deleted the add_frcnn branch January 18, 2021 09:17
@Borda
Copy link
Member

Borda commented Jan 18, 2021

@oke-aditya @akihironitta seems I was too fast :D mind the updates address in follow-up PR? :]

@akihironitta
Copy link
Contributor

akihironitta commented Jan 18, 2021

@Borda working on it :] in #524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

Enhancing Object Detection
5 participants