Slide 1

Slide 1 text

論⽂解説 High-Resolution Image Synthesis with Latent Diffusion Models Takehiro Matsuda

Slide 2

Slide 2 text

2 Explosion of Diffusion Model https://www.youtube.com/watch?v=Bo3VZCjDhGI This video was created using 36 consecutive phrases that define the visual narrative. Stable Diffusionを「いらすとや」で追加学習する https://tadaoyamaoka.hatenablog.com/entry/2022/09/18/134024 https://memeplex.app/ ⽇本でリリースされたWebサービス (複数のAIモデルを選択可) more and more …

Slide 3

Slide 3 text

3 論⽂情報 • タイトル:High-Resolution Image Synthesis with Latent Diffusion Models • 論⽂: https://arxiv.org/abs/2112.10752 • コード: https://github.com/CompVis/latent-diffusion • 投稿学会: CVPR2022 • 著者: Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, Bj¨orn Ommer • 所属:Ludwig Maximilian University of Munich & IWR, Heidelberg University, Runway ML 選んだ理由: • 最近話題のStable Diffusionの前⾝となる論⽂ • Diffusion Modelの基本原理・構成を知りたい

Slide 4

Slide 4 text

4 Latent Diffusion Model Overview 画像⽣成の⾼い性能を持ちつつ計算量を削減、 様々なタスクに使⽤可能なアーキテクチャを⽰す。

Slide 5

Slide 5 text

5 まず、論⽂“Denoising Diffusion Probabilistic Models”(DPM)をもとに 基本的なDiffusion Modelについて説明

Slide 6

Slide 6 text

6 Basic of Diffusion Model Forward trajectory(diffusion) Reverse trajectory(denoising) 複雑な分布x0 を”徐々に”簡単な分布xT に変換するようなマルコフ過程を定義する 𝑞 𝑥! |𝑥!"# これに対して逆変換になるような過程𝑝$ 𝑥!"# |𝑥! を”学習で得る”ことで簡単な分布XT を 与えることで学習データセットに近い意味あるデータを⽣成できる。 データ⽣成 拡散過程

Slide 7

Slide 7 text

7 Toy Diffusion Model 下記記事をもとに点群表現したピカチュウとイーブイをDiffusion Modelで再現する A Toy Diffusion model you can run on your laptop https://medium.com/mlearning-ai/a-toy-diffusion-model-you-can-run-on-your-laptop- 20e9e5a83462

Slide 8

Slide 8 text

8 Diffusion Model Process 𝛽! が⼗分に⼩さければ、逆過程も同様の関数系で表わせる。 (Kolmogorov equation) ガウス分布で少量のノイズを付与していく。 𝑝 𝑥!"# |𝑥! の平均𝜇$ 𝑥! , 𝑡 、分散Σ$ 𝑥! , 𝑡 を推定する問題 ⽬的関数

Slide 9

Slide 9 text

9 Implementation of DPM 論⽂にはネットワーク構造の記載はないが、GitHubの実装は下のような特徴 • ResNetBlockで構成するU-Net形状 • self-attentionあり • timeはsinusoidal position embedding https://github.com/hojonathanho/diffusion/blob/ master/diffusion_tf/models/unet.py

Slide 10

Slide 10 text

10 Example of frozen for t tが⼤きいところで分岐させるほど⼤域的な表現に変化が表れ、 t=0に近いところほど微細な変化が表れている。

Slide 11

Slide 11 text

11 Example of Interpolation 2枚の画像をサンプリングして、対応するノイズを求めて混合させる ことで、融合した⽣成画像を得られる。 Interpolation images with 500 timesteps of diffusion

Slide 12

Slide 12 text

12 Diffusion Model vs. GAN • GANと⽐べて多様なデータの⽣成に強い • 学習が安定している 短所 • 学習・⽣成に時間がかかる (学習で150-1000個の V100を1⽇使う, 50kのサンプルの⽣成に1つのA100で5⽇かかる [15]) • 潜在変数の次元数が⾼い ⻑所 Diffusion ModelをGANと⽐較して [15]Diffusion models beat gans on image synthesis

Slide 13

Slide 13 text

13 本題となる“High-Resolution Image Synthesis with Latent Diffusion Models”(LDM) について説明

Slide 14

Slide 14 text

14 Latent Diffusion Models basic idea 直接Pixel空間で処理をすることで学習、推論(⽣成)の時間がかかっている。 Autoencoderから得られたlatent spaceでDiffusion modelを適⽤することで、 多様なデータの⽣成を⾼速に⾏うことができるようになった。 また、タスクごとのconditioningとなるネットワークと連結cross-attentionを導 ⼊することで、テキスト(プロンプト)などをもとにした⽣成を可能にした。

Slide 15

Slide 15 text

15 Latent Diffusion Models concept autoencoderで知覚的に等価な低次元の 表現空間latent spaceを得る Diffusion Modelはlatent spaceで学習する。 ⼊⼒データxがEncoderを通してLatent spaceでの 特徴になってからDiffusion Processが⾏われる。

Slide 16

Slide 16 text

16 LDM Architecture 𝐴𝑡𝑡𝑒𝑛𝑡𝑖𝑜𝑛 𝑄, 𝐾, 𝑉 = 𝑆𝑜𝑓𝑡𝑚𝑎𝑥 𝑄𝐾! 𝑑 ・𝑉 Latent space Denoising data Conditioning Encoderを通した値 各Wは学習パラメータ 𝐿𝑎𝑡𝑒𝑛𝑡 𝑆𝑝𝑎𝑐𝑒の𝐷𝑖𝑓𝑓𝑢𝑠𝑖𝑜𝑛 𝑀𝑜𝑑𝑒𝑙の𝜀" とタスクごとの𝜏" を同時に学習される。 ネットワークの役割(phase)を分割 (1つのネットワークとして連結) • Encoder-Decoder • Diffusion model • Conditioning

Slide 17

Slide 17 text

17 Text-to-image training flow image dog, flying disc, beach Transformer

Slide 18

Slide 18 text

18 Unconditional image synthesis sample

Slide 19

Slide 19 text

19 Result Score of unconditional image synthesis

Slide 20

Slide 20 text

20 Text-to-image we train a 1.45B parameter KL-regularized LDM conditioned on language prompts on LAION-400M [78]. We employ the BERT-tokenizer [14] and implement 𝜏" as a transformer [97] to infer a latent code which is mapped into the UNet via (multi-head) cross attention.

Slide 21

Slide 21 text

21 Layout-to-Image Synthesis

Slide 22

Slide 22 text

22 Super Resolution, Inpainting

Slide 23

Slide 23 text

23 Score of super resolution

Slide 24

Slide 24 text

24 Score of inpainting

Slide 25

Slide 25 text

25 Score of super resolution, inpainting Super resolutionとInpaintingの定量評価では従来⼿法を上回っていな いが、⼈間の主観評価では⾼い評価を得た。

Slide 26

Slide 26 text

26 参考資料 Denoising Diffusion Probabilistic Models https://arxiv.org/abs/2006.11239 Improved Precision and Recall Metric for Assessing Generative Models https://arxiv.org/abs/1904.06991 【AI論⽂解説】物理学の知識を背景とした画像⽣成⼿法Part1 Diffusion Probabilistic Models https://www.youtube.com/watch?v=DDGgKt_CyRQ 【AI論⽂解説】物理学の知識を背景とした画像⽣成⼿法Part2 Diffusion Probabilistic Models https://www.youtube.com/watch?v=G4tGMueM6lg 【Deep Learning研修(発展)】データ⽣成・変換のための機械学習 第7回前編「Diffusion models」 https://www.youtube.com/watch?v=10ki2IS55Q4 A Toy Diffusion model you can run on your laptop https://medium.com/mlearning-ai/a-toy-diffusion-model-you-can-run-on-your-laptop-20e9e5a83462 Ultimate Guide to Diffusion Models | ML Coding Series | Denoising Diffusion Probabilistic Models https://www.youtube.com/watch?v=y7J6sSO1k50 Stable Diffusion: High-Resolution Image Synthesis with Latent Diffusion Models | ML Coding Series https://www.youtube.com/watch?v=f6PtJKdey8E