如果您在caffe.proto
仔细观察你会发现input
和input_shape
有repeated
属性:这意味着你可以有几个等项
// DEPRECATED. See InputParameter. The input blobs to the network.
repeated string input = 3;
// DEPRECATED. See InputParameter. The shape of the input blobs.
repeated BlobShape input_shape = 8;
:
name: "AnAmazingNetWithMultipleInputs_ThankYouShai_IwillForeverBeInYourDebt"
input: "first_input_1x3x127x127"
input_shape { dim: 1 dim: 3 dim: 127 dim: 127 }
input: "second_input_2x4x224x224"
input_shape { dim: 2 dim: 4 dim: 224 dim: 224 }
# I hope you can take it from here ;)
如果您在的相关部分看得更近,你会注意到这种形式的“输入形状声明”是DEPRECATED。
一个更好的办法是使用"Input"
层:
layer {
type: "Input"
name: "one_input_layer"
top: "first_input_1x3x127x127"
shape { dim: 1 dim: 3 dim: 127 dim: 127 }
top: "second_input_2x4x224x224"
shape { dim: 2 dim: 4 dim: 224 dim: 224 }
}
你也可以有不同的"Input"
层对于每个输入,如果你发现它更容易理解/阅读。
谢谢!我应该想到使用多个输入层!一个疑问:如果我反复使用top和shape,每个top之后都必须有一个形状?它如何建立映射? – GoodDeeds
我想按出场顺序 – Shai
谢谢@Shai,那工作。但是,似乎有一个小错误:我认为shape是input_param的一个属性,而不是直接输入层。当我尝试在第二个示例中使用它时出现错误,该错误通过使用input_param进行了纠正。 – GoodDeeds