728x90
반응형
SMALL
📃 논문 https://arxiv.org/pdf/1506.01497.pdf
- 기존 Fast R-CNN 모델은 여전히 Selective search 알고리즘을 통해 region proposals 추출하기 때문에 학습 및 detection 속도를 향상시키는데 한계가 있음
- Selective search 알고리즘
- 이미지 픽셀의 컬러, 무늬, 크기, 형태에 따라 유사한 Region을 계층적 그룹핑 방법으로 계산하는 방식
- 객체가 들어있을 만한 여러개의 바운딩박스를 만들고 반복적으로 Selective Search 알고리즘을 이용하여 최적의 바운딩 박스를 선정해 Region Proposal
Preview
- 후보 영역 추출을 위해 사용되는 Selective search 알고리즘은 CPU 상에서 동작하고 이로 인해 네트워크에서 병목현상이 발생
- Faster R-CNN은 이러한 문제를 해결하고자 후보 영역 추출 작업을 수행하는 네트워크인 Region Proposal Network(이하 RPN)를 도입
- RPN은 region proposals를 보다 정교하게 추출하기 위해 다양한 크기와 가로세로비를 가지는 bounding box인 Anchor box를 도입
- RPN에서 region proposals를 추출하고 이를 Fast R-CNN 네트워크에 전달하여 객체의 class와 위치를 예측
- 모델의 전체 과정이 GPU 상에서 동작하여 병목 현상이 발생하지 않으며, end-to-end로 네트워크를 학습시키는 것이 가능해짐
- 원본 이미지를 pre-trained된 CNN 모델에 입력하여 feature map을 얻음
- feature map은 RPN에 전달되어 적절한 region proposals을 산출
- region proposals와 1) 과정에서 얻은 feature map을 통해 RoI pooling을 수행하여 고정된 크기의 feature map을 얻음
- Fast R-CNN 모델에 고정된 크기의 feature map을 입력하여 Classification과 Bounding box regression을 수행
Main Ideas
1. Anchor Box
- 원본 이미지를 일정 간격의 grid로 나눠 각 grid cell을 bounding box로 간주하여 feature map에 encode하는 Dense Sampling 방식을 사용
- sub-sampling ratio를 기준으로 grid를 나누게 됨
- 고정된 크기(fixed size)의 bounding box를 사용할 경우, 다양한 크기의 객체를 포착하지 못할 수 있음
- 지정한 위치에 사전에 정의한 서로 다른 크기(scale)와 가로세로비(aspect ratio)를 가지는 bounding box인 Anchor box를 생성하여 다양한 크기의 객체를 포착하는 방법을 제시
- aspect ratio는 width, height의 길이의 비율
- anchor box는 원본 이미지의 각 grid cell의 중심을 기준으로 생성
- 본 이미지에서 sub-sampling ratio를 기준으로 anchor box를 생성하는 기준점인 anchor를 고정 → 이 anchor를 기준으로 사전에 정의한 anchor box 9개를 생성
- 기존에 고정된 크기의 bounding box를 사용할 때보다 훨씬 많은 bounding box를 생성하며, 보다 다양한 크기의 객체를 포착하는 것이 가능
2. RPN(Region Proposal Network)
- 원본 이미지에서 anchor box를 생성하면 수많은 region proposals가 만들어짐
- RPN은 region proposals에 대하여 class score를 매기고, bounding box coefficient를 출력
- 원본 이미지를 pre-trained된 VGG 모델에 입력하여 feature map을 얻음
- 위에서 얻은 feature map에 대하여 3x3 conv 연산을 적용
- 이때 feature map의 크기가 유지될 수 있도록 padding을 추가
- class score를 매기기 위해서 feature map에 대하여 1x1 conv 연산을 적용
- 이 때 출력하는 feature map의 channel 수가 2x9가 되도록 설정
- RPN에서는 후보 영역이 어떤 class에 해당하는지까지 구체적인 분류를 하지 않고 객체가 포함되어 있는지 여부만을 분류
- bounding box regressor를 얻기 위해 feature map에 대하여 1x1 conv 연산을 적용
- 출력하는 feature map의 channel 수가 4(bounding box regressor)x9(anchor box 9개)가 되도록 설정
- class score에 따라 상위 N개의 region proposals만을 추출하고, Non maximum suppression을 적용하여 최적의 region proposals만을 Fast R-CNN에 전달
3. Multi-task Loss
- RPN과 Fast R-CNN을 학습시키기 위해 Multi-task loss를 사용
- RPN에서는 객체의 존재 여부만을 분류하는 반면, Fast R-CNN에서는 배경을 포함한 class를 분류
Training Faster R-CNN
1) feature extraction by pre-trained VGG16
- sub-sampling ratio는 1/16
💡 Input : 800x800x3 sized image
Process : feature extraction by pre-trained VGG16
Output : 50x50x512 sized feature map
2) Generate Anchors by Anchor generation layer
- region proposals를 추출하기에 앞서 원본 이미지에 대하여 anchor box를 생성하는 과정을 거침
- 원본 이미지의 크기에 sub-sampling ratio를 곱한만큼의 grid cell이 생성 되며, 이를 기준으로 각 grid cell마다 9개의 anchor box를 생성
💡 Input : 800x800x3 sized image
Process : generate anchors
Output : 22500(=50x50x9) anchor boxes
3) Class scores and Bounding box regressor by RPN
- RPN은 VGG16으로부터 feature map을 입력받아 anchor에 대한 class score, bounding box regressor를 반환
💡 Input : 50x50x512 sized feature map
Process : Region proposal by RPN
Output : class scores(50x50x2x9 sized feature map) and bounding box regressors(50x50x4x9 sized feature map)
4) Region proposal by Proposal layer
- Proposal layer에서는 2)번 과정에서 생성된 anchor boxes와 RPN에서 반환한 class scores와 bounding box regressor를 사용하여 region proposals를 추출하는 작업을 수
- Non maximum suppression을 적용하여 부적절한 객체를 제거한 후, class score 상위 N개의 anchor box를 추출
- regression coefficients를 anchor box에 적용하여 anchor box가 객체의 위치를 더 잘 detect하도록 조정
💡 Input
- 22500(=50x50x9) anchor boxes
- class scores(50x50x2x9 sized feature map) and bounding box regressors(50x50x4x9 sized feature map)
Process : region proposal by proposal layer
Output : top-N ranked region proposals
5) Select anchors for training RPN by Anchor target layer
- Anchor target layer의 목표는 RPN이 학습하는데 사용할 수 있는 anchor를 선택
- 2)번 과정에서 생성한 anchor box 중에서 원본 이미지의 경계를 벗어나지 않는 anchor box를 선택후 positive/negative 데이터를 sampling
- positive sample은 객체가 존재하는 foreground
- negative sample은 객체가 존재하지 않는 background
- 전체 anchor box 중에서 다음과 같은 조건을 만족하는 sample을 positive sample로 선정
- ground truth box와 가장 큰 IoU 값을 가지는 경우
- ground truth box와의 IoU 값이 0.7 이상인 경우
💡 Input : anchor boxes, ground truth boxes
Process : select anchors for training RPN
Output : positive/negative samples with target regression coefficients(타겟회귀계수)
6) Select anchors for training Fast R-CNN by Proposal Target layer
- region proposals와 ground truth box와의 IoU를 계산하여 0.5 이상일 경우 positive, 0.1~0.5 사이일 경우 negative sample로 라벨링됨
💡 Input : top-N ranked region proposals, ground truth boxes
Process : select region proposals for training Faster R-CNN
Output : positive/negative samples with target regression coefficients
7) Max pooling by RoI pooling
- 원본 이미지를 VGG16 모델에 입력하여 얻은 feature map과 6) 과정을 통해 얻은 sample을 사용하여 RoI pooling을 수행 → 고정된 크기의 feature map이 출력
💡 Input
- 50x50x512 sized feature map
- positive/negative samples with target regression coefficients
Process : RoI pooling
Output : 7x7x512 sized feature map
8) Train Fast R-CNN by Multi-task loss
- Fast R-CNN 모델의 동작 순서와 동일
💡 Input : 7x7x512 sized feature map
Process
- feature extraction by fc layer
- classification by Classifier
- bounding box regression by Bounding box regressor
- Train Fast R-CNN by Multi-task loss
Output : loss(Loss loss + Smooth L1 loss)
🤔 Alternating Training(번갈아 가면서 학습)
- 논문에서는 Faster R-CNN 모델을 학습시키기 위해 RPN과 Fast R-CNN을 번갈아가며 학습시키는 Alternating Training 방법을 사용
Detection
- 실제 detection(=inference) 시에는 Anchor target layer와 Proposal target layer는 사용되지 않음
- 두 layer 모두 네트워크를 학습시키기 위한 데이터셋을 구성하는데 사용되기 때문
- Fast R-CNN은 Proposal layer에서 추출한 region proposals를 활용하여 detection을 수행
- 최종적으로 얻은 predicted box에 Non maximum suppression을 적용하여 최적의 bounding box만을 결과로 출력
- Faster R-CNN 모델은 PASCAL VOC 2012 데이터셋에서 mAP 값이 75.9를 보이면서 Fast R-CNN 모델보다 더 높은 detection 성능을 보임
- Fast R-CNN 모델이 0.5fps(frame pre second)인 반면 Faster R-CNN 모델은 17fps를 보이며, 이미지 처리 속도 면에서 발전한 결과
- feature extraction에 사용하는 convolutional layer의 feature를 공유하면서 end-to-end로 학습시키는 것이 가능해짐
논문의 저자는 detection 속도에 대해 "near real-time"이라고 언급하며, 실시간 detection에는 한계가 있음
728x90
반응형
LIST
'AI Paper Review' 카테고리의 다른 글
[논문 리뷰] Computer Vision - Retina(Focal Loss for Dense Object Detection) (0) | 2023.09.09 |
---|---|
[논문 리뷰] Computer Vision - UNet (0) | 2023.09.08 |
[논문 리뷰] Computer Vision - Mask R-CNN (0) | 2023.09.08 |
[논문 리뷰] Computer Vision - YOLO(You Only Look Once:Unified, Real-Time Object Detection) (0) | 2023.09.07 |
[논문 리뷰] Computer Vision - Fast R-CNN (0) | 2023.09.06 |