An Image is Worth 32 Tokens for Reconstruction and Generation

预备知识

核心思想

20250723115513

  1. (Encoding) TiTok 直接将 Image 按照 patch 展开得到 $\mathbf{P}$, 拼接 $K$ 个 learnable tokens $\mathbf{L} \in \mathbb{R}^{K \times D}$ 然后喂入 ViT 中. 其目的是希望这 $K$ 个 learnable tokens 不需要满足所谓的结构性, 逐步通过 Transformer 吸收图片的主要信息:

    $$ \mathbf{Z} \in \mathbb{R}^{K \times D} = Enc(\mathbf{P} \oplus \mathbf{L}). $$
  2. (Quantization) $K$ 个 learnable tokens 最终得到 $K$ 个 latent tokens, 通过一般的向量量化方法即可得到离散编码.

  3. (Decoding) 是在离散编码的基础上, 配合重复的 [mask] tokens, 来重建一个一个 Patch:

    $$ \mathbf{\hat{I}} = Dec(Quant(\mathbf{Z}) \oplus \mathbf{M}), $$

    其中 $\mathbf{M} \in \mathbb{R}^{\frac{H}{f} \times \frac{W}{f} \times D}$.

参考文献

  1. Yu Q., Weber M., Deng X., Shen X., Cremers D. and Chen L. An Image is Worth 32 Tokens for Reconstruction and Generation. NeurIPS, 2024. [PDF] [Code]