GeorgeSeif / Semantic-Segmentation-Suite

Semantic Segmentation Suite in TensorFlow. Implement, train, and test new Semantic Segmentation models easily!
2.5k stars 880 forks source link

[Q] Why is there "resize_bilinear" for "image_level_features"? (I think it does nothing..) #229

Closed ywpkwon closed 4 years ago

ywpkwon commented 4 years ago

In the function "AtrousSpatialPyramidPoolingModule", (line 30, models/DeepLabV3.py)

There is "image_features" (line 41)

    feature_map_size = tf.shape(inputs)

    # Global average pooling
    image_features = tf.reduce_mean(inputs, [1, 2], keep_dims=True)
    image_features = slim.conv2d(image_features, depth, [1, 1], activation_fn=None)
    image_features = tf.image.resize_bilinear(image_features, (feature_map_size[1], feature_map_size[2]))

It looks to me that image_feature is reduce_mean(keep_dims=True) of inputs so has same size with the inputs. feature_map_size is also the shape of inputs.

Then why is the resize_bilinear needed if image_features has already feature map_size?

ywpkwon commented 4 years ago

Oh, I was confused. If you have a similar question, you may want to see https://github.com/rishizek/tensorflow-deeplab-v3/issues/37.