使用
DenseNet和Inception中更多采用的是concatenate操作,而ResNet更多采用的add操作。
concatenate为横向或纵向空间上的叠加,而add为简单的像素叠加。
add
使用keras中源码容易看到,是像素的叠加
def _merge_function(self, inputs):
output = inputs[0]
for i in range(1, len(inputs)):
output += inputs[i]
return output
cancatnate
t1 = [[1, 2, 3], [4, 5, 6]]
t2 = [[7, 8, 9], [10, 11, 12]]
tf.concat([t1, t2], 0) ==> [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
tf.concat([t1, t2], 1) ==> [[1, 2, 3, 7, 8, 9], [4, 5, 6, 10, 11, 12]]
# tensor t3 with shape [2, 3]
# tensor t4 with shape [2, 3]
tf.shape(tf.concat([t3, t4], 0)) ==> [4, 3]
tf.shape(tf.concat([t3, t4], 1)) ==> [2, 6]
---------------------
作者:KUNLI7
来源:CSDN
原文:https://blog.csdn.net/u012193416/article/details/79479935
版权声明:本文为博主原创文章,转载请附上博文链接!