아이공의 AI 공부 도전기

[논문 Summary] FamNet (2021 CVPR) "Learning To Count Everything"

 

     

 

논문 정보

Citation : 2023.02.11 토요일 기준 24회

저자

Viresh Ranjan, Udbhav Sharma, Thu Nguyen, Minh Hoai

 

논문 링크

Official

https://openaccess.thecvf.com/content/CVPR2021/papers/Ranjan_Learning_To_Count_Everything_CVPR_2021_paper.pdf

 

Arxiv

https://arxiv.org/abs/2104.08391

 

Learning To Count Everything

Existing works on visual counting primarily focus on one specific category at a time, such as people, animals, and cells. In this paper, we are interested in counting everything, that is to count objects from any category given only a few annotated instanc

arxiv.org

 

 

논문 Summary

Abstract

 

 

0. 설명 시작 전 Overview

 

이 논문의 기여도는 크게 2가지

1) few-shot regression task를 통해 모든 물체에 대한 counting이 가능하게 했다.

2) few-shot counting task에 맞는 147 종류 6000장 이상의 이미지를 보유한 데이터 세트를 제안한다.

 

1. Introduction

 

다양한 종류 물체가 많이 있을 때 세는 것이 어려운 이유 2가지

1) 현존하는 대다수의 counting은 label이 달린 supervised regression task로 density map을 뽑기 위한 모델을 활용

2) 한 종류에 국한 되지 않는 데이터 세트가 존재하지 않음

 

 

few shot setting

- input : 이미지 한 장과 이미지 속 관심있는 물체의 소수의 examples(bounding box된 부분)

- output : 관심있는 물체의 counting 개수

 

Contribution 1

 

few-shot coutning task를 위해 Few Shot Adaptation and Matching Network(FamNet)을 제안

본 네트워크에는 2개의 key point 존재

1) feature extraction module

2) density prediction module

 

+ test time 시 새로운 few-shot adaptation scheme를 통해 성능 향상

 

Contribution 2

 

오직 few-shot counting만을 위한 147 종류로 된 6000장 이상의 데이터 세트을 제안

Few-Shot Counting-147 (FSC-147)

 

 

2. Related work

 

1) annotate된 특정 type의 object ex) 사람, 차, 동물 등을 기반으로 단일 물체의 counting

2) 제안한 아이디어와 비슷한 개념을 지닌 모델 : GMN

3) few-shot detection

few-shot counting과 few-shot detection은 2가지가 다름

- few-shot counting은 dot annoation이 필요하지만 few-shot detection은 bounding box annotation이 필요

- few-shot detection은 occlusion에 영향을 받지만 few-shot counting은 density estimation을 사용하기 때문에 상대적으로 occlusion에 강건함. 이는 density estimation 방법이 crowd counting이나 cell counting과 같은 다양한 도메인에 적용했을 때 강건했음을 경험적으로 알 수 있음.

 

4) few-shot classification : MAML(Model Agnostic Meta Learning) - 2차 미분을 사용하기 때문에 계산 비용이 높음

 

3. Few-Shot Adaptation & Matching Network

 

3.1 Network architecture

 

 

Input : 3 채널 이미지 한 장과 count하고자 하는 bounding box exemplar

Output : Height와 Width만 존재하는 예측한 Density map

해당 output인 density map을 sum하여 count 진행

 

FamNet은 크게 2 모듈이 존재

1) multi-scale feature extraction module

2) density prediction module

 

<Feature Extraction Module>

다양한 category의 object를 다루기 때문에 ImageNet-pretrained Resnet-50을 backbone으로 첫 4개의 block 사용함.

이때 이 block들은 훈련 단계에서는 freeze

 

<ROI Pool>

Resnet-50 3~4번째 block으로부터 ROI pooling을 수행함으로써 exemplar를 위한 multi-scale feature를 획득

 

<Featuer Correlation Layer>

이후 exemplar feature와 이미지 feature 간의 correlation map을 사용하여 density prediction module이 agnostic하게 함.

object들이 각기 다른 크기를 가지는 것에 대해

 

 <Density prediction Module>

 5개의 conv + 3개의 upsampling layer로 구성

 마지막 conv는 1x1으로 input 이미지 사이즈와 맞춤.

 

 

3.2 Training

 

본 모델의 학습에 있어 다른 방법들과 달리 exemplar는 bounding box 기반의 annotation이 되어있다. 이는 기존 dot annotation으로 loss를 구성하고 15x15의 고정된 size의 Gaussian window로 convolve하여 density map을 구성하는 것과는 다르다.

 

사용하는 데이터 세트 속 각 객체의 사이즈는 variation이 크다. (다양하다)

target density map을 만들기 위해서 adaptive window size에 따라 Gaussian smoothing을 해야한다.

각 dot은 물체의 중앙을 의미하기에 이를 기반으로 nearest neighbor한 dot들 간의 길이를 계산하여 평균을 낸다. 이 평균 distance를 Gaussian window size로 사용하여 density map을 구성한다.

Gaussian std는 window size의 1/4

 

Ground Truth Density Map과 Predicted Density map 간의 MSE Loss 사용

Adam Optimizer

learining rate $10^{-5}$

batch size 1

이미지 height를 384로 고정하고 width는 원본 이미지 비율에 맞게 조절

 

 

 

3.3 Test-time adaptation

 

Key Idea

 

추정한 count 정확도를 향상시키기 위해서 exemplar의 bounding box를 단순히 exemplar의 appearance feature를 추출하기 위한 방법으로만 사용할 것이 아니라 location을 활용하는 것이 더 좋을 것 같다

이를 location 정보를 활용하기 위해 2가지 loss를 제안

 

$b \in B$ : Bounding box

$Z_b$ : location b에 존재하는 density map Z로부터 crop

 

 

1) Min-Count loss

 

 $Z_b$ 내 density value의 합은 최소 1이다.

그러나 overlap과 같은 경우에 따라 1 이상이 될 수 있다.

 

Min-Count loss를 통해 제약 위반의 정량화할 수 있게 한다.

가령 1보다 크면 0이 반환 -> Loss는 없음

1보다 작으면 숫자 반환 -> Loss 존재

 

 

2) Perturbation Loss

 

 

exemplar bounding box에 의해 제공되는  위치 정보를 활용하는 이 loss는 correlation filter 기반의 tracking 알고리즘의 성공에서 영감을 받음.

 

bounding box의 정확한 위치일 때 높은 response

perturbed location일 때 낮은 response

 

predicted density map $Z$는 exemplar와 이미지 간의 correlation response map

exemplar 위치 주변은 gaussian 처럼 보임.

이를 활용한 차이를 Loss로 줌.

 

 

 

Combined Adaptation Loss

 

 

test time 각 test 이미지 별로 100번의 gradient descent step을 수행

learning rate $10^{-7}$

$\lambda_1, \lambda_2$ : $10^{-9}, 10^{-4}$

 

training loss는 test 에서는 사용하지 않음

loss와 gradient는 비슷한 크기를 유지하는 것이 중요

 

adaptation loss는 오직 test time에서만 사용 

 

 

4. FSC-147 Dataset

COCO dataset의 이미지들은 물체의 pose나 appearance에 큰 variation이 있거나 작은 숫자가 존재하기 때문에 의도한 application 조건을 만족하지 못한다.

이에 147가지의 object category를 포함하는 6135장의 이미지들로 구성된 본 데이터 세트를 제안한다.

물체는 7개에서 3731개까지 존재하며 이미지 마다 평균 56개의 물체가 존재한다.

 

데이터 세트 filtering

 

1) High image quality : 고품질 이미지

2) Large enough object count : 최소 7개 이상의 물체 개수

3) Appearance similarity : 비슷한 pose, texture, appearance를 가진 물체들을 모음

4) No severe occlusion

 

 

Train / validation / test = 3659장 /  1286장 / 1190장

평균 height, width = 774, 938

평균 56개 object 존재

총 343,818개의 물체 존재

 

예시

 

5. Experiments

 

MAE, RMSE를 활용한 Evaluation Metrics 사용

 

비교했을 때 제안한 모델 FamNet이 낮은 MAE, RMSE를 보임

 COCO dataset에서도 마찬가지의 결과를 보임

 

exemplar를 증가시켰을 때 성능이 향상됨

 

 Ablation Study를 진행했을 때 다 사용했을 때가 가장 좋음

 

 

CARPK dataset을 활용해서 훈련시킨 후 성능을 평가했을 때 제안 모델의 성능이 좋음

다만 few-shot으로만 했을 때는 성능이 우월하지는 않음

 

 

 

Predicted density map과 실제 count 개수

중간 정도 잘 alignment되었을 때는 성능이 괜찮게 나오나 정형화되지 않았을 때는 성능이 좋지 않을 수 있음.

특히 4째 행은 제대로 count하지 못함.

background와 객체 간의 유사도를 구분하지 못해서 생긴 일이라 판단. 

 

 

test time adaptation을 했을 때 성능이 잘 나옴을 확인할 수 있었음.

 

Reference

공식 Github

https://github.com/cvlab-stonybrook/LearningToCountEverything

 

GitHub - cvlab-stonybrook/LearningToCountEverything

Contribute to cvlab-stonybrook/LearningToCountEverything development by creating an account on GitHub.

github.com

 

 

공유하기

facebook twitter kakaoTalk kakaostory naver band
loading