Ошибка Caffe: нет поля с именем net

У меня на моем компьютере работал пример программы Caffe C ++, но после недавней перекомпиляции Caffe я столкнулся с этой ошибкой при попытке запустить программу:

[libprotobuf ОШИБКА google / protobuf / text_format.cc: 245] Ошибка синтаксического анализа текстового формата caffe.NetParameter: 2: 4: Тип сообщения «caffe.NetParameter» не имеет поля с именем «net».
upgrade_proto.cpp: 928] Ошибка проверки: ReadProtoFromTextFile (param_file, param) Не удалось проанализировать файл NetParameter: /home/jack/Desktop/beeshiny/deploy.prototxt

Я что-то упустил или был изменен синтаксис файлов prototxt? Мой файл deploy.prototxt (который я передаю программе на C ++) выглядит так:

# The train/test net protocol buffer definition
net: "/home/jack/Desktop/beeshiny/deploy_arch.prototxt"
# test_iter specifies how many forward passes the test should carry out.
# In the case of MNIST, we have test batch size 100 and 100 test iterations,
# covering the full 10,000 testing images.
test_iter: 100
# Carry out testing every 500 training iterations.
test_interval: 500
# The base learning rate, momentum and the weight decay of the network.
base_lr: 0.01
momentum: 0.9
weight_decay: 0.0005
# The learning rate policy
lr_policy: "inv"
gamma: 0.0001
power: 0.75
# Display every 100 iterations
display: 100
# The maximum number of iterations
max_iter: 10000
# snapshot intermediate results
snapshot: 5000
snapshot_prefix: "lenet"
# solver mode: CPU or GPU
solver_mode: CPU

Содержимое файла deploy_arch.prototxt, указанного в файле prototxt выше:

name: "LeNet"
input: "data"
input_shape {
  dim: 10
  dim: 1
  dim: 24
  dim: 24
}
layer {
  name: "conv1"
  type: "Convolution"
  bottom: "data"
  top: "conv1"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  convolution_param {
    num_output: 20
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "pool1"
  type: "Pooling"
  bottom: "conv1"
  top: "pool1"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}
layer {
  name: "conv2"
  type: "Convolution"
  bottom: "pool1"
  top: "conv2"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  convolution_param {
    num_output: 50
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "pool2"
  type: "Pooling"
  bottom: "conv2"
  top: "pool2"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}
layer {
  name: "ip1"
  type: "InnerProduct"
  bottom: "pool2"
  top: "ip1"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  inner_product_param {
    num_output: 500
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "relu1"
  type: "ReLU"
  bottom: "ip1"
  top: "ip1"
}
layer {
  name: "ip2"
  type: "InnerProduct"
  bottom: "ip1"
  top: "ip2"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  inner_product_param {
    num_output: 3
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "loss"
  type: "Softmax"
  bottom: "ip2"
  top: "loss"
}

Я не понимаю, почему это внезапно перестало работать, если только обновление не сделало мой файл prototxt устаревшим?


person Jack Simpson    schedule 09.09.2015    source источник
comment
сообщение об ошибке касается ...beeshiny/deploy.prototxt, в то время как решатель имеет .../deploy_arch.prototxt - может ли это быть связано? Можете ли вы показать первые несколько строк модели развертывания?   -  person Shai    schedule 09.09.2015
comment
Большое спасибо, Шай, я обновил вопрос с помощью другого файла prototxt и четко указал, какой из них я передаю программе на C ++.   -  person Jack Simpson    schedule 09.09.2015
comment
ваш deploy.prototxt описывает не сеть, а скорее решатель. ваш классификатор ожидает сетевого описания и поэтому не может проанализировать решатель.   -  person Shai    schedule 09.09.2015
comment
Вы правы, я снова полностью запутался, большое вам спасибо за вашу помощь и извинения за основную ошибку.   -  person Jack Simpson    schedule 09.09.2015


Ответы (1)


Я решил свою проблему, добавив caffe/python в $PYTHONPATH.

person user3835707    schedule 02.06.2016