修改lenet网络进行训练(二)
来源:互联网 发布:编程社区论坛 编辑:程序博客网 时间:2024/05/17 06:26
参考文档为caffe官网指导文档 “training lenet on mnist with caffe"
准备数据集
定义MNIST网络
定义MNIST Solver
训练测试模型
(一)准备数据集
cd /home/ypp/caffe-master #cd 到caffe-master安装的根目录
sudo ./data/mnist/get_mnist.sh
sudo ./examples/mnist/create_mnist.sh
会在examples/mnist目录下生成测试和训练数据集
(二)定义MNIST网络
name: "LeNet"#writing the data layerlayer { name: "mnist" type: "Data" data_param { source: "mnist_train_lmdb" backend: LMDB batch_size: 64 scale: 0.00390625 } top: "data" top: "label"}#writing the convolution layerlayer { name: "conv1" type: "Convolution" param { lr_mult: 1 } param { lr_mult: 2 } convolution_param { num_output: 20 kernel_size: 5 stride: 1 weight_filler { type: "xavier" } bias_filler { type: "constant" } }}#writing the pooling layerlayer { name: "pool1" type: "Pooling" pooling_param { kernel_size: 2 stride: 2 pool: MAX } bottom: "conv1" top: "pool1"}layer { name: "conv2" type: "Convolution" param { lr_mult: 1 } param { lr_mult: 2 } convolution_param { num_output: 50 kernel_size: 5 stride: 1 weight_filler { type: "xavier" } bias_filler { type: "constant" } } bottom: "pool1" top: "conv2"}layer { name: "pool2" type: "Pooling" pooling_param { kernel_size: 2 stride: 2 pool: MAX } bottom: "conv2" top: "pool2"}#writing the fully connected layerlayer { name: "ip1" type: "InnerProduct" param { lr_mult: 1 } param { lr_mult: 2 } inner_product_param { num_output: 500 weight_filler { type: "xavier" } bias_filler { type: "constant" } } bottom: "pool2" top: "ip1"}#writing the ReLU layerlayer { name: "relu1" type: "ReLU" bottom: "ip1" top: "ip1"}layer { name: "ip2" type: "InnerProduct" param { lr_mult: 1 } param { lr_mult: 2 } inner_product_param { num_output: 10 weight_filler { type: "xavier" } bias_filler { type: "constant" } } bottom: "ip1" top: "ip2"}#writing the loss layerlayer { name: "loss" type: "SoftmaxWithLoss" bottom: "ip2" bottom: "label"}
定义的网络为:输入->卷积层 ->降采样层->卷积层->降采样层 ->全连接层->ReLU层->全连接层->损失函数
也可以根据相应的网络自行修改
(三)定义MNIST Solver
<pre name="code" class="plain">#The train/test net protocol buffer definitionnet: "examples/mnist/define_myself_mnist.prototxt"# test_iter specifies how many forward passes the test should carry out.# In the case of MNIST, we have test batch size 100 and 100 test iterations,# covering the full 10,000 testing images.test_iter: 100# Carry out testing every 500 training iterations.test_interval: 500# The base learning rate, momentum and the weight decay of the network.base_lr: 0.01momentum: 0.9weight_decay: 0.0005# The learning rate policylr_policy: "inv"gamma: 0.0001power: 0.75# Display every 100 iterationsdisplay: 100# The maximum number of iterationsmax_iter: 10000# snapshot intermediate resultssnapshot: 5000snapshot_prefix: "examples/mnist/lenet"# solver mode: CPU or GPUsolver_mode: CPU
(四)训练测试模型
新建脚本 train-lenet.sh
#!/usr/bin/env sh./build/tools/caffe train --solver=examples/mnist/lenet_solver.prototxtcd 到caffe-master根目录下 执行
sudo ./examples/mnist/train-lenet.sh
0 0
- 修改lenet网络进行训练(二)
- 修改lenet网络进行训练(一)
- (Caffe,LeNet)网络训练流程(二)
- (Caffe,LeNet)网络训练流程(二)
- 待完成任务(一) 利用自己的数据集 利用lenet网络进行训练
- Caffe MNIST训练lenet网络
- (Caffe,LeNet)初始化训练网络(三)
- 使用LeNet网络训练Caltech101数据集
- lenet-5 学习笔记(二) 网络层次详解
- CNN学习(二)-LeNet网络结构的学习
- Windows平台基于Caffe框架的LeNet网络训练
- caffe训练mnist数据集使用lenet网络
- C++ 调用 Caffe 训练好的网络(样例:LeNet)
- caffe 安装与配置 (仅CPU版)以及Ubuntu 14.04 64位机上用Caffe+MNIST训练Lenet网络
- (二)caffe 网络训练执行流程
- windows+VS2013+CPU(only)安装caffe及训练lenet
- BP神经网络进行网络训练
- 【caffe】使用自己的图像数据训练lenet并用opencv进行预测
- poj1564Sum It Up【dfs】
- 组合模式
- leetcode有序单链表合并
- command line tools 安装
- Github入门
- 修改lenet网络进行训练(二)
- 把xheditor配置到网站上
- 添加缓存
- V4L2编程
- TreeMap按照value进行排序
- Bash shell programming 函数返回值
- .bash_profile和.bashrc以及profile的什么区别
- 闲谈计算机系统(1)
- JAVA 字符串 的转换