Loading [MathJax]/jax/output/CommonHTML/jax.js

상세 컨텐츠

본문 제목

[6주차/백서경/논문리뷰] ViTPose : Simple Vision Transformer Baselines for Human Post Estimation (2022)

2023 Summer Session/CV Team 2

by bravesk 2023. 8. 10. 19:56

본문

해당 글은 노션에서 작성되었습니다. 글과 사진이 깨지는 부분이 있어 자세한 내용은 https://western-hortensia-8e0.notion.site/ViTPose-Simple-Vision-Transformer-Baselines-for-Human-Post-Estimation-2022-05ddcec739774f54b2a453d091102147?pvs=4 를 참고해주세요!

3. ViTPose

1. Patch embedding layer

input : original image

[downsample]

person instance가 있는 image가 주어지면, downsampling ratio인 dd 짜리 patch로 나눠준다.
Rd23 인 patch N(=HdWd)개가 생기므로 전체 patch는
xpRNd23 이 된다.

[flatten]

2D인 각 patch를 flatten하여 dd3 짜리 1D로 만들어준다

xpRN(d23)

[linear projection]

transformer의 input으로 constant한 size의 vector를 받기 때문에, dd3인 각 patch를 C dimension으로 linear projection 한다.

모든 patch에 linear projection 적용해 나온 output xpRNC=RHdWdC 이 F0가 되어 transformer의 input으로 들어간다.

2. Transformer Encoder

input : embedded patches

F0RHdWdC

Multiple-Head Self Attention

Fi+1=Fi+MHSA(LN(Fi))

[Layer Norm]

embedded patch에 layer normalization을 적용

[Linear Layer]

[ Attention Score ]

query와 key 행렬을 내적하여 attention score를 얻는데, 이때 내적하는 것은 query와 key 간의 유사도를 구하는 것으로 해석할 수 있다.

[ Scaling & Softmax ]

attention score 값 간의 차이를 눌러주기 위해 특정 값으로 나눠 scaling해주고, softmax를 적용해서 유사도 값을 0-1 사이로 맞춰준다.

[ Value 행렬과 연산 ]

Query와 key의 유사도인 attention score 행렬과 Value 행렬을 내적하여 최종 Self-Attention Value를 얻는다.

[ Multi-head ]

[ Skip connection ]

layer norm과 multihead self attention을 거친 output을 input에 더해준다.

Fi+1=Fi+MHSA(LN(Fi))

FFN(feed-forward network)

Fi+1=Fi+1+FFN(LN(Fi))

3. Decoder

input : encoder output Fi

FiRHd(=16)Wd(=16)C

우리가 원하는 것은 key joint의 값이므로, encoder output을 joint로 변환해주는 과정이 필요하다. ViTPose는 transformer encoder에 가벼운 decoder를 붙여서 최종 output을 얻는다.

K=Conv11(Deconv(Deconv(Fout)))

[Deconvolution]

input으로 H16W16C의 Fi가 들어오면, decoder에서 deconvolution을 통해 upsampling을 해준다. 한번의 deconvolution에서 2배 upsample이 되어서 두번의 deconv를 거치고 나면 RH4W4C 가 된다.

[Predictor-convolution layer]

찾고자 하는 목표 joint의 개수가 Nk개라고 할 때, 11 convolution을 거쳐H4W4C 에서 H16W16Nk 의 feature map을 얻는다.

 

reference

---

https://www.blossominkyung.com/deeplearning/transformer-mha

관련글 더보기

댓글 영역