2016-04-28 14 views
0

デコンボリューションレイヤーを完全連結レイヤーで連結しようとしていますが、連結レイヤーを処理するために連結レイヤーの後に再構成すると、バッチサイズが変更されます。私はないWICH:端末上Decatvolutionalレイヤーを使用したConcat FCレイヤー

...... 

    layer { 
     name: "fc4" 
     type: "InnerProduct" 
     bottom: "fc3" 
     top: "fc4" 
     param { 
     lr_mult: 1 
     decay_mult: 1 
     } 
     param { 
     lr_mult: 2 
     decay_mult: 0 
     } 
     inner_product_param { 
     num_output: 21904 
     weight_filler { 
      type: "gaussian" 
      std: 0.01 
     } 
     bias_filler { 
      type: "constant" 
      value: 0 
     } 
     } 
    } 
    layer { 
     name: "deconv" 
     type: "Deconvolution" 
     bottom: "data" 
     top: "deconv" 
     param { 
     lr_mult: 1 
     decay_mult: 1 
     } 
     param { 
     lr_mult: 2 
     decay_mult: 0 
     } 
     convolution_param { 
     num_output: 256 
     pad: 1 
     kernel_size: 8 
     weight_filler { 
      type: "gaussian" 
      std: 0.01 
     } 
     bias_filler { 
      type: "constant" 
      value: 0 
     } 
     } 
    } 
    layer { 
     type: "Flatten" 
     bottom: "deconv" 
     top: "dec_flatten" 
     name: "dec_flatten" 
    } 
    layer { 
     name: "concat" 
     bottom: "fc4" 
     bottom: "dec_flatten" 
     top: "concat" 
     type: "Concat" 
     concat_param { 
     axis: 1 
     } 
    } 
    layer { 
     name: "reshape" 
     type: "Reshape" 
     bottom: "concat" 
     top: "output" 
     reshape_param { 
     shape { 
     dim: -1 
     dim: 1 
     dim: 148 
     dim: 148 
     } 
     } 
    } 
    layer { 
     name: "conv1" 
     type: "Convolution" 
     bottom: "output" 
     top: "conv1" 
     param { 
     lr_mult: 1 
     decay_mult: 1 
     } 
     param { 
     lr_mult: 2 
     decay_mult: 0 
     } 
     convolution_param { 
     num_output: 16 
     kernel_size: 5 
     stride: 1 
     weight_filler { 
      type: "gaussian" 
      std: 0.01 
     } 
     bias_filler { 
      type: "constant" 
      value: 0 
     } 
     } 
    } 
    .... 

を、私はこの出力を持っている:私は私のバッチサイズの変更を再構築行うと、彼らは、バッチサイズを変更せずに再構築する方法

0428 11:45:41.201318 52048 net.cpp:454] fc4 <- fc3 
I0428 11:45:41.201325 52048 net.cpp:411] fc4 -> fc4 
I0428 11:45:41.320688 52048 net.cpp:150] Setting up fc4 
I0428 11:45:41.320735 52048 net.cpp:157] Top shape: 1 21904 (21904) 
I0428 11:45:41.320740 52048 net.cpp:165] Memory required for data: 114240 
I0428 11:45:41.320752 52048 layer_factory.hpp:76] Creating layer deconv 
I0428 11:45:41.320770 52048 net.cpp:106] Creating Layer deconv 
I0428 11:45:41.320776 52048 net.cpp:454] deconv <- data_data_0_split_1 
I0428 11:45:41.320786 52048 net.cpp:411] deconv -> deconv 
I0428 11:45:41.322069 52048 net.cpp:150] Setting up deconv 
I0428 11:45:41.322095 52048 net.cpp:157] Top shape: 1 256 37 37 (350464) 
I0428 11:45:41.322100 52048 net.cpp:165] Memory required for data: 1516096 
I0428 11:45:41.322110 52048 layer_factory.hpp:76] Creating layer dec_flatten 
I0428 11:45:41.322119 52048 net.cpp:106] Creating Layer dec_flatten 
I0428 11:45:41.322124 52048 net.cpp:454] dec_flatten <- deconv 
I0428 11:45:41.322130 52048 net.cpp:411] dec_flatten -> dec_flatten 
I0428 11:45:41.322156 52048 net.cpp:150] Setting up dec_flatten 
I0428 11:45:41.322163 52048 net.cpp:157] Top shape: 1 350464 (350464) 
I0428 11:45:41.322167 52048 net.cpp:165] Memory required for data: 2917952 
I0428 11:45:41.322171 52048 layer_factory.hpp:76] Creating layer concat 
I0428 11:45:41.322180 52048 net.cpp:106] Creating Layer concat 
I0428 11:45:41.322183 52048 net.cpp:454] concat <- fc4 
I0428 11:45:41.322188 52048 net.cpp:454] concat <- dec_flatten 
I0428 11:45:41.322194 52048 net.cpp:411] concat -> concat 
I0428 11:45:41.322216 52048 net.cpp:150] Setting up concat 
I0428 11:45:41.322223 52048 net.cpp:157] Top shape: 1 372368 (372368) 
I0428 11:45:41.322227 52048 net.cpp:165] Memory required for data: 4407424 
I0428 11:45:41.322232 52048 layer_factory.hpp:76] Creating layer reshape 
I0428 11:45:41.322242 52048 net.cpp:106] Creating Layer reshape 
I0428 11:45:41.322247 52048 net.cpp:454] reshape <- concat 
I0428 11:45:41.322252 52048 net.cpp:411] reshape -> output 
I0428 11:45:41.322283 52048 net.cpp:150] Setting up reshape 
I0428 11:45:41.322295 52048 net.cpp:157] Top shape: 17 1 148 148 (372368) 
I0428 11:45:41.322311 52048 net.cpp:165] Memory required for data: 5896896 
I0428 11:45:41.322315 52048 layer_factory.hpp:76] Creating layer conv1 
I0428 11:45:41.322325 52048 net.cpp:106] Creating Layer conv1 
I0428 11:45:41.322330 52048 net.cpp:454] conv1 <- output 
I0428 11:45:41.322337 52048 net.cpp:411] conv1 -> conv1 
I0428 11:45:41.323410 52048 net.cpp:150] Setting up conv1 
I0428 11:45:41.323438 52048 net.cpp:157] Top shape: 17 16 144 144 (5640192) 

知られていますか?

おかげ

答えて

0

concatブロブの形状は1x372368です。

今度はprototxtと、このブロブデータを再構築しようとしていた:H = 148の寸法として

reshape_param { 
    shape { 
    dim: -1 
    dim: 1 
    dim: 148 
    dim: 148 
    } 

、= 148、C = 1がすでにによって固定さwは、nの値であります372368/(148*148*1) = 17

バッチカウントを変更しない場合は、h、w、またはcの値をh*w*c*n = 372368に変更する必要があります。

編集1: 編集の回答: 現在、コンカットレイヤのサイズは画像あたり207936で、1024サイズのラベルを使用して損失を計算しようとしています。両方の底の小塊の寸法が異なるので、これは機能しません。 inner productレイヤーをconcatレイヤーの出力にnum_output:1024で接続してみることもできます。このinner productレイヤーの出力は、ラベルと共に損失レイヤーで使用できます。

+0

ありがとうございましたAnoop、私はそれを試してみましょう。 –

+0

Anoop、私の結果を変えると思うこの解決策を考えて、私はconv3の損失層の2つの底を設定します、そういう意味で、トレーニングはうまくいきますが、これは間違っていますか? 私がしようとしていることを明確にするために私はこの論文に従ってください:[link](http://arxiv.org/pdf/1603.07235v2.pdf) –

+0

あなたが2つのブロブと同じブロブを設定しようとしている損失層の入力、それは完全に間違っています。損失は​​常にゼロになり、モデルは何も学ばなくなるでしょう。 prototxtを変更しても、そのモデルで訓練するときの結果は変更できません。あなたが何を意味するかを詳しく教えてください。 –

関連する問題