如何在原型文件中更改Caffe输入图像大小?

时间:2017-06-22 12:23:28

标签: deep-learning caffe

我已经使用了Alexnet和Caffe框架,首先我保存了我的对象图像然后将主题调整为100X200,然后我创建了LMDB数据库并读取了这些图像,并将主题标记为lmdb文件。现在我想用这些原型文件训练我的网络:

name: "CaffeNet"
layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  include {
    phase: TRAIN
  }
  transform_param {
    mirror: true
    #crop_size: 100
    mean_file: "[my-location]/db/mean.binaryproto"
  }
# mean pixel / channel-wise mean instead of mean image
#  transform_param {
#    crop_size: 227
#    mean_value: 104
#    mean_value: 117
#    mean_value: 123
#    mirror: true
#  }
  data_param {
    source: "[my-location]/db/train_lmdb"
    batch_size: 256
    backend: LMDB
  }
}
layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  include {
    phase: TEST
  }
  transform_param {
    mirror: false
    #crop_size: 100
    mean_file: "[my-location]/db/mean.binaryproto"
  }
# mean pixel / channel-wise mean instead of mean image
#  transform_param {
#    crop_size: 227
#    mean_value: 104
#    mean_value: 117
#    mean_value: 123
#    mirror: true
#  }
  data_param {
    source: "[my-location]/db/validation_lmdb"
    batch_size: 50
    backend: LMDB
  }
}
layer {
  name: "conv1"
  ......

当我尝试在caffe目录中使用Caffe脚本训练网络时:

caffe/build/tools/caffe train --solver [solverlocation].prototxt

我有

  

data_transformer.cpp:63]检查失败:datum_height ==   data_mean_.height()(200 vs. 100)

我知道默认的imagnet图像是100X100,但我的网络无法使用这个尺寸。我怎么能告诉Caffe我的输入图像尺寸(宽度,高度)已经改变了?

PS =我已发表评论crop_size,以避免对从lmdb读取的输入图像进行任何更改。

0 个答案:

没有答案