制图方法
第一章 Netscope绘制深度学习网络模型
一、什么是Netscope?
Netscope用来可视化Caffe结构里prototxt格式的网络结构,可以绘制如AlexNet等深度学习网络结构,是一个在线可视化工具
。
二、Netscope网址
1、Netscope文档链接
2、Netscope的github链接
3、Netscope在线链接
其中:
1.github连接可以下载.prototxt
文件
2.在线连接可以生成网络结构图,操作过程中将.prototxt
文件中的文本粘贴至灰色方框中,然后通过按下shift+enter
生成图片。
三、Prototxt文件编写介绍
1.模型建立
定义网络名称
name: "CNN" #定义网络名称
定于输入层
# 定义输入层
layer {
name: "data"
type: "Input"
top: "data"
input_param { shape: { dim: 10 dim: 3 dim: 227 dim: 227 } }
# dim:数量 dim:通道数 dim:长度 dim:宽度
}
定义卷积层和池化层
layer {
name: "conv1"
type: "Convolution"
bottom: "data" # 上方连接的模块
top: "conv1" # 下方连接的模块
param {
lr_mult: 0.01 # 学习率
decay_mult: 0 # 延迟数
}
convolution_param {
num_output: 64 # 输出通道数
kernel_size: 3 # 卷积核大小
padding: 1 # 卷积的相关参数
}
}
layer {
name: "relu1"
type: "ReLU"
bottom: "conv1" # 上方同下方连接模块相同
top: "conv1" # 因此会同上方连接模块结合
}
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX # 池化类型
kernel_size: 3 # 核大小
stride: 2 # 步长
}
}
定义全连接层
layer {
name: "fc2"
type: "InnerProduct"
bottom: "pool1"
top: "fc2"
param {
lr_mult: 1
decay_mult: 1
}
param {
lr_mult: 2
decay_mult: 0
}
inner_product_param {
num_output: 1 # 输出通道数
}
}
定义输出层
layer {
name: "prob"
type: "Softmax"
bottom: "fc2"
top: "prob"
}
网络结构展示
总结
Netscope可以绘制深度学习模型,且配色很好看,可以绘制较大模型,但简单模型样式单薄。