CAFFE -FCN訓練配置過程

轉載自 http://blog.csdn.net/jiongnima/article/details/78549326?locationNum=3&fps=1

   在2015年發表於計算機視覺頂會CVPR上的Fully Convolutional Networks for Semantic Segmentation 論文(下文中簡稱FCN)開創了圖像語義分割的新流派。在後來的科研工作者發表學術論文做實驗的時候,還常常把自己的實驗結果與FCN相比較。筆者在做實驗的時候,也去改動並跑了跑FCN的代碼,可是問題出現了,筆者的訓練並不收斂

   下面是筆者最初的訓練prototxt文件:

[python]  view plain  copy
  1. name: "fcn8snet"  
  2. layer {  
  3.   name: "data"  
  4.   type: "ImageData"  
  5.   top: "data"  
  6.   top: "fake-dlabel"  
  7.   include {  
  8.     phase: TRAIN  
  9.   }  
  10.   transform_param {  
  11.     mean_file: "fcn8s_cityscapes/fcn_mean.binaryproto"  
  12.     #scale: 0.00390625  
  13.   }  
  14.   image_data_param {  
  15.     source: "fcn8s_cityscapes/data/train_img.txt"  
  16.     batch_size: 1  
  17.     root_folder: "fcn8s_cityscapes/data/train/image/"  
  18.   }  
  19. }  
  20. layer {  
  21.   name: "label"  
  22.   type: "ImageData"  
  23.   top: "label"  
  24.   top: "fake_llabel"  
  25.   include {  
  26.     phase: TRAIN  
  27.   }  
  28.   image_data_param {  
  29.     source: "fcn8s_cityscapes/data/train_label.txt"  
  30.     batch_size: 1  
  31.     root_folder: "fcn8s_cityscapes/data/train/label/"  
  32.     is_color: false  
  33.   }  
  34. }  
  35. layer {  
  36.   name: "conv1_1"  
  37.   type: "Convolution"  
  38.   bottom: "data"  
  39.   top: "conv1_1"  
  40.   param {  
  41.     lr_mult: 1  
  42.     decay_mult: 1  
  43.   }  
  44.   param {  
  45.     lr_mult: 2  
  46.     decay_mult: 0  
  47.   }  
  48.   convolution_param {  
  49.     num_output: 64  
  50.     pad: 100  
  51.     kernel_size: 3  
  52.     stride: 1  
  53.   }  
  54. }  
  55. layer {  
  56.   name: "relu1_1"  
  57.   type: "ReLU"  
  58.   bottom: "conv1_1"  
  59.   top: "conv1_1"  
  60. }  
  61. layer {  
  62.   name: "conv1_2"  
  63.   type: "Convolution"  
  64.   bottom: "conv1_1"  
  65.   top: "conv1_2"  
  66.   param {  
  67.     lr_mult: 1  
  68.     decay_mult: 1  
  69.   }  
  70.   param {  
  71.     lr_mult: 2  
  72.     decay_mult: 0  
  73.   }  
  74.   convolution_param {  
  75.     num_output: 64  
  76.     pad: 1  
  77.     kernel_size: 3  
  78.     stride: 1  
  79.   }  
  80. }  
  81. layer {  
  82.   name: "relu1_2"  
  83.   type: "ReLU"  
  84.   bottom: "conv1_2"  
  85.   top: "conv1_2"  
  86. }  
  87. layer {  
  88.   name: "pool1"  
  89.   type: "Pooling"  
  90.   bottom: "conv1_2"  
  91.   top: "pool1"  
  92.   pooling_param {  
  93.     pool: MAX  
  94.     kernel_size: 2  
  95.     stride: 2  
  96.   }  
  97. }  
  98. layer {  
  99.   name: "conv2_1"  
  100.   type: "Convolution"  
  101.   bottom: "pool1"  
  102.   top: "conv2_1"  
  103.   param {  
  104.     lr_mult: 1  
  105.     decay_mult: 1  
  106.   }  
  107.   param {  
  108.     lr_mult: 2  
  109.     decay_mult: 0  
  110.   }  
  111.   convolution_param {  
  112.     num_output: 128  
  113.     pad: 1  
  114.     kernel_size: 3  
  115.     stride: 1  
  116.   }  
  117. }  
  118. layer {  
  119.   name: "relu2_1"  
  120.   type: "ReLU"  
  121.   bottom: "conv2_1"  
  122.   top: "conv2_1"  
  123. }  
  124. layer {  
  125.   name: "conv2_2"  
  126.   type: "Convolution"  
  127.   bottom: "conv2_1"  
  128.   top: "conv2_2"  
  129.   param {  
  130.     lr_mult: 1  
  131.     decay_mult: 1  
  132.   }  
  133.   param {  
  134.     lr_mult: 2  
  135.     decay_mult: 0  
  136.   }  
  137.   convolution_param {  
  138.     num_output: 128  
  139.     pad: 1  
  140.     kernel_size: 3  
  141.     stride: 1  
  142.   }  
  143. }  
  144. layer {  
  145.   name: "relu2_2"  
  146.   type: "ReLU"  
  147.   bottom: "conv2_2"  
  148.   top: "conv2_2"  
  149. }  
  150. layer {  
  151.   name: "pool2"  
  152.   type: "Pooling"  
  153.   bottom: "conv2_2"  
  154.   top: "pool2"  
  155.   pooling_param {  
  156.     pool: MAX  
  157.     kernel_size: 2  
  158.     stride: 2  
  159.   }  
  160. }  
  161. layer {  
  162.   name: "conv3_1"  
  163.   type: "Convolution"  
  164.   bottom: "pool2"  
  165.   top: "conv3_1"  
  166.   param {  
  167.     lr_mult: 1  
  168.     decay_mult: 1  
  169.   }  
  170.   param {  
  171.     lr_mult: 2  
  172.     decay_mult: 0  
  173.   }  
  174.   convolution_param {  
  175.     num_output: 256  
  176.     pad: 1  
  177.     kernel_size: 3  
  178.     stride: 1  
  179.   }  
  180. }  
  181. layer {  
  182.   name: "relu3_1"  
  183.   type: "ReLU"  
  184.   bottom: "conv3_1"  
  185.   top: "conv3_1"  
  186. }  
  187. layer {  
  188.   name: "conv3_2"  
  189.   type: "Convolution"  
  190.   bottom: "conv3_1"  
  191.   top: "conv3_2"  
  192.   param {  
  193.     lr_mult: 1  
  194.     decay_mult: 1  
  195.   }  
  196.   param {  
  197.     lr_mult: 2  
  198.     decay_mult: 0  
  199.   }  
  200.   convolution_param {  
  201.     num_output: 256  
  202.     pad: 1  
  203.     kernel_size: 3  
  204.     stride: 1  
  205.   }  
  206. }  
  207. layer {  
  208.   name: "relu3_2"  
  209.   type: "ReLU"  
  210.   bottom: "conv3_2"  
  211.   top: "conv3_2"  
  212. }  
  213. layer {  
  214.   name: "conv3_3"  
  215.   type: "Convolution"  
  216.   bottom: "conv3_2"  
  217.   top: "conv3_3"  
  218.   param {  
  219.     lr_mult: 1  
  220.     decay_mult: 1  
  221.   }  
  222.   param {  
  223.     lr_mult: 2  
  224.     decay_mult: 0  
  225.   }  
  226.   convolution_param {  
  227.     num_output: 256  
  228.     pad: 1  
  229.     kernel_size: 3  
  230.     stride: 1  
  231.   }  
  232. }  
  233. layer {  
  234.   name: "relu3_3"  
  235.   type: "ReLU"  
  236.   bottom: "conv3_3"  
  237.   top: "conv3_3"  
  238. }  
  239. layer {  
  240.   name: "pool3"  
  241.   type: "Pooling"  
  242.   bottom: "conv3_3"  
  243.   top: "pool3"  
  244.   pooling_param {  
  245.     pool: MAX  
  246.     kernel_size: 2  
  247.     stride: 2  
  248.   }  
  249. }  
  250. layer {  
  251.   name: "conv4_1"  
  252.   type: "Convolution"  
  253.   bottom: "pool3"  
  254.   top: "conv4_1"  
  255.   param {  
  256.     lr_mult: 1  
  257.     decay_mult: 1  
  258.   }  
  259.   param {  
  260.     lr_mult: 2  
  261.     decay_mult: 0  
  262.   }  
  263.   convolution_param {  
  264.     num_output: 512  
  265.     pad: 1  
  266.     kernel_size: 3  
  267.     stride: 1  
  268.   }  
  269. }  
  270. layer {  
  271.   name: "relu4_1"  
  272.   type: "ReLU"  
  273.   bottom: "conv4_1"  
  274.   top: "conv4_1"  
  275. }  
  276. layer {  
  277.   name: "conv4_2"  
  278.   type: "Convolution"  
  279.   bottom: "conv4_1"  
  280.   top: "conv4_2"  
  281.   param {  
  282.     lr_mult: 1  
  283.     decay_mult: 1  
  284.   }  
  285.   param {  
  286.     lr_mult: 2  
  287.     decay_mult: 0  
  288.   }  
  289.   convolution_param {  
  290.     num_output: 512  
  291.     pad: 1  
  292.     kernel_size: 3  
  293.     stride: 1  
  294.   }  
  295. }  
  296. layer {  
  297.   name: "relu4_2"  
  298.   type: "ReLU"  
  299.   bottom: "conv4_2"  
  300.   top: "conv4_2"  
  301. }  
  302. layer {  
  303.   name: "conv4_3"  
  304.   type: "Convolution"  
  305.   bottom: "conv4_2"  
  306.   top: "conv4_3"  
  307.   param {  
  308.     lr_mult: 1  
  309.     decay_mult: 1  
  310.   }  
  311.   param {  
  312.     lr_mult: 2  
  313.     decay_mult: 0  
  314.   }  
  315.   convolution_param {  
  316.     num_output: 512  
  317.     pad: 1  
  318.     kernel_size: 3  
  319.     stride: 1  
  320.   }  
  321. }  
  322. layer {  
  323.   name: "relu4_3"  
  324.   type: "ReLU"  
  325.   bottom: "conv4_3"  
  326.   top: "conv4_3"  
  327. }  
  328. layer {  
  329.   name: "pool4"  
  330.   type: "Pooling"  
  331.   bottom: "conv4_3"  
  332.   top: "pool4"  
  333.   pooling_param {  
  334.     pool: MAX  
  335.     kernel_size: 2  
  336.     stride: 2  
  337.   }  
  338. }  
  339. layer {  
  340.   name: "conv5_1"  
  341.   type: "Convolution"  
  342.   bottom: "pool4"  
  343.   top: "conv5_1"  
  344.   param {  
  345.     lr_mult: 1  
  346.     decay_mult: 1  
  347.   }  
  348.   param {  
  349.     lr_mult: 2  
  350.     decay_mult: 0  
  351.   }  
  352.   convolution_param {  
  353.     num_output: 512  
  354.     pad: 1  
  355.     kernel_size: 3  
  356.     stride: 1  
  357.   }  
  358. }  
  359. layer {  
  360.   name: "relu5_1"  
  361.   type: "ReLU"  
  362.   bottom: "conv5_1"  
  363.   top: "conv5_1"  
  364. }  
  365. layer {  
  366.   name: "conv5_2"  
  367.   type: "Convolution"  
  368.   bottom: "conv5_1"  
  369.   top: "conv5_2"  
  370.   param {  
  371.     lr_mult: 1  
  372.     decay_mult: 1  
  373.   }  
  374.   param {  
  375.     lr_mult: 2  
  376.     decay_mult: 0  
  377.   }  
  378.   convolution_param {  
  379.     num_output: 512  
  380.     pad: 1  
  381.     kernel_size: 3  
  382.     stride: 1  
  383.   }  
  384. }  
  385. layer {  
  386.   name: "relu5_2"  
  387.   type: "ReLU"  
  388.   bottom: "conv5_2"  
  389.   top: "conv5_2"  
  390. }  
  391. layer {  
  392.   name: "conv5_3"  
  393.   type: "Convolution"  
  394.   bottom: "conv5_2"  
  395.   top: "conv5_3"  
  396.   param {  
  397.     lr_mult: 1  
  398.     decay_mult: 1  
  399.   }  
  400.   param {  
  401.     lr_mult: 2  
  402.     decay_mult: 0  
  403.   }  
  404.   convolution_param {  
  405.     num_output: 512  
  406.     pad: 1  
  407.     kernel_size: 3  
  408.     stride: 1  
  409.   }  
  410. }  
  411. layer {  
  412.   name: "relu5_3"  
  413.   type: "ReLU"  
  414.   bottom: "conv5_3"  
  415.   top: "conv5_3"  
  416. }  
  417. layer {  
  418.   name: "pool5"  
  419.   type: "Pooling"  
  420.   bottom: "conv5_3"  
  421.   top: "pool5"  
  422.   pooling_param {  
  423.     pool: MAX  
  424.     kernel_size: 2  
  425.     stride: 2  
  426.   }  
  427. }  
  428. layer {  
  429.   name: "fc6"  
  430.   type: "Convolution"  
  431.   bottom: "pool5"  
  432.   top: "fc6"  
  433.   param {  
  434.     lr_mult: 1  
  435.     decay_mult: 1  
  436.   }  
  437.   param {  
  438.     lr_mult: 2  
  439.     decay_mult: 0  
  440.   }  
  441.   convolution_param {  
  442.     num_output: 4096  
  443.     pad: 0  
  444.     kernel_size: 7  
  445.     stride: 1  
  446.   }  
  447. }  
  448. layer {  
  449.   name: "relu6"  
  450.   type: "ReLU"  
  451.   bottom: "fc6"  
  452.   top: "fc6"  
  453. }  
  454. layer {  
  455.   name: "drop6"  
  456.   type: "Dropout"  
  457.   bottom: "fc6"  
  458.   top: "fc6"  
  459.   dropout_param {  
  460.     dropout_ratio: 0.5  
  461.   }  
  462. }  
  463. layer {  
  464.   name: "fc7"  
  465.   type: "Convolution"  
  466.   bottom: "fc6"  
  467.   top: "fc7"  
  468.   param {  
  469.     lr_mult: 1  
  470.     decay_mult: 1  
  471.   }  
  472.   param {  
  473.     lr_mult: 2  
  474.     decay_mult: 0  
  475.   }  
  476.   convolution_param {  
  477.     num_output: 4096  
  478.     pad: 0  
  479.     kernel_size: 1  
  480.     stride: 1  
  481.   }  
  482. }  
  483. layer {  
  484.   name: "relu7"  
  485.   type: "ReLU"  
  486.     kernel_size: 1  
  487.     stride: 1  
  488.   }  
  489. }  
  490. layer {  
  491.   name: "relu7"  
  492.   type: "ReLU"  
  493.   bottom: "fc7"  
  494.   top: "fc7"  
  495. }  
  496. layer {  
  497.   name: "drop7"  
  498.   type: "Dropout"  
  499.   bottom: "fc7"  
  500.   top: "fc7"  
  501.   dropout_param {  
  502.     dropout_ratio: 0.5    dropout_ratio: 0.5  
  503.   }  
  504. }  
  505. layer {  
  506.   name: "score_fr_cityscapes"  
  507.   type: "Convolution"  
  508.   bottom: "fc7"  
  509.   top: "score_fr"  
  510.   param {  
  511.     lr_mult: 1  
  512.     decay_mult: 1  
  513.   }  
  514.   param {  
  515.     lr_mult: 2  
  516.     decay_mult: 0  
  517.   }  
  518.   }  
  519. }  
相關文章
相關標籤/搜索