博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
caffe linux下面的调试mnist遇到的问题
阅读量:6956 次
发布时间:2019-06-27

本文共 2198 字,大约阅读时间需要 7 分钟。

搭建环境参考

这个教程基本是正确的。

补充一点就是

make all -j4

之后,在build/bin/下面会生成很多*.bin文件,就证明编译成功。

 

下面是运行mnist,执行到create_mnist.sh这一步的时候遇见了一个问题

./create_mnist.sh: 17: ./create_mnist.sh: build/examples/mnist/convert_mnist_data.bin: not found

这个要变换目录才可以

注意:新版caffe都需要从根目录上执行,不然可能会遇到这个错误

ubuntu@ubuntu-PC:~/work/caffe-master$ cp examples/mnist/create_mnist.sh ./ubuntu@ubuntu-PC:~/work/caffe-master$ ./create_mnist.sh

看看官方给的教程

cd $CAFFE_ROOT./data/mnist/get_mnist.sh./examples/mnist/create_mnist.sh

直接根据官方的教程来配置算了

结尾也就是官方自己的数据测试完,得到一个99%的准确度,然后就完了(很多博客也是这样就结束了),就大功告成!#$%%%%*& what the fu*k!!!!

不用自己那点数据来测一下吗??

那好吧,我来续命....

可以用python,也可以用c++自己调用classification.bin

如果不动用法,直接

./build/examples/cpp_classification/classification.bin

会提示你使用方法的

python:

import os        import sys        import numpy as np        import matplotlib.pyplot as plt        caffe_root = '/home/vr/Documents/Caffe/setup/caffe-master/'        sys.path.insert(0, caffe_root + 'python')        import caffe        MODEL_FILE = '/home/vr/Documents/Caffe/setup/caffe-master/examples/mnist/lenet.prototxt'        PRETRAINED = '/home/vr/Documents/Caffe/setup/caffe-master/examples/mnist/lenet_iter_10000.caffemodel'        IMAGE_FILE = '/home/vr/Documents/Caffe/setup/caffe-master/examples/mnist/test/0012.jpg'              input_image=caffe.io.load_image(IMAGE_FILE,color=False)      #print input_image      net = caffe.Classifier(MODEL_FILE, PRETRAINED)             prediction=net.predict([input_image])       caffe.set_mode_cpu()      print 'predicted class:', prediction[0].argmax()

.sh脚本调用

./build/examples/cpp_classification/classification.bin \examples/mnist/classificat_net.prototxt \examples/mnist/lenet_iter_10000.caffemodel \examples/mnist/mean.binaryproto examples/mnist/label.txt \examples/mnist/0.png

什么???参数太多?

可以,直接改classification.cpp文件

重新编译classification.bin

 

遇到新问题了,执行classification.bin的时候找不到库!so库!

 

./build/tools/caffe: error while loading shared libraries: libcaffe.so.1.0.0-rc5: cannot open shared object file: No such file or directory

 

参考

里面有一个解决方法说的是要把库(或者库的软链接)拷到 /usr/lib/x86_64-linux-gnu/目录下

 

sudo cp distribute/bin/libcaffe.so.1.0.0-rc5 /usr/lib/x86_64-linux-gnu/

 

果然运行正常了。

(未完,待续)

 

转载于:https://www.cnblogs.com/baldermurphy/p/6528077.html

你可能感兴趣的文章
XY问题在开发中的体现
查看>>
更换或加装网卡的eth编号顺序配置
查看>>
Executors下面的线程池实现
查看>>
锐捷CCNA系列(五) 交换机配置模式切换
查看>>
squid命中率监控软件安装
查看>>
备份 Outlook 2010 中接收到的邮件和联系人
查看>>
用open***组建lan to lan ***
查看>>
我的友情链接
查看>>
Invalid source HTML for this operation , Error In IE
查看>>
Linux服务器间建立双向信任-无密码相互访问
查看>>
【COCOS2D-HTML5 开发之二】cocos2d-html5项目定义成员,局部变量,函数笔记随笔
查看>>
rsync与inotify
查看>>
将博客搬至CSDN
查看>>
使用docker镜像玩转steam挂卡
查看>>
修改root密码方式及克隆虚拟机
查看>>
hadoop技术入门学习之发行版选择
查看>>
spring-boot官方参考文档(使用spring-boot)(2.2)
查看>>
scrapy之异步写入数据库
查看>>
贪吃蛇
查看>>
现代图像处理技术试题
查看>>