Sota를 달성한 object detection network들은 객체 위치를 예측하기 위해 region proposal 알고리즘에 의존한다. SPPnet과 Fast R-CNN 같은 발전으로 네트워크 실행시간을 단축시킬 수 있었지만, region proposal을 계산에서 병목현상이 발생하였다.
따라서, 전체 이미지의 detection 네트워크와 전체 이미지의 convolution 특징을 공유하여 비용이 거의 들지 않는 RPN이라는 네트워크를 제안한다.
RPN은 각 위치에서 객체의 경계와 객체성 점수를 동시에 예측하는 fully convolution convoultion 네트워크이며, 높은 퀄리티의 region proposal을 생성하기 위해서 end-to-end로 학습된다.
따라서, RPN은 Fast R-CNN의 convolution 특징과 RPN의 특징을 공유함으로써 single 네트워크로 병합함으로, 최근에 인기있는 attention 매커니즘을 통해 통합된 네트워크가 바라보아야할 위치를 지시한다.
기존의 R-CNN과 Fast R-CNN의 region proposal은 Selective search를 사용하여 CPU상에서 생성되었기 때문에 속도가 느렸다. 이를 GPU에서 활용하기 위해 RPN을 사용하여 region proposal을 추출하였고, 하나의 네트워크로 연결하여 end-to-end로 학습할 수 있는 Faster R-CNN이 등장하였다.
Fast R-CNN은 같은 region 기반 detector에서 나온 convolutional feature map들이 바로 region proposal 생성에 사용될 수 있다는 것을 관찰 했으며, 이를 통해 end-to-end로 학습할 수 있었다고 한다.
RPN은 큰 범위와 측면 비율을 통해 region proposal을 효율적으로 예측하도록 설계되었다. 피라미드 형태의 새로운 앵커 박스를 도입하여 multi-scale과 측면 비율들을 참조하여 사용하였고 이는 훈련 및 테스트에서 우수한 성능을 냈다고 한다.
Faster R-CNN의 구조는 아래 그림과 같이 RPN + Fast R-CNN의 구조와 같다
input
Feature Etraction
RPN
Classification layer
이후 NMS방법에 따라 class 별 상위 N개의 region proposal를 추출
Regressor layer
ROI pooling
Loss
Faster R-CNN 학습 과정
pre-train된 VGG16 모델에 원본 이미지를 넣어 feature map생성 (sub sampling ratio 1/16)
원본이미지에서 sub sampling ration만큼의 grid cell이 생성되고 각 위치에서 anchor box를 생성 (Anchor generation layer)
RPN을 학습시키기 위한 anchor sample 구성(anchor target layer)
IOU ≥ 0.7 : Positive(1)
IOU ≤ 0.3 : Negative(-1)
0.3 < IOU < 0.7 : 0
Positive,Negative 비율이 1:1이 되도록 Sampling ( positive 256, negative 256)
만약 Positive의 개수가 부족하다면 Zero padding을 하거나 IoU 값이 가장 높은 box를 positive로 사용
input : 50 x 50 x 9 anchor boxes, ground truth boxes
process : select anchor samples
output : positive/negative anchor boxes
RPN에 VGG16에서 나온 feature map을 input으로 넣고 3x3 conv를 거친 후 각각의 1x1 conv를 통해 class score와 bounding box regressor를 추출
RPN에서 얻은 class score, bounding box regressor를 NMS 방법으로 class별 상위 N개의 region proposal 추출(Proposal layer)
Fast R-CNN을 학습하기 위한 region proposal Sampling(Proposal target layer)
추출한 상위 N개의 region proposal과 GT의 IOU를 계산.
IOU ≥ 0.5 : Positive
0.1 ≤ IOU < 0.5 : Negative
input : 상위 N개의 region proposal, ground truth boxes
Process : labeling region proposal
output : positive/negative region proposals
맨 처음 원본이미지를 VGG16 모델에 넣어 나온 feature map과 6을 통해 얻은 region proposals들을 사용하여 ROI pooling 수행(ROI pooling)
Loss에 따른 Fast R-CNN 학습 (Fast R-CNN)
입력받은 feature map을 fc layer에 입력해서 4096 크기의 feature vector를 얻는다
feature vector를 Classifier와 bbox regressor에 입력
출력된 결과를 loss를 이용해 학습
input : 7 x 7 x 512 feature map
Process : feature extraction, Classifier, regressior, train Fast R-CNN by loss
output : loss
장점 : selective search 대신 RPN을 제안하여 GPU에서 수행되게 하여 속도를 빠르게함
단점 : Real time Detector가 되기엔 역부족?