谷歌大脑的《EfficientDet: Scalable and Efficient Object Detection》代码目前已经公布,代码链接:https://github.com/google/automl/tree/master/efficientdet
接下来将对BiFPN中加权融合部分进行解析。
对应代码入下:
# Combine all nodes.
dtype = nodes[0].dtype
if config.weight_method == 'attn':
edge_weights = [tf.cast(tf.Variable(1.0, name='WSM'), dtype=dtype)
for _ in range(len(fnode['inputs_offsets']))]
normalized_weights = tf.nn.softmax(tf.stack(edge_weights))
nodes = tf.stack(nodes, axis=-1)
new_node = tf.reduce_sum(tf.multiply(nodes, normalized_w