論文閱讀:You Only Look Once: Unified, Real-Time Object Detection
Preface
注:這篇今年 CVPR 2016 年的檢測文章 YOLO,我之前寫過這篇文章的解讀。但因為不小心在 Markdown 編輯器中編輯時刪除了。幸好同組的夥伴轉載了我的,我就直接考過來了,重新發一下。以後得給自己的博文留個備份。
abstract
這篇文章提出了一個新的物體檢測的方法:You Only Look Once(YOLO)。
之前的物體檢測方法通常都轉變為了一個分類問題,如 R-CNN、Fast R-CNN 等等。另外,關於對 R-CNN、Fast R-CNN、Faster R-CNN 這一系列方法,知乎上有個特別好的帖子:如何評價rcnn、fast-rcnn和faster-rcnn這一系列方法?
而這篇文章將檢測變為一個 regression problem,YOLO 從輸入的影象,僅僅經過一個 neural network,直接得到 bounding boxes 以及每個 bounding box 所屬類別的概率。正因為整個的檢測過程僅僅有一個網路,所以它可以直接 end-to-end 的優化。
YOLO 結構十分的快,標準的 YOLO 版本每秒可以實時地處理 45 幀影象。一個較小版本:Fast YOLO,可以每秒處理 155 幀影象,它的 mAP(mean Average Precision) 依然可以達到其他實時檢測演算法的兩倍。
同時相比較於其他的 state-of-art detection systems。儘管 YOLO 的定位更容易出錯,這裡的 定位出錯
但是 YOLO 有更少的 false-positive,文章這裡提到了一個詞:background errors,背景誤差。這裡所謂的 背景誤差 即是指 False Positive。在這篇 Paper 的Assigned Reviewer 裡,有 Reviewer 提到了這個問題:
On overall, the paper reads well, even if some terms such as IOU (I guess it’s the abbreviation of intersection over union but it would be better to say it as it’s not a standard abbreviation) or “background errors” (I’m not really sure of the meaning of this expression. Are they False Positive? If yes, it should be better to use False Positive instead).
最後,YOLO 可以學習到物體的更加泛化的特徵,在將 YOLO 用到其他領域的影象時(如 artwork 的影象上),其檢測效果要優於 DPM、R-CNN 這類方法。
Introduction
現在的 detection systems 將物體檢測問題,最後會轉變成一個分類問題。在檢測中,detection systems 採用一個 classifier 去評估一張影象中,各個位置一定區域的 window 或 bounding box 內,是否包含一個物體?包含了哪種物體?
一些 detection systems,如 Deformable Parts Models(DPM),採用的是 sliding window 的方式去檢測。
最近的 R-CNN、Fast R-CNN 則採用的是 region proposals 的方法,先生成一些可能包含待檢測物體的 potential bounding box,再通過一個 classifier 去判斷每個 bounding box 裡是否包含有物體,以及物體所屬類別的 probability 或者 confidence。這種方法的 pipeline 需要經過好幾個獨立的部分,所以檢測速度很慢,也難以去優化,因為每個獨立的部分都需要單獨訓練。
本文將 object detection 的框架設計為一個 regression problem。直接從影象畫素到 bounding box 以及 probabilities。這個 YOLO 系統如圖看了一眼影象就能 predict 是否存在物體,他們在哪個位置,所以也才叫 You Only Look Once。
YOLO 的 idea 十分簡單,如 Figure 1:
將影象輸入單獨的一個 CNN 網路,就會 predict 出 bounding boxes,以及這些 bounding boxes 所屬類別的概率。YOLO 用一整幅影象來訓練,同時可以直接優化 detection performance。
這樣的統一的架構,對比之前如 R-CNN、Fast R-CNN 的 pipeline,有以下幾點好處:
(1)YOLO 檢測系統非常非常的快。受益於將 detection 架構設計成一個 regression problem,以及簡單的 pipeline。在 Titan X 上,不需要經過批處理,標準版本的 YOLO 系統可以每秒處理 45 張影象;YOLO 的極速版本可以處理 150 幀影象。這就意味著 YOLO 可以以小於 25 毫秒延遲的處理速度,實時地處理視訊。同時,YOLO 實時檢測的mean Average Precision(mAP) 是其他實時檢測系統的兩倍。
(2)YOLO 在做 predict 的時候,YOLO 使用的是全域性影象。與 sliding window 和 region proposals 這類方法不同,YOLO 一次“看”一整張影象,所以它可以將物體的整體(contextual)的 class information 以及 appearance information 進行 encoding。目前最快最好的Fast R-CNN ,較容易誤將影象中的 background patches 看成是物體,因為它看的範圍比較小。YOLO 的 background errors 比 Fast R-CNN 少一半多。
(3)YOLO 學到物體更泛化的特徵表示。當在自然場景影象上訓練 YOLO,再在 artwork 影象上去測試 YOLO 時,YOLO 的表現甩 DPM、R-CNN 好幾條街。YOLO 模型更能適應新的 domain。
Unified Detection
YOLO 檢測系統,先將輸入影象分成
每一個 grid cell 預測
本文中的每一個 bounding box 包含了
每一個 grid cell 還要預測
在測試階段,將每個 grid cell 的 conditional class probabilities 與每個 bounding box 的 confidence 相乘:
上面得到每個 bounding box 的具體類別的 confidence score。這樣就把 bounding box 中預測的 class 的 probability,以及 bounding box 與 object 契合的有多好,都進行了 encoding。
將 YOLO 用於 PASCAL VOC 資料集時:
- 本文使用的
S=7 ,即將一張影象分為7×7=49 個 grid cells - 每一個 grid cell 預測
B=2 個 boxes(每個 box 是(x,y,w,h,confidence) ,5 個數值) - 同時,PASCAL 資料集中有
20 個類別,則,上面的C=20
因此,最後的 prediction 是
Network Design
YOLO 仍是 CNN 的經典形式,開始是 convolutional layers 提取特徵,再是 fully connected layers 進行 predict 結果:probabilities 以及 coordinates。
YOLO 的 CNN 結構取自兩篇論文:GoogLeNet、Network in Network. YOLO 有
網路結構,更詳細的如下表所示:
Layers | Parameters |
---|---|
Input Data | Images Size: |
Convolution | num_filters: |
Max Pooling | kernel size: |
Convolution | num_filters: |
Max Pooling | kernel size: |
Convolution | num_filters: |
Convolution | num_filters: |
Convolution | num_filters: |
Convolution | num_filters: |
Max Pooling | kernel size: |
Convolution | num_filters: |
Convolution | num_filters: |
Convolution | num_filters: |
Convolution | num_filters: |
Convolution | num_filters: |
Convolution | num_filters: |