TL;DR
- I read this because.. : aka. CheferCAM. explainable CLIP score์ ๊ด์ฌ์์ด์. ์ด ๋ ผ๋ฌธ ๋ ํฌ์์ colab ์ ๊ณต๊ฐํ๋๋ฐ ํ ํฐ๋ณ visualize ๊ฒฐ๊ณผ๋ฅผ ๋ณผ ์ ์์.
- task : explainability in neural network
- problem : ์ ์ TiBA(https://github.com/long8v/PTIR/issues/158 ) ์์ self-attention ๋ง ๋ง๊ณ multi-modal ํ๊ฒฝ์ co-attention, enocder-decoder ๊ตฌ์กฐ๋ ํ๊ณ ์ถ๋ค
- idea : ์ด์ ์ ouput์ ๋ํ gradient(==LRP)๊ฐ ์๋๋ผ attention map์ ๋ํ gradient๋ฅผ ์ฐ์
- input/output : model // heatmap for text or vision tokens
- architecture : ViT, VisualBERT, LXMERT, DETR
- baseline : rollout, raw attention, Grad-CAM, Partial LRP, TiBA
- evaluation : perturbation(both in image and text token for VisualBERT), weakly, semantic segmentation
- result : ์ ์ ๋๋น ๋์ ์ฑ๋ฅ
- contribution : cross-attention, co-attention ๋ explainableํ๊ฒ ํ work. ICCV oral ์
- etc. : ์์ deep taylor decomposition์ด๋ค ๋ญ๋ค ํผ๊ณคํ๋๋ฐ ๊ทธ๊ฑฐ ๋ฌด์ํ๊ณ ์ด ๋ ผ๋ฌธ๋ง ์ฝ์ผ๋ฉด ์ด๋ก ์ ์ธ ๋ด์ฉ๋ ํ์ ์๊ณ ๊น๋ํ๋ฏ.. ๊ทธ๋ฆฌ๊ณ ์ฑ๋ฅ์ด ์ข์. ๋์ ๋ฐ๋๋ก ์ด๋ก ์ ์ธ ๋ด์ฉ์ด ์์ด์ ์ข ์ฃผ๋จน๊ตฌ๊ตฌ ๋๋. CLIP์ ๊ฒฝ์ฐ ์ต์ข output์ด embedding์ผํ ๋ฐ ๊ทธ๋ผ CLIPscore์ ๋ํ ์๊ฐํ๋ ์๋ ๊ฒ ๊ฐ๊ธฐ๋ ํจ..? colab ์์ธํ ๋ด์ผํ ๋ฏ.
Details
some notation
- i๋ ์ด๋ฏธ์ง ํ ํฐ
- t๋ ํ ์คํธ ํ ํฐ
- $A^{tt}$๋ text๋ผ๋ฆฌ์ self-attenion / $A^{ii}$๋ image๋ผ๋ฆฌ์ self-attenion
- $A^{ti}$๋ multi-modal attention interaction
Relevancy initialization
relevancy map์ ์ด๊ธฐํ / ์
๋ฐ์ดํธ ํ ๊ฑฐ์
SA ์ ์๋ ์๋ก ์ํธ์์ฉ์ด ์์ด์ $R^{ii}$, $R^{tt}$๋ identity. $R^{it}$๋ zero tensor.
Relevancy update rules
attention map A๋ฅผ ๊ฐ์ง๊ณ relavancy๋ฅผ updateํ ๊ฒ์ ์ ์์ ๋ฐ๋ผ head ๊ฐ ํ๊ท ์ ๊ตฌํ๊ณ gradient๋ฅผ ์ฌ์ฉ
์ฌ๊ธฐ์ $\delta A$๋ ์ฐ๋ฆฌ๊ฐ ์๊ฐํํ๊ณ ์ถ์ class t์ ๋ํ output์ธ $y_t$๋ฅผ A๋ก ๋ฏธ๋ถํ ๊ฒ. ํ๊ท ์ ์ทจํ๊ธฐ ์ ์ positive๋ง ๋จ๊ฒจ์ค(clamp)(์ด์ ๋ํ ์ด์ ๋ ๋ฑํ ์๊ณ ์ ์์ ๋ฐ๋ผ์ค)
self attention์ ๋ํ relevance ์ ๋ฐ์ดํธ ๋ฐฉ์์ ์๋์ ๊ฐ์ ์ฌ๊ธฐ์ s๋ query token, q๋ key token์.
์ฌ๊ธฐ์ $R^{xx}$๋ ๋๊ฐ๋ก ๋ถ๋ฆฌํ ์ ์๋๋ฐ ์ฒ์์ ์ด๊ธฐํํ $I$๋ $I$๋ฅผ ๋บ residual์ธ $\hat{R}^{xx}$์.
$\hat{R}^{xx}$๋ gradient๋ฅผ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ ์ซ์๊ฐ ์ ๋์ ์ผ๋ก ์์. ์ด๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด row์ ํฉ์ด 1์ด ๋๋๋ก ์ ๊ทํ ํด์ค.
co-attention / cross-attention์ ๊ฒฝ์ฐ update rule์ ์๋์ ๊ฐ์ด ์ ์ํด์ค
Obtaining classification relevancies
[CLS] ํ ํฐ์ row์ ํด๋นํ๋ relevancy map์ ๋ณด๋ฉด ๋๋๋ฐ text ์ ๋ํ๊ฑธ ๋ณด๋ ค๋ฉด $R^{tt}$์ ์ฒซ๋ฒ์งธ row๋ฅผ ๋ณด๋ฉด ๋๊ณ image์ ๋ํ๊ฑธ ๋ณด๋ ค๋ฉด $R^{ti}$์ ์ฒซ๋ฒ์งธ row๋ฅผ ๋ณด๋ฉด ๋จ
Adaptation to attention type
- ๋ modality์ ํ ํฐ์ด concat๋์ด SA์ ๋ค์ด๊ฐ๋ ๊ฒฝ์ฐ: ์ ์ฒด $R^{(i+t, i+t)}$์์ [cls] token์ ํด๋นํ๋ row($R^{i+t}$)์ Relevancy map์ผ๋ก ๋ง๋ค ์ ์์.
- ๋ modality๊ฐ ๊ฐ๊ฐ SA ๋จผ์ ํ๊ณ ์๋ก CA๋ก ์ ๋ณด๊ตํํ๋ ๊ฒฝ์ฐ(co-attention): ์์์ ์ค๋ช ํ propagation์ ๋ค ํด์ผ ํจ. ์ดํ relavancy map์ ๋ถ๋ฅ ๋ชจ๋ธ์ relevancy๋ฅผ ๋ณด๋ ๊ฒ๊ณผ ๊ฐ์ ๋ฐฉ์์ผ๋ก ๋ณด๋ฉด ๋จ
- encoder-decoder๊ตฌ์กฐ: cross-attention์ด ํ ๋ฐฉํฅ์ผ๋ก๋ง ์ด๋ฃจ์ด์ง๋ฏ๋ก equation 11์ ์ํด๋ ๋จ