“華爲雲杯”2020深圳開放數據應用創新大賽·生活垃圾圖片分類(目標檢測)

代碼和思路分享來自Github:github.com/selous123/yo
調ultralytics/yolov3這個爐子,目前b榜在0.74左右,一階段準確率很高的網絡了。前排大佬可能大部分都是基於MMdet的二階段網絡,Faster-RCNN,Cascade-RCNN等。

MMdetection安裝配置:

初識CV:mmdetection源碼筆記彙總zhuanlan.zhihu.com圖標

目標檢測比賽的簡單tricks:

初識CV:目標檢測比賽中的tricks(已更新更多代碼解析)zhuanlan.zhihu.com圖標


華爲雲比賽鏈接:

華爲雲大賽平臺competition.huaweicloud.com

【賽題背景】

2016年12月,深圳市城市管理和綜合執法局發佈了《深圳市打造“全國最乾淨城市”三年行動計劃(2017-2019)》。按照行動計劃的戰略目標,市、區、街各級城管部門隨即開展行動,逐項認真部署落實。市城市管理和綜合執法局領導直奔基層一線,在全市範圍內開展以查找內街小巷市容環境管理問題和督促問題整改落實爲主要內容的“行走深圳”活動。同時,深入推進“源頭充分減量,前端分流分類,中段乾溼分離,末端綜合利用”的垃圾治理深圳模式,積極開展以打造深圳公廁成爲“乾淨衛生、功能完善、美觀雅緻、羣衆滿意”的靚麗城市名片的“公廁革命”。通過建立環境衛生專項整治、指數測評、責任落實等相關個工作機制,並開展城中村、集貿市場、垃圾收運和城市傢俱等相關潔淨行動,越來越多的居民享受到打造全國最乾淨城市帶來的環境福利。

本賽題以垃圾分類爲主題,利用人工智能技術,對居民生活垃圾圖片進行檢測,找出圖片中有哪些類別的垃圾,並指示出垃圾在圖片中的位置

思路分享:yolov3-pytorch-custom

1. 比賽總結

1.0. Baseline

Network Architecture: yolo-v3 = (darknet53 + FPN + yolo-head)
Training strategy: warm-up, cosine learning rate decay, Multi-scale training, SGD optimizer
Loss: GIOU, iou_net (obj損失以GIOU值爲標記)
Data Argumentation: mosica, flip, hsv_augmentation, random_affine
NMS: Merge-NMS

1.1. 在該數據上 work 的調參技巧

a. spp (spatial pyramid pooling)

b. kmeans algorithm for clustering anchors.

c. stitcher augmentation

d. multi scale testing.

1.2. 該 work 卻不 work 的技巧 —沒盡力調

a. 常用正則化方法,通過分析網絡有很嚴重的過擬合, 但常用的解決過擬合方法並沒有效果如:dropblock, L1&L2 regulization, label smoothing.

b. 小物體檢測mAP的值要明顯低於其他尺度的mAP. 在計算損失時,通過損失加權,增大小物體的損失 (2 - w * h) 沒效果。

c. 某些類的mAP值要普遍比其他類低很多,我們通過mAP的值對樣本採樣進行重加權, 沒效果。通過增加每個類的數據,提升較少。

d. focal loss, 沒提升,網絡很難收斂。

1.3. 目前模型存在的問題

a. 在訓練集上過擬合

b. 某些類 mAP 比較差

c. 小物體 mAP 普遍比較差

d. 數據集中存在遮擋的問題

1.4. 未來想嘗試的技巧

a. 將損失使用傳統 YOLO-v3 的形式實現。在其中添加 IOU-Net 分支

b. TSD (SenseTime 1st place) 在網絡中將框預測和類別預測進行解耦

c. 改進 NMS 和 Testing

2. 代碼說明

2.1. Training

command: 默認模型使用 spatial pyramid pooling 結構和 stitcher 數據增廣。訓練集驗證集分爲9:1的比例。模型以及訓練參數會保存在文件夾 baseline-stitcher (save) 參數下。

python3 train.py cfg cfg/yolov3-spp-44.cfg data data/rubbish.data weights weights/yolov3-sppu.pt batch-size 16 epochs 120 save baseline-stitcher

其他訓練參數可以參考train.py文件中的參數設置部分:

parser.add_argument(’–reg-ratio’, type=float, default=0.0, help=‘reg_ratio for L1&L2 regulization to weights’)
parser.add_argument(’–ssd-aug’, action=‘store_true’, help=‘use ssd augmentation or not’)
parser.add_argument(’–image-weights’, action=‘store_true’, help=‘use image_weights or not’)
parser.add_argument(’–smooth-ratio’, type=float, default=0.0, help=‘label smooth ratio for cls bceloss’)
parser.add_argument(’–lbox-weight’, action=‘store_true’, help=‘weight box loss by size of gt-box or not’)

2.2. Testing

command:

python3 test.py cfg trained_models/baseline-stitcher/yolov3-spp-44.cfg data data/rubbish.data weights trained_models/baseline-stitcher/best.pt batch-size 8

2.3. Submit

command:

python gen_submit_dir.py -m trained_models/baseline-stitcher -s submit/baseline-stitcher

然後將submit/baseline-stitcher下生成的model文件夾上傳到 華爲雲的obs雲儲存中

cd submit/baseline-stitcher
obsutil cp -r -f model/ obs://hellopytorch/baseline-stithcer

最後部署到modelart中,提交即可。

Reference

Crowdhuman人體檢測比賽第一名經驗總結

CVPR 2020丨​商湯TSD目標檢測算法獲得Open Images冠軍

目標檢測比賽中的tricks(已更新更多代碼解析)

Stithcer Augmentation

Imbalance Problems in Object Detection: A Review

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章