深度学习之图像分类模型Cifar10数据集解读

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


  1. [root@localhost cifar10]# ./get_cifar10.sh   
  2. Downloading...  
  3. --2015-03-09 18:38:23--  http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz  
  4. Resolving www.cs.toronto.edu... 128.100.3.30  
  5. Connecting to www.cs.toronto.edu|128.100.3.30|:80... connected.  
  6. HTTP request sent, awaiting response... 200 OK  
  7. Length: 170052171 (162M) [application/x-gzip]  
  8. Saving to: 鈥渃ifar-10-binary.tar.gz鈥  
  9.   
  10. 100%[=============================================================>] 170,052,171 1.66M/s   in 5m 22s    
  1. Unzipping...  
  2. Done.  


然后进入目录 执行

cd $CAFFE_ROOT/examples/cifar10

./create_cifar10.sh


create_cifar10.sh 源代码如下,我们可以看到,所做的工作就是将图片库转成leveldb格式,并计算均值二进制文件

  1. #!/usr/bin/env sh  
  2. # This script converts the cifar data into leveldb format.  
  3.   
  4. EXAMPLE=examples/cifar10  
  5. DATA=data/cifar10  
  6.   
  7. echo "Creating leveldb..."  
  8.   
  9. rm -rf $EXAMPLE/cifar10_train_leveldb $EXAMPLE/cifar10_test_leveldb  
  10.   
  11. ./build/examples/cifar10/convert_cifar_data.bin $DATA $EXAMPLE  
  12.   
  13. echo "Computing image mean..."  
  14.   
  15. ./build/tools/compute_image_mean $EXAMPLE/cifar10_train_leveldb \  
  16.   $EXAMPLE/mean.binaryproto leveldb  
  17.   
  18. echo "Done."  

运行之后,将会在 examples 中出现数据库文件 ./cifar10-leveldb 和数据库图像均值二进制文件 ./mean.binaryproto
  1. [root@localhost caffe]# ./examples/cifar10/create_cifar10.sh  
  2. Creating leveldb...  
  3. Computing image mean...  
  4. E0309 18:50:12.026103 18241 compute_image_mean.cpp:114] Processed 10000 files.  
  5. E0309 18:50:12.094758 18241 compute_image_mean.cpp:114] Processed 20000 files.  
  6. E0309 18:50:12.163048 18241 compute_image_mean.cpp:114] Processed 30000 files.  
  7. E0309 18:50:12.231233 18241 compute_image_mean.cpp:114] Processed 40000 files.  
  8. E0309 18:50:12.299324 18241 compute_image_mean.cpp:114] Processed 50000 files.  
  9. Done.  


模型描述在examples/cifar10/cifar10_quick_solver.prototxt,和 examples/cifar10/cifar10_quick_train_test.prototxt 中。


  1. # reduce the learning rate after 8 epochs (4000 iters) by a factor of 10  
  2.   
  3. # The train/test net protocol buffer definition  
  4. net: "examples/cifar10/cifar10_quick_train_test.prototxt"  
  5. # test_iter specifies how many forward passes the test should carry out.  
  6. # In the case of MNIST, we have test batch size 100 and 100 test iterations,  
  7. # covering the full 10,000 testing images.  
  8. test_iter: 100  
  9. # Carry out testing every 500 training iterations.  
  10. test_interval: 500  
  11. # The base learning rate, momentum and the weight decay of the network.  
  12. base_lr: 0.001  
  13. momentum: 0.9  
  14. weight_decay: 0.004  
  15. # The learning rate policy  
  16. lr_policy: "fixed"  
  17. # Display every 100 iterations  
  18. display: 100  
  19. # The maximum number of iterations  
  20. max_iter: 4000  
  21. # snapshot intermediate results  
  22. snapshot: 4000  
  23. snapshot_prefix: "examples/cifar10/cifar10_quick"  
  24. # solver mode: CPU or GPU  
  25. solver_mode: CPU  
  26. ~  


  1. name: "CIFAR10_quick"  
  2. layers {  
  3.   name: "cifar"  
  4.   type: DATA  
  5.   top: "data"  
  6.   top: "label"  
  7.   data_param {  
  8.     source: "examples/cifar10/cifar10_train_leveldb"  
  9.     batch_size: 100  
  10.   }  
  11.   transform_param {  
  12.     mean_file: "examples/cifar10/mean.binaryproto"  
  13.   }  
  14.   include: { phase: TRAIN }  
  15. }  
  16. layers {  
  17.   name: "cifar"  
  18.   type: DATA  
  19.   top: "data"  
  20.   top: "label"  
  21.   data_param {  
  22.     source: "examples/cifar10/cifar10_test_leveldb"  
  23.     batch_size: 100  
  24.   }  
  25.   transform_param {  
  26.     mean_file: "examples/cifar10/mean.binaryproto"  
  27.   }  
  28.   include: { phase: TEST }  
  29. }  
  30. layers {  
  31.   name: "conv1"  
  32.   type: CONVOLUTION  
  33.   bottom: "data"  
  34.   top: "conv1"  
  35.   blobs_lr: 1  
  36.   blobs_lr: 2  
  37.   convolution_param {  
  38.     num_output: 32  
  39.     pad: 2  
  40.     kernel_size: 5  
  41.     stride: 1  
  42.     weight_filler {  
  43.       type: "gaussian"  
  44.       std: 0.0001  
  45.     }  
  46.     bias_filler {  
  47.       type: "constant"  
  48.     }  
  49.   }  
  50. }  
  51. layers {  
  52.   name: "pool1"  
  53.   type: POOLING  
  54.   bottom: "conv1"  
  55.   top: "pool1"  
  56.   pooling_param {  
  57.     pool: MAX  
  58.     kernel_size: 3  
  59.     stride: 2  
  60.   }  
  61. }  
  62. layers {  
  63.   name: "relu1"  
  64.   type: RELU  
  65.   bottom: "pool1"  
  66.   top: "pool1"  
  67. }  
  68. layers {  
  69.   name: "conv2"  
  70.   type: CONVOLUTION  
  71.   bottom: "pool1"  
  72.   top: "conv2"  
  73.   blobs_lr: 1  
  74.   blobs_lr: 2  
  75.   convolution_param {  
  76.     num_output: 32  
  77.     pad: 2  
  78.     kernel_size: 5  
  79.     stride: 1  
  80.     weight_filler {  
  81.       type: "gaussian"  
  82.       std: 0.01  
  83.     }  
  84.     bias_filler {  
  85.       type: "constant"  
  86.     }  
  87.   }  
  88. }  
  89. layers {  
  90.   name: "relu2"  
  91.   type: RELU  
  92.   bottom: "conv2"  
  93.   top: "conv2"  
  94. }  
  95. layers {  
  96.   name: "pool2"  
  97.   type: POOLING  
  98.   bottom: "conv2"  
  99.   top: "pool2"  
  100.   pooling_param {  
  101.     pool: AVE  
  102.     kernel_size: 3  
  103.     stride: 2  
  104.   }  
  105. }  
  106. layers {  
  107.   name: "conv3"  
  108.   type: CONVOLUTION  
  109.   bottom: "pool2"  
  110.   top: "conv3"  
  111.   blobs_lr: 1  
  112.   blobs_lr: 2  
  113.   convolution_param {  
  114.     num_output: 64  
  115.     pad: 2  
  116.     kernel_size: 5  
  117.     stride: 1  
  118.     weight_filler {  
  119.       type: "gaussian"  
  120.       std: 0.01  
  121.     }  
  122.     bias_filler {  
  123.       type: "constant"  
  124.     }  
  125.   }  
  126. }  
  127. layers {  
  128.   name: "relu3"  
  129.   type: RELU  
  130.   bottom: "conv3"  
  131.   top: "conv3"  
  132. }  
  133. layers {  
  134.   name: "pool3"  
  135.   type: POOLING  
  136.   bottom: "conv3"  
  137.   top: "pool3"  
  138.   pooling_param {  
  139.     pool: AVE  
  140.     kernel_size: 3  
  141.     stride: 2  
  142.   }  
  143. }  
  144. layers {  
  145.   name: "ip1"  
  146.   type: INNER_PRODUCT  
  147.   bottom: "pool3"  
  148.   top: "ip1"  
  149.   blobs_lr: 1  
  150.   blobs_lr: 2  
  151.   inner_product_param {  
  152.     num_output: 64  
  153.     weight_filler {  
  154.       type: "gaussian"  
  155.       std: 0.1  
  156.     }  
  157.     bias_filler {  
  158.       type: "constant"  
  159.     }  
  160.   }  
  161. }  
  162. layers {  
  163.   name: "ip2"  
  164.   type: INNER_PRODUCT  
  165.   bottom: "ip1"  
  166.   top: "ip2"  
  167.   blobs_lr: 1  
  168.   blobs_lr: 2  
  169.   inner_product_param {  
  170.     num_output: 10  
  171.     weight_filler {  
  172.       type: "gaussian"  
  173.       std: 0.1  
  174.     }  
  175.     bias_filler {  
  176.       type: "constant"  
  177.     }  
  178.   }  
  179. }  
  180. layers {  
  181.   name: "accuracy"  
  182.   type: ACCURACY  
  183.   bottom: "ip2"  
  184.   bottom: "label"  
  185.   top: "accuracy"  
  186.   include: { phase: TEST }  
  187. }  
  188. layers {  
  189.   name: "loss"  
  190.   type: SOFTMAX_LOSS  
  191.   bottom: "ip2"  
  192.   bottom: "label"  
  193.   top: "loss"  
  194. }  




模型训练是 执行 train_quick.sh ,内容如下
  1. [root@localhost cifar10]# vi train_quick.sh   
  2.   
  3.   
  4. #!/usr/bin/env sh  
  5.   
  6.   
  7. TOOLS=./build/tools  
  8.   
  9.   
  10. $TOOLS/caffe train \  
  11.   --solver=examples/cifar10/cifar10_quick_solver.prototxt  
  12.   
  13.   
  14. # reduce learning rate by factor of 10 after 8 epochs  
  15. $TOOLS/caffe train \  
  16.   --solver=examples/cifar10/cifar10_quick_solver_lr1.prototxt \  
  17.   --snapshot=examples/cifar10/cifar10_quick_iter_4000.solverstate  
  18. ~  
执行结果如下:


  1. I0313 00:40:24.471531 13825 net.cpp:56] Memory required for data: 0  
  2. I0313 00:40:24.471560 13825 net.cpp:67] Creating Layer cifar  
  3. I0313 00:40:24.471570 13825 net.cpp:356] cifar -> data  
  4. I0313 00:40:24.471585 13825 net.cpp:356] cifar -> label  
  5. I0313 00:40:24.471596 13825 net.cpp:96] Setting up cifar  
  6. I0313 00:40:24.471602 13825 data_layer.cpp:45] Opening leveldb examples/cifar10/cifar10_test_leveldb  
  7. I0313 00:40:24.549324 13825 data_layer.cpp:128] output data size: 100,3,32,32  
  8. I0313 00:40:24.549372 13825 base_data_layer.cpp:36] Loading mean file fromexamples/cifar10/mean.binaryproto  
  9. I0313 00:40:24.550582 13825 base_data_layer.cpp:64] Initializing prefetch  
  10. I0313 00:40:24.550639 13825 base_data_layer.cpp:66] Prefetch initialized.  
  11. I0313 00:40:24.550683 13825 net.cpp:103] Top shape: 100 3 32 32 (307200)  
  12. I0313 00:40:24.550698 13825 net.cpp:103] Top shape: 100 1 1 1 (100)  
  13. I0313 00:40:24.550709 13825 net.cpp:113] Memory required for data: 1229200  
  14. I0313 00:40:24.550734 13825 net.cpp:67] Creating Layer label_cifar_1_split  
  15. I0313 00:40:24.550750 13825 net.cpp:394] label_cifar_1_split <- label  
  16. I0313 00:40:24.550775 13825 net.cpp:356] label_cifar_1_split -> label_cifar_1_split_0  
  17. I0313 00:40:24.550802 13825 net.cpp:356] label_cifar_1_split -> label_cifar_1_split_1  
  18. I0313 00:40:24.550824 13825 net.cpp:96] Setting up label_cifar_1_split  
  19. I0313 00:40:24.550843 13825 net.cpp:103] Top shape: 100 1 1 1 (100)  
  20. I0313 00:40:24.550855 13825 net.cpp:103] Top shape: 100 1 1 1 (100)  
  21. I0313 00:40:24.550866 13825 net.cpp:113] Memory required for data: 1230000  
  22. I0313 00:40:24.550889 13825 net.cpp:67] Creating Layer conv1  
  23. I0313 00:40:24.550902 13825 net.cpp:394] conv1 <- data  
  24. I0313 00:40:24.550926 13825 net.cpp:356] conv1 -> conv1  
  25. I0313 00:40:24.550951 13825 net.cpp:96] Setting up conv1  
  26. I0313 00:40:24.551573 13825 net.cpp:103] Top shape: 100 32 32 32 (3276800)  
  27. I0313 00:40:24.551583 13825 net.cpp:113] Memory required for data: 14337200  
  28. I0313 00:40:24.551599 13825 net.cpp:67] Creating Layer pool1  
  29. I0313 00:40:24.551605 13825 net.cpp:394] pool1 <- conv1  
  30. I0313 00:40:24.551615 13825 net.cpp:356] pool1 -> pool1  
  31. I0313 00:40:24.551625 13825 net.cpp:96] Setting up pool1  
  32. I0313 00:40:24.551633 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)  
  33. I0313 00:40:24.551638 13825 net.cpp:113] Memory required for data: 17614000  
  34. I0313 00:40:24.551652 13825 net.cpp:67] Creating Layer relu1  
  35. I0313 00:40:24.551658 13825 net.cpp:394] relu1 <- pool1  
  36. I0313 00:40:24.551667 13825 net.cpp:345] relu1 -> pool1 (in-place)  
  37. I0313 00:40:24.551676 13825 net.cpp:96] Setting up relu1  
  38. I0313 00:40:24.551682 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)  
  39. I0313 00:40:24.551687 13825 net.cpp:113] Memory required for data: 20890800  
  40. I0313 00:40:24.551695 13825 net.cpp:67] Creating Layer conv2  
  41. I0313 00:40:24.551700 13825 net.cpp:394] conv2 <- pool1  
  42. I0313 00:40:24.551710 13825 net.cpp:356] conv2 -> conv2  
  43. I0313 00:40:24.551720 13825 net.cpp:96] Setting up conv2  
  44. I0313 00:40:24.554986 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)  
  45. I0313 00:40:24.554996 13825 net.cpp:113] Memory required for data: 24167600  
  46. I0313 00:40:24.555009 13825 net.cpp:67] Creating Layer relu2  
  47. I0313 00:40:24.555024 13825 net.cpp:394] relu2 <- conv2  
  48. I0313 00:40:24.555034 13825 net.cpp:345] relu2 -> conv2 (in-place)  
  49. I0313 00:40:24.555043 13825 net.cpp:96] Setting up relu2  
  50. I0313 00:40:24.555049 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)  
  51. I0313 00:40:24.555054 13825 net.cpp:113] Memory required for data: 27444400  
  52. I0313 00:40:24.555061 13825 net.cpp:67] Creating Layer pool2  
  53. I0313 00:40:24.555068 13825 net.cpp:394] pool2 <- conv2  
  54. I0313 00:40:24.555076 13825 net.cpp:356] pool2 -> pool2  
  55. I0313 00:40:24.555085 13825 net.cpp:96] Setting up pool2  
  56. I0313 00:40:24.555094 13825 net.cpp:103] Top shape: 100 32 8 8 (204800)  
  57. I0313 00:40:24.555099 13825 net.cpp:113] Memory required for data: 28263600  
  58. I0313 00:40:24.555109 13825 net.cpp:67] Creating Layer conv3  
  59. I0313 00:40:24.555114 13825 net.cpp:394] conv3 <- pool2  
  60. I0313 00:40:24.555124 13825 net.cpp:356] conv3 -> conv3  
  61. I0313 00:40:24.555135 13825 net.cpp:96] Setting up conv3  
  62. I0313 00:40:24.561589 13825 net.cpp:103] Top shape: 100 64 8 8 (409600)  
  63. I0313 00:40:24.561599 13825 net.cpp:113] Memory required for data: 29902000  
  64. I0313 00:40:24.561611 13825 net.cpp:67] Creating Layer relu3  
  65. I0313 00:40:24.561619 13825 net.cpp:394] relu3 <- conv3  
  66. I0313 00:40:24.561627 13825 net.cpp:345] relu3 -> conv3 (in-place)  
  67. I0313 00:40:24.561636 13825 net.cpp:96] Setting up relu3  
  68. I0313 00:40:24.561642 13825 net.cpp:103] Top shape: 100 64 8 8 (409600)  
  69. I0313 00:40:24.561646 13825 net.cpp:113] Memory required for data: 31540400  
  70. I0313 00:40:24.561655 13825 net.cpp:67] Creating Layer pool3  
  71. I0313 00:40:24.561661 13825 net.cpp:394] pool3 <- conv3  
  72. I0313 00:40:24.561669 13825 net.cpp:356] pool3 -> pool3  
  73. I0313 00:40:24.561678 13825 net.cpp:96] Setting up pool3  
  74. I0313 00:40:24.561686 13825 net.cpp:103] Top shape: 100 64 4 4 (102400)  
  75. I0313 00:40:24.561691 13825 net.cpp:113] Memory required for data: 31950000  
  76. I0313 00:40:24.561699 13825 net.cpp:67] Creating Layer ip1  
  77. I0313 00:40:24.561704 13825 net.cpp:394] ip1 <- pool3  
  78. I0313 00:40:24.561714 13825 net.cpp:356] ip1 -> ip1  
  79. I0313 00:40:24.561724 13825 net.cpp:96] Setting up ip1  
  80. I0313 00:40:24.569967 13825 net.cpp:103] Top shape: 100 64 1 1 (6400)  
  81. I0313 00:40:24.569975 13825 net.cpp:113] Memory required for data: 31975600  
  82. I0313 00:40:24.569988 13825 net.cpp:67] Creating Layer ip2  
  83. I0313 00:40:24.569993 13825 net.cpp:394] ip2 <- ip1  
  84. I0313 00:40:24.570004 13825 net.cpp:356] ip2 -> ip2  
  85. I0313 00:40:24.570014 13825 net.cpp:96] Setting up ip2  
  86. I0313 00:40:24.570108 13825 net.cpp:103] Top shape: 100 10 1 1 (1000)  
  87. I0313 00:40:24.570114 13825 net.cpp:113] Memory required for data: 31979600  
  88. I0313 00:40:24.570127 13825 net.cpp:67] Creating Layer ip2_ip2_0_split  
  89. I0313 00:40:24.570134 13825 net.cpp:394] ip2_ip2_0_split <- ip2  
  90. I0313 00:40:24.570143 13825 net.cpp:356] ip2_ip2_0_split -> ip2_ip2_0_split_0  
  91. I0313 00:40:24.570154 13825 net.cpp:356] ip2_ip2_0_split -> ip2_ip2_0_split_1  
  92. I0313 00:40:24.570163 13825 net.cpp:96] Setting up ip2_ip2_0_split  
  93. I0313 00:40:24.570171 13825 net.cpp:103] Top shape: 100 10 1 1 (1000)  
  94. I0313 00:40:24.570176 13825 net.cpp:103] Top shape: 100 10 1 1 (1000)  
  95. I0313 00:40:24.570181 13825 net.cpp:113] Memory required for data: 31987600  
  96. I0313 00:40:24.570189 13825 net.cpp:67] Creating Layer accuracy  
  97. I0313 00:40:24.570194 13825 net.cpp:394] accuracy <- ip2_ip2_0_split_0  
  98. I0313 00:40:24.570202 13825 net.cpp:394] accuracy <- label_cifar_1_split_0  
  99. I0313 00:40:24.570214 13825 net.cpp:356] accuracy -> accuracy  
  100. I0313 00:40:24.570222 13825 net.cpp:96] Setting up accuracy  
  101. I0313 00:40:24.570230 13825 net.cpp:103] Top shape: 1 1 1 1 (1)  
  102. I0313 00:40:24.570235 13825 net.cpp:113] Memory required for data: 31987604  
  103. I0313 00:40:24.570245 13825 net.cpp:67] Creating Layer loss  
  104. I0313 00:40:24.570250 13825 net.cpp:394] loss <- ip2_ip2_0_split_1  
  105. I0313 00:40:24.570257 13825 net.cpp:394] loss <- label_cifar_1_split_1  
  106. I0313 00:40:24.570266 13825 net.cpp:356] loss -> loss  
  107. I0313 00:40:24.570274 13825 net.cpp:96] Setting up loss  
  108. I0313 00:40:24.570286 13825 net.cpp:103] Top shape: 1 1 1 1 (1)  
  109. I0313 00:40:24.570291 13825 net.cpp:109]     with loss weight 1  
  110. I0313 00:40:24.570305 13825 net.cpp:113] Memory required for data: 31987608  
  111. I0313 00:40:24.570312 13825 net.cpp:170] loss needs backward computation.  
  112. I0313 00:40:24.570317 13825 net.cpp:172] accuracy does not need backward computation.  
  113. I0313 00:40:24.570322 13825 net.cpp:170] ip2_ip2_0_split needs backward computation.  
  114. I0313 00:40:24.570338 13825 net.cpp:170] ip2 needs backward computation.  
  115. I0313 00:40:24.570349 13825 net.cpp:170] ip1 needs backward computation.  
  116. I0313 00:40:24.570359 13825 net.cpp:170] pool3 needs backward computation.  
  117. I0313 00:40:24.570372 13825 net.cpp:170] relu3 needs backward computation.  
  118. I0313 00:40:24.570384 13825 net.cpp:170] conv3 needs backward computation.  
  119. I0313 00:40:24.570396 13825 net.cpp:170] pool2 needs backward computation.  
  120. I0313 00:40:24.570406 13825 net.cpp:170] relu2 needs backward computation.  
  121. I0313 00:40:24.570420 13825 net.cpp:170] conv2 needs backward computation.  
  122. I0313 00:40:24.570432 13825 net.cpp:170] relu1 needs backward computation.  
  123. I0313 00:40:24.570442 13825 net.cpp:170] pool1 needs backward computation.  
  124. I0313 00:40:24.570456 13825 net.cpp:170] conv1 needs backward computation.  
  125. I0313 00:40:24.570471 13825 net.cpp:172] label_cifar_1_split does not need backward computation.  
  126. I0313 00:40:24.570482 13825 net.cpp:172] cifar does not need backward computation.  
  127. I0313 00:40:24.570494 13825 net.cpp:208] This network produces output accuracy  
  128. I0313 00:40:24.570505 13825 net.cpp:208] This network produces output loss  
  129. I0313 00:40:24.570536 13825 net.cpp:467] Collecting Learning Rate and Weight Decay.  
  130. I0313 00:40:24.570549 13825 net.cpp:219] Network initialization done.  
  131. I0313 00:40:24.570554 13825 net.cpp:220] Memory required for data: 31987608  
  132. I0313 00:40:24.570590 13825 solver.cpp:41] Solver scaffolding done.  
  133. I0313 00:40:24.570595 13825 solver.cpp:160] Solving CIFAR10_quick  
  134. I0313 00:40:24.570600 13825 solver.cpp:161] Learning Rate Policy: fixed  
  135. I0313 00:40:24.570631 13825 solver.cpp:264] Iteration 0, Testing net (#0)  
  136. I0313 00:40:24.570639 13825 net.cpp:652] Copying source layer cifar  
  137. I0313 00:40:24.570644 13825 net.cpp:652] Copying source layer conv1  
  138. I0313 00:40:24.570652 13825 net.cpp:652] Copying source layer pool1  
  139. I0313 00:40:24.570657 13825 net.cpp:652] Copying source layer relu1  
  140. I0313 00:40:24.570662 13825 net.cpp:652] Copying source layer conv2  
  141. I0313 00:40:24.570667 13825 net.cpp:652] Copying source layer relu2  
  142. I0313 00:40:24.570672 13825 net.cpp:652] Copying source layer pool2  
  143. I0313 00:40:24.570677 13825 net.cpp:652] Copying source layer conv3  
  144. I0313 00:40:24.570696 13825 net.cpp:652] Copying source layer relu3  
  145. I0313 00:40:24.570703 13825 net.cpp:652] Copying source layer pool3  
  146. I0313 00:40:24.570708 13825 net.cpp:652] Copying source layer ip1  
  147. I0313 00:40:24.570724 13825 net.cpp:652] Copying source layer ip2  
  148. I0313 00:40:24.570729 13825 net.cpp:652] Copying source layer loss  
  149. }  
  150. I0313 00:40:24.471531 13825 net.cpp:56] Memory required for data: 0  
  151. I0313 00:40:24.471560 13825 net.cpp:67] Creating Layer cifar  
  152. I0313 00:40:24.471570 13825 net.cpp:356] cifar -> data  
  153. I0313 00:40:24.471585 13825 net.cpp:356] cifar -> label  
  154. I0313 00:40:24.471596 13825 net.cpp:96] Setting up cifar  
  155. I0313 00:40:24.471602 13825 data_layer.cpp:45] Opening leveldb examples/cifar10/cifar10_test_leveldb  
  156. I0313 00:40:24.549324 13825 data_layer.cpp:128] output data size: 100,3,32,32  
  157. I0313 00:40:24.549372 13825 base_data_layer.cpp:36] Loading mean file fromexamples/cifar10/mean.binaryproto  
  158. I0313 00:40:24.550582 13825 base_data_layer.cpp:64] Initializing prefetch  
  159. I0313 00:40:24.550639 13825 base_data_layer.cpp:66] Prefetch initialized.  
  160. I0313 00:40:24.550683 13825 net.cpp:103] Top shape: 100 3 32 32 (307200)  
  161. I0313 00:40:24.550698 13825 net.cpp:103] Top shape: 100 1 1 1 (100)  
  162. I0313 00:40:24.550709 13825 net.cpp:113] Memory required for data: 1229200  
  163. I0313 00:40:24.550734 13825 net.cpp:67] Creating Layer label_cifar_1_split  
  164. I0313 00:40:24.550750 13825 net.cpp:394] label_cifar_1_split <- label  
  165. I0313 00:40:24.550775 13825 net.cpp:356] label_cifar_1_split -> label_cifar_1_split_0  
  166. I0313 00:40:24.550802 13825 net.cpp:356] label_cifar_1_split -> label_cifar_1_split_1  
  167. I0313 00:40:24.550824 13825 net.cpp:96] Setting up label_cifar_1_split  
  168. I0313 00:40:24.550843 13825 net.cpp:103] Top shape: 100 1 1 1 (100)  
  169. I0313 00:40:24.550855 13825 net.cpp:103] Top shape: 100 1 1 1 (100)  
  170. I0313 00:40:24.550866 13825 net.cpp:113] Memory required for data: 1230000  
  171. I0313 00:40:24.550889 13825 net.cpp:67] Creating Layer conv1  
  172. I0313 00:40:24.550902 13825 net.cpp:394] conv1 <- data  
  173. I0313 00:40:24.550926 13825 net.cpp:356] conv1 -> conv1  
  174. I0313 00:40:24.550951 13825 net.cpp:96] Setting up conv1  
  175. I0313 00:40:24.551573 13825 net.cpp:103] Top shape: 100 32 32 32 (3276800)  
  176. I0313 00:40:24.551583 13825 net.cpp:113] Memory required for data: 14337200  
  177. I0313 00:40:24.551599 13825 net.cpp:67] Creating Layer pool1  
  178. I0313 00:40:24.551605 13825 net.cpp:394] pool1 <- conv1  
  179. I0313 00:40:24.551615 13825 net.cpp:356] pool1 -> pool1  
  180. I0313 00:40:24.551625 13825 net.cpp:96] Setting up pool1  
  181. I0313 00:40:24.551633 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)  
  182. I0313 00:40:24.551638 13825 net.cpp:113] Memory required for data: 17614000  
  183. I0313 00:40:24.551652 13825 net.cpp:67] Creating Layer relu1  
  184. I0313 00:40:24.551658 13825 net.cpp:394] relu1 <- pool1  
  185. I0313 00:40:24.551667 13825 net.cpp:345] relu1 -> pool1 (in-place)  
  186. I0313 00:40:24.551676 13825 net.cpp:96] Setting up relu1  
  187. I0313 00:40:24.551682 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)  
  188. I0313 00:40:24.551687 13825 net.cpp:113] Memory required for data: 20890800  
  189. I0313 00:40:24.551695 13825 net.cpp:67] Creating Layer conv2  
  190. I0313 00:40:24.551700 13825 net.cpp:394] conv2 <- pool1  
  191. I0313 00:40:24.551710 13825 net.cpp:356] conv2 -> conv2  
  192. I0313 00:40:24.551720 13825 net.cpp:96] Setting up conv2  
  193. I0313 00:40:24.554986 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)  
  194. I0313 00:40:24.554996 13825 net.cpp:113] Memory required for data: 24167600  
  195. I0313 00:40:24.555009 13825 net.cpp:67] Creating Layer relu2  
  196. I0313 00:40:24.555024 13825 net.cpp:394] relu2 <- conv2  
  197. I0313 00:40:24.555034 13825 net.cpp:345] relu2 -> conv2 (in-place)  
  198. I0313 00:40:24.555043 13825 net.cpp:96] Setting up relu2  
  199. I0313 00:40:24.555049 13825 net.cpp:103] Top shape: 100 32 16 16 (819200)  
  200. I0313 00:40:24.555054 13825 net.cpp:113] Memory required for data: 27444400  
  201. I0313 00:40:24.555061 13825 net.cpp:67] Creating Layer pool2  
  202. I0313 00:40:24.555068 13825 net.cpp:394] pool2 <- conv2  
  203. I0313 00:40:24.555076 13825 net.cpp:356] pool2 -> pool2  
  204. I0313 00:40:24.555085 13825 net.cpp:96] Setting up pool2  
  205. I0313 00:40:24.555094 13825 net.cpp:103] Top shape: 100 32 8 8 (204800)  
  206. I0313 00:40:24.555099 13825 net.cpp:113] Memory required for data: 28263600  
  207. I0313 00:40:24.555109 13825 net.cpp:67] Creating Layer conv3  
  208. I0313 00:40:24.555114 13825 net.cpp:394] conv3 <- pool2  
  209. I0313 00:40:24.555124 13825 net.cpp:356] conv3 -> conv3  
  210. I0313 00:40:24.555135 13825 net.cpp:96] Setting up conv3  
  211. I0313 00:40:24.5I0313 00:41:19.945504 13934 data_layer.cpp:187] Restarting data prefetching from start.  
  212. I0313 00:41:21.066936 13825 solver.cpp:315]     Test net output #0: accuracy = 0.0932  
  213. I0313 00:41:21.066978 13825 solver.cpp:315]     Test net output #1: loss = 2.30265 (* 1 = 2.30265 loss)  
  214. I0313 00:41:22.483836 13825 solver.cpp:209] Iteration 0, loss = 2.3028  
  215. I0313 00:41:22.483877 13825 solver.cpp:224]     Train net output #0: loss = 2.3028 (* 1 = 2.3028 loss)  
  216. I0313 00:41:22.483894 13825 solver.cpp:445] Iteration 0, lr = 0.001  
  217. I0313 00:43:45.116195 13825 solver.cpp:209] Iteration 100, loss = 1.785  
  218. I0313 00:43:45.116281 13825 solver.cpp:224]     Train net output #0: loss = 1.785 (* 1 = 1.785 loss)  
  219. I0313 00:43:45.116291 13825 solver.cpp:445] Iteration 100, lr = 0.001  
  220. I0313 00:46:07.567387 13825 solver.cpp:209] Iteration 200, loss = 1.62294  
  221. I0313 00:46:07.567468 13825 solver.cpp:224]     Train net output #0: loss = 1.62294 (* 1 = 1.62294 loss)  
  222. I0313 00:46:07.567479 13825 solver.cpp:445] Iteration 200, lr = 0.001  
  223. I0313 00:48:30.618835 13825 solver.cpp:209] Iteration 300, loss = 1.34621  
  224. I0313 00:48:30.618942 13825 solver.cpp:224]     Train net output #0: loss = 1.34621 (* 1 = 1.34621 loss)  
  225. I0313 00:48:30.618953 13825 solver.cpp:445] Iteration 300, lr = 0.001  
  1. I0313 00:50:52.191938 13825 solver.cpp:209] Iteration 400, loss = 1.28778  
  2. I0313 00:50:52.192026 13825 solver.cpp:224]     Train net output #0: loss = 1.28778 (* 1 = 1.28778 loss)  
  3. I0313 00:50:52.192037 13825 solver.cpp:445] Iteration 400, lr = 0.001  
  4. I0313 00:53:09.941452 14527 data_layer.cpp:187] Restarting data prefetching from start.  
  5. I0313 00:53:12.735488 13825 solver.cpp:264] Iteration 500, Testing net (#0)  
  6. I0313 00:53:12.735517 13825 net.cpp:652] Copying source layer cifar  
  7. I0313 00:53:12.735524 13825 net.cpp:652] Copying source layer conv1  
  8. I0313 00:53:12.735530 13825 net.cpp:652] Copying source layer pool1  
  9. I0313 00:53:12.735535 13825 net.cpp:652] Copying source layer relu1  
  10. I0313 00:53:12.735540 13825 net.cpp:652] Copying source layer conv2  
  11. I0313 00:53:12.735545 13825 net.cpp:652] Copying source layer relu2  
  12. I0313 00:53:12.735550 13825 net.cpp:652] Copying source layer pool2  
  13. I0313 00:53:12.735554 13825 net.cpp:652] Copying source layer conv3  
  14. I0313 00:53:12.735560 13825 net.cpp:652] Copying source layer relu3  
  15. I0313 00:53:12.735565 13825 net.cpp:652] Copying source layer pool3  
  16. I0313 00:53:12.735569 13825 net.cpp:652] Copying source layer ip1  
  17. I0313 00:53:12.735575 13825 net.cpp:652] Copying source layer ip2  
  18. I0313 00:53:12.735580 13825 net.cpp:652] Copying source layer loss  
  19. I0313 00:54:08.180796 14634 data_layer.cpp:187] Restarting data prefetching from start.  
  20. I0313 00:54:09.297691 13825 solver.cpp:315]     Test net output #0: accuracy = 0.5571  
  21. I0313 00:54:09.297731 13825 solver.cpp:315]     Test net output #1: loss = 1.271 (* 1 = 1.271 loss)  
  22. I0313 00:54:10.695636 13825 solver.cpp:209] Iteration 500, loss = 1.20884  
  23. I0313 00:54:10.695677 13825 solver.cpp:224]     Train net output #0: loss = 1.20884 (* 1 = 1.20884 loss)  
  24. I0313 00:54:10.695686 13825 solver.cpp:445] Iteration 500, lr = 0.001  
  25. I0313 00:56:32.906312 13825 solver.cpp:209] Iteration 600, loss = 1.18048  
  26. I0313 00:56:32.906397 13825 solver.cpp:224]     Train net output #0: loss = 1.18048 (* 1 = 1.18048 loss)  
  27. I0313 00:56:32.906407 13825 solver.cpp:445] Iteration 600, lr = 0.001  
  1.   
  1. ……  
  1.   

附上readme里面的解释
  1. When you run the code, you will see a lot of messages flying by like this:  
  2.   
  3. I0317 21:52:48.945710 2008298256 net.cpp:74] Creating Layer conv1  
  4. I0317 21:52:48.945716 2008298256 net.cpp:84] conv1 <- data  
  5. I0317 21:52:48.945725 2008298256 net.cpp:110] conv1 -> conv1  
  6. I0317 21:52:49.298691 2008298256 net.cpp:125] Top shape: 100 32 32 32 (3276800)  
  7. I0317 21:52:49.298719 2008298256 net.cpp:151] conv1 needs backward computation.  
  8. These messages tell you the details about each layer, its connections and its output shape, which may be   
  9.   
  10. helpful in debugging. After the initialization, the training will start:  
  11.   
  12. I0317 21:52:49.309370 2008298256 net.cpp:166] Network initialization done.  
  13. I0317 21:52:49.309376 2008298256 net.cpp:167] Memory required for Data 23790808  
  14. I0317 21:52:49.309422 2008298256 solver.cpp:36] Solver scaffolding done.  
  15. I0317 21:52:49.309447 2008298256 solver.cpp:47] Solving CIFAR10_quick_train  
  16. Based on the solver setting, we will print the training loss function every 100 iterations, and test the   
  17.   
  18. network every 500 iterations. You will see messages like this:  
  19.   
  20. I0317 21:53:12.179772 2008298256 solver.cpp:208] Iteration 100, lr = 0.001  
  21. I0317 21:53:12.185698 2008298256 solver.cpp:65] Iteration 100, loss = 1.73643  
  22. ...  
  23. I0317 21:54:41.150030 2008298256 solver.cpp:87] Iteration 500, Testing net  
  24. I0317 21:54:47.129461 2008298256 solver.cpp:114] Test score #0: 0.5504  
  25. I0317 21:54:47.129500 2008298256 solver.cpp:114] Test score #1: 1.27805  
  26. For each training iteration, lr is the learning rate of that iteration, and loss is the training function. For   
  27.   
  28. the output of the testing phase, score 0 is the accuracy, and score 1 is the testing loss function.  
  29.   
  30. And after making yourself a cup of coffee, you are done!  
  31.   
  32. I0317 22:12:19.666914 2008298256 solver.cpp:87] Iteration 5000, Testing net  
  33. I0317 22:12:25.580330 2008298256 solver.cpp:114] Test score #0: 0.7533  
  34. I0317 22:12:25.580379 2008298256 solver.cpp:114] Test score #1: 0.739837  
  35. I0317 22:12:25.587262 2008298256 solver.cpp:130] Snapshotting to cifar10_quick_iter_5000  
  36. I0317 22:12:25.590215 2008298256 solver.cpp:137] Snapshotting solver state to   
  37.   
  38. cifar10_quick_iter_5000.solverstate  
  39. I0317 22:12:25.592813 2008298256 solver.cpp:81] Optimization Done.  
  40. Our model achieved ~75% test accuracy. The model parameters are stored in binary protobuf format in  
  41.   
  42. cifar10_quick_iter_5000 
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值