-
Notifications
You must be signed in to change notification settings - Fork 69
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
Error in rectangular crop #6
Comments
Yes, I see.. there is a serious problem with non-square dimensions. I will commit a fix. |
CarlosFora
pushed a commit
to CarlosFora/DSen2
that referenced
this issue
Sep 22, 2021
* Fix import and data_path * Fix path to xml file * Add data_name to class * Handle unever array case in downsizing * Add data_name instance var * Format * Format * Add generate patches script * Add logger * Add sys * Add md file for patch gen * Add test imgs ids for L1C * Add test images L2A * Add test commands * Remove xtra - * Remove duplicated test_data * remove / * Fix linter issues * Fix duplicated code * Disable tuple unbalance error * Disable type for var input_shape
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Charis,
I found an error when trying to predict non-square portions of an image (for example
--roi_x_y "500,1500,2500,2500"
).Looking into the issue it turns out that
sr
has the coordinates transposed, that is the correct output shape (the one of thedata10
array) is(996, 1998, 4)
while the shape ofsr
is(1998, 996, 6)
.If I do a
sr = np.moveaxis(sr, 0, 1)
just after line 405, I can manage to get no errors and save the output image. But then the output image is completely messed out for some reason.The point is that one shouldn't need to transpose
sr
because the code works well (the output image makes sense) with square images, but if one does not transposesr
then one cannot save the array because the dimensions are wrong. One solution that will preserve the good behaviour of square crops would be to usesr = sr.reshape(sr.shape[1], sr.shape[0], sr.shape[2])
but that does not seem to work either:sr = sr.reshape(sr.shape[1], sr.shape[0], sr.shape[2], order='C')
sr = sr.reshape(sr.shape[1], sr.shape[0], sr.shape[2], order='F')
sr = sr.reshape(sr.shape[1], sr.shape[0], sr.shape[2], order='A')
Maybe the error comes from upstairs when the arrays are cropped or from the way the image is segmented and reassembled in patches to feed the DNN.
Have you already encountered this issue?
The text was updated successfully, but these errors were encountered: