一、配置文件
1. 网络结构
henet_car_train_test.prototxt
#name : "LeNet"
layer {
name: "mnist"
type : "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
scale: 0.00390625
}
data_param {
source: "/home/datasets/carPlate/train_test_labels/train_10"
batch_size: 64
backend: LMDB
}
}
layer {
name: "mnist"
type : "Data"
top: "data"
top: "label"
include {
phase: TEST
}
transform_param {
scale: 0.00390625
}
data_param {
source: "/home/datasets/carPlate/train_test_labels/val_G5"
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
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: "group0_block0_conv0"
type : "Convolution"
bottom: "pool1"
top: "group0_block0_conv0"
param {
lr_mult: 1
decay_mult: 1
}
convolution_param {
num_output: 32
pad: 1
kernel_size: 3
stride: 1
weight_filler {
type : "msra"
}
}
}
layer {
name: "group0_block0_conv0_bn"
type : "BatchNorm"
bottom: "group0_block0_conv0"
top: "group0_block0_conv0"
param {
lr_mult: 0
decay_mult: 0
}
param {
lr_mult: 0
decay_mult: 0
}
param {
lr_mult: 0
decay_mult: 0
}
}
layer {
name: "group0_block0_conv0_scale"
type : "Scale"
bottom: "group0_block0_conv0"
top: "group0_block0_conv0"
scale_param {
bias_term: true
}
}
layer {
name: "group0_block0_conv0_relu"
type : "ReLU"
bottom: "group0_block0_conv0"
top: "group0_block0_conv0"
}
layer {
name: "group0_block0_conv1"
type : "Convolution"
bottom: "group0_block0_conv0"
top: "group0_block0_conv1"
param {
lr_mult: 1
decay_mult: 1
}
convolution_param {
num_output: 32
pad: 1
kernel_size: 3
stride: 1
weight_filler {
type : "msra"
}
}
}
layer {
name: "group0_block0_conv1_bn"
type : "BatchNorm"
bottom: "group0_block0_conv1"
top: "group0_block0_conv1"
param {
lr_mult: 0
decay_mult: 0
}
param {
lr_mult: 0
decay_mult: 0
}
param {
lr_mult: 0
decay_mult: 0
}
}
layer {
name: "group0_block0_conv1_scale"
type : "Scale"
bottom: "group0_block0_conv1"
top: "group0_block0_conv1"
scale_param {
bias_term: true
}
}
layer {
name: "group1_block0_conv0"
type : "Convolution"
bottom: "group0_block0_conv1"
top: "group1_block0_conv0"
param {
lr_mult: 1
decay_mult: 1
}
convolution_param {
num_output: 32
pad: 1
kernel_size: 3
stride: 1
weight_filler {
type : "msra"
}
}
}
layer {
name: "group1_block0_conv0_bn"
type : "BatchNorm"
bottom: "group1_block0_conv0"
top: "group1_block0_conv0"
param {
lr_mult: 0
decay_mult: 0
}
param {
lr_mult: 0
decay_mult: 0
}
param {
lr_mult: 0
decay_mult: 0
}
}
layer {
name: "group1_block0_conv0_scale"
type : "Scale"
bottom: "group1_block0_conv0"
top: "group1_block0_conv0"
scale_param {
bias_term: true
}
}
layer {
name: "group1_block0_conv0_relu"
type : "ReLU"
bottom: "group1_block0_conv0"
top: "group1_block0_conv0"
}
layer {
name: "group1_block0_conv1"
type : "Convolution"
bottom: "group1_block0_conv0"
top: "group1_block0_conv1"
param {
lr_mult: 1
decay_mult: 1
}
convolution_param {
num_output: 32
pad: 1
kernel_size: 3
stride: 1
weight_filler {
type : "msra"
}
}
}
layer {
name: "group1_block0_conv1_bn"
type : "BatchNorm"
bottom: "group1_block0_conv1"
top: "group1_block0_conv1"
param {
lr_mult: 0
decay_mult: 0
}
param {
lr_mult: 0
decay_mult: 0
}
param {
lr_mult: 0
decay_mult: 0
}
}
layer {
name: "group1_block0_conv1_scale"
type : "Scale"
bottom: "group1_block0_conv1"
top: "group1_block0_conv1"
scale_param {
bias_term: true
}
}
layer {
name: "group1_block0_sum"
type : "Eltwise"
bottom: "group0_block0_conv1"
bottom: "group1_block0_conv1"
top: "group1_block0_sum"
eltwise_param {
operation: SUM
}
}
layer {
name: "group0_block0_sum"
type : "Eltwise"
bottom: "group1_block0_sum"
bottom: "pool1"
top: "group0_block0_sum"
eltwise_param {
operation: SUM
}
}
layer {
name: "conv2"
type : "Convolution"
bottom: "group0_block0_sum"
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: "lab`}}}}}}}}
``
l"
top: "loss"
}
_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"
}
2. 超参数
lenet_solver.prototxt
net: "henet_car_train_test.prototxt"
test_iter: 100
test_interval: 500
base_lr: 0.001
momentum: 0.9
weight_decay: 0.0005
lr_policy: "inv"
gamma: 0.0001
power: 0.75
display: 100
max_iter: 10000
snapshot: 5000
snapshot_prefix: "/home/datasets/carPlate/train_test_labels/train_10/train_10"
GPU
solver_mode: GPU
二、开始训练
1. 训练并输出日志
1. 无预训练
--solver=/home/datasets /carPlate/train _test_labels/henet_solver.prototxt 2 >&1 | tee /home/datasets/carPlate/train_test_labels/train_10 /train_10_henet_Res2order.log
2. 加载预训练模型
--solver=/home/datasets /carPlate/train _test_labels/henet_solver.prototxt \
--weights=/home/datasets /carPlate/train _test_labels/train_10 /train_10_iter_45000 .caffemodel \
2>&1 | tee /home/datasets/carPlate/train_test_labels/train_30/train_30_henet_Res2order.log
3.
2. 输出数值信息
/opt/caffe/tools/extra/parse_log.py \
/home/datasets/carPlate/train_test_labels/train_10/train_10_henet_Res2order.log \
/home/datasets/carPlate/train_test_labels/train_10/ \
3. 绘制loss&accuracy曲线
4.测试数据
--model=/home/datasets /carPlate/train _test_labels/henet_car_train_test.prototxt \
--weights=/home/datasets /carPlate/train _test_labels/train_30 /train_30_iter_45000 .caffemodel \
2>&1 | tee /home/datasets/carPlate/train_test_labels/train_30/test_30_henet_Res2order.log
5. 失败记录
文件名 0 1 2 3 共计 G1 742 41 25 673 1481 G2 642 39 19 571 1271 G3 639 83 16 659 1397 G4 244 319 0 1187 1750 G5 1360 57 6 1556 2979
a. 第一次:从头开始训练
1. 网络结构:caffe自带```lenet_car_train_test.prototx```
2. 超参数:上面的```lenet_solver.prototxt```
3. 训练数据:train_100 (100%的训练数据),总的数据说明参见前文。
4. 测试结果:train_100_lenet_iter_10000.caffemodel
5. 测试分析:G4可能因为黄牌比例较大,所以效果较差;single_2是白色车牌,效果较差;其余效果也未达到99%
G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) 97.4342% 98.741% 98.7831% 31.6571% 91.0708% 93.6035% 96.846% 56.0606% 98.712%
b. 第二次:单独训练白色和黄色车牌
1. 网络结构:train_batch_size:128->64
2. 超参数:base_lr: 0.001->0.001,weight_decay: 0.0005->0.0005
3. 预训练模型:train_100_lenet_iter_10000.caffemodel
4. 训练数据:train_100_yellow_white
5. 测试结果:白牌和黄牌效果确实提升了,但是蓝牌和非车牌很差了,应该是迭代次数过多。
G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) 97.4342% 98.741% 98.7831% 31.6571% 91.0708% 93.6035% 96.846% 56.0606% 98.712% ———— ———— ———— ———— ———— 8.54701% 99.6289% 98.4848% 21.3892%
c. 第三次:单独训练白色和黄色车牌
1. 网络结构:train_batch_size:128->64, 2个conv层的学习率设为0,ip3学习率缩小100倍:0.01,0.02,
2. 超参数:base_lr: 0.001->0.001,weight_decay: 0.0005->0.0005
3. 预训练模型:train_100_lenet_iter_10000.caffemodel (从第一次开始)
4. 训练数据:train_100_yellow_white
5. 测试结果:4类别单独测试效果都上了90%,尤其是白色从56.0606%提升到97.192%,但蓝色略有下降,怀疑主要是由于蓝色和非车牌的误判导致G4效果不理想
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) train_100_lenet_iter_10000.caffemodel 97.4342% 98.741% 98.7831% 31.6571% 91.0708% 93.6035% 96.846% 56.0606% 98.712% non ———— ———— ———— ———— 8.54701% 99.6289% 98.4848% 21.3892% train_100_lenet_yellow_white_iter_10.caffemodel 97.4342% 98.7411% 98.8547% 31.7143% 91.0708% 93.5484% 97.2171% 97.192% 98.7209%
c. 第四次:单独训练蓝色车牌
1. 网络结构:train_batch_size:128->64, 2个conv层的学习率设为0,ip3学习率缩小100倍:0.01,0.02,
2. 超参数:base_lr: 0.001->0.001,weight_decay: 0.0005->0.0005
3. 预训练模型:train_100_lenet_iter_10000.caffemodel (从第一次开始)
4. 训练数据:train_100_blue_non500
5. 测试结果:白牌和黄牌效果确实提升了,但是蓝牌和非车牌很差了,应该是迭代次数过多。
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) 97.4342% 98.741% 98.7831% 31.6571% 91.0708% 93.6035% 96.846% 56.0606% 98.712% non ———— ———— ———— ———— 8.54701% 99.6289% 98.4848% train_100_lenet_yellow_white_iter_10.caffemodel 97.4342% 98.7411% 98.8547% 31.7143% 91.0708% 93.5484% 57.6994% 57.5758% 98.7209% train_100_lenet_blue_non500_iter_100.caffemodel 97.5017% 98.4264% 98.4968% 31.8857% 91.8765:% 94.5409% 86.6419% 86.3636% 97.8593%
结论:妈的数据集做错了,一定不能有文件夹为空!!!!!
6. Lenet重新训练
常用vim命令:
替换:
:%s/abc/def/g
1. 原始Lenet训练
1. 网络结构:train_batch_size=64
2. 超参数:base_lr: 0.0001,weight_decay: 0.0005->0.0005
3. 预训练模型:从零开始
4. 训练数据:train_100_all
5. 测试结果:这里只分为2类,每50000次进行重新训练(使用snapshot参数)。
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) train_100_lenet_iter_50000.caffemodel 98.7846% 99.6066% 99.3558% 97.8286% 96.811% 97.9597% 97.9592% 87.8788% 99.0584% train_100_lenet_iter_100000.caffemodel 99.1222% 99.764% 99.4273% 98.3428% 97.5495% 98.4836% 97.957% 98.4848% 99.165% train_100_lenet_iter_150000.caffemodel 99.1222 99.764 99.4989% 98.7429% 97.7845 98.5663% 98.1447% 100% 99.2627% train_100_lenet_iter_150000.caffemodel 99.1897 99.6853 99.4989% 98.8571% 97.7845 98.5387% 98.3302% 100% 99.316%
# The train/test net protocol buffer definition
net: "lenet_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.0001
momentum: 0.9
weight_decay: 0.0005
# The learning rate policy
lr_policy: "inv"
gamma: 0.0001
power: 0.75
# Display every 100 iterations
display: 100
# The maximum number of iterations
max_iter: 50000
# snapshot intermediate results
snapshot: 5000
snapshot_prefix: "/home/datasets/carPlate/train_test_2_class/train_100/train_100_lenet"
# solver mode: CPU or GPU
solver_mode: GPU
2. Lenet全连接层的裁剪
第一次
1. 网络结构:train_batch_size=64,修改ip1_400 ->ip1_400,对应的num_oputput 500 ->400,
2. 超参数:base_lr: 0.0001,weight_decay: 0.0005->0.0005, max_iter:50000
3. 预训练模型:train_100_lenet_iter_200000.caffemodel(前一个小节得到的模型)
4. 训练数据:train_100_all
5. 测试结果:这里只分为2类,每50000次进行重新训练(使用snapshot参数)。越往后训练,对负样本的准确率越高,模型大小:1.05Mb
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) train_100_lenet_iter_50000.caffemodel 98.7846% 99.6066% 99.3558% 97.8286% 96.811% 97.9597% 97.9592% 87.8788% 99.0584% train_100_lenet_iter_100000.caffemodel 99.1222% 99.764% 99.4273% 98.3428% 97.5495% 98.4836% 97.957% 98.4848% 99.165% train_100_lenet_iter_150000.caffemodel 99.1222 99.764 99.4989% 98.7429% 97.7845 98.5663% 98.1447% 100% 99.2627% train_100_lenet_iter_150000.caffemodel 99.1897 99.6853 99.4989% 98.8571% 97.7845 98.5387% 98.3302% 100% 99.316% train_100_lenet_zip_0_iter_50000.caffemodel 99.3248 99.6853 99.4273% 98.8% 97.6838 98.5112% 98.3302% 100% 99.2095% train_100_lenet_zip_0_iter_100000.caffemodel 99.2573 99.5279 99.3558% 98.87429% 97.5831 98.3182% 98.1447% 100% 99.2361%
第二次
1. 网络结构:train_batch_size=64,修改ip1_400 ->ip1_200,对应的num_oputput 400 ->200,
2. 超参数:base_lr: 0.0001,weight_decay: 0.0005->0.0005, max_iter:100000
3. 预训练模型:train_100_lenet_iter_200000.caffemodel(前一个小节得到的模型)
4. 训练数据:train_100_all
5. 测试结果:这里只分为2类,每50000次进行重新训练(使用snapshot参数)。越往后训练,对负样本的准确率越高,模型大小349k
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) train_100_lenet_iter_50000.caffemodel 98.7846% 99.6066% 99.3558% 97.8286% 96.811% 97.9597% 97.9592% 87.8788% 99.0584% train_100_lenet_iter_100000.caffemodel 99.1222% 99.764% 99.4273% 98.3428% 97.5495% 98.4836% 97.957% 98.4848% 99.165% train_100_lenet_iter_150000.caffemodel 99.1222 99.764 99.4989% 98.7429% 97.7845 98.5663% 98.1447% 100% 99.2627% train_100_lenet_iter_150000.caffemodel 99.1897 99.6853 99.4989% 98.8571% 97.7845 98.5387% 98.3302% 100% 99.316% train_100_lenet_zip_0_iter_50000.caffemodel 99.3248 99.6853 99.4273% 98.8% 97.6838 98.5112% 98.3302% 100% 99.2095% train_100_lenet_zip_0_iter_100000.caffemodel 99.2573 99.5279 99.3558% 98.87429% 97.5831 98.3182% 98.1447% 100% 99.2361% train_100_lenet_zip_1_iter_50000.caffemodel 98.9872 99.6853 99.4989% 98.85719% 97.7174 98.4836% 98.3302% 100% 99.2095% train_100_lenet_zip_1_iter_50000.caffemodel 99.0547 99.6066 99.4273% 98.97149% 97.6838 98.456% 98.3302% 100% 99.2272%
第三次
1. 网络结构:train_batch_size=64,修改ip1_200 ->ip1_50,对应的num_oputput 200 ->50,
2. 超参数:base_lr: 0.0001,weight_decay: 0.0005->0.0005, max_iter:100000
3. 预训练模型:train_100_lenet_iter_200000.caffemodel(前一个小节得到的模型)
4. 训练数据:train_100_all
5. 测试结果:这里只分为2类。模型大小152k
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) train_100_lenet_iter_50000.caffemodel 98.7846% 99.6066% 99.3558% 97.8286% 96.811% 97.9597% 97.9592% 87.8788% 99.0584% train_100_lenet_iter_100000.caffemodel 99.1222% 99.764% 99.4273% 98.3428% 97.5495% 98.4836% 97.957% 98.4848% 99.165% train_100_lenet_iter_150000.caffemodel 99.1222 99.764 99.4989% 98.7429% 97.7845 98.5663% 98.1447% 100% 99.2627% train_100_lenet_iter_150000.caffemodel 99.1897 99.6853 99.4989% 98.8571% 97.7845 98.5387% 98.3302% 100% 99.316% train_100_lenet_zip_0_iter_50000.caffemodel 99.3248 99.6853 99.4273% 98.8% 97.6838 98.5112% 98.3302% 100% 99.2095% train_100_lenet_zip_0_iter_100000.caffemodel 99.2573 99.5279 99.3558% 98.87429% 97.5831 98.3182% 98.1447% 100% 99.2361% train_100_lenet_zip_1_iter_50000.caffemodel 98.9872 99.6853 99.4989% 98.85719% 97.7174 98.4836% 98.3302% 100% 99.2095% train_100_lenet_zip_1_iter_100000.caffemodel 99.0547 99.6066 99.4273% 98.97149% 97.6838 98.456% 98.3302% 100% 99.2272% train_100_lenet_zip_2_iter_60000.caffemodel 99.3248 99.764 99.4989% 98.8% 97.8181 98.6215% 98.5158% 100% 99.2183% train_100_lenet_zip_2_iter_100000.caffemodel 99.1897 99.6853 99.4273% 98.8% 97.6838 98.4285% 98.5158% 100% 99.1917%
第四次
1. 网络结构:train_batch_size=64,修改ip1_50 ->ip1_10,对应的num_oputput 50 ->10,
2. 超参数:base_lr: 0.0001,weight_decay: 0.0005->0.0005, max_iter:100000
3. 预训练模型:train_100_lenet_iter_200000.caffemodel(前一个小节得到的模型)
4. 训练数据:train_100_all
5. 测试结果:这里只分为2类。模型大小126k
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) train_100_lenet_iter_50000.caffemodel 98.7846% 99.6066% 99.3558% 97.8286% 96.811% 97.9597% 97.9592% 87.8788% 99.0584% train_100_lenet_iter_100000.caffemodel 99.1222% 99.764% 99.4273% 98.3428% 97.5495% 98.4836% 97.957% 98.4848% 99.165% train_100_lenet_iter_150000.caffemodel 99.1222 99.764 99.4989% 98.7429% 97.7845 98.5663% 98.1447% 100% 99.2627% train_100_lenet_iter_150000.caffemodel 99.1897 99.6853 99.4989% 98.8571% 97.7845 98.5387% 98.3302% 100% 99.316% train_100_lenet_zip_0_iter_50000.caffemodel 99.3248 99.6853 99.4273% 98.8% 97.6838 98.5112% 98.3302% 100% 99.2095% train_100_lenet_zip_0_iter_100000.caffemodel 99.2573 99.5279 99.3558% 98.87429% 97.5831 98.3182% 98.1447% 100% 99.2361% train_100_lenet_zip_1_iter_50000.caffemodel 98.9872 99.6853 99.4989% 98.85719% 97.7174 98.4836% 98.3302% 100% 99.2095% train_100_lenet_zip_1_iter_100000.caffemodel 99.0547 99.6066 99.4273% 98.97149% 97.6838 98.456% 98.3302% 100% 99.2272% train_100_lenet_zip_2_iter_60000.caffemodel 99.3248 99.764 99.4989% 98.8% 97.8181 98.6215% 98.5158% 100% 99.2183% train_100_lenet_zip_2_iter_100000.caffemodel 99.1897 99.6853 99.4273% 98.8% 97.6838 98.4285% 98.5158% 100% 99.1917% train_100_lenet_zip_3_iter_50000.caffemodel 99.4598 99.764 99.141% 98.8571% 98.0866 98.9247% 98.3302% 100% 99.165% train_100_lenet_zip_3_iter_50000.caffemodel 99.3248 99.6853 99.3558% 98.8571% 97.8852 98.649% 98.1447% 100% 99.245%
第五次
1. 网络结构:train_batch_size=64,修改ip1_10 ->ip1_4,对应的num_oputput 10 ->4,
2. 超参数:base_lr: 0.0001,weight_decay: 0.0005->0.0005, max_iter:100000
3. 预训练模型:train_100_lenet_iter_200000.caffemodel(前一个小节得到的模型)
4. 训练数据:train_100_all
5. 测试结果:这里只分为2类。模型大小116k
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) train_100_lenet_iter_50000.caffemodel 98.7846% 99.6066% 99.3558% 97.8286% 96.811% 97.9597% 97.9592% 87.8788% 99.0584% train_100_lenet_iter_100000.caffemodel 99.1222% 99.764% 99.4273% 98.3428% 97.5495% 98.4836% 97.957% 98.4848% 99.165% train_100_lenet_iter_150000.caffemodel 99.1222 99.764 99.4989% 98.7429% 97.7845 98.5663% 98.1447% 100% 99.2627% train_100_lenet_iter_150000.caffemodel 99.1897 99.6853 99.4989% 98.8571% 97.7845 98.5387% 98.3302% 100% 99.316% train_100_lenet_zip_0_iter_50000.caffemodel 99.3248 99.6853 99.4273% 98.8% 97.6838 98.5112% 98.3302% 100% 99.2095% train_100_lenet_zip_0_iter_100000.caffemodel 99.2573 99.5279 99.3558% 98.87429% 97.5831 98.3182% 98.1447% 100% 99.2361% train_100_lenet_zip_1_iter_50000.caffemodel 98.9872 99.6853 99.4989% 98.85719% 97.7174 98.4836% 98.3302% 100% 99.2095% train_100_lenet_zip_1_iter_100000.caffemodel 99.0547 99.6066 99.4273% 98.97149% 97.6838 98.456% 98.3302% 100% 99.2272% train_100_lenet_zip_2_iter_60000.caffemodel 99.3248 99.764 99.4989% 98.8% 97.8181 98.6215% 98.5158% 100% 99.2183% train_100_lenet_zip_2_iter_100000.caffemodel 99.1897 99.6853 99.4273% 98.8% 97.6838 98.4285% 98.5158% 100% 99.1917% train_100_lenet_zip_3_iter_50000.caffemodel 99.4598 99.764 99.141% 98.8571% 98.0866 98.9247% 98.3302% 100% 99.165% train_100_lenet_zip_3_iter_50000.caffemodel 99.3248 99.6853 99.3558% 98.8571% 97.8852 98.649% 98.1447% 100% 99.245% train_100_lenet_zip_4_iter_50000.caffemodel 99.1897 99.5279 98.9979% 98.8571% 98.3552 98.9799% 98.1447% 98.4848% 99.1473% train_100_lenet_zip_4_iter_100000.caffemodel 99.3923 99.6066 99.0694% 98.8571% 98.1202 98.842% 98.1447% 100% 99.2006 %
第五次
1. 网络结构:train_batch_size=64,修改ip1_4 ->ip1_2,对应的num_oputput 4 ->2,去掉最后一层全连接层
2. 超参数:base_lr: 0.0001,weight_decay: 0.0005->0.0005, max_iter:100000
3. 预训练模型:train_100_lenet_iter_200000.caffemodel(前一个小节得到的模型)
4. 训练数据:train_100_all
5. 测试结果:至少需要两个全连接层。
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) train_100_lenet_iter_50000.caffemodel 98.7846% 99.6066% 99.3558% 97.8286% 96.811% 97.9597% 97.9592% 87.8788% 99.0584% train_100_lenet_iter_100000.caffemodel 99.1222% 99.764% 99.4273% 98.3428% 97.5495% 98.4836% 97.957% 98.4848% 99.165% train_100_lenet_iter_150000.caffemodel 99.1222 99.764 99.4989% 98.7429% 97.7845 98.5663% 98.1447% 100% 99.2627% train_100_lenet_iter_150000.caffemodel 99.1897 99.6853 99.4989% 98.8571% 97.7845 98.5387% 98.3302% 100% 99.316% train_100_lenet_zip_0_iter_50000.caffemodel 99.3248 99.6853 99.4273% 98.8% 97.6838 98.5112% 98.3302% 100% 99.2095% train_100_lenet_zip_0_iter_100000.caffemodel 99.2573 99.5279 99.3558% 98.87429% 97.5831 98.3182% 98.1447% 100% 99.2361% train_100_lenet_zip_1_iter_50000.caffemodel 98.9872 99.6853 99.4989% 98.85719% 97.7174 98.4836% 98.3302% 100% 99.2095% train_100_lenet_zip_1_iter_100000.caffemodel 99.0547 99.6066 99.4273% 98.97149% 97.6838 98.456% 98.3302% 100% 99.2272% train_100_lenet_zip_2_iter_60000.caffemodel 99.3248 99.764 99.4989% 98.8% 97.8181 98.6215% 98.5158% 100% 99.2183% train_100_lenet_zip_2_iter_100000.caffemodel 99.1897 99.6853 99.4273% 98.8% 97.6838 98.4285% 98.5158% 100% 99.1917% train_100_lenet_zip_3_iter_50000.caffemodel 99.4598 99.764 99.141% 98.8571% 98.0866 98.9247% 98.3302% 100% 99.165% train_100_lenet_zip_3_iter_100000.caffemodel 99.3248 99.6853 99.3558% 98.8571% 97.8852 98.649% 98.1447% 100% 99.245% train_100_lenet_zip_4_iter_50000.caffemodel 99.1897 99.5279 98.9979% 98.8571% 98.3552 98.9799% 98.1447% 98.4848% 99.1473% train_100_lenet_zip_4_iter_100000.caffemodel 99.3923 99.6066 99.0694% 98.8571% 98.1202 98.842% 98.1447% 100% 99.2006 % train_100_lenet_zip_5_iter_50000.caffemodel 99.1897 99.5279 98.9979% 98.8571% 98.3552 98.9799% 3.71058% 98.4848% 99.1473% train_100_lenet_zip_5_iter_50000.caffemodel 96.4889 96.5382 93.4145% 80.9714% 96.4082 98.9799% 3.71058% 96.9697% 99.2006%
3. Lenet卷积层的裁剪
name : "LeNet "
layer {
name : "mnist"
type: "Data"
top: "data"
top: "label"
include {
phase: TRAIN
}
transform_param {
scale : 0.00390625
}
data_param {
source : "train_100_all"
batch_size: 64
backend: LMDB
}
}
layer {
name : "mnist"
type: "Data"
top: "data"
top: "label"
include {
phase: TEST
}
transform_param {
scale : 0.00390625
}
data_param {
source : "val_G1"
batch_size:1
backend: LMDB
}
}
layer {
name : "conv3"
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_40"
type: "Convolution"
bottom: "pool1"
top: "conv2"
propagate_down:false
param {
lr_mult: 1
}
param {
lr_mult : 2
}
convolution_param {
num_output : 40
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_4_40"
type: "InnerProduct"
bottom: "pool2"
top: "ip1"
propagate_down:true
param {
lr_mult: 1
}
param {
lr_mult : 2
}
inner_product_param {
num_output : 4
weight_filler {
type: "xavier"
}
bias_filler {
type : "constant"
}
}
}
layer {
name : "relu1"
type: "ReLU"
bottom: "ip1"
top: "ip1"
}
layer {
name : "ip3_4"
type: "InnerProduct"
bottom: "ip1"
top: "ip2"
param {
lr_mult: 1
}
param {
lr_mult : 2
}
inner_product_param {
num_output : 2
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"
}
第6次
1. 网络结构:train_batch_size=64,修改ip1_10 ->ip1_4,对应的num_oputput 10 ->4, conv2:50->40, ip1到ip3的参数不变
2. 超参数:base_lr: 0.0001,weight_decay: 0.0005->0.0005, max_iter:100000,再增加到150000次(因为测试发现,对于白牌仍然存在提升空间)
3. 预训练模型:train_100_lenet_zip_4_iter_100000.caffemodel(前一个小节得到的模型)
4. 训练数据:train_100_all
5. 测试结果:这里只分为2类。模型大小102k
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) train_100_lenet_zip_4_iter_50000.caffemodel 99.1897 99.5279 98.9979% 98.8571% 98.3552 98.9799% 98.1447% 98.4848% 99.1473% train_100_lenet_zip_4_iter_100000.caffemodel 99.3923 99.6066 99.0694% 98.8571% 98.1202 98.842% 98.1447% 100% 99.2006 % train_100_lenet_zip_6_iter_50000.caffemodel 99.5273 99.5279 99.141% 99.0286% 97.9523 98.7869% 99.0724% 93.9394% 99.1206% train_100_lenet_zip_6_iter_100000.caffemodel 99.5273 99.6066 99.3558% 98.9143% 98.053 98.8144% 98.8868% 98.4848% 99.165% train_100_lenet_zip_6_iter_150000.caffemodel 99.5949 99.6853 99.4273% 99.0286% 97.8181 98.6215% 98.8868% 98.4848% 99.2983%
第7次
1. 网络结构:train_batch_size=64,修改ip1_10 ->ip1_4,对应的num_oputput 10 ->4, conv2:40->30, ip1到ip3的参数不变
2. 超参数:base_lr: 0.0001,weight_decay: 0.0005->0.0005, max_iter:100000,再增加到150000次(因为测试发现,对于白牌仍然存在提升空间)
3. 预训练模型:train_100_lenet_zip_4_iter_100000.caffemodel(前一个小节得到的模型)
4. 训练数据:train_100_all
5. 测试结果:这里只分为2类。模型大小79k
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) train_100_lenet_zip_4_iter_50000.caffemodel 99.1897 99.5279 98.9979% 98.8571% 98.3552 98.9799% 98.1447% 98.4848% 99.1473% train_100_lenet_zip_4_iter_100000.caffemodel 99.3923 99.6066 99.0694% 98.8571% 98.1202 98.842% 98.1447% 100% 99.2006 % train_100_lenet_zip_6_iter_50000.caffemodel 99.5273 99.5279 99.141% 99.0286% 97.9523 98.7869% 99.0724% 93.9394% 99.1206% train_100_lenet_zip_6_iter_100000.caffemodel 99.5273 99.6066 99.3558% 98.9143% 98.053 98.8144% 98.8868% 98.4848% 99.165% train_100_lenet_zip_6_iter_150000.caffemodel 99.5949 99.6853 99.4273% 99.0286% 97.8181 98.6215% 98.8868% 98.4848% 99.2983% train_100_lenet_zip_7_iter_50000.caffemodel 99.1897 99.6853 99.2126% 98.5143% 97.8516 98.7869% 98.1447% 93.9394% 99.0762% train_100_lenet_zip_7_iter_100000.caffemodel 99.3248 99.6853 99.3558% 98.6286% 97.9859 98.8144% 98.7013% 95.4545% 99.1384% train_100_lenet_zip_7_iter_150000.caffemodel 99.1897 99.6066 99.4989% 98.9143% 97.8516 98.4285% 98.7013% 93.9394% 99.2983%
第8次
1. 网络结构:train_batch_size=64,修改ip1_10 ->ip1_4,对应的num_oputput 4 ->4, conv2:30->20, ip1到ip3的参数不变
2. 超参数:base_lr: 0.0001,weight_decay: 0.0005->0.0005, max_iter:100000,再增加到150000次(因为测试发现,对于白牌仍然存在提升空间)
3. 预训练模型:train_100_lenet_zip_4_iter_100000.caffemodel(前一个小节得到的模型)
4. 训练数据:train_100_all
5. 测试结果:这里只分为2类。模型大小54k
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) train_100_lenet_zip_4_iter_50000.caffemodel 99.1897 99.5279 98.9979% 98.8571% 98.3552 98.9799% 98.1447% 98.4848% 99.1473% train_100_lenet_zip_4_iter_100000.caffemodel 99.3923 99.6066 99.0694% 98.8571% 98.1202 98.842% 98.1447% 100% 99.2006 % train_100_lenet_zip_6_iter_50000.caffemodel 99.5273 99.5279 99.141% 99.0286% 97.9523 98.7869% 99.0724% 93.9394% 99.1206% train_100_lenet_zip_6_iter_100000.caffemodel 99.5273 99.6066 99.3558% 98.9143% 98.053 98.8144% 98.8868% 98.4848% 99.165% train_100_lenet_zip_6_iter_150000.caffemodel 99.5949 99.6853 99.4273% 99.0286% 97.8181 98.6215% 98.8868% 98.4848% 99.2983% train_100_lenet_zip_7_iter_50000.caffemodel 99.1897 99.6853 99.2126% 98.5143% 97.8516 98.7869% 98.1447% 93.9394% 99.0762% train_100_lenet_zip_7_iter_100000.caffemodel 99.3248 99.6853 99.3558% 98.6286% 97.9859 98.8144% 98.7013% 95.4545% 99.1384% train_100_lenet_zip_7_iter_150000.caffemodel 99.1897 99.6066 99.4989% 98.9143% 97.8516 98.4285% 98.7013% 93.9394% 99.2983% train_100_lenet_zip_8_iter_50000.caffemodel 99.3923 99.3706 98.9979% 98.7429% 98.1537 98.9247% 98.5158% 93.9394% 99.0496% train_100_lenet_zip_8_iter_100000.caffemodel 99.5273 99.6066 99.141% 98.6286% 98.1537 98.9523% 98.5158% 96.9697% 99.0673% train_100_lenet_zip_8_iter_150000.caffemodel 99.4598 99.6853 99.4273% 98.7429% 97.9523 98.6766% 98.3302% 95.4545% 99.2361%
第9次
1. 网络结构:train_batch_size=64,修改ip1_10 ->ip1_4,对应的num_oputput 4 ->4, conv2:20->15, 增加group=5(输入和输出channel数量必须能被group整除),ip1到ip3的参数不变
2. 超参数:base_lr: 0.0001,weight_decay: 0.0005->0.0005, max_iter:100000,再增加到150000次(因为测试发现,对于白牌仍然存在提升空间)
3. 预训练模型:train_100_lenet_zip_4_iter_100000.caffemodel(前一个小节得到的模型)
4. 训练数据:train_100_all
5. 测试结果:这里只分为2类。模型大小18k
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) train_100_lenet_zip_4_iter_50000.caffemodel 99.1897 99.5279 98.9979% 98.8571% 98.3552 98.9799% 98.1447% 98.4848% 99.1473% train_100_lenet_zip_4_iter_100000.caffemodel 99.3923 99.6066 99.0694% 98.8571% 98.1202 98.842% 98.1447% 100% 99.2006 % train_100_lenet_zip_6_iter_50000.caffemodel 99.5273 99.5279 99.141% 99.0286% 97.9523 98.7869% 99.0724% 93.9394% 99.1206% train_100_lenet_zip_6_iter_100000.caffemodel 99.5273 99.6066 99.3558% 98.9143% 98.053 98.8144% 98.8868% 98.4848% 99.165% train_100_lenet_zip_6_iter_150000.caffemodel 99.5949 99.6853 99.4273% 99.0286% 97.8181 98.6215% 98.8868% 98.4848% 99.2983% train_100_lenet_zip_7_iter_50000.caffemodel 99.1897 99.6853 99.2126% 98.5143% 97.8516 98.7869% 98.1447% 93.9394% 99.0762% train_100_lenet_zip_7_iter_100000.caffemodel 99.3248 99.6853 99.3558% 98.6286% 97.9859 98.8144% 98.7013% 95.4545% 99.1384% train_100_lenet_zip_7_iter_150000.caffemodel 99.1897 99.6066 99.4989% 98.9143% 97.8516 98.4285% 98.7013% 93.9394% 99.2983% train_100_lenet_zip_8_iter_50000.caffemodel 99.3923 99.3706 98.9979% 98.7429% 98.1537 98.9247% 98.5158% 93.9394% 99.0496% train_100_lenet_zip_8_iter_100000.caffemodel 99.5273 99.6066 99.141% 98.6286% 98.1537 98.9523% 98.5158% 96.9697% 99.0673% train_100_lenet_zip_8_iter_150000.caffemodel 99.4598 99.6853 99.4273% 98.7429% 97.9523 98.6766% 98.3302% 95.4545% 99.2361% train_100_lenet_zip_9_iter_50000.caffemodel 99.5273 99.3706 98.9263% 98.5143% 98.1537 98.9247% 98.3302% 98.4848% 98.9696% train_100_lenet_zip_9_iter_100000.caffemodel 99.4598 99.4493 99.141% 98.3429% 97.7845 98.8972% 97.9592% 96.9697% 98.9785% train_100_lenet_zip_9_iter_150000.caffemodel 99.3923 99.3706 99.2126% 98.3429% 97.7174 98.6766% 97.5881% 96.9697% 99.1473%
第10次
1. 网络结构:train_batch_size=64,修改ip1_10 ->ip1_4,对应的num_oputput 4 ->4,conv1:20->15 conv2:20->15, 增加group=3(输入和输出channel数量必须能被group整除,记得更改conv1,conv2的name),ip1到ip3的参数不变
2. 超参数:base_lr: 0.0001,weight_decay: 0.0005->0.0005, max_iter:100000,再增加到150000次(因为测试发现,对于白牌仍然存在提升空间)
3. 预训练模型:train_100_lenet_zip_9_iter_100000.caffemodel(前一个小节得到的模型)
4. 训练数据:train_100_all
5. 测试结果:这里只分为2类。模型大小18k
模型 G1(1481) G2(1271) G3(1397) G4(1750) G5(2979) single_0(蓝色3627) single_1(黄色539) single_2(白色66) single_3(非11258) train_100_lenet_zip_4_iter_50000.caffemodel 99.1897 99.5279 98.9979% 98.8571% 98.3552 98.9799% 98.1447% 98.4848% 99.1473% train_100_lenet_zip_4_iter_100000.caffemodel 99.3923 99.6066 99.0694% 98.8571% 98.1202 98.842% 98.1447% 100% 99.2006 % train_100_lenet_zip_6_iter_50000.caffemodel 99.5273 99.5279 99.141% 99.0286% 97.9523 98.7869% 99.0724% 93.9394% 99.1206% train_100_lenet_zip_6_iter_100000.caffemodel 99.5273 99.6066 99.3558% 98.9143% 98.053 98.8144% 98.8868% 98.4848% 99.165% train_100_lenet_zip_6_iter_150000.caffemodel 99.5949 99.6853 99.4273% 99.0286% 97.8181 98.6215% 98.8868% 98.4848% 99.2983% train_100_lenet_zip_7_iter_50000.caffemodel 99.1897 99.6853 99.2126% 98.5143% 97.8516 98.7869% 98.1447% 93.9394% 99.0762% train_100_lenet_zip_7_iter_100000.caffemodel 99.3248 99.6853 99.3558% 98.6286% 97.9859 98.8144% 98.7013% 95.4545% 99.1384% train_100_lenet_zip_7_iter_150000.caffemodel 99.1897 99.6066 99.4989% 98.9143% 97.8516 98.4285% 98.7013% 93.9394% 99.2983% train_100_lenet_zip_8_iter_50000.caffemodel 99.3923 99.3706 98.9979% 98.7429% 98.1537 98.9247% 98.5158% 93.9394% 99.0496% train_100_lenet_zip_8_iter_100000.caffemodel 99.5273 99.6066 99.141% 98.6286% 98.1537 98.9523% 98.5158% 96.9697% 99.0673% train_100_lenet_zip_8_iter_150000.caffemodel 99.4598 99.6853 99.4273% 98.7429% 97.9523 98.6766% 98.3302% 95.4545% 99.2361% train_100_lenet_zip_9_iter_50000.caffemodel 99.5273 99.3706 98.9263% 98.5143% 98.1537 98.9247% 98.3302% 98.4848% 98.9696% train_100_lenet_zip_9_iter_100000.caffemodel 99.4598 99.4493 99.141% 98.3429% 97.7845 98.8972% 97.9592% 96.9697% 98.9785% train_100_lenet_zip_9_iter_150000.caffemodel 99.3923 99.3706 99.2126% 98.3429% 97.7174 98.6766% 97.5881% 96.9697% 99.1473%