在linux上利用caffe进行mnist的测试的时候,参考的文献是https://blog.csdn.net/jingkebiao4847/article/details/53925652.
然后在测试classifier的过程,出现如下问题:
Boost.Python.ArgumentError:Python argument types in
Net.__init__(Net,str, str, int)
did notmatch C++ signature:
__init__(boost::python::api::object,std::string, std::string, int)
__init__(boost::python::api::object,std::string, int)
在依照https://github.com/BVLC/caffe/issues/3220进行修改后重新编译caffe,原有问题消失,但出现了新的问题:
File"/home/hj/project/caffe_mnist/python/caffe/classifier.py", line 26,in __init__
caffe.Net.__init__(self, model_file,caffe.TEST, weights=pretrained_file)
TypeError:No registered converter was able to produce a C++ rvalue of type std::stringfrom this Python object of type str
解决方法是将$CAFFE_ROOT/python/caffe/_caffe.cpp内的所有std::string 替换为 char*,重新编译caffe即可。