2016-03-16 34 views
1

我写了使用HDF5关于多标签分类的朱古力净场,这里被命名为“auto_train.prototxt”错误朱古力的prototxt,caffe.SolverParameter没有名为“名”

name: "multilabel_net" 
layer { 
     name: "data" 
     type: "HDF5Data" 
     top: "data" 
     top: "label" 
     include { 
     phase: TRAIN 
     } 
     hdf5_data_param { 
     source: "examples/corel5k/train.h5list" 
     batch_size: 50 
     shuffle: 1 
     } 
    } 
    layer { 
     name: "data" 
     type: "HDF5Data" 
     top: "data" 
     top: "label" 
     include { 
     phase: TEST 
} 
    hdf5_data_param { 
    source: "examples/corel5k/test.h5list" 
    batch_size: 50 
    } 
} 
layer { 
    name: "conv1" 
    type: "Convolution" 
    bottom: "data" 
    top: "conv1" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    convolution_param { 
    num_output: 96 
    kernel_size: 11 
    stride: 4 
    weight_filler { 
     type: "gaussian" 
     std: 0.01 
    } 
    bias_filler { 
     type: "constant" 
     value: 0 
    } 
    } 
} 
layer { 
    name: "relu1" 
    type: "ReLU" 
    bottom: "conv1" 
    top: "conv1" 
} 
layer { 
    name: "pool1" 
    type: "Pooling" 
    bottom: "conv1" 
    top: "pool1" 
    pooling_param { 
    pool: MAX 
    kernel_size: 3 
    stride: 2 
    } 
} 
layer { 
    name: "norm1" 
    type: "LRN" 
    bottom: "pool1" 
    top: "norm1" 
    lrn_param { 
    local_size: 5 
    alpha: 0.0001 
    beta: 0.75 
    } 
} 
layer { 
    name: "conv2" 
    type: "Convolution" 
    bottom: "norm1" 
    top: "conv2" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    convolution_param { 
    num_output: 256 
    pad: 2 
    kernel_size: 5 
    group: 2 
    weight_filler { 
     type: "gaussian" 
     std: 0.01 
    } 
    bias_filler { 
     type: "constant" 
     value: 1 
    } 
    } 
} 
layer { 
    name: "relu2" 
    type: "ReLU" 
    bottom: "conv2" 
    top: "conv2" 
} 
layer { 
    name: "pool2" 
    type: "Pooling" 
    bottom: "conv2" 
    top: "pool2" 
    pooling_param { 
    pool: MAX 
    kernel_size: 3 
    stride: 2 
    } 
} 
layer { 
    name: "norm2" 
    type: "LRN" 
    bottom: "pool2" 
    top: "norm2" 
    lrn_param { 
    local_size: 5 
    alpha: 0.0001 
    beta: 0.75 
    } 
} 
layer { 
    name: "conv3" 
    type: "Convolution" 
    bottom: "norm2" 
    top: "conv3" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    convolution_param { 
    num_output: 384 
    pad: 1 
    kernel_size: 3 
    weight_filler { 
     type: "gaussian" 
     std: 0.01 
    } 
    bias_filler { 
     type: "constant" 
     value: 0 
    } 
    } 
} 
layer { 
    name: "relu3" 
    type: "ReLU" 
    bottom: "conv3" 
    top: "conv3" 
} 
layer { 
    name: "conv4" 
    type: "Convolution" 
    bottom: "conv3" 
    top: "conv4" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    convolution_param { 
    num_output: 384 
    pad: 1 
    kernel_size: 3 
    group: 2 
    weight_filler { 
     type: "gaussian" 
     std: 0.01 
    } 
    bias_filler { 
     type: "constant" 
     value: 1 
    } 
    } 
} 
layer { 
    name: "relu4" 
    type: "ReLU" 
    bottom: "conv4" 
    top: "conv4" 
} 
layer { 
    name: "conv5" 
    type: "Convolution" 
    bottom: "conv4" 
    top: "conv5" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    convolution_param { 
    num_output: 256 
    pad: 1 
    kernel_size: 3 
    group: 2 
    weight_filler { 
     type: "gaussian" 
     std: 0.01 
    } 
    bias_filler { 
     type: "constant" 
     value: 1 
    } 
    } 
} 
layer { 
    name: "relu5" 
    type: "ReLU" 
    bottom: "conv5" 
    top: "conv5" 
} 
layer { 
    name: "pool5" 
    type: "Pooling" 
    bottom: "conv5" 
    top: "pool5" 
    pooling_param { 
    pool: MAX 
    kernel_size: 3 
    stride: 2 
    } 
} 
layer { 
    name: "fc6" 
    type: "InnerProduct" 
    bottom: "pool5" 
    top: "fc6" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    inner_product_param { 
    num_output: 4096 
    weight_filler { 
     type: "gaussian" 
     std: 0.005 
    } 
    bias_filler { 
     type: "constant" 
     value: 1 
    } 
    } 
} 
layer { 
    name: "relu6" 
    type: "ReLU" 
    bottom: "fc6" 
    top: "fc6" 
} 
layer { 
    name: "drop6" 
    type: "Dropout" 
    bottom: "fc6" 
    top: "fc6" 
    dropout_param { 
    dropout_ratio: 0.5 
    } 
} 
layer { 
    name: "fc7" 
    type: "InnerProduct" 
    bottom: "fc6" 
    top: "fc7" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    inner_product_param { 
    num_output: 4096 
    weight_filler { 
     type: "gaussian" 
     std: 0.005 
    } 
    bias_filler { 
     type: "constant" 
     value: 1 
    } 
    } 
} 
layer { 
    name: "relu7" 
    type: "ReLU" 
    bottom: "fc7" 
    top: "fc7" 
} 
layer { 
    name: "drop7" 
    type: "Dropout" 
    bottom: "fc7" 
    top: "fc7" 
    dropout_param { 
    dropout_ratio: 0.5 
    } 
} 
layer { 
    name: "score" 
    type: "InnerProduct" 
    bottom: "fc7" 
    top: "score" 
    inner_product_param { 
    num_output: 260 
    } 
} 
layer { 
    name: "loss" 
    type: "SigmoidCrossEntropyLoss" 
    bottom: "score" 
    bottom: "label" 
    top: "loss" 
} 
layer { 
    name: "score" 
    type: "InnerProduct" 
    bottom: "fc7" 
    top: "score" 
    inner_product_param { 
    num_output: 260 
    } 
    include { 
    phase: TEST} 
} 

的prototxt文件这就是train.sh

./build/tools/caffe train \ 
-solver examples/corel5k/auto_train.prototxt \ 
-weights examples/corel5k/bvlc_reference_caffenet.caffemodel 

但是当我运行该脚本,它得到了一些错误

[libprotobuf ERROR google/protobuf/text_format.cc:245] Error parsing text-format caffe.SolverParameter: 1:5: Message type "caffe.SolverParameter" has no field named "name". 
    F0316 15:57:16.892113 3464 upgrade_proto.cpp:1063] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse SolverParameter file: examples/corel5k/auto_train.prototxt 
    *** Check failure stack trace: *** 
     @  0x7f79b3a4011d google::LogMessage::Fail() 
     @  0x7f79b3a41fbd google::LogMessage::SendToLog() 
     @  0x7f79b3a3fd38 google::LogMessage::Flush() 
     @  0x7f79b3a4281e google::LogMessageFatal::~LogMessageFatal() 
     @  0x7f79b4065ee7 caffe::ReadSolverParamsFromTextFileOrDie() 
     @   0x40a8c5 train() 
     @   0x407544 main 
     @  0x7f79b25a0ec5 (unknown) 
     @   0x407615 (unknown) 
    Aborted (core dumped) 

我不知道发生了什么,寻求帮助

回答

5

您是与解算器定义prototxt(a.k.a solver.prototxt)混乱的网状结构定义prototxt(a.k.a train_val.prototxt)。

参见例如AlexNet example这两个不同的原型文件。

网状结构的定义,train_val.prototxt定义了网络结构,看起来就像auto_train.prototxt文件,你写的。

但是,您错过了为优化过程定义元参数的solver definition prototxt,solver.prototxt
在你的情况下,solver.prototxt会看起来像:

net: "examples/corel5k/auto_train.prototxt" # here is where you put the net structure file 
test_iter: 1000 
test_interval: 1000 
base_lr: 0.01 
lr_policy: "step" 
gamma: 0.1 
stepsize: 100000 
display: 20 
max_iter: 450000 
momentum: 0.9 
weight_decay: 0.0005 
snapshot: 10000 
snapshot_prefix: "examples/corel5k/my_auto_snapshots" 
solver_mode: GPU 

你可以找到关于如何设置参数元在solver.protoxtherehere信息。

一旦你有一个适当的solver.prototxt可以运行朱古力:

./build/tools/caffe train \ 
    -solver examples/corel5k/solver.prototxt \ 
    -weights examples/corel5k/bvlc_reference_caffenet.caffemodel 
+1

哦,我明白了,谢谢 – Fangxin