Error parsing net from net file

596 views
Skip to first unread message

Alex

unread,
Feb 16, 2016, 9:49:27 AM2/16/16
to Caffe Users
Can not find typo in my net file. Caffe report me:
0216 17:26:44.361912  6254 caffe.cpp:184] Using GPUs 0
I0216 17:26:44.667951  6254 solver.cpp:47] Initializing solver from parameters: 
test_iter: 200
test_interval: 200
base_lr: 0.01
display: 200
max_iter: 450000
lr_policy: "step"
gamma: 0.1
momentum: 0.9
weight_decay: 0.0005
stepsize: 400
solver_mode: GPU
device_id: 0
net: "/home/ashkanaev/Notebook/CNN/autorobot_cnn.prototxt"
I0216 17:26:44.668064  6254 solver.cpp:90] Creating training net from net file: /home/ashkanaev/Notebook/CNN/autorobot_cnn.prototxt
[libprotobuf ERROR google/protobuf/text_format.cc:245] Error parsing text-format caffe.NetParameter: 29:9: Expected string.
F0216 17:26:44.668236  6254 upgrade_proto.cpp:68] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: /home/ashkanaev/Notebook/CNN/autorobot_cnn.prototxt
*** Check failure stack trace: ***
    @     0x7fa1625d8daa  (unknown)
    @     0x7fa1625d8ce4  (unknown)
    @     0x7fa1625d86e6  (unknown)
    @     0x7fa1625db687  (unknown)
    @     0x7fa162ce16de  caffe::ReadNetParamsFromTextFileOrDie()
    @     0x7fa162bdcfeb  caffe::Solver<>::InitTrainNet()
    @     0x7fa162bde1fc  caffe::Solver<>::Init()
    @     0x7fa162bde509  caffe::Solver<>::Solver()
    @     0x7fa162bb41f3  caffe::Creator_SGDSolver<>()
    @           0x40e78e  caffe::SolverRegistry<>::CreateSolver()
    @           0x4079cb  train()
    @           0x4058c1  main
    @     0x7fa1618e6ec5  (unknown)
    @           0x405fd1  (unknown)
    @              (nil)  (unknown)
Aborted

Net file:
name: "Autorobot_cnn"
layer {
  name: "data"
  type: "HDF5Data"
  top: "data"
  top: "label"
  hdf5_data_param {
    source: "/home/ashkanaev/Notebook/autorobot/train_data.txt"
    batch_size: 256
  }
  include: { phase: TRAIN }
}
layer {
  name: "data"
  type: "HDF5Data"
  top: "data"
  top: "label"
  hdf5_data_param {
    source: "/home/ashkanaev/Notebook/autorobot/test_data.txt"
    batch_size: 256
  }
  include: { phase: TEST }
}	
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: 20
    kernel_size: 5
    stride: 1
    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: 2
    stride: 2
  }
}
layer {
  name: "norm1"
  type: "LNR"
  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: 60
    kernel_size: 5
    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: 2
    stride: 1
  }
}
layer {
  name: "norm2"
  type: "LNR"
  bottom: "pool2"
  top: "norm2"
  lrn_param {
    local_size: 5
    alpha: 0.0001
    beta: 0.75
  }
}	
layer {
  name: "fc1"
  type: "InnerProduct"
  bottom: "norm2"
  top: "fc1"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 2
    decay_mult: 0
  }
  inner_product_param {
    num_output: 500
    weight_filler {
      type: "gaussian"
      std: 0.005
    }
    bias_filler {
      type: "constant"
      value: 1
    }
  }
}
layer {
  name: "relu3"
  type: "ReLU"
  bottom: "fc1"
  top: "fc1"
}
layer {
  name: "drop1"
  type: "Dropout"
  bottom: "fc1"
  top: "fc1"
  dropout_param {
    dropout_ratio: 0.3
  }
}
layer {
  name: "fc2"
  type: "InnerProduct"
  bottom: "fc1"
  top: "fc2"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 2
    decay_mult: 0
  }
  inner_product_param {
    num_output: 256
    weight_filler {
      type: "gaussian"
      std: 0.005
    }
    bias_filler {
      type: "constant"
      value: 1
    }
  }
}
layer {
  name: "relu4"
  type: "ReLU"
  bottom: "fc2"
  top: "fc2"
}
layer {
  name: "drop1"
  type: "Dropout"
  bottom: "fc2"
  top: "fc2"
  dropout_param {
    dropout_ratio: 0.3
  }
}
layer {
  name: "fc3"
  type: "InnerProduct"
  bottom: "fc2"
  top: "fc3"
  param {
    lr_mult: 1
    decay_mult: 1
  }
  param {
    lr_mult: 2
    decay_mult: 0
  }
  inner_product_param {
    num_output: 28
    weight_filler {
      type: "gaussian"
      std: 0.005
    }
    bias_filler {
      type: "constant"
      value: 1
    }
  }
}
layer {
  name: "accuracy"
  type: "Accuracy"
  bottom: "fc3"
  bottom: "label"
  top: "accuracy"
  include {
    phase: TEST
  }
}
layer {
  name: "loss"
  type: "Softmax"
  bottom: "fc3"
  bottom: "label"
  top: "loss"
}

someone knows how to fix it?

Jan C Peters

unread,
Feb 17, 2016, 5:01:27 AM2/17/16
to Caffe Users
How about that "#" sign in the first LRN layer?

Jan
Message has been deleted

Alex

unread,
Feb 17, 2016, 7:46:55 AM2/17/16
to Caffe Users
This is just a comment 

Jan C Peters

unread,
Feb 17, 2016, 8:10:49 AM2/17/16
to Caffe Users
Oh, ok. Did not know that comments are prefixed with a # in textual protobuf format. Since comments in the proto itself are // prefixed. Somewhat wierd...

Aside from that, the file looks fine. Maybe check for unprintable characters in an editor?

Jan

Chris

unread,
Sep 27, 2016, 9:58:23 AM9/27/16
to Caffe Users
same error here.
did you solve it?

Przemek D

unread,
Sep 28, 2016, 5:29:14 AM9/28/16
to Caffe Users
Caffe, as I have found, is very sensitive to whitespace chars. There is a leftover TAB char after the curly bracket closing your test data input layer. Try removing it and tell us if it helped any.
Reply all
Reply to author
Forward
0 new messages