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

Implement Hann window classifier to reduce edge artifacts #78

Merged
merged 8 commits into from
Dec 8, 2023

Conversation

tayden
Copy link
Collaborator

@tayden tayden commented Dec 7, 2023

This is a backwards-compatibility breaking change that remove the ability to specify batch_size and padding when doing classification but instead implements Hann Window stitching (see 1) to improve the quality of the processed outputs.

Basically, tiles are processed such that they overlap 50%, and then overlapping predictions are weighted and combined based on proximity to the center of the tile. Predictions for pixels near the center of the cropped section are assumed to have higher quality than pixel predictions near the borders. Thus, more central pixels are given higher weight when determining the final class and combining overlapping tile predictions.

There is also a fair amount of refactoring done in this PR, almost entirely to non-public APIs.

@tayden
Copy link
Collaborator Author

tayden commented Dec 7, 2023

TO DO

  • Update tests
  • Update docs
  • Show improvement using outputs in this PR

@tayden
Copy link
Collaborator Author

tayden commented Dec 8, 2023

Image classified with moving window with size 512px, with 256px of context padding on each side:
image

Image classified with moving Hann window of size 1024px, where each overlaps 50% (comparable to above):
image

Larger crop sizes are still useful and may give better results (Here with size 3200px Hann window):
image

@tayden tayden marked this pull request as ready for review December 8, 2023 21:28
@tayden tayden merged commit 1aa9ec7 into main Dec 8, 2023
19 checks passed
@tayden tayden deleted the hann-window branch December 8, 2023 22:20
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