caffe finetune 开始训练的命令:
./build/tools/caffe train -solver examples/mytask/solver.prototxt -weights examples/mytask/caffe_reference_imagenet_model.model
在caffe中可以使用draw_net.py轻松地绘制卷积神经网络(CNN,Convolutional Neural Networks)的架构图。这个工具对于我们理解、学习甚至查错都有很大的帮助。
draw_net.py的使用方法如下:
usage: draw_net.py [-h] [--rankdir RANKDIR]
input_net_proto_file output_image_file
Draw a graph of the net architecture.
positional arguments:
input_net_proto_file Input network prototxt file
output_image_file Output image file
optional arguments:
-h, --help show this help message and exit
--rankdir RANKDIR One of TB (top-bottom, i.e., vertical), RL (right-
left, i.e., horizontal), or another valid dot option;
see
http://www.graphviz.org/doc/info/attrs.html#k:rankdir
(default: LR)
其中,–rankdir选项确定了输出图片的摆放位置,如TB (Top-Bottom) 就是网络从上到下访问,同理RL (Right-Left)就是从右向左,LR (Left-Right) 就是从左向右摆放。默认使用的是LR方式。
下面的代码输出了卷积神经网络经典的LeNet的网络结构
/usr/local/caffe/python# python draw_net.py --rankdir TB ../examples/mnist/lenet.prototxt ../examples/mnist/lenet_structure.jpg
下面是bvlc_reference_caffenet的网络结构绘制
竖着绘制
/usr/local/caffe/python# python draw_net.py --rankdir TB ../examples/mytask/train_val.prototxt ../examples/mytask/a.jpg
横着绘制(LR)