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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[onnx] classification models export #830

Merged
merged 25 commits into from
Apr 5, 2022

Conversation

felixdittrich92
Copy link
Contributor

@felixdittrich92 felixdittrich92 commented Feb 22, 2022

Counterpart of #789 for all classifiaction models

  • onnx export integrated in classification training script
  • classification models onnx export test

Issue:
#789

Any feedback is welcome 馃

@codecov
Copy link

codecov bot commented Feb 22, 2022

Codecov Report

Merging #830 (6976419) into main (7f396ca) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #830   +/-   ##
=======================================
  Coverage   94.84%   94.85%           
=======================================
  Files         133      133           
  Lines        5200     5204    +4     
=======================================
+ Hits         4932     4936    +4     
  Misses        268      268           
Flag Coverage 螖
unittests 94.85% <100.00%> (+<0.01%) 猬嗭笍

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

Impacted Files Coverage 螖
doctr/models/utils/pytorch.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 7f396ca...6976419. Read the comment docs.

@fg-mindee fg-mindee self-assigned this Feb 22, 2022
fg-mindee and others added 3 commits February 23, 2022 12:42
* feat: Added new resnets

* feat: Added ResNet101

* fix: Fixed ResNet31 & ResNet34 wide

* feat: Added new pretrained resnets

* style: Fixed isort

* fix: Fixed ResNet architectures

* refactor: Refactored LinkNet

* feat: Added more LinkNets

* fix: Fixed MAGResNet

* docs: Updated documentation

* refactor: Removed ResNet101

* fix: Fixed warning

* fix: Fixed a few bugs

* test: Updated unittests

* docs: Fixed docstrings
* feat: replace bce by focal loss in linknet loss

* fix: requested changes

* fix: mask reduction

* fix: mask reduction

* fix: loss reduction

* fix: final adjustements

* fix: final changes
@fg-mindee fg-mindee added module: models Related to doctr.models topic: onnx ONNX-related type: new feature New feature labels Mar 7, 2022
@fg-mindee fg-mindee self-requested a review March 7, 2022 11:29
@felixdittrich92
Copy link
Contributor Author

@fg-mindee
Any update ? Or keep it for review after 0.5.1 release ? 馃槃

Copy link
Collaborator

@charlesmindee charlesmindee 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 this PR, I think the right place for the export_to_onnx() function might be in the package, in the models/utils/export.py file or something like that, what do you think ?

references/classification/train_pytorch.py Outdated Show resolved Hide resolved
tests/pytorch/test_models_classification_pt.py Outdated Show resolved Hide resolved
@felixdittrich92
Copy link
Contributor Author

@charlesmindee ok i have moved it to utils/pytorch ftm 馃憤 and also removed both deps we can use torch.onnx and the quantization maybe later add directtly as one line in the training scripts wdyt ?

Copy link
Collaborator

@charlesmindee charlesmindee 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 this PR, it is better without the dep, just need to remove it from the setup file!

setup.py Show resolved Hide resolved
setup.py Show resolved Hide resolved
Copy link
Collaborator

@charlesmindee charlesmindee 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 this feature !

@charlesmindee charlesmindee merged commit 1b4b687 into mindee:main Apr 5, 2022
@felixdittrich92 felixdittrich92 deleted the onnx-classification branch April 5, 2022 14:19
felixdittrich92 added a commit to felixdittrich92/doctr that referenced this pull request Apr 5, 2022
* backup

* onnx classification

* fix: Fixed some ResNet architecture imprecisions (mindee#828)

* feat: Added new resnets

* feat: Added ResNet101

* fix: Fixed ResNet31 & ResNet34 wide

* feat: Added new pretrained resnets

* style: Fixed isort

* fix: Fixed ResNet architectures

* refactor: Refactored LinkNet

* feat: Added more LinkNets

* fix: Fixed MAGResNet

* docs: Updated documentation

* refactor: Removed ResNet101

* fix: Fixed warning

* fix: Fixed a few bugs

* test: Updated unittests

* docs: Fixed docstrings

* update with new models

* feat: replace bce by focal loss in linknet loss (mindee#824)

* feat: replace bce by focal loss in linknet loss

* fix: requested changes

* fix: mask reduction

* fix: mask reduction

* fix: loss reduction

* fix: final adjustements

* fix: final changes

* Revert "feat: replace bce by focal loss in linknet loss (mindee#824)"

This reverts commit 6511183.

* Revert "fix: Fixed some ResNet architecture imprecisions (mindee#828)"

This reverts commit 72e5e0d.

* happy codacy

* sapply suggestions

* fix-setup

* remove onnx from test req

* move onnx deps ftm to torch

* up

* up

* revert requirements

* fix

* update docstring

* up

Co-authored-by: F-G Fernandez <76527547+fg-mindee@users.noreply.github.com>
Co-authored-by: Charles Gaillard <charles@mindee.co>
felixdittrich92 added a commit to felixdittrich92/doctr that referenced this pull request Apr 7, 2022
* backup

* onnx classification

* fix: Fixed some ResNet architecture imprecisions (mindee#828)

* feat: Added new resnets

* feat: Added ResNet101

* fix: Fixed ResNet31 & ResNet34 wide

* feat: Added new pretrained resnets

* style: Fixed isort

* fix: Fixed ResNet architectures

* refactor: Refactored LinkNet

* feat: Added more LinkNets

* fix: Fixed MAGResNet

* docs: Updated documentation

* refactor: Removed ResNet101

* fix: Fixed warning

* fix: Fixed a few bugs

* test: Updated unittests

* docs: Fixed docstrings

* update with new models

* feat: replace bce by focal loss in linknet loss (mindee#824)

* feat: replace bce by focal loss in linknet loss

* fix: requested changes

* fix: mask reduction

* fix: mask reduction

* fix: loss reduction

* fix: final adjustements

* fix: final changes

* Revert "feat: replace bce by focal loss in linknet loss (mindee#824)"

This reverts commit 6511183.

* Revert "fix: Fixed some ResNet architecture imprecisions (mindee#828)"

This reverts commit 72e5e0d.

* happy codacy

* sapply suggestions

* fix-setup

* remove onnx from test req

* move onnx deps ftm to torch

* up

* up

* revert requirements

* fix

* update docstring

* up

Co-authored-by: F-G Fernandez <76527547+fg-mindee@users.noreply.github.com>
Co-authored-by: Charles Gaillard <charles@mindee.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: models Related to doctr.models topic: onnx ONNX-related type: new feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants