wenyangchu edited a comment on issue #13750: mx.nd.Crop does not support FP16 
and decpreciated but no direct alternative with central crop
URL: 
https://github.com/apache/incubator-mxnet/issues/13750#issuecomment-450695334
 
 
   One more comment: Crop function is depreciated but I don't see the 
alternative slice function provides the same central crop option. And it has 
been used for some people including me in the unet like implementation. It is 
especially important when padding is not desired in the use case of applying 
unet in an extremely large image to avoid edge effect caused by padding. 
   
   I personally think the current Crop function is great and unique compared to 
tensorflow approach:
   
   
https://tf-unet.readthedocs.io/en/latest/_modules/tf_unet/layers.html#crop_and_concat
   
   def crop_and_concat(x1,x2):
       with tf.name_scope("crop_and_concat"):
           x1_shape = tf.shape(x1)
           x2_shape = tf.shape(x2)
           # offsets for the top left corner of the crop
           offsets = [0, (x1_shape[1] - x2_shape[1]) // 2, (x1_shape[2] - 
x2_shape[2]) // 2, 0]
           size = [-1, x2_shape[1], x2_shape[2], -1]
           x1_crop = tf.slice(x1, offsets, size)
           return tf.concat([x1_crop, x2], 3)
   
   Mxnet approach:
   cropped = mx.nd.Crop(data,data_ref, num_args = 2, center_crop = True, name = 
'cropped')
   
   After many search and trials I failed to implement the above crop_and_concat 
function in mxnet using a hybridBlock. I can only do this in the imperative 
mode. it is not desired because I prefer to export onnx for my deployment. If 
someone can teach me how to implement the above function right with hybrid 
block, it is be very appreciated :)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to