(一):CIFAR数据集:
image的个数:60000
image的大小:32*32*3
class的个数:10 (飞机;汽车;鸟;猫;鹿;狗;青蛙;马;船;卡车)
50000张用于训练,10000张用于测试。 (二)
train batch有5个 每个里面有10000张图片
test batch有1个 每一类1000张图片
batches.meta为class的名字
每个batch的有10000个data和相对应的label
label从0到9
有一个名为batches.meta.txt的文件。这是一个ASCII文件,将范围为0-9的数字标签映射到有意义的类名。它只是10个类名的列表,每行一个。行i上的类名称对应于数字标签i。
(三) 在caffe中自带的CIFAR数据集进行训练的prototxt和结构如下:
cifar10_quick_train_test.prototxt
name: "CIFAR10_quick" | |
layer { | |
name: "cifar" | |
type: "Data" | |
top: "data" | |
top: "label" | |
include { | |
phase: TRAIN | |
} | |
transform_param { | |
mean_file: "examples/cifar10/mean.binaryproto" | |
} | |
data_param { | |
source: "examples/cifar10/cifar10_train_lmdb" | |
batch_size: 100 | |
backend: LMDB | |
} | |
} | |
layer { | |
name: "cifar" | |
type: "Data" | |
top: "data" | |
top: "label" | |
include { | |
phase: TEST | |
} | |
transform_param { | |
mean_file: "examples/cifar10/mean.binaryproto" | |
} | |
data_param { | |
source: "examples/cifar10/cifar10_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: 32 | |
pad: 2 | |
kernel_size: 5 | |
stride: 1 | |
weight_filler { | |
type: "gaussian" | |
std: 0.0001 | |
} | |
bias_filler { | |
type: "constant" | |
} | |
} | |
} | |
layer { | |
name: "pool1" | |
type: "Pooling" | |
bottom: "conv1" | |
top: "pool1" | |
pooling_param { | |
pool: MAX | |
kernel_size: 3 | |
stride: 2 | |
} | |
} | |
layer { | |
name: "relu1" | |
type: "ReLU" | |
bottom: "pool1" | |
top: "pool1" | |
} | |
layer { | |
name: "conv2" | |
type: "Convolution" | |
bottom: "pool1" | |
top: "conv2" | |
param { | |
lr_mult: 1 | |
} | |
param { | |
lr_mult: 2 | |
} | |
convolution_param { | |
num_output: 32 | |
pad: 2 | |
kernel_size: 5 | |
stride: 1 | |
weight_filler { | |
type: "gaussian" | |
std: 0.01 | |
} | |
bias_filler { | |
type: "constant" | |
} | |
} | |
} | |
layer { | |
name: "relu2" | |
type: "ReLU" | |
bottom: "conv2" | |
top: "conv2" | |
} | |
layer { | |
name: "pool2" | |
type: "Pooling" | |
bottom: "conv2" | |
top: "pool2" | |
pooling_param { | |
pool: AVE | |
kernel_size: 3 | |
stride: 2 | |
} | |
} | |
layer { | |
name: "conv3" | |
type: "Convolution" | |
bottom: "pool2" | |
top: "conv3" | |
param { | |
lr_mult: 1 | |
} | |
param { | |
lr_mult: 2 | |
} | |
convolution_param { | |
num_output: 64 | |
pad: 2 | |
kernel_size: 5 | |
stride: 1 | |
weight_filler { | |
type: "gaussian" | |
std: 0.01 | |
} | |
bias_filler { | |
type: "constant" | |
} | |
} | |
} | |
layer { | |
name: "relu3" | |
type: "ReLU" | |
bottom: "conv3" | |
top: "conv3" | |
} | |
layer { | |
name: "pool3" | |
type: "Pooling" | |
bottom: "conv3" | |
top: "pool3" | |
pooling_param { | |
pool: AVE | |
kernel_size: 3 | |
stride: 2 | |
} | |
} | |
layer { | |
name: "ip1" | |
type: "InnerProduct" | |
bottom: "pool3" | |
top: "ip1" | |
param { | |
lr_mult: 1 | |
} | |
param { | |
lr_mult: 2 | |
} | |
inner_product_param { | |
num_output: 64 | |
weight_filler { | |
type: "gaussian" | |
std: 0.1 | |
} | |
bias_filler { | |
type: "constant" | |
} | |
} | |
} | |
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: "gaussian" | |
std: 0.1 | |
} | |
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" | |
} |
其中python版本需要另行修改,matlab下载即可。