1. 程式人生 > >caffe訓練自己的資料集——2. 開始訓練

caffe訓練自己的資料集——2. 開始訓練

一、配置檔案

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

# The train/test net protocol buffer definition
net:  "henet_car_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.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: 10000
# snapshot intermediate results
snapshot: 5000
snapshot_prefix: "/home/datasets/carPlate/train_test_labels/train_10/train_10"  #前一個train_10是制定路徑,最後一個表示模型檔案的字首
# solver mode: CPU or 
GPU
solver_mode: GPU

二、開始訓練

1. 訓練並輸出日誌

1. 無預訓練
/opt/caffe/build/tools/caffe train \
--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. 載入預訓練模型
/opt/caffe/build/tools/caffe train \
--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/ \#數值資訊的儲存路徑
#生成henet_Res2order.log.test 和henet_Res2order.log.train兩個檔案

3. 繪製loss&accuracy曲線

4.測試資料

/opt/caffe/build/tools/caffe test \
--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