ICNet-tensorflow
ICNet-tensorflow copied to clipboard
interp layer implementation
Hi @hellochick , I wonder if the implementation of inerp layer is similar to the original implementation ? The current function does not have conditional statements to check if only shrink or zoom is given, also the shrink implementation doesn't seem to reduce the dimension. Is there a reason for this ?
Possible change:
def interp(self, input, s_factor, z_factor, name=None):
ori_h, ori_w = input.get_shape().as_list()[1:3]
# shrink
if s_factor and not z_factor:
ori_h = (ori_h - 1) / s_factor + 1 ## current usage is (ori_h - 1) * s_factor + 1
ori_w = (ori_w - 1) / s_factor + 1 ## current usage is (ori_w - 1) * s_factor + 1
# zoom
elif z_factor and not s_factor:
ori_h = ori_h + (ori_h - 1) * (z_factor - 1)
ori_w = ori_w + (ori_w - 1) * (z_factor - 1)
resize_shape = [int(ori_h), int(ori_w)]
return tf.image.resize_bilinear(input, size=resize_shape, align_corners=True, name=name)
Hey @deeptf,
The original version of interp layer can shrink the image by just setting the parameter of (s_factor, z_factor) to (0.5, 1). Then it would downsample the original image to 1/2 resolutions