1. Feature Pyramid Networks for Object Detection
Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, Serge Belongie
https://arxiv.org/abs/1612.03144
2. Reference
1. Feature Pyramid Networks for Object Detection
2. Feature Pyramid Networks in PyTorch.
3. CONV2D, PyTorch Document
4. Jonathan Hui, Understanding Feature Pyramid Networks for object detection (FPN), Medium
5. 형준킴 염창동형준킴, 갈아먹는 Object Detection [7] Feature Pyramid Network, Tistory
6. 동산, Feature Pyramid Networks for Object Detection, Naver Blog
7. srk lee, Feature Pyramid Networks for Object Detection 논문읽기, Medium
8. EfficientDet : Scalable and Efficient Object Detection Review
9. Technical Fridays, Autoencoder: Downsampling and Upsampling
10. Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks
3. Abstract
● Feature pyramid은 다양한 스케일의 객체 검출하기 위한 인식 시스템의 기본적인
컴포넌트. 하지만, 계산량과 메모리 문제로 딥러닝을 이용한 객체 인식에서는 널리
이용되지 않았다.
● 본 논문에서는 적은 연산 비용으로 FPN(Feature Pyramid Network)라는 다양한
스케일의 semantic 정보를 포함할 수 있는 feature map을 적은 비용으로 추출할 수
있는 Architecture을 제안. FPN은 향후 발표되는 거의 모든 SOTA 객체 검출 방법에
응용되고 있다.
여기서, semantic feature은 클래스의 정보를, localization feature은 위치 정보를
갖는다.
● FPN은 Object Detector(single model)가 아닌, Feature Detector 이다. 따라서, 기존의
SOTA 모델을 backbone으로 FPN을 적용하면 비슷한 비용으로 성능 향상을 꾀할 수
있다.
● Lateral connection 와 Top-down architecture을 사용.
● Multi-scale pyramidal hierarchy을 사용.
https://arxiv.org/pdf/1612.03144.pdf
4. Introduction
(a) 기존의 객체검출 방법
Hand-engineered features(=노가다)을 이용하여 image pyramids을 구성. 각각의
pyramid에서 feature을 계산한 후 모든 위치에서 객체를 검출하는 방법.
각각의 Layer에서 feature을 추출하여 예측을 수행하기 때문에, 다양한 스케일에서
강인한 성능을 보일 수 있지만, 계산량이 어마무시.. 비현실적.
Wikipedia, Pyramid (image processing), https://en.wikipedia.org/wiki/Pyramid_(image_processing)
https://arxiv.org/pdf/1612.03144.pdf
5. Introduction
Deep Convolutional Networks(ConvNets)
● ConvNets은 scale invariant한 특징이 있지만..한계가 있다.
● 빠른 객체검출을 위해 1개의 scale만을 이용.
● 마지막에 single scale features만 이용. Different depth로 인하여
large scale gap이 발생.
● ConvNet 의 scale 변화에 강인성에는 한계가 있기 때문에,
ImageNet, COCO detection challenges 에서는 featurized image
pyramid 기반으로 multi-scale testing을 이용. 하지만, 학습시 많은
메모리가 요구, Inference time이 증가.
https://arxiv.org/pdf/1612.03144.pdf
6. Introduction
SSD: SIngle Shot Multibox Detector
● Pyramidal feature hierarchy을 이용.
● 서로 다른 scale을 갖는 feature map을 이용하여 검출에 사용.
● 계산한 feature map을 다시 사용하여 higher layer를 계속 생성.
● 이미 계산한 higher-resolution maps을 검출할 때 1회만 사용.
● Convolution 연산을 수행할수록 Semantic feature을 강인하게
추출하지만, image resolution 저하로 작은 객체를 감지하기가 어려움.
이를 해결하기 위해서는, feature map을 1회가 아닌 여러 번 사용하는
것이 좋음.
● -> FPN은 ConvNet’s feature hierarchy의 pyramidal shape을 이용하여
다양한 scale에서 강인한 semantics을 갖을 수 있도록 하는게 목적.
https://arxiv.org/pdf/1612.03144.pdf
NMS(Non-Maximum Suppression)을 이용해서 중복결과 제거
참고: https://dyndy.tistory.com/275
7. Introduction
Feature Pyramid Network, FPN
● ConvNet’s pyramidal feature hierarchy을 향상시키고, 전체 계층에 high-level
semantics을 갖는 feature pyramid를 만드는 것.
● 제안된 네트워크 구조는 bottom-up pathway, a top-down pathway, lateral
connections 을 포함.
● skip connection, top-down, cnn forward에서 생성되는 피라미드 구조를 병합.
forward에서 응축된 semantic 정보를 top-down 과정에서 upsampling하여
해상도를 올리고 forward에서 손실된 지역 정보들을 skip connection으로
보충해서 빠른 속도로 크기 변화에 강한 모델을 생성.
https://arxiv.org/pdf/1612.03144.pdf
12. FPN in PyTorch
def _make_layer(self, block, planes, num_blocks, stride):
strides = [stride] + [1]*(num_blocks-1)
layers = []
for stride in strides:
layers.append(block(self.in_planes, planes, stride))
self.in_planes= planes * block.expansion
return nn.Sequential(*layers)
def _upsample_add(self, x, y):
'''Upsample and add two feature maps.
Args:
x: (Variable) top feature map to be upsampled.
y: (Variable) lateral feature map.
Returns:
(Variable) added feature map.
Note in PyTorch, when input size is odd, the upsampled feature map
with `F.upsample(..., scale_factor=2, mode='nearest')`
maybe not equal to the lateral feature map size.
E.g. original input size: [N,_,15,15] ->
conv2d feature map size: [N,_,8,8] ->
upsampled feature map size: [N,_,16,16]
So we choose bilinear upsample which supports arbitrary output sizes.
'''
_,_,H,W = y.size()
return F.upsample(x, size=(H,W), mode='bilinear') + y
def forward(self, x):
# Bottom-up
c1 = F.relu(self.bn1(self.conv1(x)))
c1 = F.max_pool2d(c1, kernel_size=3, stride=2, padding=1)
c2 = self.layer1(c1)
c3 = self.layer2(c2)
c4 = self.layer3(c3)
c5 = self.layer4(c4)
# Top-down
p5 = self.toplayer(c5)
p4 = self._upsample_add(p5, self.latlayer1(c4))
p3 = self._upsample_add(p4, self.latlayer2(c3))
p2 = self._upsample_add(p3, self.latlayer3(c2))
# Smooth
p4 = self.smooth1(p4)
p3 = self.smooth2(p3)
p2 = self.smooth3(p2)
return p2, p3, p4, p5
def FPN101():
return FPN(Bottleneck, [2,2,2,2])
https://github.com/kuangliu/pytorch-fpn/blob/master/fpn.py
https://kharshit.github.io/blog/2019/02/15/autoencoder-downsampling-and-upsampling
13. Feature Pyramid Networks for RPN
https://medium.com/@jonathan_hui/understanding-feature-pyramid-networks-for-object-detection-fpn-45b227b9106
https://yeomko.tistory.com/44
Faster RCNN에서 RPN 생성방법
1. Pretrained된 VGG을 통과한 feature map을 생성
2. Feature map에 3X3 convolution 적용하여, Intermediate layer
생성
3. Classification와 Bounding box regression을 위해 1X1
Convolution을 적용
14. Feature Pyramid Networks for Fast R-CNN
https://medium.com/@jonathan_hui/understanding-feature-pyramid-networks-for-object-detection-fpn-45b227b9106