2016-03-16 52 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