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

handle 0 padding and set nans/infty to 0 #4

Merged
merged 1 commit into from
Jun 4, 2021

Conversation

elbeejay
Copy link
Contributor

@elbeejay elbeejay commented Jun 4, 2021

Hello, ran into 2 issues when running DeepWaterMap that I think are easily resolvable.

  1. If the image is exactly divisible by 32, then the padding indices are pad_r == (0,0) and pad_c = (0,0). This causes a problem when trying to use these padding indices to resize the output image as indexing dwm = dwm[0:-0, 0:-0] returns an empty array. So by checking for 0s in the second values for the padding arrays and setting them to 1 if needed, this issue is resolved because dwm = dwm[0:-1, 0:-1] will return the entire array.

  2. If there are any NaN or infinity values in the input image, then the pre-processing step where the image is normalized can turn the entire array into NaNs. One potential fix is to check for an NaNs or infinity values and raise an error right after loading the image, I propose simply replacing the values with 0s if they are present instead.

These fixes appear to have resolved the problems I was running into. Again, not sure if they are the best solutions, but they're working for me.

@isikdogan
Copy link
Owner

Thanks for the fix. Merging.

@isikdogan isikdogan merged commit f02bd76 into isikdogan:master Jun 4, 2021
skarimaghaei pushed a commit to skarimaghaei/deepwatermap that referenced this pull request Jan 30, 2025
handle 0 padding and set nans/infty to 0
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.

2 participants