論文題目:CornerNet: Detecting Objects as Paired Keypoints
論文位址:https://arxiv.org/pdf/1808.01244.pdf
代碼位址:https://github.com/princeton-vl/CornerNet
代碼目錄層次:

各個目錄含義:
cache:存放訓練好的模型,訓練過程中,每隔5000步存一次模型
config:配置檔案,Cornernet訓練的配置檔案由config/CornerNet.json 和 config.py組成,測試加上db/detections.py
data:存放coco資料集,需要包含coco的PythonAPI
db:資料類别、基礎參數、讀取加載等,運作自己資料集需要修改db/coco.py下的self._cat_ids
external:存放用c寫的NMS和soft_NMS算法
models和nnet:網絡結構代碼
result:村粗 python test.py的結果
test:test.py調用coco.py裡面的kp_detection方法
utils:工具類
test.py和train.py:測試和訓練
第一步,跟着README.md配置運作環境,主要是下載下傳conda_packagelist.txt裡面的包比較費時間;
第二步,制作自己的coco資料集;附上voc轉coco的github源碼:https://github.com/shiyemin/voc2coco
第三步:根據自己資料修改config/CornerNet.json裡面的dataset,batch_size,chunk_sizes,data_dir(看情況),categories,其中batch_size等于chunk_sizes每個資料的和,chunk_sizes裡面每個數表示分到每張網卡的圖檔數,單張網卡一般也就隻能3-5張;
第四步:修改config.py,display:隔幾步輸出一次loss;snapshot:隔幾步存一次模型;batch_size;pretrain:與訓練模型位址;
第五步:運作python train.py
第六步:運作python test.py,debug參數決定是不是生成測試圖檔,即把結果框畫到原圖上并儲存到/result目錄
另外測試時:test/coco.py裡面:kp_detection方法調用了db.evaluate(result_json, cls_ids, image_ids),需要把db/coco.py裡面的:
if self._split == "testdev":
return None
注釋掉,才會輸出結果。
跑我們的資料集,結果并不好:
Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.354
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.602
Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.374
Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.114
Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.383
Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.310
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.398
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.580
Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.601
Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.404
Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.574
Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.606
------------eval result--------------
0.3539904837352708
檢測時間:1幀/s
發現cornertnet對一張圖檔中存在多個相同類别的目标時,容易存在多檢現象,如下圖的框01和02