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

PatchInferencer utility class #72

Merged
merged 8 commits into from
Aug 19, 2024
Merged

Conversation

SerodioJ
Copy link
Contributor

@SerodioJ SerodioJ commented Jul 26, 2024

Describe your changes

Utility classes to perform inference in patches using either weighted average or voting methods to combine results.

PatchInferencer is a wrapper class that is initialized with a LightningModule(e.g., trained UNet) and input_size.
When called (forward method), it subdivides the input in patches of size input_size, performs inference using the LightningModule and then reconstructs the output.
It also supports the inference of additional patches so that certain regions have multiple inference results when reconstructing the output (combination can be done with averaging or voting).

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests to this functionality.
  • All tests are passing.
  • I have updated the documentation as needed.
  • I have followed the project's coding guidelines.

@GabrielBG0
Copy link
Collaborator

@SerodioJ Could you describe how you plan for this to integrate with the rest of the pipeline?

@SerodioJ
Copy link
Contributor Author

@SerodioJ Could you describe how you plan for this to integrate with the rest of the pipeline?

PatchInferencer is a wrapper class that is initialized with a LightningModule and input_size.
When called (forward method), it subdivides the input in patches of size input_size, performs inference using the LightningModule and then reconstructs the output.
It also supports the inference of additional patches so that certain regions have multiple inference results when reconstructing the output (combination can be done with averaging or voting).

@SerodioJ SerodioJ marked this pull request as ready for review August 9, 2024 16:13
@GabrielBG0
Copy link
Collaborator

@SerodioJ @otavioon what you guys think about putting this on a new module celled engines? I don't think it should go to utils (even though I told seriodio to do it)

Copy link
Collaborator

@otavioon otavioon left a comment

Choose a reason for hiding this comment

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

LGTM

@otavioon
Copy link
Collaborator

I think engines is a good location

@GabrielBG0
Copy link
Collaborator

Code has been moved to engines, merging the PR

@GabrielBG0 GabrielBG0 merged commit 26de1c8 into discovery-unicamp:main Aug 19, 2024
1 check passed
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.

3 participants