Neck이 필요한 이유
1. Object detection task에서는 이미지 내 여러 크기의 객체를 인식해야 함.
그 중에서도 작은 객체를 잡기 위함.
2. low level의 feature는 semantic이 약하므로 상대적으로 semantic이 강한 상위 feature와의 교환이 필요
3. high level의 feature에는 low level의 localization 정보를 교환해줌
Previous methods
1. Featurized image pyramid
- 입력 이미지를 다양한 크기로 resize한 뒤에 CNN에 통과시켜 feature map을 추출
- 다양한 크기의 feature map을 통해 크고 작은 물체들을 검출
- 문제점) resize된 각각의 이미지에 CNN을 적용해야 하므로 많은 연산량과 시간이 소요됨
2. Single feature map
- YOLO 사용 방법
- 하나의 이미지에 CNN을 한 번만 통과하므로 빠름
- 문제점) 최종 크기의 feature map만 사용하므로 작은 물체에 대한 정보가 소실됨
3. Pyramidal feature hierarchy
- SSD에서 사용
- forward propagation으로 계산된 여러 계층에서의 multi-scale feature map을 재사용
(SSD에서는 VGG net의 conv4_3 이후의 feature map 사용)
- 문제점) 고해상도의 feature map을 사용하지 않아 작은 물체에 대한 정보가 소실됨
4. Feature pyramid network
- FPN, Feature pyramid network에서 제안하는 방법
- feature pyramid의 각 level에서 prediction이 독립적으로 수행됨
- topdown pathway와 lateral connection을 사용, 저해상도 feature map을 결합, 모든 scale의 정보를 담고있음
- 하나의 이미지로부터 빠르게 계산되기 때문에 speed, memory, power 손실 없이 이용 가능
5. Similar structure with (4)
- TDM, SharpMask, RedNet, UNet 등의 모델들이 사용하는 방법
- FPN과 비슷하게 top-down을 사용하고, feature map을 연결하기 위해 skip connection 사용
- 마지막 stage에서만 predict
Feature Pyramid Network
bottom-up pathway, top-down pathway, lateral connection으로 이루어져있음.
Bottom-up pathway
- 이미지를 conv하여 두배씩 작아지는 feature map을 추출하는 과정
- 같은 크기의 feature map을 출력하는 layer은 서로 같은 stage
- 각 stage의 마지막 layer의 output feature map을 추출. ( = reference set)
더 깊을수록 더 강력한 feature를 보유하기 때문.
- 각 레이어 stride = [4, 8, 16, 32]
- stage1은 큰 메모리를 차지하기 때문에 피라미드에 포함시키지 않음
Top-down pathway & Lateral connections
- Pyramid level에 있는 feature map을 두배로 upsampling하고 channel수를 동일하게 맞춰주는 과정
- top-down 과정에서 매 layer마다 classifier/regressor가 적용되기 때문에 채널이 전부 같음
- nearest upsampling으로 더 높은 해상도로 만들고, 1x1 conv로 channel수를 256으로 맞춰줌
- upsampling된 feature map과 바로 아래 level의 feature map과 element-wise addition을 함 (= lateral connection)
- 마지막으로 각 합쳐진 map에 3x3 conv를 추가하여 upsampling의 aliasing효과를 줄이는 최종 feature map을 생성
(P2, P3, P4, P5)
Training ResNet + Faster R-CNN + FPN
1. Build feature pyramid by FPN
원본 이미지 입력 - Bottom up pathway -> 원본 이미지의 1/4, 1/8, 1/16, 1/32 크기의 feature map (c2, c3, c4, c5)
(c2, c3, c4, c5) - Top down pathway (upsampling, 1x1 conv로 channel수 256개 맞추기)
-> lateral connection (element-wise addition, 3x3 conv) -> (p2, p3, p4, p5)
- input: single scale image
- output: multi-scale feature map (p2, p3, p4, p5)
2. Class score and bounding box by RPN
(p2, p3, p4, p5) - RPN -> class score, bounding box regressor
-> NMS -> class score가 높은 top 1000개의 region proposal
- input: multi-scale feature map (p2, p3, p4, p5)
- output: 1000 region proposals
3. Max pooling by RoI pooling
RoI projection을 하려면 region proposal을 어떤 scale의 feature map과 매칭시킬지 결정해야 함
논문에서는 위 공식에 따라 region proposal을 k번째 feature map과 매칭함
w, h = RoI의 width, height
k = pyramid level의 index
k0 = target level (논문에서는 k0 = 4)
RoI의 scale이 작을수록 낮은 pyramid level의 (해상도가 높은) feature map에 할당
- input: multi-scale feature map (p2, p3, p4, p5) and 1000 region proposals
- output: fixed sized feature maps
4. Train Faster R-CNN
고정된 크기의 feature map을 fast R-CNN에 입력한 후 전체 네트워크를 multi-task loss function을 통해 학습
https://eehoeskrap.tistory.com/300
[Object Detection] Feature Pyramid Network (FPN)
석사 때는 Object Detection 이라는 분야를 컴퓨터비전 쪽으로 공부했었는데 최근들어 프로젝트를 수행하면서 당연히(?) 딥러닝 쪽으로 공부하고 있다. 원 논문 Lin, Tsung-Yi, et al. "Feature pyramid networks fo
eehoeskrap.tistory.com
https://herbwood.tistory.com/18
FPN 논문(Feature Pyramid Networks for Object Detection) 리뷰
이번 포스팅에서는 FPN 논문(Feature Pyramid Networks for Object Detection)을 리뷰해보도록 하겠습니다. 이미지 내 존재하는 다양한 크기의 객체를 인식하는 것은 Object dection task의 핵심적인 문제입니다. 모
herbwood.tistory.com
https://deep-learning-study.tistory.com/491
[논문 읽기] Feature Pyramid Net, FPN(2017) 리뷰
FPN, Feature Pyramid Networks for Object Detection 논문을 읽어보고, 내용을 정리한 포스팅입니다. Abstract 스케일 불변성(scale-invariance)를 얻기 위해 Feature Pyramids를 사용하는 것은 필수적입니다. 하지만 Feature
deep-learning-study.tistory.com
'Object detection' 카테고리의 다른 글
Ensemble strategies (0) | 2022.11.27 |
---|---|
Shell script command - sed (0) | 2022.11.26 |
Github branch & sh 파일 & argparse 만들기 (0) | 2022.11.21 |
Faster R-CNN (0) | 2022.11.16 |
Pre-course research (0) | 2022.11.11 |