def _crop(target_layer, offset=(None, None), name=None):
"""Crop the bottom such that it has the same shape as target_layer."""
def f(input):
width = input._keras_shape[1]
height = input._keras_shape[2]
target_width = target_layer._keras_shape[1]
target_height = target_layer._keras_shape[2]
cropped = Cropping2D(cropping=((offset[0], width - offset[0] - target_width),(offset[1],height - offset[1] - target_height)), name='{}'.format(name))(input)
return cropped
return f
评论列表
文章目录