pycaffe 无法识别 prototxt 文件中的有效参数

pycaffe does not recognise a valid parameter in prototxt file

我试图了解卷积神经网络 SegNet 的作用,因此我创建了一个 Python 模块来加载它,希望打印出其层的不同形状和属性。

from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import caffe

caffe.set_device(0)
caffe.set_mode_gpu()
net = caffe.Net('/path/to/models/segnet_train.prototxt', caffe.TEST)

[print(k, v.data.shape) for k, v in net.blobs.items()]

但它告诉我该文件不正确,尽管我可以使用 SegNet 提供的文件正确训练该网络(请参阅 prototxt 文件 here)。这是什么意思,我该怎么办?

这是完整的错误

[libprotobuf ERROR google/protobuf/text_format.cc:274] Error parsing text-format caffe.NetParameter: 7:26: Message type "caffe.LayerParameter" has no field named "dense_image_data_param".
WARNING: Logging before InitGoogleLogging() is written to STDERR
F1212 15:59:09.624486 20202 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: /path/to/models/segnet_train.prototxt

正如 Dale 在他的 中指出的那样,确实是 caffe 版本问题。我确实使用了独立的 caffe 构建,而 SegNet 自带了它自己的 caffe。

我将 python 路径更改为该发行版,一切正常。