Caffe错误:没有名为"net"的字段 [英] Caffe error: no field named "net"

查看:139
本文介绍了Caffe错误:没有名为"net"的字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的计算机上有Caffe C ++示例程序,但是最近重新编译Caffe之后,当我尝试运行该程序时遇到了该错误:

I had the Caffe C++ example program working on my computer, but after recently recompiling Caffe, I've encountered this error when I try to run the program:

[libprotobuf错误google/protobuf/text_format.cc:245]解析错误 文本格式caffe.NetParameter:2:4:消息类型"caffe.NetParameter" 没有名为"net"的字段.
upgrade_proto.cpp:928]检查失败:ReadProtoFromTextFile(param_file, 参数)无法解析NetParameter文件: /home/jack/Desktop/beeshiny/deploy.prototxt

[libprotobuf ERROR google/protobuf/text_format.cc:245] Error parsing text-format caffe.NetParameter: 2:4: Message type "caffe.NetParameter" has no field named "net".
upgrade_proto.cpp:928] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: /home/jack/Desktop/beeshiny/deploy.prototxt

我是否缺少某些内容,或者prototxt文件的语法已更改?我的deploy.prototxt文件(传递给C ++程序)如下所示:

Am I missing something or has the syntax of the prototxt files been changed? My deploy.prototxt file (that I pass to the C++ program) looks like this:

# 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

上面的prototxt文件中引用的deploy_arch.prototxt文件的内容:

The contents of the deploy_arch.prototxt file referenced in the prototxt file above:

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文件过时,否则它突然停止工作?

I don't understand why this has stopped working all of a sudden, unless an update has made my prototxt file obsolete?

推荐答案

我通过在$PYTHONPATH中添加caffe/python解决了我的问题.

I solved my problem by adding caffe/python in $PYTHONPATH.

这篇关于Caffe错误:没有名为"net"的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆