代码笔记:caffe-reid自己增加的caffe.proto

在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代表着具体的参数内容。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值