转载:http://blog.csdn.net/shuzfan/article/details/54565776

注:在写u-net网络的时候有用到

 

———————— Concat —————————

concat层实现输入数据的拼接。
该层有两个相同作用的参数:

message ConcatParameter {
  //指定拼接的维度,默认为1即以channel通道进行拼接;支持负索引,即-1表示最后一个维度
  optional int32 axis = 2 [default = 1];

  // 以后会被弃用,作用同axis一样,但不能指定为负数
  optional uint32 concat_dim = 1 [default = 1];
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

caffe中数据通常为4个维度,即 num×channels×height×width,因此默认值1表示channels通道进行拼接。而0表示num这个维度,即数量上的叠加

使用方法如下

layer {
  name: "data_all"
  type: "Concat"
  bottom: "data_classfier"
  bottom: "data_boundingbox"
  bottom: "data_facialpoints"
  top: "data_all"
  concat_param {
    axis: 0
  }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

除了拼接维度外的其它维度都必须相等。比如上面,输入图像均为 24×24×3,用于分类的有150张图片,用于boundingbox回归的有50张,用于关键点回归的也有50张,则最后拼接的结果就是(150+50+50)×3×24×24

 

 

更多推荐