faster-rcnn 結構雜談

faster-rcnn結構圖: (只截取了最難理解的部分)python

這個網絡看似很複雜,可是理解了其中關鍵的層,就基本能夠掌握這個結構了。要看源碼!!要看源碼!!要看源碼 !!重要的事情說三遍。c++

關鍵的層:網絡

 數據輸入層:#表示模塊存放的路徑 faster-rcnn/lib/roi_data_layer/layer.pyide

layer {
name: 'input-data'
type: 'Python'
top: 'data'
top: 'im_info'
top: 'gt_boxes'
python_param {
module: 'roi_data_layer.layer' #表示模塊存放的路徑 faster-rcnn/lib/roi_data_layer/layer.py
layer: 'RoIDataLayer'
param_str: "'num_classes': 81"
}
}
這層好像什麼都作,將數據直接複製到下一層  

rpn-data層:文件存放位置 faster-rcnn/lib/rpn/anchor_target_layer.py
layer {
name: 'rpn-data'
type: 'Python'
bottom: 'rpn_cls_score'
bottom: 'gt_boxes'
bottom: 'im_info'
bottom: 'data'
top: 'rpn_labels'
top: 'rpn_bbox_targets'
top: 'rpn_bbox_inside_weights'
top: 'rpn_bbox_outside_weights'
python_param {
module: 'rpn.anchor_target_layer' #文件存放位置 faster-rcnn/lib/rpn/anchor_target_layer.py
layer: 'AnchorTargetLayer'
param_str: "'feat_stride': 16 \n'scales': !!python/tuple [4, 8, 16, 32]"
}
}
這一層很重要:  
  生成 anchor
  處理 gt_boxes等其餘工做 具體沒仔細看
proposal層:#文件存放路徑 faster-rcnn/rpn/proposal_layer.py
layer {
name: 'proposal'
type: 'Python'
bottom: 'rpn_cls_prob_reshape'
bottom: 'rpn_bbox_pred'
bottom: 'im_info'
top: 'rpn_rois'
python_param {
module: 'rpn.proposal_layer'
layer: 'ProposalLayer'
param_str: "'feat_stride': 16 \n'scales': !!python/tuple [4, 8, 16, 32]"
}
}
這層應該就是生成proposal了

rpn_loss_bbox層:文件存放位置比較特殊:
  這個是使用c++代碼實現的
    頭文件:/faster-rcnn/caffe-faster-rcnn/include/caffe/fast_rcnn_layers.hpp
    實現: faster-rcnn/caffe-faster-rcnn/src/caffe/smooth_L1_loss_layer.cpp smooth_L1_loss_layer.cu
layer {  name: "rpn_loss_bbox"  type: "SmoothL1Loss"  bottom: "rpn_bbox_pred"  bottom: "rpn_bbox_targets"  bottom: 'rpn_bbox_inside_weights'  bottom: 'rpn_bbox_outside_weights'  top: "rpn_loss_bbox"  loss_weight: 1  smooth_l1_loss_param { sigma: 3.0 }}
相關文章
相關標籤/搜索