some cmd
cifar-10 tutorial
- download the binary data
1
| ./data/cifar10/get_cifar.sh
|
download:
batches.meta.txt data_batch_2.bin data_batch_4.bin get_cifar10.sh test_batch.bin
data_batch_1.bin data_batch_3.bin data_batch_5.bin readme.html
- convert binary data into leveldb format
1 2 3 4 5 6
| ./examples/cifar10/create_cifar10.sh % calling: ./examples/cifar/convert_cifar_data.bin <folder storing the binary data> <pat to store the db file>
compute the image mean: ./build/tools/compute_image_mean -backend=lmdb <folder of db file> <outputfile: mean.binaryproto>
|
train caffe from CMD:
http://vision.princeton.edu/courses/COS598/2015sp/slides/Caffe/caffe_tutorial.pdf
1 2 3 4 5
| ./train_lenet.sh
TOOLS=../../build/tools GLOG_logtostderr=1 $TOOLS/train_net.bin lenet_solver.prototxt
|
fine tuning
1 2 3 4 5
| caffe train —solver models/finetune_flickr_style/solver.prototxt —weights bvlc_reference_caffenet.caffemodel
|
1 2
| build/tools/extract_features.bin imagenet_model imagenet_val.prototxt fc7 temp/features(output file) 10(batch size)
|
add layer:
implement xx_layer.cpp
forward_cpu
backward_cpu
setup
select data
1 2 3 4 5 6
| find `pwd`/examples/images -type f -exec echo {} \; > examples/_temp/temp.txt
sed "s/$/ 0/" examples/_temp/temp.txt > examples/_temp/file_list.txt
|
creating lmdb from data
1
| ./examples/cifar10/convert_cifar_data.bin path/to/data ./examples/cifar10 lmdb
|
get the mean image
1 2
| ./build/tools/compute_image_mean -backend=lmdb ./example/cifar10_train_lmdb ./example/mean.binaryproto // get: data/ilsvrc212/imagenet_mean.binaryproto
|
subtracting the mean image from a dataset significantly improves classification accuracies. Download the mean image of the ILSVRC dataset.
run
1
| ./tools/extract_features models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel examples/_temp/imagenet_val.prototxt fc7 examples/_temp/features 10 lmdb
|
train.sh
1 2 3 4 5
| $TOOLS/caffe train \ --solver=examples/cifar10/cifar10_full_solver.prototxt
|
1 2 3 4 5 6
|
$TOOLS/caffe train \ --solver=examples/cifar10/cifar10_quick_solver.prototxt --snapshot=examples/cifar10/cifar10_full_iter_60000.solverstate.h5
|