caffe 运行mnist示例

6 篇文章 0 订阅

运行mnist示例:
1、得到数据
cd ~/caffe
sudo sh data/mnist/get_mnist.sh
2、制作符合caffe要求的数据
sudo sh examples/mnist/create_mnist.sh

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
此段主要是当时运行程序有些问题及处理方法
当时不方便打汉字,采用了中式英文注解~~
bad luck,terminal appear these:
Creating lmdb...
examples/mnist/create_mnist.sh: 17: examples/mnist/create_mnist.sh: build/examples/mnist/convert_mnist_data.bin: not found
solve method see following website:
https://blog.csdn.net/wangxing233/article/details/51734080
but it not solve this

following website :
https://blog.csdn.net/huaxie3355/article/details/71055704
can solve the problem

cd caffe
make all -j4

so,do this ,problem is solved

following website good
https://blog.csdn.net/dcxhun3/article/details/51859740#commentBox
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

3、修改lenet_solver.prototxt和train_lenet.prototxt 网络配置(使用GPU就不用改了)
cd ~/caffe
subl ./examples/mnist/lenet_solver.prototxt
设置 solver_mode: CPU ,使用GPU就不用改了
train_lenet.prototxt 可以不用修改

4、训练网络
cd ~/caffe
sudo time sh examples/mnist/train_lenet.sh

5、画出训练网络的结构图
cd ~/caffe/python
python draw_net.py ../examples/mnist/lenet_train_test.prototxt lenet.png

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
画网络过程可能会出现如下报错:
Traceback (most recent call last):
  File "draw_net.py", line 94, in <module>
    main()
  File "draw_net.py", line 90, in main
    phase)
  File "/home/pikachu/caffe/intel/caffe/python/caffe/draw.py", line 280, in draw_net_to_file
    fid.write(draw_net(caffe_net, rankdir, ext, phase))
  File "/home/pikachu/caffe/intel/caffe/python/caffe/draw.py", line 259, in draw_net
    return get_pydot_graph(caffe_net, rankdir, phase=phase).create(format=ext)
  File "/home/pikachu/.local/lib/python2.7/site-packages/pydot.py", line 1883, in create
    prog=prog))
Exception: "dot" not found in path.

这是因为在编译pycaffe 之前安装的一些依赖库不全造成的,缺啥就安装啥吧,这里缺少dot,因此:
sudo pip install pydot
执行这条命令后,再此执行:
cd ~/caffe/python
python draw_net.py ../examples/mnist/lenet_train_test.prototxt lenet_train_test.png
python draw_net.py ../examples/mnist/lenet.prototxt lenet.png
有时安装pydot后,还可能需要安装graphviz:
sudo apt install graphviz
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值