caffe结构中一层可以有多少bottoms/tops

How many bottoms/tops a layer can have in caffe structure

我一直看到 caffe 中的一些层在神经网络架构中有两个底部(源)或顶部(目标),例如这是 Segnet 数据层有两个顶部,数据和标签来自同一个源文件在同一行 img1.png lagel1.png

    layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  dense_image_data_param {
    source: "train.txt" # train file format img1.png img1.png (data and label)
    batch_size: 1               
    shuffle: true
  }

这些来自 Pascal-object-detection-fc

layer {
  name: "loss"
  type: "SoftmaxWithLoss"
  bottom: "fc8_pascal"
  bottom: "label"
}
layer {
  name: "accuracy"
  type: "Accuracy"
  bottom: "fc8_pascal"
  bottom: "label"
  top: "accuracy"
  include {
    phase: TEST
  }
}

有两个底部。

如果有人能解释将它们分成一层的含义以及为什么不为每个层设置不同的层,我将不胜感激。 另一件事,如果一个层将其自身引用为 top/bottom,是否意味着它不进行 forward/backward 计算?

将图层视为数学运算:每种图层类型执行不同的运算。 "Convolution"层将输入与层的内部参数进行卷积,"ReLU"执行线性整流等
有些操作不需要任何输入 ("bottom"s):这些通常是将 data/labels 带入网络的输入层。
其他层仅作用于单个操作数(一个 "bottom")并输出单个结果(一个 "top"):"Convolution""ReLU""Softmax" 仅举几例几个。
其他层可能会产生多个输出(许多 "top"s),例如 "Slice" 层。
您还可以找到采用多个输入并产生单个输出的层,例如 "Eltwise" 层。

最重要的是,每个 layer/operation 需要不同数量的输入,并可能产生不同数量的输出。你不应该混淆 input/output 斑点和层的操作。

有关 caffe 层的更多信息,请访问 caffe.help