Try   HackMD

R-CNN: Region-based Convolutional Neural Networks

tags: Research

當我們不僅希望知道該圖片的物件類別,並且可以準確定位該物件的位置,此時物件偵測則變成一件非常重要的事情。其應用非常廣泛,在生態研究中,可以快速定位出想要觀察到的物種,對於生態學家們可以更容易取得研究所需的資料。在自駕車的開發中,知道前方的物件為何,對於電腦判斷車的行走方向以及行駛速度都有著非常大的影響。因此 R-CNN (Region-based Convolutional Neural Networks) 的產生,對於該領域的研究有著開創的影響。


Chapter 1: Introduction

過往許多的電腦視覺領域中,將CNN的運算在最尾端加上一個分類器,用以對該影像中無論是物件或是背景的分類。但是當我們希望去定位該物件的位置時,我們不僅僅需要知道他的位置,還需要匡出它的大小。這即是這篇文章所希望處理的問題,並因此提出 R-CNN。R-CNN 的大致運作流程如下圖:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

1. 輸入資料
2. 生成候選區域: 利用 Selective Search 對一張圖像生成大約 2000 個候選區域
3. 特徵擷取: 利用 CNN 對每個候選區域進行特徵擷取,擷取出一個 4096 維的特徵向量。
4. 分類判斷: 對於每個候選區域所截取的特徵,送入每一類的 SVM 分類器,判斷是否為該類別的物件
5. 位置修正: 利用 regression 修正位置的精確度

Chapter 2:Object detection with R-CNN

2.1 Input and Preprocess Image Data

這部分主要討論上面提到的第一步與第二步。透過 selective search 找到 2000 個候選區域,再對候選區域進行 resize 為 227

× 227,以滿足後面 CNN 的輸入。文章中提到 resize 最好的方式,以單純對候選區域加上
padding=16
(padding是直接取該區域周圍的影像,如果補的部分不夠,則利用該區域平均的RGB數值對應的顏色補上)。最後將 padding 完的影像進行 resize。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2.2 CNN and Classification on Region Proposals

2.2.1 CNN Feature Extraction

本文使用 AlexNet,因為跟 VGG16 比運算量少了將近 7 倍。並利用此模型最後 p5 層 9216 維度的輸出接出來的 fully connected layer 設定為 4096,使得照片經過CNN模型擷取出來的特徵為 4096 維。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2.2.2 Model Training

在文章中提到由於可用來訓練模型的標註圖片 (同時標注圖片類別以及位置) 數量較少,因此遷移學習在此就相當重要,將在較大的圖片分類資料集 (ILSVRC2012) 訓練的預訓練模型,利用小量的圖片物件標注資料 (PASCAL) 進行微調。這樣的遷移學習對於訓練的效果有顯著的提升。

透過前一步取出 4096 維的特徵後,輸入 SVM 後,針對每一個希望訓練的類別進行訓練。在此訓練的資料中,標註為正樣本的為與正確標注的資料位置相交 IoU 最大且大於 0.6 的候選區域。

在物件位置的部分,由於經常候選區域不夠精確,仍然需要修正。在此使用 ridge regression (

λ=10000),輸入為 4096 維的特徵數據後,輸出為框的中間 xy 位置以及該框的 width 和 height。

2.2.3 Model Inference

圖像讀入後,透過 selective search 選出候選區域,將 resize 過後的候選區域輸入 CNN 中,特徵選取完,輸入已經訓練好的 SVM 模型,對候選區域們進行評分,通過 IOU 進行 NMS,得到該類的 bounding-box。


參考文章:

  1. Girshick, R., Donahue, J., Darrell, T., & Malik, J. (2014). Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition (pp. 580-587). Link
  2. Krizhevsky, A., Sutskever, I., & Hinton, G. E. (2012). Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25. Link
  3. Uijlings, J. R., Van De Sande, K. E., Gevers, T., & Smeulders, A. W. (2013). Selective search for object recognition. International journal of computer vision, 104(2), 154-171. Link
  4. RCNN- 将CNN引入目标检测的开山之作
  5. R-CNN论文详解