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

Use smarter default padding value for sliding windows #2190

Merged
merged 7 commits into from
Jul 5, 2024

Conversation

AdeelH
Copy link
Collaborator

@AdeelH AdeelH commented Jul 3, 2024

Overview

This PR introduces a new calculate_required_padding() function that calculates the appropriate padding size--based on size, stride, pad_direction, and crop_sz--which is now used by Box.get_windows() and predict_scene_ss(). It also adds more discussion about padding to the Sampling training data tutorial notebook.

The main motivation is to make it easier to determine the right padding when making semantic segmentation predictions with a crop_sz such that no pixels are left out. The padding value calculated by calculate_required_padding() ensures this.

Additionally, when crop_sz is not specified, calculate_required_padding() returns the minimum padding required to generate enough windows to cover the entire extent. This is a change from the previous behavior of always using size / 2.

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

See new/updated unit tests.

Copy link

codecov bot commented Jul 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.14%. Comparing base (adac1a2) to head (4389af7).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2190      +/-   ##
==========================================
+ Coverage   90.09%   90.14%   +0.05%     
==========================================
  Files         198      198              
  Lines        9879     9877       -2     
==========================================
+ Hits         8900     8904       +4     
+ Misses        979      973       -6     

☔ 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 July 5, 2024 14:14
@AdeelH AdeelH merged commit 8f9f6d4 into azavea:master Jul 5, 2024
1 check passed
@AdeelH AdeelH deleted the padding branch July 5, 2024 14:18
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