tf.reduce_mean实现global average pooling(全局均值池化)

net = tf.reduce_mean(net, [1, 2], name='pool5', keep_dims=True)

利用 tf.reduce_mean(net,[1,2]) 来实现。

具体请参见slim models zoo. https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/slim/python/slim/nets/resnet_v1.py.

注意slim models zoo里的tf.reduce_mean已经替换成 net = math_ops.reduce_mean(net, [1, 2], name='pool5', keep_dims=True)。

你可能感兴趣的:(tf.reduce_mean实现global average pooling(全局均值池化))