CIFAR-10数据集含有6万个32*32的彩色图像,共分为10种类型,由 Alex Krizhevsky, Vinod Nair和 Geoffrey Hinton收集而来。包含50000张训练图片,10000张测试图片
http://www.cs.toronto.edu/~kriz/cifar.html
数据集的数据存在一个10000*3072 的 numpy数组中,单位是uint8s,3072是存储了一个32*32的彩色图像。(3072=1024*3)。前1024位是r值,中间1024是g值,后面1024是b值。
首先准备数据集:
cd $CAFFE_ROOT/data/cifar10
./get_cifar10.sh
[root@localhost cifar10]# ./get_cifar10.sh
Downloading...
--2015-03-09 18:38:23-- http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz
Resolving www.cs.toronto.edu... 128.100.3.30
Connecting to www.cs.toronto.edu|128.100.3.30|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 170052171 (162M) [application/x-gzip]
Saving to: 鈥渃ifar-10-binary.tar.gz鈥
100%[=============================================================>] 170,052,171 1.66M/s in 5m 22s
Unzipping...
Done.
cd $CAFFE_ROOT/examples/cifar10
./create_cifar10.sh
create_cifar10.sh 源代码如下,我们可以看到,所做的工作就是将图片库转成leveldb格式,并计算均值二进制文件
#!/usr/bin/env sh
# This script converts the cifar data into leveldb format.
EXAMPLE=examples/cifar10
DATA=data/cifar10
echo "Creating leveldb..."
rm -rf $EXAMPLE/cifar10_train_leveldb $EXAMPLE/cifar10_test_leveldb
./build/examples/cifar10/convert_cifar_data.bin $DATA $EXAMPLE
echo "Computing image mean..."
./build/tools/compute_image_mean $EXAMPLE/cifar10_train_leveldb \
$EXAMPLE/mean.binaryproto leveldb
echo "Done."
[root@localhost caffe]# ./examples/cifar10/create_cifar10.sh
Creating leveldb...
Computing image mean...
E0309 18:50:12.026103 18241 compute_image_mean.cpp:114] Processed 10000 files.
E0309 18:50:12.094758 18241 compute_image_mean.cpp:114] Processed 20000 files.
E0309 18:50:12.163048 18241 compute_image_mean.cpp:114] Processed 30000 files.
E0309 18:50:12.231233 18241 compute_image_mean.cpp:114] Processed 40000 files.
E0309 18:50:12.299324 18241 compute_image_mean.cpp:114] Processed 50000 files.
Done.
# reduce the learning rate after 8 epochs (4000 iters) by a factor of 10
# The train/test net protocol buffer definition
net: "examples/cifar10/cifar10_quick_train_test.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.001
momentum: 0.9
weight_decay: 0.004
# The learning rate policy
lr_policy: "fixed"
# Display every 100 iterations
display: 100
# The maximum number of iterations
max_iter: 4000
# snapshot intermediate results
snapshot: 4000
snapshot_prefix: "examples/cifar10/cifar10_quick"
# solver mode: CPU or GPU
solver_mode: CPU
~
name: "CIFAR10_quick"
layers {
name: "cifar"
type: DATA
top: "data"
top: "label"
data_param {
source: "examples/cifar10/cifar10_train_leveldb"
batch_size: 100
}
transform_param {
mean_file: "examples/cifar10/mean.binaryproto"
}
include: { phase: TRAIN }
}
layers {
name: "cifar"
type: DATA
top: "data"
top: "label"
data_param {
source: "examples/cifar10/cifar10_test_leveldb"
batch_size: 100
}
transform_param {
mean_file: "examples/cifar10/mean.binaryproto"
}
include: { phase: TEST }
}
layers {
name: "conv1"
type: CONVOLUTION
bottom: "data"
top: "conv1"
blobs_lr: 1
blobs_lr: 2
convolution_param {
num_output: 32
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.0001
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "pool1"
type: POOLING
bottom: "conv1"
top: "pool1"
pooling_param {
pool: MAX
kernel_size: 3
stride: 2
}
}
layers {
name: "relu1"
type: RELU
bottom: "pool1"
top: "pool1"
}
layers {
name: "conv2"
type: CONVOLUTION
bottom: "pool1"
top: "conv2"
blobs_lr: 1
blobs_lr: 2
convolution_param {
num_output: 32
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "relu2"
type: RELU
bottom: "conv2"
top: "conv2"
}
layers {
name: "pool2"
type: POOLING
bottom: "conv2"
top: "pool2"
pooling_param {
pool: AVE
kernel_size: 3
stride: 2
}
}
layers {
name: "conv3"
type: CONVOLUTION
bottom: "pool2"
top: "conv3"
blobs_lr: 1
blobs_lr: 2
convolution_param {
num_output: 64
pad: 2
kernel_size: 5
stride: 1
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "relu3"
type: RELU
bottom: "conv3"
top: "conv3"
}
layers {
name: "pool3"
type: POOLING
bottom: "conv3"
top: "pool3"
pooling_param {
pool: AVE
kernel_size: 3
stride: 2
}
}
layers {
name: "ip1"
type: INNER_PRODUCT
bottom: "pool3"
top: "ip1"
blobs_lr: 1
blobs_lr: 2
inner_product_param {
num_output: 64
weight_filler {
type: "gaussian"
std: 0.1
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "ip2"
type: INNER_PRODUCT
bottom: "ip1"
top: "ip2"
blobs_lr: 1
blobs_lr: 2
inner_product_param {
num_output: 10
weight_filler {
type: "gaussian"
std: 0.1
}
bias_filler {
type: "constant"
}
}
}
layers {
name: "accuracy"
type: ACCURACY
bottom: "ip2"
bottom: "label"
top: "accuracy"
include: { phase: TEST }
}
layers {
name: "loss"
type: SOFTMAX_LOSS
bottom: "ip2"
bottom: "label"
top: "loss"
}
[root@localhost cifar10]# vi train_quick.sh
#!/usr/bin/env sh
TOOLS=./build/tools
$TOOLS/caffe train \
--solver=examples/cifar10/cifar10_quick_solver.prototxt
# reduce learning rate by factor of 10 after 8 epochs
$TOOLS/caffe train \
--solver=examples/cifar10/cifar10_quick_solver_lr1.prototxt \
--snapshot=examples/cifar10/cifar10_quick_iter_4000.solverstate
~
执行结果如下:
I0313 00:40:24.471531 13825 net.cpp:56] Memory required for data: 0
I0313 00:40:24.471560 13825 net.cpp:67] Creating Layer cifar
I0313 00:40:24.471570 13825 net.cpp:356] cifar -> data
I0313 00:40:24.471585 13825 net.cpp:356] cifar -> label
I0313 00:40:24.471596 13825 net.cpp:96] Setting up cifar
I0313 00:40:24.471602 13825 data_layer.cpp:45] Opening leveldb examples/cifar10/cifar10_test_leveldb
I0313 00:40:24.549324 13825 data_layer.cpp:128] output data size: 100,3,32,32
I0313 00:40:24.549372 13825 base_data_layer.cpp:36] Loading mean file fromexamples/cifar10/mean.binaryproto
I0313 00:40:24.550582 13825 base_data_layer.cpp:64] Initializing prefetch
I0313 00:40:24.550639 13825 base_data_layer.cpp:66] Prefetch initialized.
I0313 00:40:24.550683 13825 net.cpp:103] Top shape: 100 3 32 32 (307200)
I0313 00:40:24.550698 13825 net.cpp:103] Top shape: 100 1 1 1 (100)
I0313 00:40:24.550709 13825 net.cpp:113] Memory required for data: 1229200
I0313 00:40:24.550734 13825 net.cpp:67] Creating Layer label_cifar_1_split
I0313 00:40:24.550750 13825 net.cpp:394] label_cifar_1_split <- label
I0313 00:40:24.550775 13825 net.cpp:356] label_cifar_1_split -> label_cifar_1_split_0
I0313 00:40:24.550802 13825 net.cpp:356] label_cifar_1_split -> label_cifar_1_split_1
I0313 00:40:24.550824 13825 net.cpp:96] Setting up label_cifar_1_split
I0313 00:40:24.550843 13825 net.cpp:103] Top shape: 100 1 1 1 (100)
I0313 00:40:24.550855 13825 net.cpp:103] Top shape: 100 1 1 1 (100)
I0313 00:40:24.550866 13825 net.cpp:113] Memory required for data: 1230000
I0313 00:40:24.550889 13825 net.cpp:67] Creating Layer conv1
I0313 00:40:24.550902 13825 net.cpp:394] conv1 <- data
I0313 00:40:24.550926 13825 net.cpp:356] conv1 -> conv1
I0313 00:40:24.550951 13825 net.cpp:96] Setting up conv1
I0313 00:40:24.551573 13825 net.cpp:103] Top shape: 100 32 32 32 (3276800)
I0313 00:40:24.551583 13825 net.cpp:113] Memory required for data: 14337200
I0313 00:40:24.551599 13825 net.cpp:67] Creating Layer pool1
I0313 00:40:24.551605 13825 net.cpp:394] pool1 <- conv1
I0313 00:40:24.551615 13825 net.cpp:356] pool1 -> pool1
I0313 00:40:24.551625 13825 net.cpp:96] Setting up pool1
I0313 00:40:24.551633 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)
I0313 00:40:24.551638 13825 net.cpp:113] Memory required for data: 17614000
I0313 00:40:24.551652 13825 net.cpp:67] Creating Layer relu1
I0313 00:40:24.551658 13825 net.cpp:394] relu1 <- pool1
I0313 00:40:24.551667 13825 net.cpp:345] relu1 -> pool1 (in-place)
I0313 00:40:24.551676 13825 net.cpp:96] Setting up relu1
I0313 00:40:24.551682 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)
I0313 00:40:24.551687 13825 net.cpp:113] Memory required for data: 20890800
I0313 00:40:24.551695 13825 net.cpp:67] Creating Layer conv2
I0313 00:40:24.551700 13825 net.cpp:394] conv2 <- pool1
I0313 00:40:24.551710 13825 net.cpp:356] conv2 -> conv2
I0313 00:40:24.551720 13825 net.cpp:96] Setting up conv2
I0313 00:40:24.554986 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)
I0313 00:40:24.554996 13825 net.cpp:113] Memory required for data: 24167600
I0313 00:40:24.555009 13825 net.cpp:67] Creating Layer relu2
I0313 00:40:24.555024 13825 net.cpp:394] relu2 <- conv2
I0313 00:40:24.555034 13825 net.cpp:345] relu2 -> conv2 (in-place)
I0313 00:40:24.555043 13825 net.cpp:96] Setting up relu2
I0313 00:40:24.555049 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)
I0313 00:40:24.555054 13825 net.cpp:113] Memory required for data: 27444400
I0313 00:40:24.555061 13825 net.cpp:67] Creating Layer pool2
I0313 00:40:24.555068 13825 net.cpp:394] pool2 <- conv2
I0313 00:40:24.555076 13825 net.cpp:356] pool2 -> pool2
I0313 00:40:24.555085 13825 net.cpp:96] Setting up pool2
I0313 00:40:24.555094 13825 net.cpp:103] Top shape: 100 32 8 8 (204800)
I0313 00:40:24.555099 13825 net.cpp:113] Memory required for data: 28263600
I0313 00:40:24.555109 13825 net.cpp:67] Creating Layer conv3
I0313 00:40:24.555114 13825 net.cpp:394] conv3 <- pool2
I0313 00:40:24.555124 13825 net.cpp:356] conv3 -> conv3
I0313 00:40:24.555135 13825 net.cpp:96] Setting up conv3
I0313 00:40:24.561589 13825 net.cpp:103] Top shape: 100 64 8 8 (409600)
I0313 00:40:24.561599 13825 net.cpp:113] Memory required for data: 29902000
I0313 00:40:24.561611 13825 net.cpp:67] Creating Layer relu3
I0313 00:40:24.561619 13825 net.cpp:394] relu3 <- conv3
I0313 00:40:24.561627 13825 net.cpp:345] relu3 -> conv3 (in-place)
I0313 00:40:24.561636 13825 net.cpp:96] Setting up relu3
I0313 00:40:24.561642 13825 net.cpp:103] Top shape: 100 64 8 8 (409600)
I0313 00:40:24.561646 13825 net.cpp:113] Memory required for data: 31540400
I0313 00:40:24.561655 13825 net.cpp:67] Creating Layer pool3
I0313 00:40:24.561661 13825 net.cpp:394] pool3 <- conv3
I0313 00:40:24.561669 13825 net.cpp:356] pool3 -> pool3
I0313 00:40:24.561678 13825 net.cpp:96] Setting up pool3
I0313 00:40:24.561686 13825 net.cpp:103] Top shape: 100 64 4 4 (102400)
I0313 00:40:24.561691 13825 net.cpp:113] Memory required for data: 31950000
I0313 00:40:24.561699 13825 net.cpp:67] Creating Layer ip1
I0313 00:40:24.561704 13825 net.cpp:394] ip1 <- pool3
I0313 00:40:24.561714 13825 net.cpp:356] ip1 -> ip1
I0313 00:40:24.561724 13825 net.cpp:96] Setting up ip1
I0313 00:40:24.569967 13825 net.cpp:103] Top shape: 100 64 1 1 (6400)
I0313 00:40:24.569975 13825 net.cpp:113] Memory required for data: 31975600
I0313 00:40:24.569988 13825 net.cpp:67] Creating Layer ip2
I0313 00:40:24.569993 13825 net.cpp:394] ip2 <- ip1
I0313 00:40:24.570004 13825 net.cpp:356] ip2 -> ip2
I0313 00:40:24.570014 13825 net.cpp:96] Setting up ip2
I0313 00:40:24.570108 13825 net.cpp:103] Top shape: 100 10 1 1 (1000)
I0313 00:40:24.570114 13825 net.cpp:113] Memory required for data: 31979600
I0313 00:40:24.570127 13825 net.cpp:67] Creating Layer ip2_ip2_0_split
I0313 00:40:24.570134 13825 net.cpp:394] ip2_ip2_0_split <- ip2
I0313 00:40:24.570143 13825 net.cpp:356] ip2_ip2_0_split -> ip2_ip2_0_split_0
I0313 00:40:24.570154 13825 net.cpp:356] ip2_ip2_0_split -> ip2_ip2_0_split_1
I0313 00:40:24.570163 13825 net.cpp:96] Setting up ip2_ip2_0_split
I0313 00:40:24.570171 13825 net.cpp:103] Top shape: 100 10 1 1 (1000)
I0313 00:40:24.570176 13825 net.cpp:103] Top shape: 100 10 1 1 (1000)
I0313 00:40:24.570181 13825 net.cpp:113] Memory required for data: 31987600
I0313 00:40:24.570189 13825 net.cpp:67] Creating Layer accuracy
I0313 00:40:24.570194 13825 net.cpp:394] accuracy <- ip2_ip2_0_split_0
I0313 00:40:24.570202 13825 net.cpp:394] accuracy <- label_cifar_1_split_0
I0313 00:40:24.570214 13825 net.cpp:356] accuracy -> accuracy
I0313 00:40:24.570222 13825 net.cpp:96] Setting up accuracy
I0313 00:40:24.570230 13825 net.cpp:103] Top shape: 1 1 1 1 (1)
I0313 00:40:24.570235 13825 net.cpp:113] Memory required for data: 31987604
I0313 00:40:24.570245 13825 net.cpp:67] Creating Layer loss
I0313 00:40:24.570250 13825 net.cpp:394] loss <- ip2_ip2_0_split_1
I0313 00:40:24.570257 13825 net.cpp:394] loss <- label_cifar_1_split_1
I0313 00:40:24.570266 13825 net.cpp:356] loss -> loss
I0313 00:40:24.570274 13825 net.cpp:96] Setting up loss
I0313 00:40:24.570286 13825 net.cpp:103] Top shape: 1 1 1 1 (1)
I0313 00:40:24.570291 13825 net.cpp:109] with loss weight 1
I0313 00:40:24.570305 13825 net.cpp:113] Memory required for data: 31987608
I0313 00:40:24.570312 13825 net.cpp:170] loss needs backward computation.
I0313 00:40:24.570317 13825 net.cpp:172] accuracy does not need backward computation.
I0313 00:40:24.570322 13825 net.cpp:170] ip2_ip2_0_split needs backward computation.
I0313 00:40:24.570338 13825 net.cpp:170] ip2 needs backward computation.
I0313 00:40:24.570349 13825 net.cpp:170] ip1 needs backward computation.
I0313 00:40:24.570359 13825 net.cpp:170] pool3 needs backward computation.
I0313 00:40:24.570372 13825 net.cpp:170] relu3 needs backward computation.
I0313 00:40:24.570384 13825 net.cpp:170] conv3 needs backward computation.
I0313 00:40:24.570396 13825 net.cpp:170] pool2 needs backward computation.
I0313 00:40:24.570406 13825 net.cpp:170] relu2 needs backward computation.
I0313 00:40:24.570420 13825 net.cpp:170] conv2 needs backward computation.
I0313 00:40:24.570432 13825 net.cpp:170] relu1 needs backward computation.
I0313 00:40:24.570442 13825 net.cpp:170] pool1 needs backward computation.
I0313 00:40:24.570456 13825 net.cpp:170] conv1 needs backward computation.
I0313 00:40:24.570471 13825 net.cpp:172] label_cifar_1_split does not need backward computation.
I0313 00:40:24.570482 13825 net.cpp:172] cifar does not need backward computation.
I0313 00:40:24.570494 13825 net.cpp:208] This network produces output accuracy
I0313 00:40:24.570505 13825 net.cpp:208] This network produces output loss
I0313 00:40:24.570536 13825 net.cpp:467] Collecting Learning Rate and Weight Decay.
I0313 00:40:24.570549 13825 net.cpp:219] Network initialization done.
I0313 00:40:24.570554 13825 net.cpp:220] Memory required for data: 31987608
I0313 00:40:24.570590 13825 solver.cpp:41] Solver scaffolding done.
I0313 00:40:24.570595 13825 solver.cpp:160] Solving CIFAR10_quick
I0313 00:40:24.570600 13825 solver.cpp:161] Learning Rate Policy: fixed
I0313 00:40:24.570631 13825 solver.cpp:264] Iteration 0, Testing net (#0)
I0313 00:40:24.570639 13825 net.cpp:652] Copying source layer cifar
I0313 00:40:24.570644 13825 net.cpp:652] Copying source layer conv1
I0313 00:40:24.570652 13825 net.cpp:652] Copying source layer pool1
I0313 00:40:24.570657 13825 net.cpp:652] Copying source layer relu1
I0313 00:40:24.570662 13825 net.cpp:652] Copying source layer conv2
I0313 00:40:24.570667 13825 net.cpp:652] Copying source layer relu2
I0313 00:40:24.570672 13825 net.cpp:652] Copying source layer pool2
I0313 00:40:24.570677 13825 net.cpp:652] Copying source layer conv3
I0313 00:40:24.570696 13825 net.cpp:652] Copying source layer relu3
I0313 00:40:24.570703 13825 net.cpp:652] Copying source layer pool3
I0313 00:40:24.570708 13825 net.cpp:652] Copying source layer ip1
I0313 00:40:24.570724 13825 net.cpp:652] Copying source layer ip2
I0313 00:40:24.570729 13825 net.cpp:652] Copying source layer loss
}
I0313 00:40:24.471531 13825 net.cpp:56] Memory required for data: 0
I0313 00:40:24.471560 13825 net.cpp:67] Creating Layer cifar
I0313 00:40:24.471570 13825 net.cpp:356] cifar -> data
I0313 00:40:24.471585 13825 net.cpp:356] cifar -> label
I0313 00:40:24.471596 13825 net.cpp:96] Setting up cifar
I0313 00:40:24.471602 13825 data_layer.cpp:45] Opening leveldb examples/cifar10/cifar10_test_leveldb
I0313 00:40:24.549324 13825 data_layer.cpp:128] output data size: 100,3,32,32
I0313 00:40:24.549372 13825 base_data_layer.cpp:36] Loading mean file fromexamples/cifar10/mean.binaryproto
I0313 00:40:24.550582 13825 base_data_layer.cpp:64] Initializing prefetch
I0313 00:40:24.550639 13825 base_data_layer.cpp:66] Prefetch initialized.
I0313 00:40:24.550683 13825 net.cpp:103] Top shape: 100 3 32 32 (307200)
I0313 00:40:24.550698 13825 net.cpp:103] Top shape: 100 1 1 1 (100)
I0313 00:40:24.550709 13825 net.cpp:113] Memory required for data: 1229200
I0313 00:40:24.550734 13825 net.cpp:67] Creating Layer label_cifar_1_split
I0313 00:40:24.550750 13825 net.cpp:394] label_cifar_1_split <- label
I0313 00:40:24.550775 13825 net.cpp:356] label_cifar_1_split -> label_cifar_1_split_0
I0313 00:40:24.550802 13825 net.cpp:356] label_cifar_1_split -> label_cifar_1_split_1
I0313 00:40:24.550824 13825 net.cpp:96] Setting up label_cifar_1_split
I0313 00:40:24.550843 13825 net.cpp:103] Top shape: 100 1 1 1 (100)
I0313 00:40:24.550855 13825 net.cpp:103] Top shape: 100 1 1 1 (100)
I0313 00:40:24.550866 13825 net.cpp:113] Memory required for data: 1230000
I0313 00:40:24.550889 13825 net.cpp:67] Creating Layer conv1
I0313 00:40:24.550902 13825 net.cpp:394] conv1 <- data
I0313 00:40:24.550926 13825 net.cpp:356] conv1 -> conv1
I0313 00:40:24.550951 13825 net.cpp:96] Setting up conv1
I0313 00:40:24.551573 13825 net.cpp:103] Top shape: 100 32 32 32 (3276800)
I0313 00:40:24.551583 13825 net.cpp:113] Memory required for data: 14337200
I0313 00:40:24.551599 13825 net.cpp:67] Creating Layer pool1
I0313 00:40:24.551605 13825 net.cpp:394] pool1 <- conv1
I0313 00:40:24.551615 13825 net.cpp:356] pool1 -> pool1
I0313 00:40:24.551625 13825 net.cpp:96] Setting up pool1
I0313 00:40:24.551633 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)
I0313 00:40:24.551638 13825 net.cpp:113] Memory required for data: 17614000
I0313 00:40:24.551652 13825 net.cpp:67] Creating Layer relu1
I0313 00:40:24.551658 13825 net.cpp:394] relu1 <- pool1
I0313 00:40:24.551667 13825 net.cpp:345] relu1 -> pool1 (in-place)
I0313 00:40:24.551676 13825 net.cpp:96] Setting up relu1
I0313 00:40:24.551682 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)
I0313 00:40:24.551687 13825 net.cpp:113] Memory required for data: 20890800
I0313 00:40:24.551695 13825 net.cpp:67] Creating Layer conv2
I0313 00:40:24.551700 13825 net.cpp:394] conv2 <- pool1
I0313 00:40:24.551710 13825 net.cpp:356] conv2 -> conv2
I0313 00:40:24.551720 13825 net.cpp:96] Setting up conv2
I0313 00:40:24.554986 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)
I0313 00:40:24.554996 13825 net.cpp:113] Memory required for data: 24167600
I0313 00:40:24.555009 13825 net.cpp:67] Creating Layer relu2
I0313 00:40:24.555024 13825 net.cpp:394] relu2 <- conv2
I0313 00:40:24.555034 13825 net.cpp:345] relu2 -> conv2 (in-place)
I0313 00:40:24.555043 13825 net.cpp:96] Setting up relu2
I0313 00:40:24.555049 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)
I0313 00:40:24.555054 13825 net.cpp:113] Memory required for data: 27444400
I0313 00:40:24.555061 13825 net.cpp:67] Creating Layer pool2
I0313 00:40:24.555068 13825 net.cpp:394] pool2 <- conv2
I0313 00:40:24.555076 13825 net.cpp:356] pool2 -> pool2
I0313 00:40:24.555085 13825 net.cpp:96] Setting up pool2
I0313 00:40:24.555094 13825 net.cpp:103] Top shape: 100 32 8 8 (204800)
I0313 00:40:24.555099 13825 net.cpp:113] Memory required for data: 28263600
I0313 00:40:24.555109 13825 net.cpp:67] Creating Layer conv3
I0313 00:40:24.555114 13825 net.cpp:394] conv3 <- pool2
I0313 00:40:24.555124 13825 net.cpp:356] conv3 -> conv3
I0313 00:40:24.555135 13825 net.cpp:96] Setting up conv3
I0313 00:40:24.5I0313 00:41:19.945504 13934 data_layer.cpp:187] Restarting data prefetching from start.
I0313 00:41:21.066936 13825 solver.cpp:315] Test net output #0: accuracy = 0.0932
I0313 00:41:21.066978 13825 solver.cpp:315] Test net output #1: loss = 2.30265 (* 1 = 2.30265 loss)
I0313 00:41:22.483836 13825 solver.cpp:209] Iteration 0, loss = 2.3028
I0313 00:41:22.483877 13825 solver.cpp:224] Train net output #0: loss = 2.3028 (* 1 = 2.3028 loss)
I0313 00:41:22.483894 13825 solver.cpp:445] Iteration 0, lr = 0.001
I0313 00:43:45.116195 13825 solver.cpp:209] Iteration 100, loss = 1.785
I0313 00:43:45.116281 13825 solver.cpp:224] Train net output #0: loss = 1.785 (* 1 = 1.785 loss)
I0313 00:43:45.116291 13825 solver.cpp:445] Iteration 100, lr = 0.001
I0313 00:46:07.567387 13825 solver.cpp:209] Iteration 200, loss = 1.62294
I0313 00:46:07.567468 13825 solver.cpp:224] Train net output #0: loss = 1.62294 (* 1 = 1.62294 loss)
I0313 00:46:07.567479 13825 solver.cpp:445] Iteration 200, lr = 0.001
I0313 00:48:30.618835 13825 solver.cpp:209] Iteration 300, loss = 1.34621
I0313 00:48:30.618942 13825 solver.cpp:224] Train net output #0: loss = 1.34621 (* 1 = 1.34621 loss)
I0313 00:48:30.618953 13825 solver.cpp:445] Iteration 300, lr = 0.001
I0313 00:50:52.191938 13825 solver.cpp:209] Iteration 400, loss = 1.28778
I0313 00:50:52.192026 13825 solver.cpp:224] Train net output #0: loss = 1.28778 (* 1 = 1.28778 loss)
I0313 00:50:52.192037 13825 solver.cpp:445] Iteration 400, lr = 0.001
I0313 00:53:09.941452 14527 data_layer.cpp:187] Restarting data prefetching from start.
I0313 00:53:12.735488 13825 solver.cpp:264] Iteration 500, Testing net (#0)
I0313 00:53:12.735517 13825 net.cpp:652] Copying source layer cifar
I0313 00:53:12.735524 13825 net.cpp:652] Copying source layer conv1
I0313 00:53:12.735530 13825 net.cpp:652] Copying source layer pool1
I0313 00:53:12.735535 13825 net.cpp:652] Copying source layer relu1
I0313 00:53:12.735540 13825 net.cpp:652] Copying source layer conv2
I0313 00:53:12.735545 13825 net.cpp:652] Copying source layer relu2
I0313 00:53:12.735550 13825 net.cpp:652] Copying source layer pool2
I0313 00:53:12.735554 13825 net.cpp:652] Copying source layer conv3
I0313 00:53:12.735560 13825 net.cpp:652] Copying source layer relu3
I0313 00:53:12.735565 13825 net.cpp:652] Copying source layer pool3
I0313 00:53:12.735569 13825 net.cpp:652] Copying source layer ip1
I0313 00:53:12.735575 13825 net.cpp:652] Copying source layer ip2
I0313 00:53:12.735580 13825 net.cpp:652] Copying source layer loss
I0313 00:54:08.180796 14634 data_layer.cpp:187] Restarting data prefetching from start.
I0313 00:54:09.297691 13825 solver.cpp:315] Test net output #0: accuracy = 0.5571
I0313 00:54:09.297731 13825 solver.cpp:315] Test net output #1: loss = 1.271 (* 1 = 1.271 loss)
I0313 00:54:10.695636 13825 solver.cpp:209] Iteration 500, loss = 1.20884
I0313 00:54:10.695677 13825 solver.cpp:224] Train net output #0: loss = 1.20884 (* 1 = 1.20884 loss)
I0313 00:54:10.695686 13825 solver.cpp:445] Iteration 500, lr = 0.001
I0313 00:56:32.906312 13825 solver.cpp:209] Iteration 600, loss = 1.18048
I0313 00:56:32.906397 13825 solver.cpp:224] Train net output #0: loss = 1.18048 (* 1 = 1.18048 loss)
I0313 00:56:32.906407 13825 solver.cpp:445] Iteration 600, lr = 0.001
……
When you run the code, you will see a lot of messages flying by like this:
I0317 21:52:48.945710 2008298256 net.cpp:74] Creating Layer conv1
I0317 21:52:48.945716 2008298256 net.cpp:84] conv1 <- data
I0317 21:52:48.945725 2008298256 net.cpp:110] conv1 -> conv1
I0317 21:52:49.298691 2008298256 net.cpp:125] Top shape: 100 32 32 32 (3276800)
I0317 21:52:49.298719 2008298256 net.cpp:151] conv1 needs backward computation.
These messages tell you the details about each layer, its connections and its output shape, which may be
helpful in debugging. After the initialization, the training will start:
I0317 21:52:49.309370 2008298256 net.cpp:166] Network initialization done.
I0317 21:52:49.309376 2008298256 net.cpp:167] Memory required for Data 23790808
I0317 21:52:49.309422 2008298256 solver.cpp:36] Solver scaffolding done.
I0317 21:52:49.309447 2008298256 solver.cpp:47] Solving CIFAR10_quick_train
Based on the solver setting, we will print the training loss function every 100 iterations, and test the
network every 500 iterations. You will see messages like this:
I0317 21:53:12.179772 2008298256 solver.cpp:208] Iteration 100, lr = 0.001
I0317 21:53:12.185698 2008298256 solver.cpp:65] Iteration 100, loss = 1.73643
...
I0317 21:54:41.150030 2008298256 solver.cpp:87] Iteration 500, Testing net
I0317 21:54:47.129461 2008298256 solver.cpp:114] Test score #0: 0.5504
I0317 21:54:47.129500 2008298256 solver.cpp:114] Test score #1: 1.27805
For each training iteration, lr is the learning rate of that iteration, and loss is the training function. For
the output of the testing phase, score 0 is the accuracy, and score 1 is the testing loss function.
And after making yourself a cup of coffee, you are done!
I0317 22:12:19.666914 2008298256 solver.cpp:87] Iteration 5000, Testing net
I0317 22:12:25.580330 2008298256 solver.cpp:114] Test score #0: 0.7533
I0317 22:12:25.580379 2008298256 solver.cpp:114] Test score #1: 0.739837
I0317 22:12:25.587262 2008298256 solver.cpp:130] Snapshotting to cifar10_quick_iter_5000
I0317 22:12:25.590215 2008298256 solver.cpp:137] Snapshotting solver state to
cifar10_quick_iter_5000.solverstate
I0317 22:12:25.592813 2008298256 solver.cpp:81] Optimization Done.
Our model achieved ~75% test accuracy. The model parameters are stored in binary protobuf format in
cifar10_quick_iter_5000