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

Simplify inference with ONNX models #2060

Merged
merged 7 commits into from
Feb 14, 2024
Merged

Simplify inference with ONNX models #2060

merged 7 commits into from
Feb 14, 2024

Conversation

AdeelH
Copy link
Collaborator

@AdeelH AdeelH commented Feb 14, 2024

Overview

This PR makes it easier to use an ONNX model for inference. See commits for details.

Checklist

  • Added unit tests, if applicable
  • Updated documentation, if applicable
  • Added needs-backport label if the change should be back-ported to the previous release
  • PR has a name that won't get you publicly shamed for vagueness

Notes

N/A

Testing Instructions

  • Manually tested with an ONNX model.

This allows using the base DataConfig class instead of a specific subclass (e.g. like SemanticSegmentationGeoDataConfig) which makes it easier to define a Learner for inference. For instance, one can now simply define a learner for ONNX inference like so:

learner = SemanticSegmentationLearner(
    cfg=SemanticSegmentationLearnerConfig(data=DataConfig(img_sz=512)),
    model_weights_path='model.onnx',
    training=False,
)
This decouples prediction from the PyTorchLearnerBackends.
@AdeelH AdeelH changed the title Simplify inference with an ONNX model Simplify inference with ONNX models Feb 14, 2024
Copy link

codecov bot commented Feb 14, 2024

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (e6510d7) 89.75% compared to head (822cdae) 89.65%.

Files Patch % Lines
...ch_learner/rastervision/pytorch_learner/learner.py 72.22% 10 Missing ⚠️
...earner/rastervision/pytorch_learner/utils/utils.py 0.00% 5 Missing ⚠️
...ner/rastervision/pytorch_learner/learner_config.py 80.00% 1 Missing ⚠️
...r/rastervision/pytorch_learner/utils/prediction.py 97.56% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2060      +/-   ##
==========================================
- Coverage   89.75%   89.65%   -0.11%     
==========================================
  Files         196      197       +1     
  Lines        9735     9761      +26     
==========================================
+ Hits         8738     8751      +13     
- Misses        997     1010      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AdeelH AdeelH marked this pull request as ready for review February 14, 2024 20:14
@AdeelH AdeelH merged commit d6d28f7 into azavea:master Feb 14, 2024
2 checks passed
@AdeelH AdeelH deleted the onnx-pred branch February 14, 2024 20:15
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.

1 participant