Changes to model.py and loader.py to allow patching during inference, irrespective of whether x1 and x2 increase or decrease from the top left corner. In particular, the code is modified to overcome the error deriving from xr.combine_by_coords that the coordinates are not monotonic in direction. Summary of changes:
data/loader.py
Add new method, self._compute_x1x2_direction(), to calculate x1 and x2 direction
Add additional if/else statements to sample_sliding_window(), so the top left corner is always the first part of the image to be patched, irrespective of coordinate direction. This can probably be simplified.
Other minor change in loader.py
sample_sliding_window() sometimes produces duplicate entries, so code added in this method to remove these.
model/model.py
Identify direction of x1 and x2 in main body of patch_predict() (line 985-997)
Add x1_ascend and x2_ascend as arguments to get_patch_overlap(), so overlap between patches can be calculated irrespective of coordinate direction
Add x1_ascend and x2_ascend as arguments to stitch_clipped_predictions() and add additional if/else statements to make stitching agnostic to x1 and x2 direction
Other minor changes in model.py:
Change all references of x and y to x2 and x1 respectively
change reference of unnorm_coords['x1'] to orig_x1_name
Prediction when patching (stride = 0.25, patch = 0.5):
Prediction when patching (stride = 0.05, patch = 0.1):
Prediction when not patching:
Difference between prediction when patching/not patching- todo-resolve line!!:
Changes to model.py and loader.py to allow patching during inference, irrespective of whether
x1
andx2
increase or decrease from the top left corner. In particular, the code is modified to overcome the error deriving fromxr.combine_by_coords
that the coordinates are not monotonic in direction. Summary of changes:data/loader.py
self._compute_x1x2_direction()
, to calculatex1
andx2
directionsample_sliding_window()
, so the top left corner is always the first part of the image to be patched, irrespective of coordinate direction. This can probably be simplified.Other minor change in loader.py
model/model.py
x1
andx2
in main body ofpatch_predict()
(line 985-997)x1_ascend
andx2_ascend
as arguments toget_patch_overlap()
, so overlap between patches can be calculated irrespective of coordinate directionx1_ascend
andx2_ascend
as arguments tostitch_clipped_predictions()
and add additional if/else statements to make stitching agnostic to x1 and x2 directionOther minor changes in model.py:
x
andy
tox2
andx1
respectivelyunnorm_coords['x1']
toorig_x1_name
Prediction when patching (stride = 0.25, patch = 0.5):
Prediction when patching (stride = 0.05, patch = 0.1):
Prediction when not patching:
Difference between prediction when patching/not patching- todo-resolve line!!: