caffe 实践程序4——cifar10网络
2016-07-29 15:57
597 查看
cifar10是个中小型的图片数据库,总共60000张32*32大小的图片,5w张用于训练,1w张用于测试。
caffe上cifar10的训练流程。
cifar10_quick_train_test.prototxt
[html] view
plain copy
![](https://code.csdn.net/assets/CODE_ico.png)
![](https://code.csdn.net/assets/ico_fork.svg)
name: "CIFAR10_quick"
layer {
name: "cifar"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
mean_file: "examples/cifar10/mean.binaryproto"
}
data_param {
source: "examples/cifar10/cifar10_train_lmdb"
batch_size: 100
backend: LMDB
}
}
layer {
name: "cifar"
type: "Data"
top: "data"
top: "label"
include {
phase: TEST
}
transform_param {
mean_file: "examples/cifar10/mean.binaryproto"
}
data_param {
source: "examples/cifar10/cifar10_test_lmdb"
batch_size: 100
backend: LMDB
}
}
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
convolution_param {
num_output: 32
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.0001
}
bias_filler {
type: "constant"
}
}
}
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "relu1"
type: "ReLU"
bottom: "pool1"
top: "pool1"
}
layer {
name: "conv2"
type: "Convolution"
bottom: "pool1"
top: "conv2"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
convolution_param {
num_output: 32
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
}
}
}
layer {
name: "relu2"
type: "ReLU"
bottom: "conv2"
top: "conv2"
}
layer {
name: "pool2"
type: "Pooling"
bottom: "conv2"
top: "pool2"
pooling_param {
pool: AVE
kernel_size: 3
stride: 2
}
}
layer {
name: "conv3"
type: "Convolution"
bottom: "pool2"
top: "conv3"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
convolution_param {
num_output: 64
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
}
}
}
layer {
name: "relu3"
type: "ReLU"
bottom: "conv3"
top: "conv3"
}
layer {
name: "pool3"
type: "Pooling"
bottom: "conv3"
top: "pool3"
pooling_param {
pool: AVE
kernel_size: 3
stride: 2
}
}
layer {
name: "ip1"
type: "InnerProduct"
bottom: "pool3"
top: "ip1"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
inner_product_param {
num_output: 64
weight_filler {
type: "gaussian"
std: 0.1
}
bias_filler {
type: "constant"
}
}
}
layer {
name: "ip2"
type: "InnerProduct"
bottom: "ip1"
top: "ip2"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
inner_product_param {
num_output: 10
weight_filler {
type: "gaussian"
std: 0.1
}
bias_filler {
type: "constant"
}
}
}
layer {
name: "accuracy"
type: "Accuracy"
bottom: "ip2"
bottom: "label"
top: "accuracy"
include {
phase: TEST
}
}
layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "ip2"
bottom: "label"
top: "loss"
}
之前做可视化,导师想通过改变网络层数训练模型,进而观察可视化结果,来评估网络好坏程度及为修改网络参数提供方案。
一张32*32大小的图片输入网络,变动如下:
[html] view
plain copy
![](https://code.csdn.net/assets/CODE_ico.png)
![](https://code.csdn.net/assets/ico_fork.svg)
conv1 100 32 32*32
pool1 100 32 16*16
conv2 100 32 16*16
pool2 100 32 8*8
conv3 100 64 8*8
pool3 100 64 4*4
ip1 100 64 1*1
ip1 100 10 1*1
因为conv1中的pad参数,所以从conv1出来的大小为(32+2×pad-kernel_size+stride)/stride=32,即输入是32*32,输出也是32*32。
现在在原网络增加两大层(一个大层是指:conv,pool,relu),中间有5大层时,网络已达极限,因为原始图片为32*32大小,
网络5:data ->cpr1->crp2->crp3->crp4->crp5->ip1->ip2 识别率:53% 52.29%
若再增加层数识别率均为10%,现原因不明
caffe上cifar10的训练流程。
cifar10_quick_train_test.prototxt
[html] view
plain copy
![](https://code.csdn.net/assets/CODE_ico.png)
name: "CIFAR10_quick"
layer {
name: "cifar"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
mean_file: "examples/cifar10/mean.binaryproto"
}
data_param {
source: "examples/cifar10/cifar10_train_lmdb"
batch_size: 100
backend: LMDB
}
}
layer {
name: "cifar"
type: "Data"
top: "data"
top: "label"
include {
phase: TEST
}
transform_param {
mean_file: "examples/cifar10/mean.binaryproto"
}
data_param {
source: "examples/cifar10/cifar10_test_lmdb"
batch_size: 100
backend: LMDB
}
}
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
convolution_param {
num_output: 32
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.0001
}
bias_filler {
type: "constant"
}
}
}
layer {
name: "pool1"
type: "Pooling"
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layer {
name: "relu1"
type: "ReLU"
bottom: "pool1"
top: "pool1"
}
layer {
name: "conv2"
type: "Convolution"
bottom: "pool1"
top: "conv2"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
convolution_param {
num_output: 32
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
}
}
}
layer {
name: "relu2"
type: "ReLU"
bottom: "conv2"
top: "conv2"
}
layer {
name: "pool2"
type: "Pooling"
bottom: "conv2"
top: "pool2"
pooling_param {
pool: AVE
kernel_size: 3
stride: 2
}
}
layer {
name: "conv3"
type: "Convolution"
bottom: "pool2"
top: "conv3"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
convolution_param {
num_output: 64
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
}
}
}
layer {
name: "relu3"
type: "ReLU"
bottom: "conv3"
top: "conv3"
}
layer {
name: "pool3"
type: "Pooling"
bottom: "conv3"
top: "pool3"
pooling_param {
pool: AVE
kernel_size: 3
stride: 2
}
}
layer {
name: "ip1"
type: "InnerProduct"
bottom: "pool3"
top: "ip1"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
inner_product_param {
num_output: 64
weight_filler {
type: "gaussian"
std: 0.1
}
bias_filler {
type: "constant"
}
}
}
layer {
name: "ip2"
type: "InnerProduct"
bottom: "ip1"
top: "ip2"
param {
lr_mult: 1
}
param {
lr_mult: 2
}
inner_product_param {
num_output: 10
weight_filler {
type: "gaussian"
std: 0.1
}
bias_filler {
type: "constant"
}
}
}
layer {
name: "accuracy"
type: "Accuracy"
bottom: "ip2"
bottom: "label"
top: "accuracy"
include {
phase: TEST
}
}
layer {
name: "loss"
type: "SoftmaxWithLoss"
bottom: "ip2"
bottom: "label"
top: "loss"
}
之前做可视化,导师想通过改变网络层数训练模型,进而观察可视化结果,来评估网络好坏程度及为修改网络参数提供方案。
一张32*32大小的图片输入网络,变动如下:
[html] view
plain copy
![](https://code.csdn.net/assets/CODE_ico.png)
conv1 100 32 32*32
pool1 100 32 16*16
conv2 100 32 16*16
pool2 100 32 8*8
conv3 100 64 8*8
pool3 100 64 4*4
ip1 100 64 1*1
ip1 100 10 1*1
因为conv1中的pad参数,所以从conv1出来的大小为(32+2×pad-kernel_size+stride)/stride=32,即输入是32*32,输出也是32*32。
现在在原网络增加两大层(一个大层是指:conv,pool,relu),中间有5大层时,网络已达极限,因为原始图片为32*32大小,
网络5:data ->cpr1->crp2->crp3->crp4->crp5->ip1->ip2 识别率:53% 52.29%
若再增加层数识别率均为10%,现原因不明
相关文章推荐
- TCP之拥塞处理详解
- Retrofit2 完全解析 探索与okhttp之间的关系(一)
- RTSP、 RTMP、HTTP的共同点、区别(转)
- C++网络编程
- HttpMessageConverter和@ResponseBody
- 算法竞赛入门经典(第二版)-刘汝佳-第四章 函数与递归 互联网协议网络Uva1590
- tcpdump详解
- poj 2455 Secret Milking Machine(二分枚举+最大流)
- HTTP/HTTPs要点
- TCP/IP 要点
- Batch Normalization 神经网络加速算法
- Jsoup报HTTP error fetching URL. Status=403, URL=。。。
- Python 15.网络编程
- CSRF漏洞的挖掘与利用
- HttpClient 4.5使用(一)
- TCP服务器连接相关知识点
- Okhttp、Volley和Gson的简单介绍和配合使用
- AngularJs HTTP响应拦截器实现登陆、权限校验
- 【Python之路Day12】网络篇之Paramiko
- NoHttp报错之Please invoke NoHttp.initialize(Application) on Application#onCreate()