def multiscale_features(graph, names, dims, size, scope='features'):
"""
extract features from multiple endpoints, do dimensionality
reduction and resize to the given size
"""
with tf.variable_scope(scope):
endpoints = []
for i, name in enumerate(names):
endpoint = graph.get_tensor_by_name(name)
if not dims is None:
endpoint = slim.conv2d(endpoint, dims[i], 1,
activation_fn=None,
normalizer_fn=None)
endpoint = tf.image.resize_images(endpoint, size[0], size[1])
endpoints.append(endpoint)
return tf.concat(3, endpoints)
评论列表
文章目录