在caffe-reid的train.proto中,输入层是自己实现的。而且里面新增了参数项reid_data_param
,因此,需要自caffe.proto文件中添加对应的数据结构,这样才能生成对应的接口来读取train.proto中的文件。
同时,在 LayerParameter
要新增相应的类型和变量。
自定义的输入层中的reid_data_param
layer {
name: "data"
type: "ReidData"
top: "data"
top: "label"
transform_param {
mirror: true
crop_size: 227
mean_value: 97.8286
mean_value: 99.0468
mean_value: 105.606
}
reid_data_param {
source: "examples/market1501/lists/train.lst"
batch_size: 128
new_height: 256
new_width: 256
pos_fraction: 1
neg_fraction: 1
pos_limit: 1
neg_limit: 4
pos_factor: 1
neg_factor: 1.01
}
}
caffe.proto对应新增的数据结构
message ReidDataParameter {
// Specify the data source.
optional string source = 1;
// Specify the batch size.
optional uint32 batch_size = 4 [default = 1];
// It will also resize images if new_height or new_width are not zero.
optional uint32 new_height = 9 [default = 0];
optional uint32 new_width = 10 [default = 0];
// Specify if the images are color or gray
optional bool is_color = 11 [default = true];
optional uint32 pos_fraction = 12 [default = 1]; // Strictly positive values
optional uint32 neg_fraction = 13 [default = 1]; // Strictly positive values
optional float pos_limit = 14 [default = 1]; // Strictly positive values
optional float neg_limit = 15 [default = 4]; // Strictly positive values
optional float pos_factor = 16 [default = 1]; // Strictly positive values
optional float neg_factor = 17 [default = 1.01]; // Strictly positive values
//optional uint32 pn_step = 18 [default = 10000]; // Strictly positive values
}
LayerParameter新增的声明与定义
message LayerParameter {
...
optional ReidDataParameter reid_data_param = 200;
...
}
注意:ReidDataParameter
代表着参数的类型,这就是之前描述的数据结构。而reid_data_param
代表着具体的参数内容。