1. 程式人生 > >目標檢測PVAnet原理和程式碼理解

目標檢測PVAnet原理和程式碼理解

1 闡述了原始碼中影響模型的相關引數

(1)train.prototxt裡分別用c++和python層對proposal和rpn裡的box的形狀給了引數。c++的在pvanet/caffe-fast-rcnn/src/caffe/layers/proposal.cpp裡,python的在pvanet/lib/rpn/generate_anchors.py裡。

其中AnchorBox的 base_size=16。經過上述檔案裡的計算,其形狀為:

w = scale * base_size / sqrt(ratio)和h = w *ratio,所以為了提高檢測效果,可以用 scale 和 ratio 按需改box的形狀。    

(2).pvanet/lib/fast_rcnn/config.py

這個檔案很重要啊,訓練網路相關的設定幾乎都在裡面了。

1.1 關鍵引數

1.TRAIN.HAS_RPN = Ture

2.樣本里目標大小要大於 RPN_MIN_SIZE = 16 這個引數,這對應於pvanet 進行roipooling的特徵圖上目標至少有一個畫素大小

3.開啟水平翻轉樣本增強

比如:

#Minibatch size (number of regions of interest [ROIs])

__C.TRAIN.BATCH_SIZE= 128

#Overlap required between a ROI and ground-truth box in order for that ROI to

# beused as a bounding-box regression training example

__C.TRAIN.BBOX_THRESH= 0.5  

#Iterations between snapshots

__C.TRAIN.SNAPSHOT_ITERS= 10000  

# UseRPN to detect objects

__C.TRAIN.HAS_RPN= True

#IOU>= thresh: positive example

__C.TRAIN.RPN_POSITIVE_OVERLAP= 0.7

# IOU< thresh: negative example

__C.TRAIN.RPN_NEGATIVE_OVERLAP= 0.3

......

(3)繪製網路結構圖
pvanet/caffe-fast-rcnn/python/draw_net.py指令碼可以根據prototxt繪製網路結構模型:

python draw_net.pytest.prototxt test.jpg --rankdir TB

2關於pvanet中originalmodel和test model的理解

http://blog.csdn.net/tingyue_/article/details/53545027

1.1 為什麼在fine-tuning過程中用的是test.pt網路架構?

fine-tuning按理說,屬於訓練過程。不採用bn,scale/shift操作勢必會影響權值更新(bn的提出就是為了解決深層網路中權值衰減問題)。這也是,我之前的一大疑問點。
    不過討論之後,終於明朗。雖說fine-tuning是訓練過程,不過由於在fine-tuning之前,已經有過訓練(有bn),網路權值已經在最優權值附近。fine-tuning的作用不過是網路權值的微調。而且有些時候因為所有分類目標卷積層的前幾層特徵都類似,在fine-tuning時,會固定前幾層卷積層網路引數。所以fine-tuning採用不加bn,scale/shift的test.pt網路架構,也就說的通啦。

3 主要講述了對論文的理解

http://www.jianshu.com/p/362f2535adb0

4 論文理解

https://zhuanlan.zhihu.com/p/30173314

5 論文解讀

http://baijiahao.baidu.com/s?id=1577068638139284237&wfr=spider&for=pc

6 論文解讀很詳細並且全面的部落格

http://www.cnblogs.com/xueyuxiaolang/p/5959442.html

6.1

6.2


7 訓練過程中異常

 http://www.caffecn.cn/?/question/982

     pvanet訓練自己的資料集生成壓縮版(comp)的model的方法,採用pvanet訓練自己的資料集(標註格式與voc完全一致),最終想要生成壓縮版(comp)的model,嘗試用命令:./tools/train_net.py --gpu 0 --solvermodels/pvanet/ example_finetune/ solver.prototxt --weightsmodels/pvanet/comp/test.model –iters 100000 --cfg models/pvanet/cfgs/train.yml–imdb voc_2007_trainval進行微調訓練,生成的Model識別效果非常差!即使用models/pvanet/full/test.model微調的model識別的效果也是同樣的差!後來用   ./tools/train_net.py  --gpu 0 --solver models/pvanet/ example_train_384/solver.prototxt--weights models/pvanet/imagenet/original.model --iters 100000  --cfgmodels/pvanet/cfgs/train.yml  --imdb voc_2007_trainval相當於在作者給的imagenet的model上進行微調的Model識別效果還可以,對於小目標的識別沒有作者給的Model效果好,而且應該屬於full版本的實時性一般。