2017-08-18 5 views
0

私はCaffeを使用してConstitutional Neural Networkに取り組んでいます。 私は、層 "ハンガリアン"を持つprototxtファイルを持っています。その層には2つの付加的な最上層がある。box_confidencesbox_assignmentsbox_confidencesは下のように他の層box_lossで使用されていることを次にCaffe Convolutional Neural Networkのレイヤーを初期化する

layer { 
    name: "hungarian" 
    type: "HungarianLoss" 
    bottom: "bbox_concat" 
    bottom: "boxes" 
    bottom: "box_flags" 
    top: "hungarian" 
    top: "box_confidences" 
    top: "box_assignments" 
    loss_weight: 0.03 
    hungarian_loss_param { 
    match_ratio: 0.5 
    permute_matches: true 
    } 
} 

layer{ 
    name: "box_loss" 
    type: "SoftmaxWithLoss" 
    bottom: "score_concat" 
    bottom: "box_confidences" 
    top: "box_loss" 
} 

マイクエリです

(1)私はbox_confidencesbox_assignmentsこれらのセットアップ層には必要ですか?

(2)必要に応じて、このprototxtファイルにレイヤーを設定する方法はありますか?その層は、私はちょうど乱雑にならないいくつかの他のコードのため.....を置くだけでBLOBデータを保持しているし、どのようにこれら2つの層はHungarianLossLayerクラスのメンバ関数で使用されている

void HungarianLossLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top){ 
    ............... 
    ............... 
    ............... 
    Dtype* top_confidences = top[1]->mutable_cpu_data(); 
    ............... 
    ............... 
    ............... 
    for (int i = 0; i < num_pred; ++i) { 
     top_confidences[n * num_pred + i] = 
      assignment[i] < num_gt_[n] ? Dtype(1) : Dtype(0); 
     Dtype* top_assignments = top[2]->mutable_cpu_data(); 
     top_assignments[n * num_pred + i] = 
      assignment[i] < num_gt_[n] ? assignment[i] : Dtype(-1); 
    } 
    ............... 
    ............... 

} 

として見ることができます。

従ってbox_confidencesおよびbox_assignmentsはデータブロブであり、サイズはnum_predです。コードを実行していない間に、num_predの値を知ることは難しいです。

prototxtファイルにこれらの2つのレイヤーを設定するにはどうすればよいでしょうか?

答えて

0

box_confidencesおよびbox_assignmentsは、HungarianLossレイヤによって出力されるフィーチャマップ(または中間アクティベーション)です。このメモリの手動設定は必要ありません。ネットワーク内の次のレイヤー(SoftmaxWithLossなど)のボトムブロブとして安全に提供できます。

関連する問題