You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/01/01 10:47:21 UTC

[GitHub] wenyangchu edited a comment on issue #13750: mx.nd.Crop does not support FP16 and decpreciated but no direct alternative with central crop

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')

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services