Node cropping in 3D
It seems that cntk.ops.crop_automatic performs cropping only in 2D. Is there a way to do it also in 3D? So far, I just fall back to using crop_automatic to crop the 2D shape, and then use slice to do the cropping of the depth dimension manually, but it would be great, to be able to just use crop_automatic and possible specify a rank for the operation, so that the channel dimension is kept.
This is a great suggestion. I think we need a transform that's dedicated to 3D data. Would you be interested in contributing one?
So far, I just wrote a simple python function that calls slice three times. I'm not sure this is the best way but it works for me. It also only works if the cropping is symmetric and it's only tested for odd kernel sizes. I'm not sure if this is good enough for a general contribution.
def crop3d(input_node, reference_node):
cropped = input_node
for i in range(1, 4):
first = int((input_node.shape[i] - reference_node.shape[i]) / 2)
last = int(first + reference_node.shape[i])
cropped = cntk.ops.slice(cropped, axis=i, begin_index=first, end_index=last)
return cropped