ubuntu14.04用cafe训练自己的数据

训练mnist数据集并测试
1.获取数据集
cd ~/caffe
./data/mnist/get_mnist.sh

2.转换格式,下载的数据是二进制格式,转换成lmdb格式
./examples/mnist/create_mnist.sh

3.训练数据集
./examples/mnist/train_lenet.sh

4.测试数据集
./build/tools/caffe.bin test -model examples/mnist/lenet_train_test.prototxt -weights examples/mnist/lenet_iter_10000.caffemodel -iterations 100


训练并测试自己的数据集
1.数据集放在./home/iscas/caffe/data/image1000test200  数据集是在windows7制作的2.
2.转换数据集格式并生成均值
参见/home/iscas/caffe/examples/image1000test200/create_image1000test200.sh,具体内容如下所示:

#!/usr/bin/env sh
# This script converts the cifar data into leveldb format.
set -e

EXAMPLE=examples/image1000test200
DATA=data/image1000test200
DBTYPE=lmdb

TRAIN_DATA_ROOT=/home/iscas/caffe/data/image1000test200/train/
VAL_DATA_ROOT=/home/iscas/caffe/data/image1000test200/val/


RESIZE_HEIGHT=32
RESIZE_WIDTH=32


echo "Creating $DBTYPE..."

rm -rf $EXAMPLE/image1000test200_train_$DBTYPE $EXAMPLE/image1000test200_val_$DBTYPE

./build/tools/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH $TRAIN_DATA_ROOT $DATA/train.txt $EXAMPLE/image1000test200_train_lmdb $DBTYPE

./build/tools/convert_imageset.bin --resize_height=$RESIZE_HEIGHT --resize_width=$RESIZE_WIDTH $VAL_DATA_ROOT $DATA/val.txt $EXAMPLE/image1000test200_val_lmdb $DBTYPE

echo "Computing image mean..."

./build/tools/compute_image_mean -backend=$DBTYPE \
  $EXAMPLE/image1000test200_train_$DBTYPE $EXAMPLE/mean.binaryproto

echo "Done."


3.生成mine_solver.prototxt和mine_train_test.prototxt两个文件,放在/home/iscas/caffe/data/image1000test200/train_val/ 文件夹下
4.训练网络
参见/home/iscas/caffe/examples/image1000test200/image1000test200_train.sh,具体内容如下所示:

#!/usr/bin/env sh
set -e

TOOLS=./build/tools

$TOOLS/caffe train \

  --solver=data/image1000test200/train_val/mine_solver.prototxt $@


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值