错误导入hdf5文件以在caffe中训练hdf5_classification

时间:2016-04-29 04:39:34

标签: c++ caffe hdf5

这是我的日志

Log file created at: 2016/04/29 14:01:52
    Running on machine: DELL
    Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
    F0429 14:01:52.191473 14832 upgrade_proto.cpp:79] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: examples/hdf5_classification/nonlinear_auto_train.prototxt

这是我的蝙蝠

.\bin\caffe.exe train --solver=D:\caffe-windows-master\examples\hdf5_classification\nonlinear_solver.prototxt
pause

这是我的nonlinear_solver.prototxt

train_net: "examples/hdf5_classification/nonlinear_auto_train.prototxt"
#test_net: "examples/hdf5_classification/nonlinear_auto_test.prototxt"
#test_iter: 250
#test_interval: 1000
base_lr: 0.01
lr_policy: "step"
gamma: 0.1
stepsize: 5000
display: 1000
max_iter: 10000
momentum: 0.9
weight_decay: 0.0005
snapshot: 10000
snapshot_prefix: "examples/hdf5_classification/data/train"
solver_mode: GPU

这是我的nonlinear_auto_train.prototxt

layer {
  name: "data"
  type: "HDF5Data"
  top: "data"
  top: "label"
  hdf5_data_param {
    source: "D:\caffe-windows-master\examples/hdf5_classification/data/list.txt"
    batch_size: 10
  }
}
layer {
  name: "ip1"
  type: "InnerProduct"
  bottom: "data"
  top: "ip1"
  inner_product_param {
    num_output: 40
    weight_filler {
      type: "xavier"
    }
  }
}
layer {
  name: "relu1"
  type: "ReLU"
  bottom: "ip1"
  top: "ip1"
}
layer {
  name: "ip2"
  type: "InnerProduct"
  bottom: "ip1"
  top: "ip2"
  inner_product_param {
    num_output: 2
    weight_filler {
      type: "xavier"
    }
  }
}
layer {
  name: "accuracy"
  type: "Accuracy"
  bottom: "ip2"
  bottom: "label"
  top: "accuracy"
}
layer {
  name: "loss"
  type: "SoftmaxWithLoss"
  bottom: "ip2"
  bottom: "label"
  top: "loss"
}

代码在Windows上运行

  

首先,我找不到D:\ ThirdPartyLibrary;

     

其次,h5文件已保存在适当的文件夹中;

     

第三,我使用每个文件的绝对路径

我不知道为什么代码运行不好

1 个答案:

答案 0 :(得分:0)

您收到错误消息"无法解析[...] train.prototxt"。
这暗示您的train.prototxt文件中存在语法错误 我怀疑这行

source: "D:\caffe-windows-master\examples/hdf5_classification/data/list.txt"

混合斜线和反斜杠 尝试:

source: "D:/caffe-windows-master/examples/hdf5_classification/data/list.txt"