caffe利用lenet_5模型跑MNIST数据
来源:互联网 发布:淘宝客服规则 编辑:程序博客网 时间:2024/06/05 20:25
一:MNIST数据集的获取
1.获取MNIST数据集
cd data/mnist/./get_mnist.shtree
2.此时可以查看一下caffe下get_mnist.sh脚本的内容
#!/usr/bin/env sh# This scripts downloads the mnist data and unzips it.DIR="$( cd "$(dirname "$0")" ; pwd -P )"cd "$DIR"echo "Downloading..."for fname in train-images-idx3-ubyte train-labels-idx1-ubyte t10k-images-idx3-ubyte t10k-labels-idx1-ubytedo if [ ! -e $fname ]; then wget --no-check-certificate http://yann.lecun.com/exdb/mnist/${fname}.gz gunzip ${fname}.gz fidone
3.目前下载下来的是压缩形式的bin二进制文件,需要转换为LEVELDB或者LMDB形式才能被caffe所识别
执行:
./examples/mnist/create_mnist.sh查看所生成的目录文件:
ls -l examples/mnist/mnist_train_lmdb/ls -l examples/mnist/mnist_test_lmdb/当然具体大家可以使用vi或者gedit去查看该文件的具体内容以及将MNIST数据集转换为llmdb格式的源文件:
examples/mnist/convert_mnist_data.cpp
二:跑lenet-5模型
1.查看lenet-5模型描述文件
gedit examples/mnist/lenet_train_val.prototxt
gedit examples/mnist/lenet_solver.prototxt修改为CPU,我自己使用CPU跑
执行:
examples/mnist/train_lenet.sh开始盖楼:
模型描述
name: "LeNet"state { phase: TEST}layer { name: "mnist" type: "Data" top: "data" top: "label" include { phase: TEST } transform_param { scale: 0.00390625 } data_param { source: "examples/mnist/mnist_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: 20 kernel_size: 5 stride: 1 weight_filler { type: "xavier" } bias_filler { type: "constant" } }}layer { name: "pool1" type: "Pooling" bottom: "conv1" top: "pool1" pooling_param { pool: MAX kernel_size: 2 stride: 2 }}layer { name: "conv2" type: "Convolution" bottom: "pool1" top: "conv2" 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" } }}layer { name: "pool2" type: "Pooling" bottom: "conv2" top: "pool2" pooling_param { pool: MAX kernel_size: 2 stride: 2 }}layer { name: "ip1" type: "InnerProduct" bottom: "pool2" top: "ip1" param { lr_mult: 1 } param { lr_mult: 2 } inner_product_param { num_output: 500 weight_filler { type: "xavier" } bias_filler { type: "constant" } }}layer { name: "relu1" type: "ReLU" bottom: "ip1" top: "ip1"}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: "xavier" } 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"}开始训练
最终训练模型结果是保存在examples/mnist/lenet_iter_10000.caffemodel,训练状态保存在
examples/mnist/lenet_iter_10000.solverstate中,均是protobuffer二进制格式文件。
3.测试模型
./build/tools/caffe.bin test -model examples/mnist/lenet_train_test.prototxt -weights examples/mnist/lenet_iter_10000.caffemodel -iterations 100
阅读全文
0 0
- caffe利用lenet_5模型跑MNIST数据
- 【Caffe】训练MNIST数据集模型
- 【Caffe】训练MNIST数据集模型
- caffe 跑mnist 数据集
- caffe之利用mnist数据集训练好的lenet_iter_10000.caffemodel模型测试一张自己的手写体数字
- caffe之利用mnist数据集训练好的lenet_iter_10000.caffemodel模型测试一张自己的手写体数字
- Caffe实战:LeNet模型训练测试MNIST数据集
- win10+only-cpu利用Caffe框架测试mnist数据集
- Caffe 训练mnist数据
- caffe mnist数据层
- caffe mnist数据实战
- caffe 下测试 MNIST数据
- Caffe mnist数据集训练
- caffe训练mnist数据集
- Mnist数据集测试Caffe
- caffe(一): 利用自带MNIST例程训练手写字符识别模型
- caffe(二): 利用训练好的MNIST模型测试自己的手写字符图片
- Caffe容器中如何用GPU跑mnist数据集
- TCP重传机制
- codeforces817F MEX Queries -- 线段树
- 每天五分钟linux(10)-cat
- PowerDesigner16.5版本显示工具箱
- uva 815 Flooded!
- caffe利用lenet_5模型跑MNIST数据
- 线程间的协调
- 2017多校联合(hdu6043)KazaQ's Socks找规律
- HDU1273-漫步深林
- 零基础写Java知乎爬虫之获取知乎编辑推荐内容
- php计算几分钟前、几小时前、几天前的几个函数、类功能实现
- win7安装VirtualBox,创建虚拟机启动报错STATUS_OBJECT_NAME_NOT_FOUND (0 retries) Driver is probably stuck stoppin
- 在android项目中启动微信,QQ,支付宝等应用
- TASKCTL4.1单机部署