-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
Hello! First of all, thanks for the useful library, I think it is extremely useful, especially the elastic transformation, which has improved sensibly my pipeline.
However, when considering the random_crop implementation:
def random_crop(img, crop_height, crop_width, crop_depth, h_start, w_start, d_start):
height, width, depth = img.shape[:3] # Considering that here we are only taking the "space" dimensions...
if height < crop_height or width < crop_width or depth < crop_depth:
img = pad(img, (crop_width, crop_height, crop_depth))
warn('image size smaller than crop size, pad by default.', UserWarning)
else:
x1, y1, z1, x2, y2, z2 = get_random_crop_coords(height, width, depth, crop_height, crop_width, crop_depth, h_start, w_start, d_start)
img = img[x1:x2, y1:y2, z1:z2] # ...It is possible to use ellipsis here and admit an equal random cropping on each batch and channel: img[..., x1:x2, y1:y2, z1:z2]
return imgit assumes that the input is 3D. I saw some similar assumptions and errors in the code and I would be interested in improving or fixing the code where it is needed!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels