diff --git a/.buildinfo b/.buildinfo
old mode 100644
new mode 100755
index 4008a6ed..4151526e
--- a/.buildinfo
+++ b/.buildinfo
@@ -1,4 +1,4 @@
-# Sphinx build info version 1
-# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: 88136a339ad9f24f63bebc3ce6bec1df
-tags: 645f666f9bcd5a90fca523b33c5a78b7
+# Sphinx build info version 1
+# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
+config: 6c7bebb5f823a0444f206cc24f8717b0
+tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/_images/0-side-view-photo-of-17-year-old-girl-in-a-japanese-school.gif b/_images/0-side-view-photo-of-17-year-old-girl-in-a-japanese-school.gif
old mode 100644
new mode 100755
diff --git a/_images/0-side-view-photo-of-17-year-old-girl-in-a-japanese-school_edit.gif b/_images/0-side-view-photo-of-17-year-old-girl-in-a-japanese-school_edit.gif
old mode 100644
new mode 100755
diff --git a/_images/0-side-view-photo-of-man-in-black-padded-jumper,-hallway,.gif b/_images/0-side-view-photo-of-man-in-black-padded-jumper,-hallway,.gif
old mode 100644
new mode 100755
diff --git a/_images/0-side-view-photo-of-man-in-black-padded-jumper,-hallway,_edit.gif b/_images/0-side-view-photo-of-man-in-black-padded-jumper,-hallway,_edit.gif
old mode 100644
new mode 100755
diff --git a/_images/00.png b/_images/00.png
old mode 100644
new mode 100755
diff --git a/_images/001.png b/_images/001.png
old mode 100644
new mode 100755
diff --git a/_images/01.png b/_images/01.png
old mode 100644
new mode 100755
diff --git a/_images/010.png b/_images/010.png
old mode 100644
new mode 100755
diff --git a/_images/011.png b/_images/011.png
old mode 100644
new mode 100755
diff --git a/_images/012.png b/_images/012.png
old mode 100644
new mode 100755
diff --git a/_images/013.png b/_images/013.png
new file mode 100755
index 00000000..fa74e292
Binary files /dev/null and b/_images/013.png differ
diff --git a/_images/02.png b/_images/02.png
old mode 100644
new mode 100755
diff --git a/_images/021.png b/_images/021.png
old mode 100644
new mode 100755
diff --git a/_images/022.png b/_images/022.png
new file mode 100755
index 00000000..aee92089
Binary files /dev/null and b/_images/022.png differ
diff --git a/_images/03.png b/_images/03.png
old mode 100644
new mode 100755
diff --git a/_images/031.png b/_images/031.png
old mode 100644
new mode 100755
diff --git a/_images/032.png b/_images/032.png
new file mode 100755
index 00000000..846a1e6e
Binary files /dev/null and b/_images/032.png differ
diff --git a/_images/04.png b/_images/04.png
old mode 100644
new mode 100755
diff --git a/_images/041.png b/_images/041.png
old mode 100644
new mode 100755
diff --git a/_images/042.png b/_images/042.png
new file mode 100755
index 00000000..3ef7267c
Binary files /dev/null and b/_images/042.png differ
diff --git a/_images/05.png b/_images/05.png
old mode 100644
new mode 100755
diff --git a/_images/051.png b/_images/051.png
old mode 100644
new mode 100755
diff --git a/_images/052.png b/_images/052.png
new file mode 100755
index 00000000..71781f20
Binary files /dev/null and b/_images/052.png differ
diff --git a/_images/06.png b/_images/06.png
old mode 100644
new mode 100755
diff --git a/_images/061.png b/_images/061.png
old mode 100644
new mode 100755
diff --git a/_images/062.png b/_images/062.png
new file mode 100755
index 00000000..491b65fb
Binary files /dev/null and b/_images/062.png differ
diff --git a/_images/07.png b/_images/07.png
old mode 100644
new mode 100755
diff --git a/_images/071.png b/_images/071.png
old mode 100644
new mode 100755
diff --git a/_images/072.png b/_images/072.png
new file mode 100755
index 00000000..a7baf832
Binary files /dev/null and b/_images/072.png differ
diff --git a/_images/08.png b/_images/08.png
old mode 100644
new mode 100755
diff --git a/_images/081.png b/_images/081.png
old mode 100644
new mode 100755
diff --git a/_images/09.png b/_images/09.png
old mode 100644
new mode 100755
diff --git a/_images/091.png b/_images/091.png
old mode 100644
new mode 100755
diff --git a/_images/1.png b/_images/1.png
old mode 100644
new mode 100755
diff --git a/_images/10.png b/_images/10.png
old mode 100644
new mode 100755
diff --git a/_images/101.png b/_images/101.png
old mode 100644
new mode 100755
diff --git a/_images/102.png b/_images/102.png
old mode 100644
new mode 100755
diff --git a/_images/11.png b/_images/11.png
old mode 100644
new mode 100755
diff --git a/_images/12.png b/_images/12.png
old mode 100644
new mode 100755
diff --git a/_images/13.png b/_images/13.png
old mode 100644
new mode 100755
diff --git a/_images/14.png b/_images/14.png
old mode 100644
new mode 100755
diff --git a/_images/2.png b/_images/2.png
old mode 100644
new mode 100755
diff --git a/_images/21.png b/_images/21.png
old mode 100644
new mode 100755
diff --git a/_images/3.png b/_images/3.png
old mode 100644
new mode 100755
diff --git a/_images/31.png b/_images/31.png
old mode 100644
new mode 100755
diff --git a/_images/4.png b/_images/4.png
old mode 100644
new mode 100755
diff --git a/_images/41.png b/_images/41.png
old mode 100644
new mode 100755
diff --git a/_images/4classes.png b/_images/4classes.png
old mode 100644
new mode 100755
diff --git a/_images/5.png b/_images/5.png
old mode 100644
new mode 100755
diff --git a/_images/51.png b/_images/51.png
old mode 100644
new mode 100755
diff --git a/_images/54544834-db8a-49f3-9ac7-d4a530724fd8.png b/_images/54544834-db8a-49f3-9ac7-d4a530724fd8.png
old mode 100644
new mode 100755
diff --git a/_images/6-image-of-a-man-with-blonde-hair-and-blue-eyes,.gif b/_images/6-image-of-a-man-with-blonde-hair-and-blue-eyes,.gif
old mode 100644
new mode 100755
diff --git a/_images/6-image-of-a-man-with-blonde-hair-and-blue-eyes,_edit.gif b/_images/6-image-of-a-man-with-blonde-hair-and-blue-eyes,_edit.gif
old mode 100644
new mode 100755
diff --git a/_images/6.png b/_images/6.png
old mode 100644
new mode 100755
diff --git a/_images/61.png b/_images/61.png
old mode 100644
new mode 100755
diff --git a/_images/7.png b/_images/7.png
old mode 100644
new mode 100755
diff --git a/_images/71.png b/_images/71.png
old mode 100644
new mode 100755
diff --git a/_images/8.png b/_images/8.png
old mode 100644
new mode 100755
diff --git a/_images/81.png b/_images/81.png
old mode 100644
new mode 100755
diff --git a/_images/9.png b/_images/9.png
old mode 100644
new mode 100755
diff --git a/_images/91.png b/_images/91.png
old mode 100644
new mode 100755
diff --git a/_images/ConceptLab01.png b/_images/ConceptLab01.png
old mode 100644
new mode 100755
diff --git a/_images/ConceptLab02.png b/_images/ConceptLab02.png
old mode 100644
new mode 100755
diff --git a/_images/ConceptLab03.png b/_images/ConceptLab03.png
old mode 100644
new mode 100755
diff --git a/_images/ConceptLab04.png b/_images/ConceptLab04.png
old mode 100644
new mode 100755
diff --git a/_images/ConceptLab05.png b/_images/ConceptLab05.png
old mode 100644
new mode 100755
diff --git a/_images/ConceptLab06.png b/_images/ConceptLab06.png
old mode 100644
new mode 100755
diff --git a/_images/ConceptLab07.png b/_images/ConceptLab07.png
old mode 100644
new mode 100755
diff --git a/_images/ConceptLab08.png b/_images/ConceptLab08.png
old mode 100644
new mode 100755
diff --git a/_images/ConceptLab09.png b/_images/ConceptLab09.png
old mode 100644
new mode 100755
diff --git a/_images/ConceptLab10.png b/_images/ConceptLab10.png
old mode 100644
new mode 100755
diff --git a/_images/ConceptLab11.png b/_images/ConceptLab11.png
old mode 100644
new mode 100755
diff --git a/_images/ConceptLab12.png b/_images/ConceptLab12.png
old mode 100644
new mode 100755
diff --git a/_images/DDIM_pic.png b/_images/DDIM_pic.png
old mode 100644
new mode 100755
diff --git a/_images/DDPM_eq.png b/_images/DDPM_eq.png
old mode 100644
new mode 100755
diff --git a/_images/DreamFusioneq1.png b/_images/DreamFusioneq1.png
new file mode 100755
index 00000000..afe4bee4
Binary files /dev/null and b/_images/DreamFusioneq1.png differ
diff --git a/_images/DreamFusioneq2.png b/_images/DreamFusioneq2.png
new file mode 100755
index 00000000..0caba869
Binary files /dev/null and b/_images/DreamFusioneq2.png differ
diff --git a/_images/DreamFusioneq3.png b/_images/DreamFusioneq3.png
new file mode 100755
index 00000000..7d15bca4
Binary files /dev/null and b/_images/DreamFusioneq3.png differ
diff --git a/_images/DreamFusioneq4.png b/_images/DreamFusioneq4.png
new file mode 100755
index 00000000..fcebcfb6
Binary files /dev/null and b/_images/DreamFusioneq4.png differ
diff --git a/_images/DreamFusioneq5.png b/_images/DreamFusioneq5.png
new file mode 100755
index 00000000..01fe5e55
Binary files /dev/null and b/_images/DreamFusioneq5.png differ
diff --git a/_images/DreamFusioneq6.png b/_images/DreamFusioneq6.png
new file mode 100755
index 00000000..a3d92133
Binary files /dev/null and b/_images/DreamFusioneq6.png differ
diff --git a/_images/DreamFusioneq7.png b/_images/DreamFusioneq7.png
new file mode 100755
index 00000000..95d56959
Binary files /dev/null and b/_images/DreamFusioneq7.png differ
diff --git a/_images/DreamFusionfig1.png b/_images/DreamFusionfig1.png
new file mode 100755
index 00000000..d88e444e
Binary files /dev/null and b/_images/DreamFusionfig1.png differ
diff --git a/_images/DreamFusionfig2.png b/_images/DreamFusionfig2.png
new file mode 100755
index 00000000..a262a273
Binary files /dev/null and b/_images/DreamFusionfig2.png differ
diff --git a/_images/DreamFusionfig3.png b/_images/DreamFusionfig3.png
new file mode 100755
index 00000000..ef007c10
Binary files /dev/null and b/_images/DreamFusionfig3.png differ
diff --git a/_images/DreamFusionfig3_fig.png b/_images/DreamFusionfig3_fig.png
new file mode 100755
index 00000000..2f785a7b
Binary files /dev/null and b/_images/DreamFusionfig3_fig.png differ
diff --git a/_images/DreamFusionfig4.png b/_images/DreamFusionfig4.png
new file mode 100755
index 00000000..a5df160f
Binary files /dev/null and b/_images/DreamFusionfig4.png differ
diff --git a/_images/DreamFusionfig5.png b/_images/DreamFusionfig5.png
new file mode 100755
index 00000000..455ee23c
Binary files /dev/null and b/_images/DreamFusionfig5.png differ
diff --git a/_images/DreamFusionfig8.png b/_images/DreamFusionfig8.png
new file mode 100755
index 00000000..fb18e48b
Binary files /dev/null and b/_images/DreamFusionfig8.png differ
diff --git a/_images/DreamFusiontable1.png b/_images/DreamFusiontable1.png
new file mode 100755
index 00000000..36c3833e
Binary files /dev/null and b/_images/DreamFusiontable1.png differ
diff --git a/_images/IMG_4859.png b/_images/IMG_4859.png
old mode 100644
new mode 100755
diff --git a/_images/IMG_4860.png b/_images/IMG_4860.png
old mode 100644
new mode 100755
diff --git a/_images/IMG_4861.png b/_images/IMG_4861.png
old mode 100644
new mode 100755
diff --git a/_images/IMG_4869.png b/_images/IMG_4869.png
old mode 100644
new mode 100755
diff --git a/_images/IMG_4872.png b/_images/IMG_4872.png
old mode 100644
new mode 100755
diff --git a/_images/IMG_4874.png b/_images/IMG_4874.png
old mode 100644
new mode 100755
diff --git a/_images/IMG_4891.png b/_images/IMG_4891.png
old mode 100644
new mode 100755
diff --git a/_images/LCM-LoRA_1.png b/_images/LCM-LoRA_1.png
old mode 100644
new mode 100755
diff --git a/_images/LCM-LoRA_10.png b/_images/LCM-LoRA_10.png
old mode 100644
new mode 100755
diff --git a/_images/LCM-LoRA_2.png b/_images/LCM-LoRA_2.png
old mode 100644
new mode 100755
diff --git a/_images/LCM-LoRA_3.png b/_images/LCM-LoRA_3.png
old mode 100644
new mode 100755
diff --git a/_images/LCM-LoRA_4.png b/_images/LCM-LoRA_4.png
old mode 100644
new mode 100755
diff --git a/_images/LCM-LoRA_5.png b/_images/LCM-LoRA_5.png
old mode 100644
new mode 100755
diff --git a/_images/LCM-LoRA_6.png b/_images/LCM-LoRA_6.png
old mode 100644
new mode 100755
diff --git a/_images/LCM-LoRA_7.png b/_images/LCM-LoRA_7.png
old mode 100644
new mode 100755
diff --git a/_images/LCM-LoRA_8.png b/_images/LCM-LoRA_8.png
old mode 100644
new mode 100755
diff --git a/_images/LCM-LoRA_9.png b/_images/LCM-LoRA_9.png
old mode 100644
new mode 100755
diff --git a/_images/LMD1.png b/_images/LMD1.png
old mode 100644
new mode 100755
diff --git a/_images/LMD10.png b/_images/LMD10.png
old mode 100644
new mode 100755
diff --git a/_images/LMD11.png b/_images/LMD11.png
old mode 100644
new mode 100755
diff --git a/_images/LMD12.png b/_images/LMD12.png
old mode 100644
new mode 100755
diff --git a/_images/LMD13.png b/_images/LMD13.png
old mode 100644
new mode 100755
diff --git a/_images/LMD14.png b/_images/LMD14.png
old mode 100644
new mode 100755
diff --git a/_images/LMD2.png b/_images/LMD2.png
old mode 100644
new mode 100755
diff --git a/_images/LMD3.png b/_images/LMD3.png
old mode 100644
new mode 100755
diff --git a/_images/LMD4.png b/_images/LMD4.png
old mode 100644
new mode 100755
diff --git a/_images/LMD6.png b/_images/LMD6.png
old mode 100644
new mode 100755
diff --git a/_images/LMD7.png b/_images/LMD7.png
old mode 100644
new mode 100755
diff --git a/_images/LMD8.png b/_images/LMD8.png
old mode 100644
new mode 100755
diff --git a/_images/LMD9.png b/_images/LMD9.png
old mode 100644
new mode 100755
diff --git a/_images/Latent_Space.png b/_images/Latent_Space.png
old mode 100644
new mode 100755
diff --git a/_images/MimicBrush_1.png b/_images/MimicBrush_1.png
old mode 100644
new mode 100755
diff --git a/_images/MimicBrush_2.png b/_images/MimicBrush_2.png
old mode 100644
new mode 100755
diff --git a/_images/MimicBrush_3.png b/_images/MimicBrush_3.png
old mode 100644
new mode 100755
diff --git a/_images/MimicBrush_4.png b/_images/MimicBrush_4.png
old mode 100644
new mode 100755
diff --git a/_images/MimicBrush_5.png b/_images/MimicBrush_5.png
old mode 100644
new mode 100755
diff --git a/_images/MimicBrush_6.png b/_images/MimicBrush_6.png
old mode 100644
new mode 100755
diff --git a/_images/styleGAN_fig1.png b/_images/StyleGAN_fig1.png
old mode 100644
new mode 100755
similarity index 100%
rename from _images/styleGAN_fig1.png
rename to _images/StyleGAN_fig1.png
diff --git a/_images/styleGAN_fig2.png b/_images/StyleGAN_fig2.png
old mode 100644
new mode 100755
similarity index 100%
rename from _images/styleGAN_fig2.png
rename to _images/StyleGAN_fig2.png
diff --git a/_images/styleGAN_fig3.png b/_images/StyleGAN_fig3.png
old mode 100644
new mode 100755
similarity index 100%
rename from _images/styleGAN_fig3.png
rename to _images/StyleGAN_fig3.png
diff --git a/_images/styleGAN_fig4.png b/_images/StyleGAN_fig4.png
old mode 100644
new mode 100755
similarity index 100%
rename from _images/styleGAN_fig4.png
rename to _images/StyleGAN_fig4.png
diff --git a/_images/styleGAN_fig5.png b/_images/StyleGAN_fig5.png
old mode 100644
new mode 100755
similarity index 100%
rename from _images/styleGAN_fig5.png
rename to _images/StyleGAN_fig5.png
diff --git a/_images/styleGAN_fig6.png b/_images/StyleGAN_fig6.png
old mode 100644
new mode 100755
similarity index 100%
rename from _images/styleGAN_fig6.png
rename to _images/StyleGAN_fig6.png
diff --git a/_images/styleGAN_fig7.png b/_images/StyleGAN_fig7.png
old mode 100644
new mode 100755
similarity index 100%
rename from _images/styleGAN_fig7.png
rename to _images/StyleGAN_fig7.png
diff --git a/_images/styleGAN_fig8.png b/_images/StyleGAN_fig8.png
old mode 100644
new mode 100755
similarity index 100%
rename from _images/styleGAN_fig8.png
rename to _images/StyleGAN_fig8.png
diff --git a/_images/TEXTUALINVERSION.png b/_images/TEXTUALINVERSION.png
old mode 100644
new mode 100755
diff --git a/_images/Unet.png b/_images/Unet.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled.png b/_images/Untitled.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled1.png b/_images/Untitled1.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled10.png b/_images/Untitled10.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled11.png b/_images/Untitled11.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled111.png b/_images/Untitled111.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled2.png b/_images/Untitled2.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled3.png b/_images/Untitled3.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled31.png b/_images/Untitled31.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled4.png b/_images/Untitled4.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled5.png b/_images/Untitled5.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled6.png b/_images/Untitled6.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled7.png b/_images/Untitled7.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled8.png b/_images/Untitled8.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled9.png b/_images/Untitled9.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled_1.png b/_images/Untitled_1.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled_10.png b/_images/Untitled_10.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled_12.png b/_images/Untitled_12.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled_2.png b/_images/Untitled_2.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled_3.png b/_images/Untitled_3.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled_4.png b/_images/Untitled_4.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled_6.png b/_images/Untitled_6.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled_8.png b/_images/Untitled_8.png
old mode 100644
new mode 100755
diff --git a/_images/Untitled_9.png b/_images/Untitled_9.png
old mode 100644
new mode 100755
diff --git a/_images/adagn_table.png b/_images/adagn_table.png
old mode 100644
new mode 100755
diff --git a/_images/algorithm.png b/_images/algorithm.png
old mode 100644
new mode 100755
diff --git a/_images/animation.png b/_images/animation.png
old mode 100644
new mode 100755
diff --git a/_images/architect_1.png b/_images/architect_1.png
old mode 100644
new mode 100755
diff --git a/_images/architect_2.png b/_images/architect_2.png
old mode 100644
new mode 100755
diff --git a/_images/architect_3.png b/_images/architect_3.png
old mode 100644
new mode 100755
diff --git a/_images/architecture.png b/_images/architecture.png
old mode 100644
new mode 100755
diff --git a/_images/architecture2.png b/_images/architecture2.png
old mode 100644
new mode 100755
diff --git a/_images/attention3d.png b/_images/attention3d.png
old mode 100644
new mode 100755
diff --git a/_images/block.png b/_images/block.png
old mode 100644
new mode 100755
diff --git a/_images/cascaded_dms.png b/_images/cascaded_dms.png
old mode 100644
new mode 100755
diff --git a/_images/cat.png b/_images/cat.png
old mode 100644
new mode 100755
diff --git a/_images/class_eq1.png b/_images/class_eq1.png
old mode 100644
new mode 100755
diff --git a/_images/class_eq2.png b/_images/class_eq2.png
old mode 100644
new mode 100755
diff --git a/_images/classifier_guidance_vis.png b/_images/classifier_guidance_vis.png
old mode 100644
new mode 100755
diff --git a/_images/clip.png b/_images/clip.png
old mode 100644
new mode 100755
diff --git a/_images/cm3leon_result.png b/_images/cm3leon_result.png
old mode 100644
new mode 100755
diff --git a/_images/coin3d_01.png b/_images/coin3d_01.png
new file mode 100755
index 00000000..653c2a2c
Binary files /dev/null and b/_images/coin3d_01.png differ
diff --git a/_images/coin3d_02.png b/_images/coin3d_02.png
new file mode 100755
index 00000000..bde73044
Binary files /dev/null and b/_images/coin3d_02.png differ
diff --git a/_images/coin3d_03.png b/_images/coin3d_03.png
new file mode 100755
index 00000000..f027cfb2
Binary files /dev/null and b/_images/coin3d_03.png differ
diff --git a/_images/coin3d_04.png b/_images/coin3d_04.png
new file mode 100755
index 00000000..9903cf9b
Binary files /dev/null and b/_images/coin3d_04.png differ
diff --git a/_images/coin3d_05.png b/_images/coin3d_05.png
new file mode 100755
index 00000000..d9821f98
Binary files /dev/null and b/_images/coin3d_05.png differ
diff --git a/_images/coin3d_06.png b/_images/coin3d_06.png
new file mode 100755
index 00000000..4783f237
Binary files /dev/null and b/_images/coin3d_06.png differ
diff --git a/_images/coin3d_07.png b/_images/coin3d_07.png
new file mode 100755
index 00000000..8171360f
Binary files /dev/null and b/_images/coin3d_07.png differ
diff --git a/_images/coin3d_08.png b/_images/coin3d_08.png
new file mode 100755
index 00000000..84c784eb
Binary files /dev/null and b/_images/coin3d_08.png differ
diff --git a/_images/coin3d_09.png b/_images/coin3d_09.png
new file mode 100755
index 00000000..9d566f60
Binary files /dev/null and b/_images/coin3d_09.png differ
diff --git a/_images/coin3d_10.png b/_images/coin3d_10.png
new file mode 100755
index 00000000..f323194a
Binary files /dev/null and b/_images/coin3d_10.png differ
diff --git a/_images/coin3d_11.png b/_images/coin3d_11.png
new file mode 100755
index 00000000..66e99d95
Binary files /dev/null and b/_images/coin3d_11.png differ
diff --git a/_images/compare_table.png b/_images/compare_table.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_01.png b/_images/consistency_models_01.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_02.png b/_images/consistency_models_02.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_03.png b/_images/consistency_models_03.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_04.png b/_images/consistency_models_04.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_05.png b/_images/consistency_models_05.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_06.png b/_images/consistency_models_06.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_07.png b/_images/consistency_models_07.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_08.png b/_images/consistency_models_08.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_09.png b/_images/consistency_models_09.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_10.png b/_images/consistency_models_10.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_11.png b/_images/consistency_models_11.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_12.png b/_images/consistency_models_12.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_13.png b/_images/consistency_models_13.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_14.png b/_images/consistency_models_14.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_15.png b/_images/consistency_models_15.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_16.png b/_images/consistency_models_16.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_17.png b/_images/consistency_models_17.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_18.png b/_images/consistency_models_18.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_19.png b/_images/consistency_models_19.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_20.png b/_images/consistency_models_20.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_21.png b/_images/consistency_models_21.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_22.png b/_images/consistency_models_22.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_23.png b/_images/consistency_models_23.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_24.png b/_images/consistency_models_24.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_25.png b/_images/consistency_models_25.png
old mode 100644
new mode 100755
diff --git a/_images/consistency_models_26.png b/_images/consistency_models_26.png
old mode 100644
new mode 100755
diff --git a/_images/conv3d.png b/_images/conv3d.png
old mode 100644
new mode 100755
diff --git a/_images/ddim_pipe.png b/_images/ddim_pipe.png
old mode 100644
new mode 100755
diff --git a/_images/ddpm_pipeline.png b/_images/ddpm_pipeline.png
old mode 100644
new mode 100755
diff --git a/_images/deer.png b/_images/deer.png
old mode 100644
new mode 100755
diff --git a/_images/dreambooth_01.png b/_images/dreambooth_01.png
old mode 100644
new mode 100755
diff --git a/_images/dreambooth_02.png b/_images/dreambooth_02.png
old mode 100644
new mode 100755
diff --git a/_images/dreambooth_03.png b/_images/dreambooth_03.png
old mode 100644
new mode 100755
diff --git a/_images/dreambooth_04.png b/_images/dreambooth_04.png
old mode 100644
new mode 100755
diff --git a/_images/dreambooth_05.png b/_images/dreambooth_05.png
old mode 100644
new mode 100755
diff --git a/_images/dreambooth_06.png b/_images/dreambooth_06.png
old mode 100644
new mode 100755
diff --git a/_images/dreambooth_07.png b/_images/dreambooth_07.png
old mode 100644
new mode 100755
diff --git a/_images/dreambooth_08.png b/_images/dreambooth_08.png
old mode 100644
new mode 100755
diff --git a/_images/dreambooth_09.png b/_images/dreambooth_09.png
old mode 100644
new mode 100755
diff --git a/_images/dreamfieldfig1.png b/_images/dreamfieldfig1.png
new file mode 100755
index 00000000..b12ed913
Binary files /dev/null and b/_images/dreamfieldfig1.png differ
diff --git a/_images/eDiff-I.png b/_images/eDiff-I.png
old mode 100644
new mode 100755
diff --git a/_images/efficiency.png b/_images/efficiency.png
old mode 100644
new mode 100755
diff --git a/_images/einops.png b/_images/einops.png
old mode 100644
new mode 100755
diff --git a/_images/eq_1.png b/_images/eq_1.png
old mode 100644
new mode 100755
diff --git a/_images/eq_11.png b/_images/eq_11.png
old mode 100644
new mode 100755
diff --git a/_images/evalution.png b/_images/evalution.png
old mode 100644
new mode 100755
diff --git a/_images/exp-1.png b/_images/exp-1.png
old mode 100644
new mode 100755
diff --git a/_images/exp-2.png b/_images/exp-2.png
old mode 100644
new mode 100755
diff --git a/_images/exp-3.png b/_images/exp-3.png
old mode 100644
new mode 100755
diff --git a/_images/exp-4.png b/_images/exp-4.png
old mode 100644
new mode 100755
diff --git a/_images/exp-5.png b/_images/exp-5.png
old mode 100644
new mode 100755
diff --git a/_images/experiment1.png b/_images/experiment1.png
old mode 100644
new mode 100755
diff --git a/_images/f637f3b3-9e18-48d1-946a-784830e6fb98.png b/_images/f637f3b3-9e18-48d1-946a-784830e6fb98.png
new file mode 100755
index 00000000..0e1c70c6
Binary files /dev/null and b/_images/f637f3b3-9e18-48d1-946a-784830e6fb98.png differ
diff --git a/_images/fed6a1b4-97d4-4ef7-ab99-6ac3cef4bbbd.png b/_images/fed6a1b4-97d4-4ef7-ab99-6ac3cef4bbbd.png
new file mode 100755
index 00000000..8232902b
Binary files /dev/null and b/_images/fed6a1b4-97d4-4ef7-ab99-6ac3cef4bbbd.png differ
diff --git a/_images/fig1.png b/_images/fig1.png
old mode 100644
new mode 100755
diff --git a/_images/fig10.png b/_images/fig10.png
old mode 100644
new mode 100755
diff --git a/_images/fig11.png b/_images/fig11.png
old mode 100644
new mode 100755
diff --git a/_images/fig12.png b/_images/fig12.png
old mode 100644
new mode 100755
diff --git a/_images/fig13.png b/_images/fig13.png
old mode 100644
new mode 100755
diff --git a/_images/fig14.png b/_images/fig14.png
old mode 100644
new mode 100755
diff --git a/_images/fig15.png b/_images/fig15.png
old mode 100644
new mode 100755
diff --git a/_images/fig16.png b/_images/fig16.png
old mode 100644
new mode 100755
diff --git a/_images/fig2.png b/_images/fig2.png
old mode 100644
new mode 100755
diff --git a/_images/fig21.png b/_images/fig21.png
old mode 100644
new mode 100755
diff --git a/_images/fig3.png b/_images/fig3.png
old mode 100644
new mode 100755
diff --git a/_images/fig4.gif b/_images/fig4.gif
old mode 100644
new mode 100755
diff --git a/_images/fig4.png b/_images/fig4.png
old mode 100644
new mode 100755
diff --git a/_images/fig5.png b/_images/fig5.png
old mode 100644
new mode 100755
diff --git a/_images/fig51.png b/_images/fig51.png
old mode 100644
new mode 100755
diff --git a/_images/fig6.png b/_images/fig6.png
old mode 100644
new mode 100755
diff --git a/_images/fig61.png b/_images/fig61.png
old mode 100644
new mode 100755
diff --git a/_images/fig7.png b/_images/fig7.png
old mode 100644
new mode 100755
diff --git a/_images/fig71.png b/_images/fig71.png
old mode 100644
new mode 100755
diff --git a/_images/fig8.png b/_images/fig8.png
old mode 100644
new mode 100755
diff --git a/_images/fig81.png b/_images/fig81.png
old mode 100644
new mode 100755
diff --git a/_images/fig9.png b/_images/fig9.png
old mode 100644
new mode 100755
diff --git a/_images/fig91.png b/_images/fig91.png
old mode 100644
new mode 100755
diff --git a/_images/fig_1.png b/_images/fig_1.png
old mode 100644
new mode 100755
diff --git a/_images/fig_10.png b/_images/fig_10.png
old mode 100644
new mode 100755
diff --git a/_images/fig_11.png b/_images/fig_11.png
old mode 100644
new mode 100755
diff --git a/_images/fig_13.png b/_images/fig_13.png
old mode 100644
new mode 100755
diff --git a/_images/fig_131.png b/_images/fig_131.png
old mode 100644
new mode 100755
diff --git a/_images/fig_2.png b/_images/fig_2.png
old mode 100644
new mode 100755
diff --git a/_images/fig_3.png b/_images/fig_3.png
old mode 100644
new mode 100755
diff --git a/_images/fig_31.png b/_images/fig_31.png
old mode 100644
new mode 100755
diff --git a/_images/fig_4.png b/_images/fig_4.png
old mode 100644
new mode 100755
diff --git a/_images/fig_41.png b/_images/fig_41.png
old mode 100644
new mode 100755
diff --git a/_images/fig_5.png b/_images/fig_5.png
old mode 100644
new mode 100755
diff --git a/_images/fig_6.png b/_images/fig_6.png
old mode 100644
new mode 100755
diff --git a/_images/fig_61.png b/_images/fig_61.png
old mode 100644
new mode 100755
diff --git a/_images/fig_7.png b/_images/fig_7.png
old mode 100644
new mode 100755
diff --git a/_images/fig_8.png b/_images/fig_8.png
old mode 100644
new mode 100755
diff --git a/_images/figure1.1.png b/_images/figure1.1.png
old mode 100644
new mode 100755
diff --git a/_images/figure1.png b/_images/figure1.png
old mode 100644
new mode 100755
diff --git a/_images/figure11.png b/_images/figure11.png
old mode 100644
new mode 100755
diff --git a/_images/figure2.png b/_images/figure2.png
old mode 100644
new mode 100755
diff --git a/_images/figure3.10.png b/_images/figure3.10.png
old mode 100644
new mode 100755
diff --git a/_images/figure3.3.png b/_images/figure3.3.png
old mode 100644
new mode 100755
diff --git a/_images/figure3.8.png b/_images/figure3.8.png
old mode 100644
new mode 100755
diff --git a/_images/figure3.9.png b/_images/figure3.9.png
old mode 100644
new mode 100755
diff --git a/_images/figure3.png b/_images/figure3.png
old mode 100644
new mode 100755
diff --git a/_images/figure4.1.png b/_images/figure4.1.png
old mode 100644
new mode 100755
diff --git a/_images/figure4.10.png b/_images/figure4.10.png
old mode 100644
new mode 100755
diff --git a/_images/figure4.11.png b/_images/figure4.11.png
old mode 100644
new mode 100755
diff --git a/_images/figure4.12.png b/_images/figure4.12.png
old mode 100644
new mode 100755
diff --git a/_images/figure4.6.png b/_images/figure4.6.png
old mode 100644
new mode 100755
diff --git a/_images/figure4.7.png b/_images/figure4.7.png
old mode 100644
new mode 100755
diff --git a/_images/figure4.8.png b/_images/figure4.8.png
old mode 100644
new mode 100755
diff --git a/_images/figure4.9.png b/_images/figure4.9.png
old mode 100644
new mode 100755
diff --git a/_images/figure4.png b/_images/figure4.png
old mode 100644
new mode 100755
diff --git a/_images/figure41.png b/_images/figure41.png
old mode 100644
new mode 100755
diff --git a/_images/figure5.1.png b/_images/figure5.1.png
old mode 100644
new mode 100755
diff --git a/_images/figure5.2.png b/_images/figure5.2.png
old mode 100644
new mode 100755
diff --git a/_images/figure5.3.png b/_images/figure5.3.png
old mode 100644
new mode 100755
diff --git a/_images/figure5.4.png b/_images/figure5.4.png
old mode 100644
new mode 100755
diff --git a/_images/figure5.5.png b/_images/figure5.5.png
old mode 100644
new mode 100755
diff --git a/_images/figure5.6.png b/_images/figure5.6.png
old mode 100644
new mode 100755
diff --git a/_images/figure5.7.png b/_images/figure5.7.png
old mode 100644
new mode 100755
diff --git a/_images/figure5.png b/_images/figure5.png
old mode 100644
new mode 100755
diff --git a/_images/figure6.png b/_images/figure6.png
old mode 100644
new mode 100755
diff --git a/_images/figure61.png b/_images/figure61.png
old mode 100644
new mode 100755
diff --git a/_images/figure7.png b/_images/figure7.png
old mode 100644
new mode 100755
diff --git a/_images/figure71.png b/_images/figure71.png
old mode 100644
new mode 100755
diff --git a/_images/figure8.png b/_images/figure8.png
old mode 100644
new mode 100755
diff --git a/_images/figure_1.png b/_images/figure_1.png
old mode 100644
new mode 100755
diff --git a/_images/figure_16.png b/_images/figure_16.png
old mode 100644
new mode 100755
diff --git a/_images/figure_2.png b/_images/figure_2.png
old mode 100644
new mode 100755
diff --git a/_images/figure_21.png b/_images/figure_21.png
old mode 100644
new mode 100755
diff --git a/_images/figure_3.png b/_images/figure_3.png
old mode 100644
new mode 100755
diff --git a/_images/figure_31.png b/_images/figure_31.png
old mode 100644
new mode 100755
diff --git a/_images/figure_4.png b/_images/figure_4.png
old mode 100644
new mode 100755
diff --git a/_images/figure_41.png b/_images/figure_41.png
old mode 100644
new mode 100755
diff --git a/_images/figure_5.png b/_images/figure_5.png
old mode 100644
new mode 100755
diff --git a/_images/figure_51.png b/_images/figure_51.png
old mode 100644
new mode 100755
diff --git a/_images/figure_52.png b/_images/figure_52.png
old mode 100644
new mode 100755
diff --git a/_images/figure_6.png b/_images/figure_6.png
old mode 100644
new mode 100755
diff --git a/_images/figure_61.png b/_images/figure_61.png
old mode 100644
new mode 100755
diff --git a/_images/figure_6_1.png b/_images/figure_6_1.png
old mode 100644
new mode 100755
diff --git a/_images/figure_7.png b/_images/figure_7.png
old mode 100644
new mode 100755
diff --git a/_images/figure_8_9.png b/_images/figure_8_9.png
old mode 100644
new mode 100755
diff --git a/_images/gan_01.png b/_images/gan_01.png
old mode 100644
new mode 100755
diff --git a/_images/gan_02.png b/_images/gan_02.png
old mode 100644
new mode 100755
diff --git a/_images/gan_03.png b/_images/gan_03.png
old mode 100644
new mode 100755
diff --git a/_images/gan_04.png b/_images/gan_04.png
old mode 100644
new mode 100755
diff --git a/_images/gan_05.png b/_images/gan_05.png
old mode 100644
new mode 100755
diff --git a/_images/glide1.png b/_images/glide1.png
old mode 100644
new mode 100755
diff --git a/_images/glide10.png b/_images/glide10.png
old mode 100644
new mode 100755
diff --git a/_images/glide12.png b/_images/glide12.png
old mode 100644
new mode 100755
diff --git a/_images/glide13.png b/_images/glide13.png
old mode 100644
new mode 100755
diff --git a/_images/glide14.png b/_images/glide14.png
old mode 100644
new mode 100755
diff --git a/_images/glide15.png b/_images/glide15.png
old mode 100644
new mode 100755
diff --git a/_images/glide2.png b/_images/glide2.png
old mode 100644
new mode 100755
diff --git a/_images/glide5.png b/_images/glide5.png
old mode 100644
new mode 100755
diff --git a/_images/glide6.png b/_images/glide6.png
old mode 100644
new mode 100755
diff --git a/_images/glide7.png b/_images/glide7.png
old mode 100644
new mode 100755
diff --git a/_images/glide8.png b/_images/glide8.png
old mode 100644
new mode 100755
diff --git a/_images/glide9.png b/_images/glide9.png
old mode 100644
new mode 100755
diff --git a/_images/hyperdreambooth_01.png b/_images/hyperdreambooth_01.png
old mode 100644
new mode 100755
diff --git a/_images/hyperdreambooth_02.png b/_images/hyperdreambooth_02.png
old mode 100644
new mode 100755
diff --git a/_images/hyperdreambooth_03.png b/_images/hyperdreambooth_03.png
old mode 100644
new mode 100755
diff --git a/_images/hyperdreambooth_04.png b/_images/hyperdreambooth_04.png
old mode 100644
new mode 100755
diff --git a/_images/hyperdreambooth_05.png b/_images/hyperdreambooth_05.png
old mode 100644
new mode 100755
diff --git a/_images/hyperdreambooth_06.png b/_images/hyperdreambooth_06.png
old mode 100644
new mode 100755
diff --git a/_images/hyperdreambooth_07.png b/_images/hyperdreambooth_07.png
old mode 100644
new mode 100755
diff --git a/_images/hyperdreambooth_08.png b/_images/hyperdreambooth_08.png
old mode 100644
new mode 100755
diff --git a/_images/hyperdreambooth_09.png b/_images/hyperdreambooth_09.png
old mode 100644
new mode 100755
diff --git a/_images/hyperdreambooth_10.png b/_images/hyperdreambooth_10.png
old mode 100644
new mode 100755
diff --git a/_images/hyperdreambooth_11.png b/_images/hyperdreambooth_11.png
old mode 100644
new mode 100755
diff --git a/_images/illustration.png b/_images/illustration.png
old mode 100644
new mode 100755
diff --git a/_images/image%2011.png b/_images/image%2011.png
new file mode 100755
index 00000000..d7e3a8f0
Binary files /dev/null and b/_images/image%2011.png differ
diff --git a/_images/image%2012.png b/_images/image%2012.png
new file mode 100755
index 00000000..d324cf2a
Binary files /dev/null and b/_images/image%2012.png differ
diff --git a/_images/image%2013.png b/_images/image%2013.png
new file mode 100755
index 00000000..c1d2c362
Binary files /dev/null and b/_images/image%2013.png differ
diff --git a/_images/image%2014.png b/_images/image%2014.png
new file mode 100755
index 00000000..30f76d31
Binary files /dev/null and b/_images/image%2014.png differ
diff --git a/_images/image%2015.png b/_images/image%2015.png
new file mode 100755
index 00000000..b3f8a257
Binary files /dev/null and b/_images/image%2015.png differ
diff --git a/_images/image%2017.png b/_images/image%2017.png
new file mode 100755
index 00000000..b8505d12
Binary files /dev/null and b/_images/image%2017.png differ
diff --git a/_images/image%202.png b/_images/image%202.png
new file mode 100755
index 00000000..683e90e8
Binary files /dev/null and b/_images/image%202.png differ
diff --git a/_images/image%203.png b/_images/image%203.png
new file mode 100755
index 00000000..91e364c9
Binary files /dev/null and b/_images/image%203.png differ
diff --git a/_images/image%204.png b/_images/image%204.png
new file mode 100755
index 00000000..d418cd6b
Binary files /dev/null and b/_images/image%204.png differ
diff --git a/_images/image(0).png b/_images/image(0).png
old mode 100644
new mode 100755
diff --git a/_images/image(1).png b/_images/image(1).png
old mode 100644
new mode 100755
diff --git a/_images/image(2).png b/_images/image(2).png
old mode 100644
new mode 100755
diff --git a/_images/image(3).png b/_images/image(3).png
old mode 100644
new mode 100755
diff --git a/_images/image(4).png b/_images/image(4).png
old mode 100644
new mode 100755
diff --git a/_images/image(5).png b/_images/image(5).png
old mode 100644
new mode 100755
diff --git a/_images/image(6).png b/_images/image(6).png
old mode 100644
new mode 100755
diff --git a/_images/image(7).png b/_images/image(7).png
old mode 100644
new mode 100755
diff --git a/_images/image(8).png b/_images/image(8).png
old mode 100644
new mode 100755
diff --git a/_images/image.png b/_images/image.png
old mode 100644
new mode 100755
diff --git a/_images/image0.png b/_images/image0.png
old mode 100644
new mode 100755
diff --git a/_images/image1.png b/_images/image1.png
old mode 100644
new mode 100755
diff --git a/_images/image10.png b/_images/image10.png
old mode 100644
new mode 100755
diff --git a/_images/image11.png b/_images/image11.png
old mode 100644
new mode 100755
diff --git a/_images/image111.png b/_images/image111.png
old mode 100644
new mode 100755
diff --git a/_images/image12.png b/_images/image12.png
old mode 100644
new mode 100755
diff --git a/_images/image121.png b/_images/image121.png
old mode 100644
new mode 100755
diff --git a/_images/image13.png b/_images/image13.png
old mode 100644
new mode 100755
diff --git a/_images/image131.png b/_images/image131.png
old mode 100644
new mode 100755
diff --git a/_images/image14.png b/_images/image14.png
old mode 100644
new mode 100755
diff --git a/_images/image15.png b/_images/image15.png
old mode 100644
new mode 100755
diff --git a/_images/image16.png b/_images/image16.png
old mode 100644
new mode 100755
diff --git a/_images/image17.png b/_images/image17.png
old mode 100644
new mode 100755
diff --git a/_images/image18.png b/_images/image18.png
old mode 100644
new mode 100755
diff --git a/_images/image181.png b/_images/image181.png
old mode 100644
new mode 100755
diff --git a/_images/image19.png b/_images/image19.png
old mode 100644
new mode 100755
diff --git a/_images/image191.png b/_images/image191.png
old mode 100644
new mode 100755
diff --git a/_images/image2.png b/_images/image2.png
old mode 100644
new mode 100755
diff --git a/_images/image20.png b/_images/image20.png
old mode 100644
new mode 100755
diff --git a/_images/image21.png b/_images/image21.png
old mode 100644
new mode 100755
diff --git a/_images/image211.png b/_images/image211.png
old mode 100644
new mode 100755
diff --git a/_images/image22.png b/_images/image22.png
old mode 100644
new mode 100755
diff --git a/_images/image23.png b/_images/image23.png
old mode 100644
new mode 100755
index 92e9adef..f17b5eb8
Binary files a/_images/image23.png and b/_images/image23.png differ
diff --git a/_images/image24.png b/_images/image24.png
old mode 100644
new mode 100755
diff --git a/_images/image3.png b/_images/image3.png
old mode 100644
new mode 100755
diff --git a/_images/image31.png b/_images/image31.png
old mode 100644
new mode 100755
diff --git a/_images/image4.png b/_images/image4.png
old mode 100644
new mode 100755
diff --git a/_images/image41.png b/_images/image41.png
old mode 100644
new mode 100755
diff --git a/_images/image5.png b/_images/image5.png
old mode 100644
new mode 100755
diff --git a/_images/image6.png b/_images/image6.png
old mode 100644
new mode 100755
diff --git a/_images/image61.png b/_images/image61.png
old mode 100644
new mode 100755
diff --git a/_images/image7.png b/_images/image7.png
old mode 100644
new mode 100755
diff --git a/_images/image71.png b/_images/image71.png
old mode 100644
new mode 100755
diff --git a/_images/image8.png b/_images/image8.png
old mode 100644
new mode 100755
diff --git a/_images/image81.png b/_images/image81.png
old mode 100644
new mode 100755
diff --git a/_images/image9.png b/_images/image9.png
old mode 100644
new mode 100755
diff --git a/_images/image_1.png b/_images/image_1.png
new file mode 100755
index 00000000..26299f4f
Binary files /dev/null and b/_images/image_1.png differ
diff --git a/_images/image_10.png b/_images/image_10.png
new file mode 100755
index 00000000..719cdba1
Binary files /dev/null and b/_images/image_10.png differ
diff --git a/_images/image_101.png b/_images/image_101.png
new file mode 100755
index 00000000..16d49986
Binary files /dev/null and b/_images/image_101.png differ
diff --git a/_images/image_11.png b/_images/image_11.png
new file mode 100755
index 00000000..835e03f4
Binary files /dev/null and b/_images/image_11.png differ
diff --git a/_images/image_111.png b/_images/image_111.png
new file mode 100755
index 00000000..055086b8
Binary files /dev/null and b/_images/image_111.png differ
diff --git a/_images/image_12.png b/_images/image_12.png
new file mode 100755
index 00000000..a632471e
Binary files /dev/null and b/_images/image_12.png differ
diff --git a/_images/image_121.png b/_images/image_121.png
new file mode 100755
index 00000000..f1d6ae7b
Binary files /dev/null and b/_images/image_121.png differ
diff --git a/_images/image_13.png b/_images/image_13.png
new file mode 100755
index 00000000..b77fe9f5
Binary files /dev/null and b/_images/image_13.png differ
diff --git a/_images/image_131.png b/_images/image_131.png
new file mode 100755
index 00000000..84a3b475
Binary files /dev/null and b/_images/image_131.png differ
diff --git a/_images/image_14.png b/_images/image_14.png
new file mode 100755
index 00000000..d2da7675
Binary files /dev/null and b/_images/image_14.png differ
diff --git a/_images/image_141.png b/_images/image_141.png
new file mode 100755
index 00000000..3d1eafe4
Binary files /dev/null and b/_images/image_141.png differ
diff --git a/_images/image_15.png b/_images/image_15.png
new file mode 100755
index 00000000..7e197e9c
Binary files /dev/null and b/_images/image_15.png differ
diff --git a/_images/image_151.png b/_images/image_151.png
new file mode 100755
index 00000000..169df153
Binary files /dev/null and b/_images/image_151.png differ
diff --git a/_images/image_16.png b/_images/image_16.png
new file mode 100755
index 00000000..0d3f092e
Binary files /dev/null and b/_images/image_16.png differ
diff --git a/_images/image_161.png b/_images/image_161.png
new file mode 100755
index 00000000..538812aa
Binary files /dev/null and b/_images/image_161.png differ
diff --git a/_images/image_17.png b/_images/image_17.png
new file mode 100755
index 00000000..c68e1506
Binary files /dev/null and b/_images/image_17.png differ
diff --git a/_images/image_171.png b/_images/image_171.png
new file mode 100755
index 00000000..69f07e17
Binary files /dev/null and b/_images/image_171.png differ
diff --git a/_images/image_18.png b/_images/image_18.png
new file mode 100755
index 00000000..5b39fc04
Binary files /dev/null and b/_images/image_18.png differ
diff --git a/_images/image_181.png b/_images/image_181.png
new file mode 100755
index 00000000..6eb24b79
Binary files /dev/null and b/_images/image_181.png differ
diff --git a/_images/image_19.png b/_images/image_19.png
new file mode 100755
index 00000000..e7c42fe6
Binary files /dev/null and b/_images/image_19.png differ
diff --git a/_images/image_2.png b/_images/image_2.png
new file mode 100755
index 00000000..62276650
Binary files /dev/null and b/_images/image_2.png differ
diff --git a/_images/image_21.png b/_images/image_21.png
new file mode 100755
index 00000000..410e2e76
Binary files /dev/null and b/_images/image_21.png differ
diff --git a/_images/image_22.png b/_images/image_22.png
new file mode 100755
index 00000000..685acb9b
Binary files /dev/null and b/_images/image_22.png differ
diff --git a/_images/image_23.png b/_images/image_23.png
new file mode 100755
index 00000000..e636965b
Binary files /dev/null and b/_images/image_23.png differ
diff --git a/_images/image_24.png b/_images/image_24.png
new file mode 100755
index 00000000..096fe207
Binary files /dev/null and b/_images/image_24.png differ
diff --git a/_images/image_25.png b/_images/image_25.png
new file mode 100755
index 00000000..7d250eba
Binary files /dev/null and b/_images/image_25.png differ
diff --git a/_images/image_26.png b/_images/image_26.png
new file mode 100755
index 00000000..c2b83e7f
Binary files /dev/null and b/_images/image_26.png differ
diff --git a/_images/image_27.png b/_images/image_27.png
new file mode 100755
index 00000000..b5d95e4a
Binary files /dev/null and b/_images/image_27.png differ
diff --git a/_images/image_28.png b/_images/image_28.png
new file mode 100755
index 00000000..51d5aa89
Binary files /dev/null and b/_images/image_28.png differ
diff --git a/_images/image_29.png b/_images/image_29.png
new file mode 100755
index 00000000..7de3b645
Binary files /dev/null and b/_images/image_29.png differ
diff --git a/_images/image_3.png b/_images/image_3.png
new file mode 100755
index 00000000..4ae123b9
Binary files /dev/null and b/_images/image_3.png differ
diff --git a/_images/image_30.png b/_images/image_30.png
new file mode 100755
index 00000000..b34af1ba
Binary files /dev/null and b/_images/image_30.png differ
diff --git a/_images/image_31.png b/_images/image_31.png
new file mode 100755
index 00000000..76a89370
Binary files /dev/null and b/_images/image_31.png differ
diff --git a/_images/image_32.png b/_images/image_32.png
new file mode 100755
index 00000000..c4ca45f4
Binary files /dev/null and b/_images/image_32.png differ
diff --git a/_images/image_33.png b/_images/image_33.png
new file mode 100755
index 00000000..556ca308
Binary files /dev/null and b/_images/image_33.png differ
diff --git a/_images/image_34.png b/_images/image_34.png
new file mode 100755
index 00000000..ff459da1
Binary files /dev/null and b/_images/image_34.png differ
diff --git a/_images/image_35.png b/_images/image_35.png
new file mode 100755
index 00000000..b2d6896b
Binary files /dev/null and b/_images/image_35.png differ
diff --git a/_images/image_36.png b/_images/image_36.png
new file mode 100755
index 00000000..a55dad90
Binary files /dev/null and b/_images/image_36.png differ
diff --git a/_images/image_37.png b/_images/image_37.png
new file mode 100755
index 00000000..8be2ec76
Binary files /dev/null and b/_images/image_37.png differ
diff --git a/_images/image_38.png b/_images/image_38.png
new file mode 100755
index 00000000..ed4a882b
Binary files /dev/null and b/_images/image_38.png differ
diff --git a/_images/image_39.png b/_images/image_39.png
new file mode 100755
index 00000000..c5bbfe12
Binary files /dev/null and b/_images/image_39.png differ
diff --git a/_images/image_4.png b/_images/image_4.png
new file mode 100755
index 00000000..883fac02
Binary files /dev/null and b/_images/image_4.png differ
diff --git a/_images/image_40.png b/_images/image_40.png
new file mode 100755
index 00000000..152ab77c
Binary files /dev/null and b/_images/image_40.png differ
diff --git a/_images/image_5.png b/_images/image_5.png
new file mode 100755
index 00000000..f17b5eb8
Binary files /dev/null and b/_images/image_5.png differ
diff --git a/_images/image_6.png b/_images/image_6.png
new file mode 100755
index 00000000..2baffdf6
Binary files /dev/null and b/_images/image_6.png differ
diff --git a/_images/image_7.png b/_images/image_7.png
new file mode 100755
index 00000000..72bed245
Binary files /dev/null and b/_images/image_7.png differ
diff --git a/_images/image_8.png b/_images/image_8.png
new file mode 100755
index 00000000..af3daa7b
Binary files /dev/null and b/_images/image_8.png differ
diff --git a/_images/image_81.png b/_images/image_81.png
new file mode 100755
index 00000000..e18b49d9
Binary files /dev/null and b/_images/image_81.png differ
diff --git a/_images/image_9.png b/_images/image_9.png
new file mode 100755
index 00000000..9342ff9e
Binary files /dev/null and b/_images/image_9.png differ
diff --git a/_images/image_91.png b/_images/image_91.png
new file mode 100755
index 00000000..25d172a4
Binary files /dev/null and b/_images/image_91.png differ
diff --git a/_images/imagen.png b/_images/imagen.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_1.png b/_images/imagen_1.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_10.png b/_images/imagen_10.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_11.png b/_images/imagen_11.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_12.png b/_images/imagen_12.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_13.png b/_images/imagen_13.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_2.png b/_images/imagen_2.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_3.png b/_images/imagen_3.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_5.png b/_images/imagen_5.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_6.png b/_images/imagen_6.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_7.png b/_images/imagen_7.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_8.png b/_images/imagen_8.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_9.png b/_images/imagen_9.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_editor_01.png b/_images/imagen_editor_01.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_editor_02.png b/_images/imagen_editor_02.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_editor_03.png b/_images/imagen_editor_03.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_editor_04.png b/_images/imagen_editor_04.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_editor_05.png b/_images/imagen_editor_05.png
old mode 100644
new mode 100755
diff --git a/_images/imagen_editor_06.png b/_images/imagen_editor_06.png
old mode 100644
new mode 100755
diff --git a/_images/img.png b/_images/img.png
old mode 100644
new mode 100755
diff --git a/_images/img0.png b/_images/img0.png
old mode 100644
new mode 100755
diff --git a/_images/img01.png b/_images/img01.png
old mode 100644
new mode 100755
diff --git a/_images/img02.png b/_images/img02.png
old mode 100644
new mode 100755
diff --git a/_images/img03.png b/_images/img03.png
old mode 100644
new mode 100755
diff --git a/_images/img04.png b/_images/img04.png
old mode 100644
new mode 100755
diff --git a/_images/img1.png b/_images/img1.png
old mode 100644
new mode 100755
diff --git a/_images/img10.png b/_images/img10.png
old mode 100644
new mode 100755
diff --git a/_images/img101.png b/_images/img101.png
old mode 100644
new mode 100755
diff --git a/_images/img102.png b/_images/img102.png
old mode 100644
new mode 100755
diff --git a/_images/img103.png b/_images/img103.png
old mode 100644
new mode 100755
diff --git a/_images/img11.png b/_images/img11.png
old mode 100644
new mode 100755
diff --git a/_images/img110.png b/_images/img110.png
old mode 100644
new mode 100755
diff --git a/_images/img111.png b/_images/img111.png
old mode 100644
new mode 100755
diff --git a/_images/img112.png b/_images/img112.png
old mode 100644
new mode 100755
diff --git a/_images/img113.png b/_images/img113.png
old mode 100644
new mode 100755
diff --git a/_images/img114.png b/_images/img114.png
old mode 100644
new mode 100755
diff --git a/_images/img12.png b/_images/img12.png
old mode 100644
new mode 100755
diff --git a/_images/img121.png b/_images/img121.png
old mode 100644
new mode 100755
diff --git a/_images/img122.png b/_images/img122.png
old mode 100644
new mode 100755
diff --git a/_images/img123.png b/_images/img123.png
old mode 100644
new mode 100755
diff --git a/_images/img13.png b/_images/img13.png
old mode 100644
new mode 100755
diff --git a/_images/img131.png b/_images/img131.png
old mode 100644
new mode 100755
diff --git a/_images/img132.png b/_images/img132.png
old mode 100644
new mode 100755
diff --git a/_images/img14.png b/_images/img14.png
old mode 100644
new mode 100755
diff --git a/_images/img141.png b/_images/img141.png
old mode 100644
new mode 100755
diff --git a/_images/img142.png b/_images/img142.png
old mode 100644
new mode 100755
diff --git a/_images/img15.png b/_images/img15.png
old mode 100644
new mode 100755
diff --git a/_images/img151.png b/_images/img151.png
old mode 100644
new mode 100755
diff --git a/_images/img152.png b/_images/img152.png
old mode 100644
new mode 100755
diff --git a/_images/img16.png b/_images/img16.png
old mode 100644
new mode 100755
diff --git a/_images/img161.png b/_images/img161.png
old mode 100644
new mode 100755
diff --git a/_images/img17.png b/_images/img17.png
old mode 100644
new mode 100755
diff --git a/_images/img171.png b/_images/img171.png
old mode 100644
new mode 100755
diff --git a/_images/img18.png b/_images/img18.png
old mode 100644
new mode 100755
diff --git a/_images/img181.png b/_images/img181.png
old mode 100644
new mode 100755
diff --git a/_images/img19.png b/_images/img19.png
old mode 100644
new mode 100755
diff --git a/_images/img2.png b/_images/img2.png
old mode 100644
new mode 100755
diff --git a/_images/img21.png b/_images/img21.png
old mode 100644
new mode 100755
diff --git a/_images/img22.png b/_images/img22.png
old mode 100644
new mode 100755
diff --git a/_images/img23.png b/_images/img23.png
old mode 100644
new mode 100755
diff --git a/_images/img24.png b/_images/img24.png
old mode 100644
new mode 100755
diff --git a/_images/img25.png b/_images/img25.png
old mode 100644
new mode 100755
diff --git a/_images/img26.png b/_images/img26.png
old mode 100644
new mode 100755
diff --git a/_images/img3.png b/_images/img3.png
old mode 100644
new mode 100755
diff --git a/_images/img31.png b/_images/img31.png
old mode 100644
new mode 100755
diff --git a/_images/img32.png b/_images/img32.png
old mode 100644
new mode 100755
diff --git a/_images/img33.png b/_images/img33.png
old mode 100644
new mode 100755
diff --git a/_images/img34.png b/_images/img34.png
old mode 100644
new mode 100755
diff --git a/_images/img35.png b/_images/img35.png
old mode 100644
new mode 100755
diff --git a/_images/img36.png b/_images/img36.png
old mode 100644
new mode 100755
diff --git a/_images/img4.png b/_images/img4.png
old mode 100644
new mode 100755
diff --git a/_images/img41.png b/_images/img41.png
old mode 100644
new mode 100755
diff --git a/_images/img42.png b/_images/img42.png
old mode 100644
new mode 100755
diff --git a/_images/img43.png b/_images/img43.png
old mode 100644
new mode 100755
diff --git a/_images/img44.png b/_images/img44.png
old mode 100644
new mode 100755
diff --git a/_images/img45.png b/_images/img45.png
old mode 100644
new mode 100755
diff --git a/_images/img5.png b/_images/img5.png
old mode 100644
new mode 100755
diff --git a/_images/img51.png b/_images/img51.png
old mode 100644
new mode 100755
diff --git a/_images/img52.png b/_images/img52.png
old mode 100644
new mode 100755
diff --git a/_images/img53.png b/_images/img53.png
old mode 100644
new mode 100755
diff --git a/_images/img54.png b/_images/img54.png
old mode 100644
new mode 100755
diff --git a/_images/img55.png b/_images/img55.png
old mode 100644
new mode 100755
diff --git a/_images/img6.png b/_images/img6.png
old mode 100644
new mode 100755
diff --git a/_images/img61.png b/_images/img61.png
old mode 100644
new mode 100755
diff --git a/_images/img62.png b/_images/img62.png
old mode 100644
new mode 100755
diff --git a/_images/img63.png b/_images/img63.png
old mode 100644
new mode 100755
diff --git a/_images/img64.png b/_images/img64.png
old mode 100644
new mode 100755
diff --git a/_images/img65.png b/_images/img65.png
old mode 100644
new mode 100755
diff --git a/_images/img7.png b/_images/img7.png
old mode 100644
new mode 100755
diff --git a/_images/img71.png b/_images/img71.png
old mode 100644
new mode 100755
diff --git a/_images/img72.png b/_images/img72.png
old mode 100644
new mode 100755
diff --git a/_images/img73.png b/_images/img73.png
old mode 100644
new mode 100755
diff --git a/_images/img74.png b/_images/img74.png
old mode 100644
new mode 100755
diff --git a/_images/img75.png b/_images/img75.png
old mode 100644
new mode 100755
diff --git a/_images/img8.png b/_images/img8.png
old mode 100644
new mode 100755
diff --git a/_images/img81.png b/_images/img81.png
old mode 100644
new mode 100755
diff --git a/_images/img82.png b/_images/img82.png
old mode 100644
new mode 100755
diff --git a/_images/img83.png b/_images/img83.png
old mode 100644
new mode 100755
diff --git a/_images/img84.png b/_images/img84.png
old mode 100644
new mode 100755
diff --git a/_images/img85.png b/_images/img85.png
old mode 100644
new mode 100755
diff --git a/_images/img9.png b/_images/img9.png
old mode 100644
new mode 100755
diff --git a/_images/img91.png b/_images/img91.png
old mode 100644
new mode 100755
diff --git a/_images/img92.png b/_images/img92.png
old mode 100644
new mode 100755
diff --git a/_images/img93.png b/_images/img93.png
old mode 100644
new mode 100755
diff --git a/_images/img94.png b/_images/img94.png
old mode 100644
new mode 100755
diff --git a/_images/img_00.png b/_images/img_00.png
old mode 100644
new mode 100755
diff --git a/_images/img_001.png b/_images/img_001.png
old mode 100644
new mode 100755
diff --git a/_images/img_002.png b/_images/img_002.png
old mode 100644
new mode 100755
diff --git a/_images/img_01.png b/_images/img_01.png
old mode 100644
new mode 100755
diff --git a/_images/img_011.png b/_images/img_011.png
old mode 100644
new mode 100755
diff --git a/_images/img_012.png b/_images/img_012.png
old mode 100644
new mode 100755
diff --git a/_images/img_02.png b/_images/img_02.png
old mode 100644
new mode 100755
diff --git a/_images/img_021.png b/_images/img_021.png
old mode 100644
new mode 100755
diff --git a/_images/img_022.png b/_images/img_022.png
old mode 100644
new mode 100755
diff --git a/_images/img_03.png b/_images/img_03.png
old mode 100644
new mode 100755
diff --git a/_images/img_031.png b/_images/img_031.png
old mode 100644
new mode 100755
diff --git a/_images/img_032.png b/_images/img_032.png
old mode 100644
new mode 100755
diff --git a/_images/img_04.png b/_images/img_04.png
old mode 100644
new mode 100755
diff --git a/_images/img_041.png b/_images/img_041.png
old mode 100644
new mode 100755
diff --git a/_images/img_05.png b/_images/img_05.png
old mode 100644
new mode 100755
diff --git a/_images/img_051.png b/_images/img_051.png
old mode 100644
new mode 100755
diff --git a/_images/img_06.png b/_images/img_06.png
old mode 100644
new mode 100755
diff --git a/_images/img_061.png b/_images/img_061.png
old mode 100644
new mode 100755
diff --git a/_images/img_062.png b/_images/img_062.png
old mode 100644
new mode 100755
diff --git a/_images/img_07.png b/_images/img_07.png
old mode 100644
new mode 100755
diff --git a/_images/img_071.png b/_images/img_071.png
old mode 100644
new mode 100755
diff --git a/_images/img_08.png b/_images/img_08.png
old mode 100644
new mode 100755
diff --git a/_images/img_081.png b/_images/img_081.png
old mode 100644
new mode 100755
diff --git a/_images/img_082.png b/_images/img_082.png
old mode 100644
new mode 100755
diff --git a/_images/img_09.png b/_images/img_09.png
old mode 100644
new mode 100755
diff --git a/_images/img_091.png b/_images/img_091.png
old mode 100644
new mode 100755
diff --git a/_images/img_092.png b/_images/img_092.png
old mode 100644
new mode 100755
diff --git a/_images/img_10.png b/_images/img_10.png
old mode 100644
new mode 100755
diff --git a/_images/img_101.png b/_images/img_101.png
old mode 100644
new mode 100755
diff --git a/_images/img_102.png b/_images/img_102.png
old mode 100644
new mode 100755
diff --git a/_images/img_11.png b/_images/img_11.png
old mode 100644
new mode 100755
diff --git a/_images/img_111.png b/_images/img_111.png
old mode 100644
new mode 100755
diff --git a/_images/img_112.png b/_images/img_112.png
old mode 100644
new mode 100755
diff --git a/_images/img_12.png b/_images/img_12.png
old mode 100644
new mode 100755
diff --git a/_images/img_121.png b/_images/img_121.png
old mode 100644
new mode 100755
diff --git a/_images/img_13.png b/_images/img_13.png
old mode 100644
new mode 100755
diff --git a/_images/img_131.png b/_images/img_131.png
old mode 100644
new mode 100755
diff --git a/_images/img_14.png b/_images/img_14.png
old mode 100644
new mode 100755
diff --git a/_images/img_141.png b/_images/img_141.png
old mode 100644
new mode 100755
diff --git a/_images/img_15.png b/_images/img_15.png
old mode 100644
new mode 100755
diff --git a/_images/img_151.png b/_images/img_151.png
old mode 100644
new mode 100755
diff --git a/_images/img_16.png b/_images/img_16.png
old mode 100644
new mode 100755
diff --git a/_images/img_161.png b/_images/img_161.png
old mode 100644
new mode 100755
diff --git a/_images/img_17.png b/_images/img_17.png
old mode 100644
new mode 100755
diff --git a/_images/img_171.png b/_images/img_171.png
old mode 100644
new mode 100755
diff --git a/_images/img_18.png b/_images/img_18.png
old mode 100644
new mode 100755
diff --git a/_images/img_181.png b/_images/img_181.png
old mode 100644
new mode 100755
diff --git a/_images/img_19.png b/_images/img_19.png
old mode 100644
new mode 100755
diff --git a/_images/img_191.png b/_images/img_191.png
old mode 100644
new mode 100755
diff --git a/_images/img_19_2.png b/_images/img_19_2.png
old mode 100644
new mode 100755
diff --git a/_images/img_20.png b/_images/img_20.png
old mode 100644
new mode 100755
diff --git a/_images/img_201.png b/_images/img_201.png
old mode 100644
new mode 100755
diff --git a/_images/img_21.png b/_images/img_21.png
old mode 100644
new mode 100755
diff --git a/_images/img_211.png b/_images/img_211.png
old mode 100644
new mode 100755
diff --git a/_images/img_22.png b/_images/img_22.png
old mode 100644
new mode 100755
diff --git a/_images/img_221.png b/_images/img_221.png
old mode 100644
new mode 100755
diff --git a/_images/img_23.png b/_images/img_23.png
old mode 100644
new mode 100755
diff --git a/_images/img_231.png b/_images/img_231.png
old mode 100644
new mode 100755
diff --git a/_images/img_24.png b/_images/img_24.png
old mode 100644
new mode 100755
diff --git a/_images/img_241.png b/_images/img_241.png
old mode 100644
new mode 100755
diff --git a/_images/img_25.png b/_images/img_25.png
old mode 100644
new mode 100755
diff --git a/_images/img_26.png b/_images/img_26.png
old mode 100644
new mode 100755
diff --git a/_images/img_261.png b/_images/img_261.png
old mode 100644
new mode 100755
diff --git a/_images/img_27.png b/_images/img_27.png
old mode 100644
new mode 100755
diff --git a/_images/img_271.png b/_images/img_271.png
old mode 100644
new mode 100755
diff --git a/_images/img_28.png b/_images/img_28.png
old mode 100644
new mode 100755
diff --git a/_images/img_281.png b/_images/img_281.png
old mode 100644
new mode 100755
diff --git a/_images/img_29.png b/_images/img_29.png
old mode 100644
new mode 100755
diff --git a/_images/img_291.png b/_images/img_291.png
old mode 100644
new mode 100755
diff --git a/_images/img_30.png b/_images/img_30.png
old mode 100644
new mode 100755
diff --git a/_images/img_301.png b/_images/img_301.png
old mode 100644
new mode 100755
diff --git a/_images/img_31.png b/_images/img_31.png
old mode 100644
new mode 100755
diff --git a/_images/img_32.png b/_images/img_32.png
old mode 100644
new mode 100755
diff --git a/_images/img_33.png b/_images/img_33.png
old mode 100644
new mode 100755
diff --git a/_images/img_34.png b/_images/img_34.png
old mode 100644
new mode 100755
diff --git a/_images/img_35.png b/_images/img_35.png
old mode 100644
new mode 100755
diff --git a/_images/img_36.png b/_images/img_36.png
old mode 100644
new mode 100755
diff --git a/_images/img_37.png b/_images/img_37.png
old mode 100644
new mode 100755
diff --git a/_images/img_38.png b/_images/img_38.png
old mode 100644
new mode 100755
diff --git a/_images/img_39.png b/_images/img_39.png
old mode 100644
new mode 100755
diff --git a/_images/img_40.png b/_images/img_40.png
old mode 100644
new mode 100755
diff --git a/_images/img_41.png b/_images/img_41.png
old mode 100644
new mode 100755
diff --git a/_images/img_42.png b/_images/img_42.png
old mode 100644
new mode 100755
diff --git a/_images/img_43.png b/_images/img_43.png
old mode 100644
new mode 100755
diff --git a/_images/img_44.png b/_images/img_44.png
old mode 100644
new mode 100755
diff --git a/_images/img_results.png b/_images/img_results.png
old mode 100644
new mode 100755
diff --git a/_images/improved_ddpm_eq.png b/_images/improved_ddpm_eq.png
old mode 100644
new mode 100755
diff --git a/_images/improved_ddpm_pic.png b/_images/improved_ddpm_pic.png
old mode 100644
new mode 100755
diff --git a/_images/inference_pipeline.png b/_images/inference_pipeline.png
old mode 100644
new mode 100755
diff --git a/_images/interpolation.png b/_images/interpolation.png
old mode 100644
new mode 100755
diff --git a/_images/langevin.gif b/_images/langevin.gif
new file mode 100755
index 00000000..964abb85
Binary files /dev/null and b/_images/langevin.gif differ
diff --git a/_images/layout_to_image.png b/_images/layout_to_image.png
old mode 100644
new mode 100755
diff --git a/_images/ldm_01.png b/_images/ldm_01.png
old mode 100644
new mode 100755
diff --git a/_images/ldm_02.png b/_images/ldm_02.png
old mode 100644
new mode 100755
diff --git a/_images/ldm_03.png b/_images/ldm_03.png
old mode 100644
new mode 100755
diff --git a/_images/ldm_04.png b/_images/ldm_04.png
old mode 100644
new mode 100755
diff --git a/_images/ldm_05.png b/_images/ldm_05.png
old mode 100644
new mode 100755
diff --git a/_images/ldm_06.png b/_images/ldm_06.png
old mode 100644
new mode 100755
diff --git a/_images/ldm_07.png b/_images/ldm_07.png
old mode 100644
new mode 100755
diff --git a/_images/ldm_08.png b/_images/ldm_08.png
old mode 100644
new mode 100755
diff --git a/_images/ldm_09.png b/_images/ldm_09.png
old mode 100644
new mode 100755
diff --git a/_images/leaf_db.png b/_images/leaf_db.png
old mode 100644
new mode 100755
diff --git a/_images/leaf_pp.png b/_images/leaf_pp.png
old mode 100644
new mode 100755
diff --git a/_images/leaf_sd.png b/_images/leaf_sd.png
old mode 100644
new mode 100755
diff --git a/_images/limit.png b/_images/limit.png
old mode 100644
new mode 100755
diff --git a/_images/limitation.png b/_images/limitation.png
old mode 100644
new mode 100755
diff --git a/_images/lora.png b/_images/lora.png
old mode 100644
new mode 100755
diff --git a/_images/loss.png b/_images/loss.png
old mode 100644
new mode 100755
diff --git a/_images/magic_3d_01.png b/_images/magic_3d_01.png
old mode 100644
new mode 100755
diff --git a/_images/magic_3d_02.png b/_images/magic_3d_02.png
old mode 100644
new mode 100755
diff --git a/_images/magic_3d_03.png b/_images/magic_3d_03.png
old mode 100644
new mode 100755
diff --git a/_images/magic_3d_04.png b/_images/magic_3d_04.png
old mode 100644
new mode 100755
diff --git a/_images/magic_3d_05.png b/_images/magic_3d_05.png
old mode 100644
new mode 100755
diff --git a/_images/magic_3d_06.png b/_images/magic_3d_06.png
new file mode 100755
index 00000000..2f4ce60c
Binary files /dev/null and b/_images/magic_3d_06.png differ
diff --git a/_images/magic_3d_07.png b/_images/magic_3d_07.png
old mode 100644
new mode 100755
diff --git a/_images/magic_3d_08.png b/_images/magic_3d_08.png
old mode 100644
new mode 100755
diff --git a/_images/magic_3d_09.png b/_images/magic_3d_09.png
old mode 100644
new mode 100755
diff --git a/_images/main.jpeg b/_images/main.jpeg
old mode 100644
new mode 100755
diff --git a/_images/maskgit_1.png b/_images/maskgit_1.png
old mode 100644
new mode 100755
diff --git a/_images/maskgit_2.png b/_images/maskgit_2.png
old mode 100644
new mode 100755
diff --git a/_images/mipnerf.png b/_images/mipnerf.png
old mode 100644
new mode 100755
diff --git a/_images/multi_aspect_ratio.png b/_images/multi_aspect_ratio.png
old mode 100644
new mode 100755
diff --git a/_images/multiple_db.png b/_images/multiple_db.png
old mode 100644
new mode 100755
diff --git a/_images/multiple_ex.png b/_images/multiple_ex.png
old mode 100644
new mode 100755
diff --git a/_images/multiple_pp.png b/_images/multiple_pp.png
old mode 100644
new mode 100755
diff --git a/_images/multiple_sd.png b/_images/multiple_sd.png
old mode 100644
new mode 100755
diff --git a/_images/nerf.png b/_images/nerf.png
old mode 100644
new mode 100755
diff --git a/_images/notebook-example_2_1.png b/_images/notebook-example_2_1.png
old mode 100644
new mode 100755
diff --git a/_images/photo_db.png b/_images/photo_db.png
old mode 100644
new mode 100755
diff --git a/_images/photo_pp.png b/_images/photo_pp.png
old mode 100644
new mode 100755
diff --git a/_images/photo_sd.png b/_images/photo_sd.png
old mode 100644
new mode 100755
diff --git a/_images/pirate.png b/_images/pirate.png
old mode 100644
new mode 100755
diff --git a/_images/plot_result.png b/_images/plot_result.png
old mode 100644
new mode 100755
diff --git a/_images/pose.png b/_images/pose.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_01.png b/_images/progressive_distillation_01.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_02.png b/_images/progressive_distillation_02.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_03.png b/_images/progressive_distillation_03.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_04.png b/_images/progressive_distillation_04.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_05.png b/_images/progressive_distillation_05.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_06.png b/_images/progressive_distillation_06.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_07.png b/_images/progressive_distillation_07.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_08.png b/_images/progressive_distillation_08.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_09.png b/_images/progressive_distillation_09.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_10.png b/_images/progressive_distillation_10.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_11.png b/_images/progressive_distillation_11.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_12.png b/_images/progressive_distillation_12.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_13.png b/_images/progressive_distillation_13.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_14.png b/_images/progressive_distillation_14.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_15.png b/_images/progressive_distillation_15.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_16.png b/_images/progressive_distillation_16.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_17.png b/_images/progressive_distillation_17.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_18.png b/_images/progressive_distillation_18.png
old mode 100644
new mode 100755
diff --git a/_images/progressive_distillation_19.png b/_images/progressive_distillation_19.png
old mode 100644
new mode 100755
diff --git a/_images/result_base.png b/_images/result_base.png
old mode 100644
new mode 100755
diff --git a/_images/result_new.png b/_images/result_new.png
old mode 100644
new mode 100755
diff --git a/_images/sdxl_result.png b/_images/sdxl_result.png
old mode 100644
new mode 100755
diff --git a/_images/sea.png b/_images/sea.png
old mode 100644
new mode 100755
diff --git a/_images/seg.png b/_images/seg.png
old mode 100644
new mode 100755
diff --git a/_images/spherical_coord.png b/_images/spherical_coord.png
old mode 100644
new mode 100755
diff --git a/_images/structure.png b/_images/structure.png
old mode 100644
new mode 100755
diff --git a/_images/swjo_exp_01.png b/_images/swjo_exp_01.png
old mode 100644
new mode 100755
diff --git a/_images/swjo_exp_02.png b/_images/swjo_exp_02.png
old mode 100644
new mode 100755
diff --git a/_images/swjo_exp_03.png b/_images/swjo_exp_03.png
old mode 100644
new mode 100755
diff --git a/_images/swjo_exp_04.png b/_images/swjo_exp_04.png
old mode 100644
new mode 100755
diff --git a/_images/swjo_exp_05.png b/_images/swjo_exp_05.png
old mode 100644
new mode 100755
diff --git a/_images/swjo_exp_06.png b/_images/swjo_exp_06.png
old mode 100644
new mode 100755
diff --git a/_images/swjo_exp_07.png b/_images/swjo_exp_07.png
old mode 100644
new mode 100755
diff --git a/_images/swjo_exp_08.png b/_images/swjo_exp_08.png
old mode 100644
new mode 100755
diff --git a/_images/swjo_exp_09.png b/_images/swjo_exp_09.png
old mode 100644
new mode 100755
diff --git a/_images/swjo_exp_10.png b/_images/swjo_exp_10.png
old mode 100644
new mode 100755
diff --git a/_images/swjo_exp_11.png b/_images/swjo_exp_11.png
old mode 100644
new mode 100755
diff --git a/_images/swjo_exp_12.png b/_images/swjo_exp_12.png
old mode 100644
new mode 100755
diff --git a/_images/swjo_exp_13.png b/_images/swjo_exp_13.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_01.png b/_images/t2i_adapter_01.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_02.png b/_images/t2i_adapter_02.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_03.png b/_images/t2i_adapter_03.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_04.png b/_images/t2i_adapter_04.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_05.png b/_images/t2i_adapter_05.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_06.png b/_images/t2i_adapter_06.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_07.png b/_images/t2i_adapter_07.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_08.png b/_images/t2i_adapter_08.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_09.png b/_images/t2i_adapter_09.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_10.png b/_images/t2i_adapter_10.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_11.png b/_images/t2i_adapter_11.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_12.png b/_images/t2i_adapter_12.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_13.png b/_images/t2i_adapter_13.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_14.png b/_images/t2i_adapter_14.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_15.png b/_images/t2i_adapter_15.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_16.png b/_images/t2i_adapter_16.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_17.png b/_images/t2i_adapter_17.png
old mode 100644
new mode 100755
diff --git a/_images/t2i_adapter_18.png b/_images/t2i_adapter_18.png
old mode 100644
new mode 100755
diff --git a/_images/table1.png b/_images/table1.png
old mode 100644
new mode 100755
diff --git a/_images/table11.png b/_images/table11.png
old mode 100644
new mode 100755
diff --git a/_images/table12.png b/_images/table12.png
old mode 100644
new mode 100755
diff --git a/_images/table2.png b/_images/table2.png
old mode 100644
new mode 100755
diff --git a/_images/table21.png b/_images/table21.png
old mode 100644
new mode 100755
diff --git a/_images/table3.png b/_images/table3.png
old mode 100644
new mode 100755
diff --git a/_images/table4_5.png b/_images/table4_5.png
old mode 100644
new mode 100755
diff --git a/_images/table_1.png b/_images/table_1.png
old mode 100644
new mode 100755
diff --git a/_images/table_2.png b/_images/table_2.png
old mode 100644
new mode 100755
diff --git a/_images/table_3.png b/_images/table_3.png
old mode 100644
new mode 100755
diff --git a/_images/table_31.png b/_images/table_31.png
old mode 100644
new mode 100755
diff --git a/_images/table_6.png b/_images/table_6.png
old mode 100644
new mode 100755
diff --git a/_images/text_to_image.png b/_images/text_to_image.png
old mode 100644
new mode 100755
diff --git a/_images/title_fig.png b/_images/title_fig.png
old mode 100644
new mode 100755
diff --git a/_images/trade_off.png b/_images/trade_off.png
old mode 100644
new mode 100755
diff --git a/_images/training_pipeline.png b/_images/training_pipeline.png
old mode 100644
new mode 100755
diff --git a/_images/training_result.png b/_images/training_result.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_01.png b/_images/translation_turbo_01.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_02.png b/_images/translation_turbo_02.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_03.png b/_images/translation_turbo_03.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_04.png b/_images/translation_turbo_04.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_05.png b/_images/translation_turbo_05.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_06.png b/_images/translation_turbo_06.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_07.png b/_images/translation_turbo_07.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_08.png b/_images/translation_turbo_08.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_09.png b/_images/translation_turbo_09.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_10.png b/_images/translation_turbo_10.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_11.png b/_images/translation_turbo_11.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_12.png b/_images/translation_turbo_12.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_13.png b/_images/translation_turbo_13.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_14.png b/_images/translation_turbo_14.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_15.png b/_images/translation_turbo_15.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_16.png b/_images/translation_turbo_16.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_17.png b/_images/translation_turbo_17.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_18.png b/_images/translation_turbo_18.png
old mode 100644
new mode 100755
diff --git a/_images/translation_turbo_19.png b/_images/translation_turbo_19.png
old mode 100644
new mode 100755
diff --git a/_images/vae_01.png b/_images/vae_01.png
old mode 100644
new mode 100755
diff --git a/_images/vae_05.png b/_images/vae_05.png
old mode 100644
new mode 100755
diff --git a/_images/vae_07.png b/_images/vae_07.png
old mode 100644
new mode 100755
diff --git a/_images/vae_08.png b/_images/vae_08.png
old mode 100644
new mode 100755
diff --git a/_images/vae_09.png b/_images/vae_09.png
old mode 100644
new mode 100755
diff --git a/_images/vae_10.png b/_images/vae_10.png
old mode 100644
new mode 100755
diff --git a/_images/vae_11.png b/_images/vae_11.png
old mode 100644
new mode 100755
diff --git a/_images/visual_result.png b/_images/visual_result.png
old mode 100644
new mode 100755
diff --git a/_images/wallpaper.png b/_images/wallpaper.png
old mode 100644
new mode 100755
diff --git a/_images/zero123plus_01.png b/_images/zero123plus_01.png
new file mode 100755
index 00000000..e7ee4613
Binary files /dev/null and b/_images/zero123plus_01.png differ
diff --git a/_images/zero123plus_02.png b/_images/zero123plus_02.png
new file mode 100755
index 00000000..b50aa897
Binary files /dev/null and b/_images/zero123plus_02.png differ
diff --git a/_images/zero123plus_03.png b/_images/zero123plus_03.png
new file mode 100755
index 00000000..860b8c67
Binary files /dev/null and b/_images/zero123plus_03.png differ
diff --git a/_images/zero123plus_04.png b/_images/zero123plus_04.png
new file mode 100755
index 00000000..80b7321f
Binary files /dev/null and b/_images/zero123plus_04.png differ
diff --git a/_images/zero123plus_05.png b/_images/zero123plus_05.png
new file mode 100755
index 00000000..cf2a48f5
Binary files /dev/null and b/_images/zero123plus_05.png differ
diff --git a/_images/zero123plus_06.png b/_images/zero123plus_06.png
new file mode 100755
index 00000000..9d7ea46f
Binary files /dev/null and b/_images/zero123plus_06.png differ
diff --git a/_images/zero123plus_07.png b/_images/zero123plus_07.png
new file mode 100755
index 00000000..3758c408
Binary files /dev/null and b/_images/zero123plus_07.png differ
diff --git a/_images/zero123plus_08.png b/_images/zero123plus_08.png
new file mode 100755
index 00000000..667257f7
Binary files /dev/null and b/_images/zero123plus_08.png differ
diff --git a/_images/zero123plus_09.png b/_images/zero123plus_09.png
new file mode 100755
index 00000000..5f402a1c
Binary files /dev/null and b/_images/zero123plus_09.png differ
diff --git a/_images/zero123plus_10.png b/_images/zero123plus_10.png
new file mode 100755
index 00000000..e5afbcff
Binary files /dev/null and b/_images/zero123plus_10.png differ
diff --git a/_images/zero123plus_11.png b/_images/zero123plus_11.png
new file mode 100755
index 00000000..894c220f
Binary files /dev/null and b/_images/zero123plus_11.png differ
diff --git a/_images/zero123plus_12.png b/_images/zero123plus_12.png
new file mode 100755
index 00000000..1839d5be
Binary files /dev/null and b/_images/zero123plus_12.png differ
diff --git a/_panels_static/panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css b/_panels_static/panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css
old mode 100644
new mode 100755
diff --git a/_panels_static/panels-variables.06eb56fa6e07937060861dad626602ad.css b/_panels_static/panels-variables.06eb56fa6e07937060861dad626602ad.css
old mode 100644
new mode 100755
diff --git a/_sources/docs/experiments/js_exp.md b/_sources/docs/experiments/js_exp.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/experiments/swjo_exp.md b/_sources/docs/experiments/swjo_exp.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/markdown-example.md b/_sources/docs/markdown-example.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/notebook-example.ipynb b/_sources/docs/notebook-example.ipynb
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/A_Study_on_the_Evaluation_of_Generative_Models.md b/_sources/docs/review/A_Study_on_the_Evaluation_of_Generative_Models.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/AnimateDiff.md b/_sources/docs/review/AnimateDiff.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/Animate_Anyone.md b/_sources/docs/review/Animate_Anyone.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/BBDM.md b/_sources/docs/review/BBDM.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/CM3leon.md b/_sources/docs/review/CM3leon.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/Coin3D.md b/_sources/docs/review/Coin3D.md
new file mode 100755
index 00000000..505f44e3
--- /dev/null
+++ b/_sources/docs/review/Coin3D.md
@@ -0,0 +1,273 @@
+``` {admonition} Information
+- **Title:** Controllable and Interactive 3D Assets Generation with Proxy-Guided Conditioning (SIGGRAPH 2024)
+
+- **Reference**
+ - Paper: [https://arxiv.org/pdf/2405.08054](https://arxiv.org/pdf/2405.08054)
+ - Code: [https://github.com/zju3dv/Coin3D](https://github.com/zju3dv/Coin3D)
+ - Project Page : [https://zju3dv.github.io/coin3d/](https://zju3dv.github.io/coin3d/)
+
+- **Author:** Donggeun Sean Ko
+
+- **Last updated on January. 07, 2025**
+```
+
+# Coin3D
+
+## 1. Introduction
+
+:::{figure-md}
+
+
+Overview of Coin3D
+:::
+
+“사용자 친화적인” & “제어 가능”한 3D assets 생성 프레임워크는 3가지 특성을 가져야 한다고 주장함
+- **3D Controllable**: Basic shape를 이용해서 간단하고 쉽게 원하는 형태를 만들 수 있어야 됨
+- **Flexible**: Interactive하게 (UI 등)을 활용하여 다양한 결과물을 만들 수 있어야 됨 (간단)
+- **Responsive**: 중간 결과물 및 빠른 결과물을 만들 수 있게 해야 됨 (fast inference time)
+
+
+## 2. Related Works
+
+**3D Object Generation**
+- Polygon-mesh based
+- Point Cloud
+- Voxels, Implicit Fields
+- CAD-based
+- Multiview Image generation (zero123++,Wonder3D,etc)
+
+**Controllable and Interactive Generation**
+- Latent-NeRF
+- Fantasia3D
+
+**이전 방법들의 문제점**
+- "다중 얼굴 야누스 문제" (하나의 객체가 다양한 각도에서 일관성 있는 모습을 유지하지 못하는 문제)
+- 텍스트 프롬프트(텍스트-3D)나 이미지(이미지-3D)에만 집중함
+- 3D 형태를 정확하게 제어할 수 없음
+
+## Overall
+- Coin3D Input Condition (전처리)
+- 3D-Aware Conditioned Generation
+- Preview and Reconstruction
+
+:::{figure-md}
+
+
+Overview of Coin3D Main Architecture
+:::
+
+## 3. Method
+
+## 3.1: Proxy-Guided 3D Conditiong for Diffusion
+:::{figure-md}
+
+
+Proxy-based Initial Condition Generation
+:::
+
+**3D Proxy as an initial condition (Preprocessing)**
+- Coarse shape $P$와 prompt $y$로 $N_v$를 다양한 camera pose에 대하여 예측
+
+$$
+\mathbf{X}_{(i:N_v)} = f(P, y, \mathbf{c}_{(i:N_v)})
+$$
+
+Where:
+- $N_v$: consistent image
+- $P$: coarse shape
+- $f$: Multiview diffusion-based generator
+- $y$: prompt
+- $\mathbf{c}$: camera poses
+
+
+## 3.2 3D Aware Conditioned Generation
+:::{figure-md}
+
+
+3D-Aware Conditioned Generation
+:::
+
+1. 3D Proxy Sample을 Voxelize를 통해 Voxel Grid $F_v$ 생성
+2. **Multiview Image 생성**
+ - 2-1. Image Candidates를 **Clip** + (Rotation, Translation)로 **Denoising U-Net** condition input으로 입력
+ - 2-2. Volume Projected Condition도 입력 (학습)
+3. MV Images → Project Fusion을 통해
+ multiview feature volume, $F_l^t$ 생성
+4. 3D Convolution ($f_{VP}$)을 통해 intermediate feature를 MVConv
+ (3DConv intermediate layer)에 계층적으로 추가
+5. $F_c^t = f_{VM(1 \dots N)}(F_l^t) + f_{VM(1 \dots N)}(f_{VP}(F_v)_{1 \dots N})$
+6. 3D control volume 완성!
+7. 3D Control Volume을 다시 $f_u$에 넣어 MV image 생성
+
+
+## 3.2.1 Training Pipeline of 3D Aware Conditioned Generation
+
+1. **(Preprocess)** 각 학습 데이터를 MV image와 균일하게 샘플링된 coarse proxies로 변환
+2. **(Training)** $B$개의 condition 및 target image를 무작위로 sampling하고, 대응하는 coarse proxy points를 샘플링함
+3. **(Training)** $B$ timestamp with Gaussian Noise도 샘플링
+ $\epsilon_{(1:B)} \sim \mathcal{N}(0, 1)$
+4. 아래의 loss를 이용하여 추가된 noise를 network $\epsilon_\theta$를 통해 예측
+
+$$
+\epsilon_\theta : \text{model’s predicted noise}
+c(I, F_c^t, c_i) : \text{conditioned embedding}
+c_i : \text{camera view}
+F_c^t : \text{3D Control volume}
+I : \text{Candidate Image}
+$$
+
+### Loss Equation
+$$
+\min_{\theta} \mathbb{E}_{t, \mathbf{x}_{(1:N_v)}, \epsilon_{(1:N_v)}}
+\| \epsilon_i - \epsilon_\theta (\mathbf{x}_i^t, t, c(I, F_c^t, \mathbf{c}_i)) \|, \tag{2}
+$$
+
+## 3.3. Interactive Generation Workflow
+
+## 3.3.1. Proxy-bounded part editing
+
+:::{figure-md}
+
+
+Proxy-bounded Part Editing
+:::
+
+- MV diffusion은 3D volume & 2D image에 conditionin이 되어 있기 때문에,
+ 이런 condition을 고려해서 편집을 해야하는 게 간단하지 않음.
+
+- 따라서, two-pathway condition editing scheme을 구성함:
+ - Projected 2D Mask → 2D Latent Diffusion Model
+ - 3D Volume Mask → Partial Update Volume
+ - 2D Image condition + 3D masked volume condition으로 "3D image editing"을 진행
+
+$$
+\hat{F}_C^t = (1 - M) F_C^t + M \tilde{F}_C^t, \tag{3}
+$$
+
+Where:
+- $\hat{F}_C^t$: updated volume
+- $\tilde{F}_C^t$: predicted volume at $t$
+- $F_C^t$: cached original volume
+
+## 3.3.2. Interactive Preview with Progressive Volume Caching
+
+:::{figure-md}
+
+
+Interactive Preview with Progressive Volume Caching
+:::
+
+- 목표: Interactive preview를 통해 수정된 결과를 몇 초 내에 확인하고
+ 임의의 시점에서 효과를 검사 및 수정이 가능
+
+- Progressive Volume Caching
+ - 각 timestamp $t$에서 최신 3D Control Volume, $F_C^t$를 캐싱함
+ - 이를 $F_C^t$를 반복적으로 계산할 필요가 없음
+
+- Viewpoint Panning
+ - Preview 단계에서 user’s viewpoint poses $c'$를 MV diffusion viewpoint condition에 전달
+ - 이를 통해 원하는 시점 (arbitrary viewpoints)에서 프리뷰 이미지를 렌더링할 수 있음
+
+- 핵심
+ - Cache를 이용하여 불필요한 연산을 제거하고 Cache에서 저장된 3D adapter rendering output을 이용하여 여러 preview를 생성
+
+
+## 3.4 Volume-Conditioned Reconstruction
+
+## 3.4.1. Preview & Reconstruction
+
+:::{figure-md}
+
+
+Preview and Reconstruction
+:::
+
+- 기존 Multiview images를 활용한 3D Reconstruction은
+ viewpoint가 적어 unexpected geometry가 만들어져 결과물이 뭉개지거나 한계점이 보임
+
+- 3D-aware context from 3D control volume을 활용해 3D Reconstruction quality를 올림
+ - 개인적인 의견: 더 정교한 3D 물체 + Multiview가 있으니 더 정교한 결과물이 만들어진다? 라고 보여짐...
+
+- **Propose Volume SDS**
+ - integrating 3D control prior from voxelized feature $F_C^t$ to the field’s backpropagation
+
+$$
+\Delta_x L_{V-SDS} = w(t) \left( \epsilon_\theta \left( \mathbf{x}_t, t, c(I, F_C^t, \mathbf{c}) \right) - \epsilon \right),
+$$
+
+where $w(t)$ is the weighting function from **DreamFusion**.
+
+## 4. Results
+
+:::{figure-md}
+
+
+Qualitative Results
+:::
+
+### 프록시 기반 생성 방법 비교
+
+- **Wonder3D와 SyncDreamer 디테일 비교**:
+ 1. **더 높은 품질의 멀티뷰 이미지**:
+ - Coin3D 결과물은 **다양한 시점에서 일관성 있는 이미지**를 생성하며, 왜곡이나 아티팩트가 최소화됨.
+ - 반면, Wonder3D와 SyncDreamer는 복잡한 객체(예: 거북이와 오리)에서 **기하학적 불일치** 또는 텍스처 불일치를 보임.
+
+ 2. **더 나은 텍스처 메쉬**:
+ - Ours는 **더욱 현실적이고 세밀한 텍스처**를 재구성하며, 부드러운 전환과 정밀한 정렬을 유지.
+ - Wonder3D는 텍스처 불일치가 나타나고, SyncDreamer는 단순화된 텍스처를 생성하는 경향이 있음.
+
+ 3. **객체 형태의 보존**:
+ - Ours는 입력된 **coarse shape**를 정확히 보존하면서 세부 정보를 강화함.
+ - 다른 방법론은 재구성 중 형태 왜곡(예: 의자가 휘거나 일그러짐)이 나타남.
+
+ 4. **더 자연스러운 출력**:
+ - Ours의 출력은 **미적 품질이 높고 자연스러운 결과물**을 제공하며, 복잡한 텍스처(예: 도넛)에서도 특히 돋보임.
+ - Wonder3D와 SyncDreamer는 인공적이거나 세부 사항이 부족한 경우가 많음.
+
+### 주요 관찰점
+- **Coarse Shapes**: 모든 방법이 비슷한 코스 쉐이프에서 시작하지만, Ours는 이를 가장 잘 개선함.
+- **멀티뷰 이미지**: Ours는 명확하고 일관된 멀티뷰 이미지를 생성하여 정확한 3D 재구성을 가능하게 함.
+- **텍스처 메쉬**: Ours는 현실적인 텍스처를 생성하며, 경쟁 방법론보다 높은 수준의 사실성을 보여줌.
+
+### 요약:
+- **(a) Ours**: 멀티뷰 이미지의 일관성과 텍스처 메쉬 품질에서 우수함.
+- **(b) Wonder3D**: 기하학적 일관성과 텍스처 세부 정보에서 어려움.
+- **(c) SyncDreamer**: 텍스처가 단순화되고 형태가 불일치함.
+
+## 4.2 Quantitative Results
+:::{figure-md}
+
+
+Quantitative Results
+:::
+
+- **TEXTure** (Richardson et al., 2023) user study guideline 채택
+- 30명 사용자에게 35개의 test case를 무작위 순서로 제시한 후
+ perceptual quality & content matching degree (w.r.t the given image or text prompts)를 기준으로 정렬 및 점수 배정
+- 3점 Best 기준으로 함.
+
+
+## 5. Ablation Study
+
+### Volume SDS
+
+:::{figure-md}
+
+
+Ablation Study on Volume SDS
+:::
+- Volume SDS Loss를 추가시 렌더링에 artifacts가 없으며 더 스무스하고 자연스러운 텍스쳐를 바탕으로 생성함
+
+### Proxy Condition & 3D Mask Dilation
+:::{figure-md}
+
+
+Ablation Study on Proxy Condition and 3D Mask Dilation
+:::
+- Proxy 하고 Dilation이 없을 시 rendering이 고르게 안되는 현상이 생김.
+- Full method는 proxy와 dilation을 둘다 사용했으며
+
+## 6. Conclusion
+- Basic block만 있으면 원하는 3D 생성을 할 수 있음
+- Flexible 하고 UI-friendly 함 (ComfyUI 등)
+- 타 모델들에 비해 3D 결과물이 더 좋음
\ No newline at end of file
diff --git a/_sources/docs/review/ConceptLab.md b/_sources/docs/review/ConceptLab.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/ControlNet.md b/_sources/docs/review/ControlNet.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/CustomDiffusion.md b/_sources/docs/review/CustomDiffusion.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/DALLE2.md b/_sources/docs/review/DALLE2.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/DDIM.md b/_sources/docs/review/DDIM.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/DDPM.md b/_sources/docs/review/DDPM.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/DiT.md b/_sources/docs/review/DiT.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/Diffusion_models_already_have_a_Semantic_Latent_Space.md b/_sources/docs/review/Diffusion_models_already_have_a_Semantic_Latent_Space.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/DreaMoving.md b/_sources/docs/review/DreaMoving.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/DreamBooth3D.md b/_sources/docs/review/DreamBooth3D.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/DreamFusion.md b/_sources/docs/review/DreamFusion.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/DreamGaussian.md b/_sources/docs/review/DreamGaussian.md
new file mode 100755
index 00000000..b00a1a87
--- /dev/null
+++ b/_sources/docs/review/DreamGaussian.md
@@ -0,0 +1,623 @@
+``` {admonition} Information
+- **Title:** DreamGaussian: Generative Gaussian Splatting for Efficient 3D Content Creation (ICLR 2024)
+
+- **Reference**
+ - Paper: [https://arxiv.org/abs/2309.16653](https://arxiv.org/abs/2309.16653)
+ - Code: [https://github.com/dreamgaussian/dreamgaussian/tree/main](https://github.com/dreamgaussian/dreamgaussian/tree/main)
+ - Project Page: [https://dreamgaussian.github.io/](https://dreamgaussian.github.io/)
+
+- **Author:** Kyeongmin Yu
+
+- **Last updated on Dec. 26, 2024**
+```
+
+# DreamGaussian
+
+
+# 1. Abstract
+
+
+
+# 2. Related Work
+
+## 2.1 3D representations
+
+
+ Neural Radiance Fields (NeRF)
+
+
+
+
+original NeRF
+
+
+NeRF와 Mip-NeRF의 차이점
+
+
+Mip-NeRF 360의 contract($\cdot$) function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+신경망(MLP)을 이용해 3d 물체에 대한 정보를 표현했다.
+신경망은 카메라의 위치와 방향을 입력으로 해당 지점의 density와 color를 리턴한다. 온전한 하나의 이미지를 렌더링 하기 위해서는 모든 camera ray를 따라 (이론상)적분이 필요하다.
+
+
+ray tracing이 아닌 cone tracing 방식으로, 렌더링 된 이미지의 품질을 향상시킴.
+
+
+파란 영역은 euclidean space, 노란 영역은 맵핑된 영역이다.
+이외에도 기존 방식(coarse-to-fine)과 다르게 n개의 신경망을 사용했으며 초기 신경망을 최종 결과물 출력시 사용하지 않았다.
+
+
+
+
+
+
+
+Instant NGP
+
+
+Block-NeRF
+
+
+NeRF in the wild
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+voxel기반의 multiresolution hash encoding을 통해 기존 sin/cos을 이용한 positional encoding 방식을 발전시킴. 이러한 encoding 방식을 채택함으로써 encoding 자체의 속도도 빨라졌으며 다중 스케일 정보를 담은 encoding을 이용함으로써 original NeRF의 신경망보다 오히려 작은 구조를 채택할 수 있었다. 또한 cuda를 활용하여 처리속도를 향상시킴으로써 real-time에 가까운 속도를 낼 수 있었다.
+
+
+대규모 장면을 모델링하기 위해 여러 NeRF를 합쳐서 하나의 큰 장면을 구성하는 방법
+
+
+in the wild dataset에서 scene 재구성을 위해 scene을
+"static 요소"와 "transient 요소"로 분리하여 모델링
+
+
+
+
+
+
+
+3D Gaussian Splatting (3DGS)
+
+
+
+
+point cloud 예시
+
+
+Gaussian densification 과정
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+:::{figure-md}
+
+
+Gaussian Splatting optimization
+colmap과 같은 SfM 을 이용해 3D keypoint를 찾아 해당 지점으로 3D gaussian을 초기화 한다. 이후 gaussian들을 합치거나 쪼개며 최적화를 진행한다. 렌더링 시에는 3D gaussian들을 2D projection하여 하나의 이미지를 만든다.
+:::
+
+
+
+---
+
+- **3D Gaussian representation [[참고1](https://towardsdatascience.com/a-comprehensive-overview-of-gaussian-splatting-e7d570081362#4cd8)][[참고2](https://patapom.com/blog/SHPortal/)]**
+
+ 각각의 3D Gaussians은 3D position(mean) $\mu$, opacity $\alpha$, anisotropic covariance $\Sigma$로 위치와 크기, 방향을 표현하며, 여기에 spherical harmonic (SH) coefficients를 추가해 view-dependent appearance(color)를 표현했다.
+
+ - covariance matrix $\Sigma$ 를 rotation matrix $\mathbf R$ 와 scaling matrix $\mathbf S$로 분리가능.
+ - rotation matrix는 (real $r$+ imaginery $i,j,k$) 4차원의 quaternion으로 표현가능.
+ - scaling matrix는 ($x,y,z$) 3차원의 scale로 표현가능.
+ - SH 계수의 경우 일반적으로 각 색상 채널(R, G, B)당 9개의 계수, 총 27개의 계수를 사용합니다.
+ - 9개의 계수를 사용한다는 말은 $l\in[0,1,2]$ 라는 뜻이며, $m \in [-l,+l]$ 이다.
+ - SH를 이용하면 빛이 균일하게 퍼지는 표면(매트한 표면)외에도 입사각(보는 방향)에 따라 달라지는 Non-Lambertian effects도 표현할 수 있다.
+
+ **Spherical Harmonics** $Y_l^m(\theta,\phi)$ **를 이용한 lighting** [[paper](https://3dvar.com/Green2003Spherical.pdf)]
+
+ Spherical Harmonics는 번역하면 구면조화함수로 구의 표면에서 정의되는 함수를 말한다. 구면좌표계 $(r,\theta,\phi)$ 에서 $r$ 을 고정하고 $\theta, \phi$에 따라 값을 출력하는 함수이다.
+
+ :::{figure-md}
+
+
+ 수학적으로는 라플라스 미분방정식의 해
+ :::
+
+ :::{figure-md}
+
+
+ Spherical Harmonics 시각화 [[eq](https://en.wikipedia.org/wiki/Table_of_spherical_harmonics)]
+ :::
+
+ :::{figure-md}
+
+
+ Spherical Harmonics 시각화
+ :::
+
+
+
+ - cf. fourier series
+
+ :::{figure-md}
+
+
+ 삼각함수들을 이용해 임의의 주기함수를 근사하는 푸리에 변환의 3D 확장판
+ :::
+
+ :::{figure-md}
+
+
+ SH를 이용한 근사 예시. SH는 구 표면에서의 분포의 basis에 해당.
+ :::
+
+
+ **Lambertian vs. Non-lambertian**
+
+ :::{figure-md}
+
+
+ Diffuse reflection (~ Lambertian effects)
+ :::
+
+ Lambertian reflection은 어떤 각도에서 보든 같은 양 빛을 관찰 할 수 있는 이상적인 상태
+
+ :::{figure-md}
+
+
+ Non-lambertian effects -> 즉, 반사광 표현가능
+ :::
+
+---
+
+- **Pruning and Densification**
+
+ :::{figure-md}
+
+
+ 3D Gaussian Splatting
+ initialization, optimization, adaptive control of gaussians
+ :::
+
+
+---
+
+- **Volumetric Rendering**
+
+
+ :::{figure-md}
+
+
+ 3D Gaussian Splatting Volumetric Rendering
+ :::
+
+ :::{figure-md}
+
+
+ from nerfstudio
+ :::
+
+
+
+ - frustrum culling을 통해 보이지 않는 3D gaussian들을 제외하고 2D로 projection.
+ - 3D gaussian들을 sorting하고 각 픽셀의 ray에 겹치는 3D gaussian들만 color, opacity 값을 반영한다.
+
+ :::{figure-md}
+
+
+ original NeRF vs 3d Gaussian Splatting rendering
+ :::
+
+---
+
+
+## 2.2 Text-to-3D Generation
+
+- data-driven 3D diffusion models
+- 3D native diffusion models
+- lift 2D image models for 3D generation
+
+## 2.3 Image-to-3D Generation
+
+- generating 3D assets form a reference image(~ single-view 3D reconstruction)
+- text-to-3D methods can also be image-to-3D methods
+- Zero-1-to-3
+- One-2-3-45
+
+### 2.4 추가 참고자료
+
+
+DreamFusion
+
+- Score Distillation Sampling (SDS) [[arXiv](https://arxiv.org/abs/2209.14988)]
+ - pretrained 2D diffusion model을 parametric image generator로서 사용하는 방식을 제안함. image generator로서 NeRF를 사용하여 differentiable 3D representation을 가능하도록 함.
+
+ $$
+ \mathbf x=g_\Theta(p)
+ $$
+ - $\mathbf x$ 는 카메라 포즈 $p$에서 렌더링된 이미지를 의미한다. $g_\Theta(\cdot)$는 differentiable rendering function으로 NeRF parameters $\Theta$를 paramter로 갖는다.
+
+ $$
+ \triangledown_\Theta\mathcal L_\text{SDS}=\Bbb E_{t,p,\epsilon}\Big[w(t)(\epsilon_\phi(\mathbf x;t,e)-\epsilon)\frac{\partial\mathbf x}{\partial\Theta} \Big]
+ $$
+ - $w(t)=\sigma_t^2$ 는 DDPM의 weighting function, $\epsilon_\phi(\cdot)$은 pretrained parameter $\phi$로 noise를 예측하는 함수이다.
+- 즉, SDS formulation은 사전학습된 2D 이미지 생성 디퓨전 모델을 이용해 NeRF parameter $\Theta$를 최적화하는 식이다. 이를 통해 text description에 맞는 NeRF 3D shape을 최적화 할 수 있는 것이다.
+
+
+
+Marching Cube
+- 3d 모델에서 표면(mesh)을 추출하기 위한 알고리즘. 여기서 표면은 밀도가 특정 값을 넘는 지점을 의미한다.
+
+- 주어진 3D 공간을 작은 큐브(cube/voxel)로 나누고, 각 큐브의 8개 코너에서 값(일반적으로 밀도값)을 보고 그 값을 바탕으로 표면을 추출한다.
+
+- 8개의 코너의 밀도값에 따라 어떤 표면을 가지게 되는지는 미리 정해둔 정보($2^8$)를 이용한다.
+
+1. 3D 공간을 작은 큐브로 분할
+2. 임계값을 기준으로 판단
+ - 해당 지점이 물체 내부에 속하는지 외부에 속하는지 판단함
+3. 표면 생성
+ - 각 큐브의 꼭짓점 값에 따라 표면이 어떻게 생길지에 대한 규칙을 미리 정의해두고,
+ 이를 바탕으로 표면을 추출
+
+ :::{figure-md}
+
+
+ from wikipedia
+ :::
+ - 오렌지 점들은 물체의 표면 혹은 가장자리에 위치한 점들을 의미함.
+
+
+
+
+NVDiffrast
+
+nvidia 2020 ACMTOG [[arXiv](https://arxiv.org/abs/2011.03277)][[github](https://github.com/NVlabs/nvdiffrast?tab=readme-ov-file)]
+
+- 미분가능한 렌더링 방법론으로 cuda를 이용해 가속화한 것이 특징.
+ - 주로 삼각형 메시를 효율적으로 렌더링하고 그래디언트를 계산하기 위해 사용됨.
+- FLAME, 3DMM, SMPL등은 미분가능한 3D 모델으로 렌더링 방법론은 아님.
+ - 3DMM (3D Morphable Models) 1999
+
+ :::{figure-md}
+
+
+ 3DMM
+ :::
+
+ - SMPL (Skinned Multi-Person Linear Model) 2015
+
+ :::{figure-md}
+
+
+ SMPL
+ :::
+
+ - FLAME (Faces Learned with an Articulated Model and Expressions) 2017
+
+ :::{figure-md}
+
+
+ FLAME
+ :::
+
+
+
+
+Zero-1-to-3
+
+[[project page](https://zero123.cs.columbia.edu/)] [[DDPM (NeurIPS 2020)](https://www.notion.so/DDPM-NeurIPS-2020-05eb365e0ece43c0bc55ef21a8d4c6f0?pvs=21)]
+
+- **Zero-1-to-3** control the camera perspective in large-scale diffusion models,
+enabling zero-shot novel view synthesis and 3D reconstruction from a single image.
+
+- RGB image $x\in\Bbb R^{H\times W\times 3}$ , relative camera rotation $R\in \Bbb R^{3\times 3}$,relative camera translation $T\in\Bbb R^3$
+
+:::{figure-md}
+
+
+zero 1-to-3
+:::
+
+:::{figure-md}
+
+
+zero 1-to-3
+:::
+
+
+
+# 3. Method
+
+:::{figure-md}
+
+
+Method Overview
+:::
+
+- 2-stage framework for 3D content generation
+for both Image-to-3D and Text-to-3D tasks.
+ - SDS를 이용해 초기화 한 3D gaussian splatting을 이용하여 3D generation
+ - 3D gaussians에서 textured mesh 추출
+ - UV-space refinement를 통해 texture fine-tuning
+
+
+## 3.1 Generative Gaussian Splatting
+
+개별 3D gaussian의 위치와 형태는 center($\mathbf x$), scaling factor($\mathbf x$), rotation quaternion($\mathbf q$)으로 표현되며, opacity value($\alpha$), color feature($\mathbf c$)를 저장하여 volumetric rendering시 사용한다.
+
+$\Theta_i=\{\mathbf x_i, \mathbf s_i,\mathbf q_i, \alpha_i, \mathbf c_i\}$, $\mathbf x \in \Bbb R^3, \mathbf s\in \Bbb R^3, \mathbf q \in \Bbb R^4, \alpha\in \Bbb R, \mathbf c \in \Bbb R^3$
+original gaussian splatting에서는 spherical harmonics 계수를 이용하여 색을 표현하지만
+simple diffuse color를 모델링 하기 위해 간략화 → 재질 표현이 어려울 수 있다.
+
+3D Gaussians은 random position, unit scaling, no rotation으로 initialization 한 후, SDS를 이용해 최적화 한다.
+
+### Image-to-3D
+
+- 사전학습된 Zero-1-to-3 XL을 사용했으며 image $\tilde I^r_\text{RGB}$ 와 foreground mask $\tilde I^r_A$ 를 입력으로 사용한다.
+
+ $$
+ \triangledown_\Theta\mathcal L_\text{SDS}=\Bbb E_{t,p,\epsilon} \Big[w(t)(\epsilon_\phi(I^p_\text{RGB};t,\tilde I^r_\text{RGB},\triangle p)-\epsilon)\frac{\partial I^p_\text{RGB}}{\partial\Theta} \Big] \tag 1
+ $$
+
+ $w(t)$는 weighting function이고, $\epsilon_\phi(\cdot)$ 는 사전학습된 $\phi$를 이용해 예측된 noise를 뜻한다.
+ $\triangle p$ 는 relative camera pose, $r$은 reference camera이다.
+
+- 추가적으로 reference view와 transparency 를 input에 align했다.
+
+ $$
+ \mathcal L_\text{Ref}=\lambda_\text{RGB}\|I^r_\text{RGB}-\tilde I_\text{RGB}^r \|^2_2 + \lambda_A\|I^r_A-\tilde I^r_A\|^2_2 \tag 2
+ $$
+
+
+### Text-to-3D
+
+Stable diffusion을 활용하여 text-to-3D task를 수행했다.
+
+$$
+\triangledown_\Theta\mathcal L_\text{SDS}=\Bbb E_{t,p,\epsilon}\Big [ w(t)(\epsilon_\phi(I^p_\text{RGB};t,e)-\epsilon)\frac{\partial I^p_\text{RGB}}{\partial \Theta} \Big] \tag 3
+$$
+
+$e$는 주어진 text prompt의 CLIP embedding을 의미한다.
+
+### Discussion
+
+하지만 논문의 저자들은 SDS loss의 ambiguity 때문에 길게 학습하더라도 생성된 3D gaussians이 blurry하고 디테일이 부족하다고 한다. 이를 개선하기 위해 다음 단계인 mesh extraction과 texture refinement를 수행한다.
+
+## 3.2 Efficient Mesh Extraction
+
+block-wise local density query와 back-projected color를 이용해 textured mesh를 추출하는 효과적인 알고리즘을 제안한다.
+
+### Local Density Query
+
+marching cube algorithm을 적용하기 위해서는 local density grid가 필요하다. gaussian splatting 알고리즘의 주요 특징은 over-sized Gaussian 들은 최적화 과정에서 split 및 pruning된다는 점이다. 이는 효과적인 rasterization을 위해 culling technique을 적용 할 수 있는 근거가 된다. 또한 이 점은 block-wise density queries를 perform 할 때도 사용할 수 있다.
+
+먼저 3D space를 $(-1,1)^3$ 으로 맵핑한다. (그냥 최대, 최소값을 이용해 정규화) 그리고 이 공간을 $16^3$의 overlapping blocks(multiscale voxels)으로 나눈다. 그리고 각 블록의 외부에 위치한 gaussian들은 제외한다. 이를 통해 계산해야 할 gaussian의 총 개수를 효과적으로 줄일 수 있다. 그리고 각 블록의 내부에 $8^3$ dense grid를 만들어 최종적으로는 $128^3$의 dense grid를 만든다. grid position $\mathbf x$의 각 query는 남아있는 3D gaussian들의 opacity의 weighted sum으로 local density grid를 얻는다.
+
+$$
+d(\mathbf x)=\sum_i\alpha_i\text{exp}(-\frac{1}{2}(\mathbf x-\mathbf x_i)^T\Sigma_i^{-1}(\mathbf x-\mathbf x_i)) \tag{4}
+$$
+
+$\Sigma$는 covariance matrix로 scaling $\mathbf s$, rotation $\mathbf q$로 이루어져 있다. 이후에는 empirical threshold를 marching cube 알고리즘에 적용하여 mesh surface를 추출한다. [decimation과 remeshing](https://www.meshlab.net)을 이용해 후처리하여 더욱 자연스럽고(smoother), 간결한(compact) mesh를 만들었다.
+
+### Color Back-projection
+
+앞선 단계에서 mesh를 얻었기 때문에 rendered RGB 이미지를 mesh surface로 back-project하여 texture map으로 만들 수 있다.
+
+
+UV mapping from wikipedia
+
+:::{figure-md}
+
+
+uv mapping
+:::
+
+먼저 mesh의 UV coordinate를 unwrap하고 빈 texture image로 초기화 한다. 그리고 8개의 azimuth, 3개의 elevation을 균일하게 선택하고 top, bottom view까지 포함하여 corresponding RGB image를 렌더링 할 수 있게 한다. 이러한 RGB 이미지들의 각 픽셀은 UV coordinate를 기반으로 texture image로 맵핑할 수 있다.
+
+이렇게 back-project된 texture image는 다음의 texture fine-tuning 단계의 초기 설정으로 사용된다.
+
+
+## 3.3 UV-space Texture Refinement
+
+:::{figure-md}
+
+
+UV-space Texture Refinement
+:::
+
+앞선 back-projection된 coarse texture를 시작으로 texture 품질을 올리고자 했으나, SDS loss를 이용해
+UV-space를 직접 fine-tuning 하면 위의 그림과 같은 artifact가 발생하게된다. 이는 differentiable rasterization시 사용되는 mipmap texture sampling 기법때문이다. SDS와 같이 모호한 guidance를 이용하면 각 mipmap level에 따라 over-saturation된 color block으로 gradient가 전파 된다.
+
+- mipmap in rasterization
+
+
+ :::{figure-md}
+
+
+ from widipedia
+ :::
+
+ :::{figure-md}
+
+
+ from unity document
+ :::
+
+ 위와 같은 고품질 렌더링와 렌더링 속도 향상을 위해 mipmap이라는 기법을 활용한다. 본 논문에서 texture mapping, rendering시 사용한 NVdiffrast도 mipmap을 활용하고 있다.
+ mipmap은 texture를 여러 레벨의 화질으로 저장하는 방식으로 mipmap level은 특정 화질의 texture version을 의미한다. 카메라로 부터 멀리 떨어진 object는 저레벨의 mipmap을 사용해 렌더링 한다. 저레벨의 mipmap은 이미 정보손실이 일어난 상태이고 이를 이용해 렌더링 되었다면 gradient가 흐르는 방향이 왜곡 될수 있다.
+
+ ---
+
+
+$$
+I^p_\text{fine}=f_\phi(I^p_\text{coarse}+\epsilon(t_\text{start});t_\text{start},c) \tag 5
+$$
+
+stage 2 의 학습은 image-to-image synthesis와 같은 방식으로 진행된다. initialization texture가 있으므로 임의의 camera view $p$ $p$
+
+:::{figure-md}
+
+
+from SDEdit
+:::
+
+$f_\phi(\cdot)$ 는 사전학습된 2D diffusion 을 통해 refined image를 얻는 multi-step denoising process를 의미한다. $\epsilon(t_\text{start})$ 는 timestep $t_\text{start}$의 랜덤 노이즈를 말한다. $c$ 는 image-to-3D를 위한 condition인 카메라 포즈 변화량 $\Delta p$ 이고, $e$는 text-to-3D의 condition을 말한다. 시작 timestep $t_\text{start}$는 noise 강도를 제한하기 위해 신중히 선택되어야 refined image의 original content를 유지하며 detail을 향상 시킬수 있다고 한다. refined image는 이후 pixel-wise MSE loss에 texture 최적화를 위해 사용된다.
+
+$$
+\mathcal L_\text{MSE}=\|I^p_\text{fine}-I^p_\text{coarse}\|^2_2 \tag 6
+$$
+
+image-to-3D task에서는 reference view RGBA loss $\mathcal L_\text{Ref}$ 를 적용했다.
+
+실험 결과에 따르면 50 step 정도 만에 대부분 detail이 좋아졌다고 하며 반복횟수를 늘릴수록 texture의 detail이 향상되었다고 합니다.
+
+# 4. Experiments
+
+## 4.1 Implementation Details
+
+- Number of iterations
+ - first stage - 500 steps
+ - second stage - 50 steps
+- 3D Gaussian initialization
+ - number - 5000 for image-to-3D, 1000 for text-to-3D
+ - opacity - 0.1
+ - color - grey
+ - radius - 0.5
+- Rendering resolution - 64 to 512 for gaussian splatting, 128 to 1024 for mesh
+- Loss weights in eq(2) - RGB, transperency 가중치($\lambda_\text{RGB}, \lambda_A$)는 0에서 부터 각각 10000, 1000로 linearly increasing
+- Camera pose sampling - fixed radius 2 for image-to-3D / 2.5 for text-to-3D,
+ y-axis FOV 49 degree,
+ azimuth in $[-180,180]$ degree, elevation in $[-30,30]$.
+
+:::{figure-md}
+
+
+Horizontal coordinates from wikipedia
+:::
+
+:::{figure-md}
+
+
+[출처](https://www.epd.gov.hk/eia/register/report/eiareport/eia_2522017/EIA/html/Appendix/Appendix%2011.1.pdf)
+:::
+
+- Background color - white or black randomly for gaussian splatting
+- Run-time - 1min/stage for image-to-3D
+ 2min/stage for text-to-3D w. Stable Diffusion $512\times512$ resolution
+- Marching cube threshold - 1
+- GPU - NVIDIA V100(16GB), less than 8GB for this experiments
+
+## 4.2 Qualitative Comparison
+
+**Image-to-3D comparison**
+
+:::{figure-md}
+
+
+실험결과
+:::
+
+**Text-to-3D comparison**
+
+:::{figure-md}
+
+
+실험결과
+:::
+
+최적화를 진행하는 방법론 뿐만 아니라 inference-only 방법론들과 비교해도 매우 빠른 생성 속도를 보였다고 함.
+
+:::{figure-md}
+
+
+실험결과
+:::
+
+이렇게 뽑아낸 mesh는 blender와 같은 리깅 툴을 이용해 애니메이팅 가능.
+
+## 4.3 Quantitative Comparison
+
+:::{figure-md}
+
+
+실험결과
+:::
+:::{figure-md}
+
+
+실험결과
+:::
+
+## 4.4 Ablation Study
+
+:::{figure-md}
+
+
+실험결과
+:::
+
+논문에서 제안하는 파이프라인의 모든 과정이 필요함을 보여줌.
+
+- Periodical densificaiton of 3D Gaussians
+- Linear annealing of timestep t for SDS loss
+- Effect of the reference view loss $\mathcal L_{\text{Ref}}$
+
+# 5. Limitations and Conclusion
+
+- 3D content generation framework인 DreamGaussian을 통해 3D content 생성을 효율성을 증대.
+- 3D Gaussian으로 부터 mesh를 추출하는 알고리즘 제안.
+- texture fine-tuning stage를 통해 image나 text로 부터 고품질의 polygonal mesh생성 가능.
+
+:::{figure-md}
+
+
+실험결과
+:::
+
+아래와 같은 기존 방법론들의 문제점들을 여전히 가지고 있으나 score debiasing/ camera-conditioned 2D diffusion models/ BRDF auto-encoder와 같은 방법을 도입하면, 개선가능할 것으로 기대함.
+
+- Janus prob
+- over saturated texture
+- baked lighting
+
+덧붙여 texture refinement를 진행하는 stage 2에서 blurry한 결과를 얻을 수 있으나 학습을 더 진행하면 개선된다고 함.
\ No newline at end of file
diff --git a/_sources/docs/review/DreamPose.md b/_sources/docs/review/DreamPose.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/GIGAGAN.md b/_sources/docs/review/GIGAGAN.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/GLIDE.md b/_sources/docs/review/GLIDE.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/HyperDreamBooth.md b/_sources/docs/review/HyperDreamBooth.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/I-DDPM.md b/_sources/docs/review/I-DDPM.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/IP_Adapter.md b/_sources/docs/review/IP_Adapter.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/LCM-LoRA.md b/_sources/docs/review/LCM-LoRA.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/LLM_grounded_Diffusion.md b/_sources/docs/review/LLM_grounded_Diffusion.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/Latent_Diffusion_Model.md b/_sources/docs/review/Latent_Diffusion_Model.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/LoRA.md b/_sources/docs/review/LoRA.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/Make_A_Video.md b/_sources/docs/review/Make_A_Video.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/MimicBrush.md b/_sources/docs/review/MimicBrush.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/Muse.md b/_sources/docs/review/Muse.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/NeRF.md b/_sources/docs/review/NeRF.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/Point_E.md b/_sources/docs/review/Point_E.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/ProlificDreamer.md b/_sources/docs/review/ProlificDreamer.md
new file mode 100755
index 00000000..e4b83ef2
--- /dev/null
+++ b/_sources/docs/review/ProlificDreamer.md
@@ -0,0 +1,398 @@
+```{admonition} Information
+- **Title:** ProlificDreamer: High-Fidelity and Diverse Text-to-3D Generation with Variational Score Distillation (NeurIPS 2023 Spotlight)
+
+- **Reference**
+ - Paper: [https://arxiv.org/abs/2305.16213](https://arxiv.org/abs/2305.16213)
+ - Code: [https://github.com/thu-ml/prolificdreamer?tab=readme-ov-file](https://github.com/thu-ml/prolificdreamer?tab=readme-ov-file)
+
+- **Author:** Kyeongmin Yu
+
+- **Last updated on Dec. 26, 2024**
+```
+
+
+# ProlificDreamer: High-Fidelity and Diverse Text-to-3D Generation with Variational Score Distillation
+
+- view generation이 가능한 DM의 특성을 3D rendering 모델로 전달하여 pretrained 된 DM이 생성하는 이미지 분포와 3D representaiton의 분포를 맞춰가는 것으로 Dream Fusion(SDS)과 유사하지만 개선된 아이디어(VSD)를 제안하고자한 논문이다.
+
+:::{figure-md}
+
+
+Prolific Dreamer Overview
+:::
+
+📌 **Prolific Dreamer 2-stage approach**
+
+1. optimize a high-resolution NeRF by **VSD**
+2. geometry optimization of mesh from NeRF with **SDS** (optional)
+
+appendix를 참고하면, triangle 크기가 비교적 클때 VSD와 SDS의 차이가 크지 않으므로 SDS를 사용했다고 하며, 더 섬세한 mesh의 경우 VSD가 SDS에 비해 표현력이 좋을것으로 믿는다고 함.
+
+
+:::{figure-md}
+
+
+ProlificDreamer vs. DreamFusion 정성적 결과
+:::
+
+:::{figure-md}
+
+
+ProlificDreamer vs. DreamFusion 정성적 결과
+:::
+
+
+# 1 Introduction
+
+고품질의 3D content를 생산하는 것은 품이 많이 드는 일이다. 이러한 어려움을 해결하기 위해 text-to-3D 방식이 발전하고 있다. texture 기술을 기반으로 3D content 생성을 자동화하는 방식은 유망하며 다양한 분야(encompassing architecture, animation, gaming, AR/VR) paradigm의 변화를 일으킬 수 있을 것이다.
+
+Diffusion model의 text-to-image 생성력을 바탕으로 3D content를 생성하려는 DreamFusion과 같은 시도가 있었다. Dream Fusion은 **Score Distillation Sampling(SDS)** 알고리즘을 이용해 단일 3D representation을 최적화 했다. 이는 어떤 방향에서 렌더링된 이미지라도 주어진 text에 대해 높은 likelihood를 갖도록 한것으로써 diffusion model에 의해 evaluate되었다. (diffusion model을 loss에 활용) 하지만 over-satuation, over-smoothing, low-diversity 문제가 발생했다. 또한 text-to-3D의 design space에서 orthogonal 한 요소(rendering resolution - distillation time schedule)들에 대한 파악이 아직 부족하다.
+
+본 논문에서는 섬세한 3D representation을 얻기 위해 이러한 모든 요소에 대해 systematic study를 진행한다. 먼저 **Variational Score Distillation(VSD)** 를 제안한다. 이는 주어진 textual prompt와 해당 3D scene을 하나의 random variable로 취급하며 하나의 점(single point)로 취급한 SDS와는 다르다. VSD는 3D scene의 분포를 최적화하며 이러한 분포는 모든 시점에 대해 rendered images의 분포가 서로 최대한 가까워지도록 한다. pretrained 2D diffusion model의 경우에는 KL divergence에 해당한다?! 이러한 variational formulation에서 VS는 multiple 3D scene을 하나의 prompt에 정렬할 수 있는 특성을 가질 수 있다.
+
+- 원문참고
+
+ VSD optimizesa distribution of 3D scenes such that the distribution induced on images rendered from all views aligns as closely as possible, in terms of KL divergence, with the one defined by the pretrained 2D diffusion model (see Sec. 3.1). Under this variational formulation, VSD naturally characterizes the phenomenon that multiple 3D scenes can potentially align with one prompt.
+
+
+해당 variational formulation을 효율적으로 풀기 위해 VSD는 **particle-based variational inference**를 도입하고, 3D representation을 표현하기 위해 하나의 3D parameters 집합을 particles로 표현하였다. **Wasserstein gradient flow**를 이용해 이러한 particles로 부터 새로운 gradient-based update rule을 이끌어 냈다. 이는 최적화 수렴 후, 해당 particles가 desired distribution으로 부터 sample된 것임을 보장한다. update 시에는 diffused rendered images의 분포의 score function이 필요한데 이는 **pretrained diffusion model + low-rank adaptation(LoRA)** 로 얻을 수 있었다. 최종적으로 particles과 score function을 업데이트 하는 형태가 된다.
+
+Sec 3.3에서 SDS는 variational distribution에 single-point Dirac distribution을 사용하는 VSD라고 볼 수 있음을 보인다. 이를 통해 SDS가 diversity가 fidelity가 낮은 이유를 알 수 있다. single particle만으로도 VSD는 parametric score model을 학습할 수 있고 잠재적으로 SDS보다 더 나은 생성 결과를 제공할 수 있다. 또한 동일한 렌더링 함수를 이용해 2D space에서 SDS와 VSD를 비교하여 3D 요소만 분리하여 비교한 결과를 담았다. diffusion model의 고전 샘플링 방식과 같이 VSD는 CFG의 가중치 조절을 통해 보다 사실적인 sample을 생성할 수 있다. 반면 SDS는 이전 text-to-3D연구과 유사한 over-saturation, over-smoothing문제를 보이는 부족한 결과를 보였다.
+
+:::{figure-md}
+
+
+Prolific Dreamer
+:::
+
+$$
+\delta(x)=\begin{cases}0, &{x!=0} \\ \infty, &{x=0} \end{cases}
+$$
+
+$$
+\int_{-\infty} ^\infty \delta(x) dx=1
+$$
+
+Sec 4는 text-to-3D 알고리즘의 orthogonal 요소들에 대한 추가적인 **systematically study**와 clear **design space**를 담고 있다. 특히 훈련과정 중 고화질 렌더링과 시각적 품질 개선을 위한 **annealed distilling time schedule**을 제안한다. 또한 복잡한 scene을 표현하기 위한 s**cene initialization**을 제안한다. 요소들에 대한 ablation study는 Sec 5에서 볼 수 있으며, 앞서 언급한 요소들은 VSD에 효과적임을 보인다. 결론적으로 high-fidelity, diverse 3D 결과를 얻을 수있으며 이를 **ProlificDreamer**라고 한다.
+
+Sec 5에서 ProlificDreamer의 고화질(512x512) rendering 능력과 rich structure와 complex effects를 Neural Radiance Fields(NeRF)상에서 표현할 수 있음을 보인다. ProlificDreamer는 다중 물체가 포함된 복잡한 scene의 360도 전방향을 성공적으로 표현하는 것에 처음으로 성공했다. 게다가 NeRF로 초기화 한 후 ProlificDreamer로 세세하고 photorealistic한 3D texture mesh들을 생성할 수있다.
+
+:::{figure-md}
+
+
+Prolific Dreamer 생성 결과
+:::
+
+# 2. Background
+
+### Diffusion models (DMs)
+
+**Score-Based Generative Modeling through Stochastic Differential Equations**
+
+- **forward process** $\{q_t\}_{t\in[0,1]}$ - gradually add noise to a data point $x_0\sim p_0(x_0)$
+
+ $$
+ q_t(x_t|x_0):=\mathcal N(\alpha_tx_0,\sigma_t^2 I)\\q_t(x_t):=\int q_t(x_t|x_0)q_0(x_0) dx_0
+ $$
+
+ $\alpha_t, \sigma_t >0$ 는 hyperparameter로 $\alpha_0\approx 1,\sigma_0\approx 0,\alpha_1\approx 0, \sigma_t\approx 1$ 이다.
+
+- **reverse process** $p_t$ - denoising from $p_1(x_1):=\mathcal N(0,I)$ by predicting the noise added to a clean data $x_0$
+
+ noise prediction network $\epsilon_\phi(x_t,t)$을 학습하는 과정은 아래와 같다.
+
+ $$
+ \mathcal L_\text{Diff}(\phi):=\Bbb E_{x_0\sim q_0(x_0),t\sim\mathcal U(0,1),\epsilon \sim \mathcal N(o,I)}\Big[ \omega(t)\|\epsilon_\phi(\alpha_t x_0+\sigma_t\epsilon)-\epsilon\|_2^2\Big], \tag 1
+ $$
+
+ $\omega(t)$는 time dependent weighting function이다. 훈련이 끝나면 $p_t\approx q_t$ 가 되며 따라서 $p_0\approx q_0$ 으로 sample들을 그릴 수 있게 된다. 덧붙여 noise prediction network는 $p_t, q_t$ 의 score function을 approximating하는 데에도 사용가능하다. $\triangledown_{x_t}\text{log}q_t(x_t)\approx\triangledown_{x_t}\text{log}p_t(x_t)\approx-\epsilon_\phi(x_t,t)/\sigma_t$
+
+
+diffusion model이 가장 활발히 활용되고 있는 분야 중 하나는 text-to-image generation으로 text prompt $y$를 조건으로 noise를 예측한다. 또한 Classifier-free Guidence를 통해 샘플 품질과 다양성을 조절한다. guidance scale이 커질 수록 품질이 올라가지만 다양성이 감소하는 경향을 보인다.
+
+### **Text-to-3D by score distillation sampling**
+
+- **Score Distillation Sampling (SDS)** from DreamFusion
+- **Score Jacobian Chaining (SJC)** 라고도 불리며 Zero-1-to-3, Magic3d, Fantasia3d, Latent NeRF 등 다양한 연구에 활용되고 있다.
+
+사전학습된 T2I diffusion model $p_t(x_t|y)$과 noise prediction network $\epsilon_\text{pretrained}(x_t,t,y)$ 을 이용해 SDS는 single 3D representation의 parameter $\theta \in \Theta$를 최적화 한다. 이때 사용하는 metric은 **Euclidean metric**으로 $\Theta$는 Euclidean space이다.
+
+camera parameter $c$가 분포 $p(c)$를 따르고,
+differentiable rendering mapping $g(\cdot,c):\Theta \rightarrow \Bbb R^d$ 이 주어진다고 하자.
+$y^c$를 view dependent prompt라고 하면, rendering image $g(\theta,c)$에서 시작하는 forward diffusion process는 $q_t^\theta(x_t|c)$로 표현할 수 있다.
+
+SDS는 parameter $\theta$를 아래와 같이 최적화한다.
+
+$$
+\mathcal L_{\text{SDS}}(\theta):=\Bbb E_{t,c}\Big [\frac{\sigma_t}{\alpha_t}\space\omega(t)\space D_\text{KL}(q_t^\theta(x_t|c)\|p_t(x_t|y^c)\Big] \tag{2}
+$$
+
+$$
+\mathcal L_{\text{SDS}}(\theta)\approx\Bbb E_{t,\epsilon,c}\Big [\omega(t)\space \big(\epsilon_\text{pretrained}(x_t,t,y^c)-\epsilon\big)\frac{\partial g(\theta,c)}{\partial\theta}\Big] \tag{3}
+$$
+
+### 3D representations
+
+- **NeRF** → MLP
+ - multilayer perceptron을 이용해 3D 객체를 표현한다. 3차원 공간상의 위치 정보를 입력하면 해당하는 색과 밀도를 얻을 수 있다. 이때 $\theta$는 MLP의 내부 파라미터를 의미한다.
+ - 카메라 위치 $c$가 주어질때, rendering process $g(\theta,c)$는 casting rays로 정의되며 각 ray의 sampling points의 색을 가중합하여 각 픽셀의 값을 결정한다.
+ - NeRF는 최적화 측면에서 유연하고 복잡한 장면도 표현가능하다. (매우 상대적인 표현으로 사료됨.)
+- **Textured mesh** → triangle mesh + texture
+ - triangle mesh와 해당 mesh 표면의 texture, color로 3D 객체를 표현한다. 여기서 3D parameter $\theta$는 triangle meshes의 좌표와 texture parameter를 의미한다.
+ - 카메라 위치 $c$가 주어질때, rendering process $g(\theta,c)$는 casting rays로 정의되며 각 ray가 지나는 mesh의 intersection의 색을 계산함으로써 각 픽셀의 값을 결정한다.
+ - Textured mesh는 고화질 렌더링이 가능하고 differentiable rasterization을 이용하면 렌더링 속도가 빠르다.
+
+# 3. Variational Score Distillation
+
+:::{figure-md}
+
+
+Prolific Dreamer
+:::
+
+### 3.1 Sampling from 3D Distribution via Variational Inference
+
+3D represetation에 사용되는 parameter $\theta$들은 확률밀도 $\mu(\theta|y)$로 모델링 할 수 있다.
+$q_0^\mu(x_0|c,y)$는 rendered image $x_0;=g(\theta,c)$의 분포, $p_0(x_0|y^c)$는 $t=0$ 일때 marginal distribution이다.
+
+고품질의 3D representation을 얻기 위해서 distribution $\mu$를 최적화 하는 방법을 제안한다. 사전학습된 DM을 이용해 모든 view에 대한 rendered image sample과 distribution $\mu$를 정렬(align)하는 것은 아래와 같이 두 분포의 거리를 좁히는 것이라고 할 수 있다.
+
+$$
+\text{min}_\mu D_\text{KL}\big(q_0^\mu(x_0|c,y)\|p_0(x_0|y^c)\big) \tag{4}
+$$
+
+- SDS eq.2
+
+ $$
+ \mathcal L_{\text{SDS}}(\theta):=\Bbb E_{t,c}\Big [({\sigma_t}/{\alpha_t})\space\omega(t)\space D_\text{KL}(q_t^\theta(x_t|c)\|p_t(x_t|y^c)\Big] \tag{2}
+ $$
+
+
+위의 식은 일반적인 variational inference problem으로 variational distribution $q_0^\mu(x_0|c,y)$을 target distribution $p_0(x_0|y^c)$으로 근사(distill)하는 방식을 사용한다.
+
+위의 식 4의 prob을 직접 푸는것은 복잡하고 비효율적이기 때문에 diffusion model을 이용해 series of optimization problem을 통해 해결하고자 한다. $t$가 $T$를 향해 점점 커질때, 위의 최적화 문제는 diffused distribution이 gaussian distribution에 가까워 지며 점점 쉬워진다.
+
+(기존 SDS 최적화 식의 parameter $\theta$가 distribution $\mu$로 바뀐 형태)
+
+$$
+\mu^*:=\text{argmin}_\mu\Bbb E_{t,c}\Big[ (\sigma_t/\alpha_t)\omega(t)D_{KL}(q_t^\mu(x_t|c,y)\|p_t(x_t|y^c))\Big] \tag5
+$$
+
+- SDS eq.2
+
+ $$
+ \mathcal L_{\text{SDS}}(\theta):=\Bbb E_{t,c}\Big [({\sigma_t}/{\alpha_t})\space\omega(t)\space D_\text{KL}(q_t^\theta(x_t|c)\|p_t(x_t|y^c)\Big] \tag{2}
+ $$
+
+
+### 3.2 Update Rule for Variational Score Distillation
+
+식 5의 prob을 풀기위해 또 다른 생성모델을 훈련하여 풀 수 있는데 이는 resource가 많이 필요하고 최적화 과정이 복잡해진다. 앞선 particle-based variational inference 연구와 유사하게, n개의 3D particles를 유지하고 해당 particles을 위한 새로운 update rule을 제안한다. 즉, $\{\theta\}^n_{i=1}$을 현재 distribution $\mu$를 표현하기 위해 사용하는 것이다. $\theta^{(i)}$는 최적화 과정이 수렴되고 하면 최적 분포 $\mu^*$에서 샘플링된 것이 된다.
+
+$$
+\frac{d\theta_\tau}{d\tau}=-\Bbb E_{t,\epsilon,c}\Big[\omega(t)\big(-\sigma_t\triangledown_{x_t} \text{log}p_t(x_t|y^c)-(-\sigma_t\triangledown_{x_t}\text{log}q_t^{\mu_\tau}(x_t|c,y))\big)\frac{\partial g(\theta_\tau,c)}{\partial\theta_\tau} \tag 7
+$$
+
+$$
+\text{min}_{\phi}\sum^n_{i=1}\Bbb E_{t\sim\mathcal U(0,1),\epsilon\sim\mathcal N(o,I),c\sim p(c)}\Big[\|\epsilon_\phi(\alpha_tg(\theta^{(i)}),c)+\sigma_t\epsilon,t,c,y)-\epsilon\|^2_2\Big] \tag 8
+$$
+
+최종적으로는 아래와 같은 objective function을 얻는다.
+
+$$
+\triangledown_\theta\mathcal L_{VSD}(\theta)\triangleq\Bbb E_{t,\epsilon,c}\Big[\omega(t
+)(\epsilon_{\text{pretrain}}(x_t,t,y^c)-\epsilon_\phi(x_t,t,c,y))\frac{\partial g(\theta,c)}{\partial\theta}\Big]\tag {9}
+$$
+
+:::{figure-md}
+
+
+Prolific Dreamer
+:::
+
+### 3.3 Comparison with SDS
+
+**SDS as a special case of VSD**
+
+$$
+\mathcal L_{\text{SDS}}(\theta)\approx\Bbb E_{t,\epsilon,c}\Big [\omega(t)\space \big(\epsilon_\text{pretrained}(x_t,t,y^c)-\epsilon\big)\frac{\partial g(\theta,c)}{\partial\theta}\Big] \tag{SDS}
+$$
+
+$$
+\triangledown_\theta\mathcal L_{VSD}(\theta)\triangleq\Bbb E_{t,\epsilon,c}\Big[\omega(t
+)(\epsilon_{\text{pretrain}}(x_t,t,y^c)-\epsilon_\phi(x_t,t,c,y))\frac{\partial g(\theta,c)}{\partial\theta}\Big]\tag {VSD}
+$$
+
+SDS는 $\mu(\theta|y)\approx \delta(\theta-\theta^{(1)})$ 인 VSD의 special case에 해당한다. VSD는 potential mutliple particles일 뿐 아니라 parametric score function $\epsilon_\phi$도 학습하기 때문에 SDS와 동일하게 single particle을 사용해도 성능이 좋다. 또한 LoRA를 사용해 text prompt 로 부터 추가적으로 뽑아낸 정보를 estimation $\epsilon_\phi(x_t,t,c,y)$에 반영할 수 있다.
+
+:::{figure-md}
+
+
+particle이 뭘까? 느낌적인 느낌을 받아보자.
+:::
+
+
+**VSD is friendly to CFG**
+
+VSD는 사전학습된 diffusion model을 이용해 optimal $\mu^*$에서 sample $\theta$를 추출하고자 한다. 때문에 3D sampling에서 CFG를 tuning한 효과가 기존 2D이미지 생성시 DPM-solver에서 CFG 값을 조절하는 것과 유사하다. 그래서 CFG 값을 조절하면서 더 다양한 실험결과를 얻을 수 있게 된다. SDS도 이점은 마찬가지 이나, CFG 값이 클때만 유효한 3D content를 만들어 낼 수 있었다.
+
+**VSD vs. SDS in 2D experiments that isolate 3D representations**
+
+동일한 rendering 모델을 이용해 VSD와 SDS의 3D 표현력만 비교한 결과이다.
+
+:::{figure-md}
+
+
+particle이 뭘까? 느낌적인 느낌을 받아보자.
+:::
+
+
+Appendix의 실험결과
+
+:::{figure-md}
+
+
+particle 개수에 따른 생성 퀄리티 비교 (single particle을 사용할 때도 SDS보다 성능이 좋다고 함)
+:::
+
+:::{figure-md}
+
+
+2D 이미지 생성으로 비교한 VSD와 SDS의 생성 품질 차이 / SDS는 VSD에 비해 부드럽고 세부표현이 부족하다.
+:::
+
+
+:::{figure-md}
+
+
+gradient visualization에서도 SDS와 VSD의 차이점을 확인 할 수 있다.
+:::
+
+
+# 4. Prolific Dreamer
+
+### 4.1 Design Space of Text-to-3D Generation
+
+**two-stage approch**를 이용해 text-to-3D 생성의 design space를 개선하고자 했다.
+
+1. **First Stage** - optimize a high-resolution NeRF by VSD
+2. **Second Stage** - DMTet to extract textured mesh from NeRF
+
+:::{figure-md}
+
+
+Prolific Dreamer와 다른 모델의 특성 비교
+:::
+
+### 4.2 3D Representation and Training
+
+:::{figure-md}
+
+
+Prolific Dreamer 수행 결과
+:::
+
+**High-resolution rendering for NeRF training** (in 1st stage)
+
+ProlificDreamer에서는 고화질 렌더링을 위해 **Instant NGP**를 사용했으며 VSD를 이용해 512 resolution 까지 NeRF를 최적화 했다. VSD를 사용함으로써 high-fidelity 결과를 얻을 수 있었다.
+
+- Instant NGP
+
+**Scene initialization for NeRF training** (in 1st stage)
+
+NeRF의 초기 density는 $\sigma_\text{init}(\mu)=\lambda_\sigma(1-\frac{\|\mu\|_2}{r})$로 초기화 한다. $\lambda$ 는 density strength, $r$ 는 density radius, $\mu$는 3d coordinate이다.
+
+object-centric scene에서는 Magic3D의 방식을 따랐으며($\lambda=10, r=0.5$),
+복잡한 scene의 경우 $\lambda=-10$ 로 하여 density가 거의 비어있도록 하고, $r$을 2.5로 하여 camera를 둘러 싸도록 했다.
+
+**Annealed time schedule for score distillation** (in 1st stage)
+
+단순한 2단계 annealing을 score distillation objective에 적용했다. 이는 SDS나 VSD 모두에 적용가능하다. 초기 몇 스텝에서는 $t\sim \mathcal U(0.02,0.98)$로 하고 이후에는 $t\sim \mathcal U(0.02,0.50)$로 설정했다.
+
+여기서 핵심은 $q_0^\mu(x_0|c,y)$와 $p_0(x_0|y^c)$를 맞추는 것인데 t가 커지면 KL divergence가 학습초기에 더 적당한 최적화 방향으로 갈 수 있다. t가 작으면 더 세부적인 조정이 가능하므로 $p_t(x^*|y^c)$와 $p_0(x^*|y^C)$의 차를 더 줄일 수 있다.
+
+**Mesh representation and fine-tuning** (in 2nd stage)
+
+coordinate-based hash grid encoder의 특성을 이용해 NeRF에서 mesh를 추출했다. Fantasia3D의 방법론을 따랐는데 여기서는 geometry와 texture를 분리하여 최적화했다. 첫번째로는 normal map을 이용해 geometry를 최적화하고 두번째로 texture를 최적화하는 식이다. 실험결과에서 이단계에서는 SDS와 VSD의 품질 차이가 크지않아 효율성을 위해 SDS를 사용했다. 하지만 Fantasia3D와 비교했을때 VSD 및 앞선 방법론을 이용해 최적화한 NeRF에서 뽑아낸 mesh는 SDS를 이용한 것보다 뛰어났다.
+
+# 5. Experiments
+
+### 5.1 Results of Prolific Dreamer
+
+
+Appendix의 실험결과
+
+:::{figure-md}
+
+
+particle 개수에 따른 생성 퀄리티 비교 (single particle을 사용할 때도 SDS보다 성능이 좋다고 함)
+:::
+
+:::{figure-md}
+
+
+2D 이미지 생성으로 비교한 VSD와 SDS의 생성 품질 차이 / SDS는 VSD에 비해 부드럽고 세부표현이 부족하다.
+:::
+
+
+:::{figure-md}
+
+
+gradient visualization에서도 SDS와 VSD의 차이점을 확인 할 수 있다.
+:::
+
+
+
+### 5.2 Ablation Study
+
+**Ablation on NeRF Training**
+
+64x64 rendering + SDS에서 시작하여 요소들을 추가하며 실험한 결과는 아래와 같다.
+:::{figure-md}
+
+
+Prolific Dreamer 실험 결과
+:::
+
+**Ablation on mesh fine-tuning**
+
+:::{figure-md}
+
+
+Prolific Dreamer 실험 결과
+:::
+
+**Ablation on CFG**
+
+CFG 값이 작으면 diversity 상승, CFG 값이 크면 비교적 diversity가 하락하는 실험결과를 얻음. VSD의 경우 CFG 값이 작을때에도 좋은 품질의 3D content를 생성할 수있기 때문에 충분한 diversity의 결과를 얻을 수 있지만 SDS의 경우 CFG 값이 커야만 괜찮은 3D content를 생성하기 때문에 diversity가 하락할 수밖에 없음.
+
+:::{figure-md}
+
+
+Prolific Dreamer 실험 결과
+:::
+
+:::{figure-md}
+
+
+Prolific Dreamer 실험 결과
+:::
+
+:::{figure-md}
+
+
+Prolific Dreamer 실험 결과
+:::
+
+
+ 📌개인적 감상
+
+ GAN : WGAN = DreamFusion : ProlificDreamer
+
+ GAN : Diffusion = DreamFusion : ProlificDreamer
+
+
+# Future Work
+
+- GECO
+ - 고정된 수의 particle을 이용하는 prolific dreamer의 단점을 보완해 새로운 샘플을 생성할 수 있도록 함.
\ No newline at end of file
diff --git a/_sources/docs/review/SDEdit.md b/_sources/docs/review/SDEdit.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/SDXL.md b/_sources/docs/review/SDXL.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/Shap-E.md b/_sources/docs/review/Shap-E.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/StyO.md b/_sources/docs/review/StyO.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/StyleGAN.md b/_sources/docs/review/StyleGAN.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/Synthetic_Data_from_Diffusion_Models_Improves_ImageNet_Classification.md b/_sources/docs/review/Synthetic_Data_from_Diffusion_Models_Improves_ImageNet_Classification.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/Textual_Inversion.md b/_sources/docs/review/Textual_Inversion.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/VideoLDM.md b/_sources/docs/review/VideoLDM.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/Your_Diffusion_Model_is_Secretly_a_Zero_Shot_Classifier.md b/_sources/docs/review/Your_Diffusion_Model_is_Secretly_a_Zero_Shot_Classifier.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/consistency_models.md b/_sources/docs/review/consistency_models.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/cycleGAN.md b/_sources/docs/review/cycleGAN.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/dalle.md b/_sources/docs/review/dalle.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/diffusion_beats_GANs.md b/_sources/docs/review/diffusion_beats_GANs.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/dreambooth.md b/_sources/docs/review/dreambooth.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/gan.md b/_sources/docs/review/gan.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/imagen.md b/_sources/docs/review/imagen.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/imagen_editor.md b/_sources/docs/review/imagen_editor.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/latent_consistency_models.md b/_sources/docs/review/latent_consistency_models.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/magic-3d.md b/_sources/docs/review/magic-3d.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/one-step-image-translation.md b/_sources/docs/review/one-step-image-translation.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/one_step_diffusion_with_distribution_matching_distillation.md b/_sources/docs/review/one_step_diffusion_with_distribution_matching_distillation.md
new file mode 100755
index 00000000..9733e0a4
--- /dev/null
+++ b/_sources/docs/review/one_step_diffusion_with_distribution_matching_distillation.md
@@ -0,0 +1,209 @@
+``` {admonition} Information
+- **Title:** One-Step Image Diffusion with Distribution Matching Distillation
+
+- **Reference**
+ - Paper: [https://arxiv.org/abs/2311.18828](https://arxiv.org/abs/2311.18828)
+ - Code: [https://github.com/tianweiy/DMD2](https://github.com/tianweiy/DMD2)
+
+- **Author:** Joongwon Lee
+
+- **Last updated on Oct. 16, 2024**
+```
+
+# One-step Diffusion with Distribution Matching Distillation
+
+# Introduction and Preliminaries
+
+## Overview
+
+- Diffusion model has revolutionized image generation, 하지만 느린 sampling speed 가 느린 문제점이 있음
+- Accelerating sampling speed 를 목적으로 하는 많은 연구가 이루어져 왔음
+ - ODE solving: diffusion model 의 큰 틀은 유지한 채 sampling step 의 수를 줄이면서 유사한 수준의 sample 생성 (DDIM, InstaFlow, CFM)
+
+ - 하지만 여전히 50 ~ 100 step 이하로 step 을 줄이게 되면 sample quality 가 크게 감소하여 diffusion distillation 을 통한 one-step generation 방법이 연구되어지고 있음
+ - Single step distillation: Diffusion model 을 teacher 삼아 one-step generation model 학습
+ - 직관적으로 생각해보면, diffusion model 을 학습 시킨후 학습된 모델을 통해 다수의 (noise, image) pair 얻은 후 one-step VAE 를 학습시키는 것을 생각 해 볼 수 있음.
+ - 그러나, 학습된 multi step 으로 학습 된 diffusion model 을 one-step generation model 에 distillation 을 하는 것은 어려움이 있음
+ - Noise level 을 점진적으로 증가 시키며, one-step generation 을 학습시키는 방법
+- GAN 에서 영감을 받아, (noise, image) 의 대응을 강제하는 대신 (such as autoencoder), student model 이 생성하는 이미지를 teacher model (original diffusion model) 이 생성하는 이미지와 indistinguishable 하게 학습시키는 distribution matching 전략을 생각해 볼 수 있음
+
+- Diffusion model 의 score ($\newcommand{\laplacianx}{\Delta x}$$\nabla_{\mathbf{x}} \log p(\mathbf{x})$) 을 사용해서 student model ($p(x)$) 을 학습시킬 수 있음 (real image score 가 증가하는 방향으로 pattern 을 업데이트 하는 것이 desired 방향 + fake image 를 생성하는 diffusion model 의 score 을 감소시키는 방향으로 parameter update)
+ - Diffusion model and score base model
+
+ 엄밀하게 본다면, 이 논문은 diffusion model (DDPM style) 보다는 score matching 의 철학과 논리전개를 바탕으로 두고 있음. 그러나, diffusion model 과 score based model 은 궁극적으로 같은 objective 를 다른 방식으로 학습하고 있을 뿐이고, 그 score 과 diffusion model 이 예측하는 one-step denoised 분포 ($\mu_{base}$) 는 쉽게 변환 가능함.
+
+ $$
+ s_{\text{real}}(x_t, t) = - \frac{x_t - \alpha_t \mu_{\text{base}}(x_t, t)}{\sigma_t^2}
+ $$
+
+ :::{figure-md}
+
+
+ NCSN
+ :::
+
+ :::{figure-md}
+
+
+ Langevin sampling of score models
+ :::
+
+
+# Method
+
+## Overview
+
+:::{figure-md}
+
+
+Overall scheme
+:::
+
+- 학습된 diffusion model (real data score function) 이 주어진 상황에서 one-step generator ($G_{\theta}$) 를 학습시키기 위해, 두개의 loss 1) distribution matching gradient (엄밀하게는 loss 보다는 parameter update gradient) 2) regression loss 를 사용
+- Adversarial AutoEncoder 가 연상되는 architecture 를 가지고 있음
+ - Adversarial AutoEncoder
+
+ :::{figure-md}
+
+
+ Adeverserial AE architecture
+ :::
+
+ AAE 는 VAE 가 생성하는 이미지에 대한 1) regression loss 와 2) implicit distribution matching loss 를 가지고 있는데, 여기서 implicit distribution matching 을 teacher diffusion model 의 distribution matching gradient 로 대체한 형태
+
+- 총 네 부분으로 나뉘어져 있음
+ - Paired dataset construction
+ - Pretrained base model (= real data score function, freezed)
+ - One-step generator (main objective)
+ - Fake data generator (= fake data score function, on-line training)
+
+## Distribution Matching Loss
+
+우선, 생성모델의 training objective를 생각해보면, $p_\text{fake}$ (one-step generator이 생성하는 분포) $p_\text{real}$ (실제 데이터의 분포) 를 matching 시키도록 학습을 시켜야하는 것이 one-step generator의 학습 objective이고 아래와 같이 씌여질 수 있음:
+
+$$
+\begin{align*}
+D_{KL}(p_{\text{fake}} \parallel p_{\text{real}}) &= \mathbb{E}_{x \sim p_{\text{fake}}} \left( \log \frac{p_{\text{fake}}(x)}{p_{\text{real}}(x)} \right) \\
+&= \mathbb{E}_{\substack{z \sim \mathcal{N}(0; I) \\ x = G_{\theta}(z)}} \left( - \log p_{\text{real}}(x) + \log p_{\text{fake}}(x|z)\right)
+\end{align*}
+$$
+
+지만, $p_\text{real}(x)$ 를 바로 구하는 것이 어려움 (이것이 곧 생성모델의 objective). 그러나, 모델을 학습시키기 위해서는 $D_{KL}$ 을 직접 구할 필요는 없고, $D_{KL}$ 을 minimize 하는 (fake 과 real 의 분포사이의 거리를 최소화 시키는 방향으로) parameter update 를 하기 위한 미분값만 알면 충분함. 위 식을 one-step generator 의 learnable paramter ($\theta$) 에 대해 미분 해주면,
+
+$$
+\nabla_{\theta} D_{KL} = \mathbb{E}_{\substack{z \sim \mathcal{N}(0; I) \\ x = G_{\theta}(z)}} \left[ - \left( s_{\text{real}}(x) - s_{\text{fake}}(x) \right) \nabla_{\theta} G_{\theta}(z) \right]
+$$
+
+$$
+s_{\text{real}}(x) = \nabla_x \log p_{\text{real}}(x), \quad s_{\text{fake}}(x) = \nabla_x \log p_{\text{fake}}(x)
+$$
+
+이 유도되는데, 여기서 score $s_{\text{real}}(x)$ 와 $s_{\text{fake}}(x)$ 를 정확히 알 수 있다면, one-step generator 을 학습시킬 수 있음. 단, score 이 $x$ 가 존재하는 전체 space 에 대해서 잘 작동하는 score 이여야함 (= Score-SDE).
+
+이제, 그러면 우리의 objective 는 real score 와 fake score 을 어떻게 구할지가 되는데, $s_{\text{real}}(x)$ 은 pretrained diffusion model 에서:
+
+$$
+s_{\text{real}}(x_t, t) = - \frac{x_t - \alpha_t \mu_{\text{base}}(x_t, t)}{\sigma_t^2}
+$$
+
+와 같이 유도됨. $s_{\text{fake}}(x)$ 의 경우가 복잡해지는데, $s_{\text{fake}}(x)$ 는 one-step generator 가 생성하는 이미지의 score function 라서 one-step generator 로 생성 된 이미지가 있어야 해당 이미지를 생성하는 diffusion 모델을 학습시켜서 구할 수 있음.
+
+:::{figure-md}
+
+
+Distribution matching gradient computation
+:::
+
+여기서 저자들은 fake data score function (initialized to real data score function) 을 동시에 학습시키는 방법으로 해결
+
+$$
+s_{\text{fake}}(x_t, t) = - \frac{x_t - \alpha_t \mu_{\text{fake}}^{\phi}(x_t, t)}{\sigma_t^2}
+$$
+
+$$
+\mathcal{L}_{\text{denoise}}^{\phi} = \left\lVert \mu_{\text{fake}}^{\phi}(x_t, t) - x_0 \right\rVert_2^2
+$$
+
+정리하자면, real score 은 real distribution (data distribution) 방향으로 parameter update를 하면서 fake distribution (one-step generation 의 output) 을 real distribution 에 가깝게 일치시키는 역할을 하며, fake score 의 반대방향으로 parameter update 를 하는 것은 fake data generator (one-step generator) 의 반대방향으로 distribution 을 밀어내서 most probable 한 한개의 점으로 모든 fake image 가 collapse 하는것을 방지하는 regularizer 역할을 한다.
+
+
+## Regression Loss
+
+그런데, score 만을 사용하여 one-step generator 을 학습시키는 것은 충분하지 않음. 두가지 측면에서 생각 해 볼 수 있는데 1) Practically, 매우 작은 noise level 에서는 score 이 reliable 하지 않아짐 2) Theoretically, $\nabla_x \log p_(x)$ 는 $p(x)$ 의 scale 에 영향을 받지 않아, 데이터의 높고 낮음에 대한 정보를 줄 수 없음.
+
+따라서, real + fake score 로 학습이 진행된다면, 낮은 real score 을 보이는 영역은 커버하지 못하는 부분으로 one-step generation 모델이 수렴하게 될 것 이고, high dimension 에서는 generated image 의 pixel level accuracy 에 문제가 생길 수 있음.
+
+여기서 저자들은 pixel-wise MSE (regression loss) 를 사용하여 간단히 이 문제를 해결함.
+
+:::{figure-md}
+
+
+Regression loss
+:::
+
+:::{figure-md}
+
+
+The effect of real and fake scores and regression loss
+:::
+
+- 그렇다면, Regression loss 하나만으로는 학습이 왜 불가능한가? (개인적 생각)
+
+ 이론상 regression loss 만을 사용해도 충분히 one-step generator 을 학습시킬 수 있어 보인다. 그러나, regression 의 근본적 문제점은 distribution to distribution matching 이 아니라는 점이다. e.g.
+
+
+
+
+Regression loss 를 얻기 위해서는 (noise, real image) pair 가 필요하게 되는데, 저자들은 학습된 diffusion model 에서부터 ODE solver 을 사용하여 gaussian noise와 real image 사이에 쌍을 얻어서 데이터셋을 학습 이전에 구축, 해당 pair들을 바탕으로 regression loss 를 구함 (Learned Perceptual Image Patch Similarity).
+
+$$
+\mathcal{L}_{\text{reg}} = \mathbb{E}_{(z,y) \sim \mathcal{D}} \, \ell(G_\theta(z), y)
+$$
+
+## Full algorithm
+
+:::{figure-md}
+
+
+Training algorithm
+:::
+
+
+# Results
+
+## Main comparison
+
+:::{figure-md}
+
+
+Image generation benchmarks
+:::
+
+## Ablation Study
+
+:::{figure-md}
+
+
+Ablation on distribution matching
+:::
+
+:::{figure-md}
+
+
+Ablation on regression loss
+:::
+
+
+## Comparison with Unaccelerated Models
+
+:::{figure-md}
+
+
+Comparison with Unaccelerated Models
+:::
+
+# Conclusion and Limitations
+
+- Score model 을 사용한 distribution matching loss 와 regularizing term 인 regression loss 를 통해, teacher model 에 준하는 성능을 낼 수 있었다
+- One step generator 와 multi-step generation 사이에는 근본적인 성능 tradeoff 가 존재함
+- one-step generator 의 성능은 teacher diffusion model 의 성능에 종속된다
\ No newline at end of file
diff --git a/_sources/docs/review/progressive_distillation.md b/_sources/docs/review/progressive_distillation.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/t2i_adapter.md b/_sources/docs/review/t2i_adapter.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/vae.md b/_sources/docs/review/vae.md
old mode 100644
new mode 100755
diff --git a/_sources/docs/review/zero123plus.md b/_sources/docs/review/zero123plus.md
new file mode 100755
index 00000000..3ffde840
--- /dev/null
+++ b/_sources/docs/review/zero123plus.md
@@ -0,0 +1,160 @@
+``` {admonition} Information
+- **Title:** Zero123++: a Single Image to Consistent Multi-view Diffusion Base Model
+
+- **Reference**
+ - Paper: [https://arxiv.org/abs/2310.15110](https://arxiv.org/abs/2310.15110)
+ - Code: [https://github.com/SUDO-AI-3D/zero123plus](https://github.com/SUDO-AI-3D/zero123plus)
+
+- **Author:** Sangwoo Jo
+
+- **Last updated on Dec. 16, 2024**
+```
+
+# Zero123++
+
+## 1. Introduction
+
+:::{figure-md}
+
+
+High-quality, consistent multi-view 3D images from Zero123++
+:::
+
+Zero-1-to-3(Zero123) 논문이 zero-shot 형태로 single-image-to-3D conversion 을 하는 기법을 처음으로 소개하였습니다. 하지만 해당 방식으로는 주어진 view 에 대해서 독립적으로 객체를 생성하게 됨으로써 multi-view consistency 에서 부족한 부분을 보여주게 된다고 설명합니다. Zero123++ 논문에서 이를 해결하기 위해 여섯개의 view 로부터 하나의 이미지를 생성하여 multi-view 에 대한 joint distirbution 을 학습할 수 있도록 설정합니다.
+
+또한, Zero-1-to-3 논문에서 다음과 같은 한계점이 있다고 제시합니다.
+
+a) 첫번째로 global 및 local conditioning mechanism 을 비롯한 Stable Diffusion model prior 를 효율적으로 사용하지 않았고,
+
+b) 두번째로 Zero-1-to-3 논문에서 512x512 이미지 해상도로 학습 시 불안정하게 수렴하게 되어 256x256 해상도로 줄인 부분에 대해 논문 저자는 원인을 분석하며 새로운 scheduling 기법을 소개합니다.
+
+## 2. Improving Consistency and Conditioning
+
+### 2.1. Multi-view Generation
+
+Zero-1-to-3 모델은 단일 이미지를 독립적으로 생성하며 multi-view 이미지에 대한 상관관계를 학습 혹은 생성 시에 고려하지 않습니다. 따라서, Zero123++에서는 3×2 layout 의 6개 이미지를 단일 프레임으로 tiling 하여 multiple image 에 대한 joint distribution 을 학습하게 됩니다.
+
+Objaverse 데이터셋은 기본적으로 gravity axis 은 동일하지만 객체들이 일관된 canonical pose 를 가지고 있지 않습니다. 따라서 절대적인 camera pose 를 기반으로 해당 데이터셋을 학습하게 되면 객체의 orientation 을 학습하는데 어려움이 있다고 주장합니다.
+
+반면에 Zero-1-to-3 는 input view 에 대한 상대적인 camera pose(elevation/azimuth angle) 을 입력받아 학습하였습니다. 그러나 해당 방식을 활용한다면 novel view 에 대한 relative pose 를 구하기 위해서는 input view 에 대한 elevation angle 을 사전에 알아야 한다는 단점이 있습니다. 후속적으로 One-2-3-45 그리고 DreamGaussian 논문에서 elevation angle 을 추가적으로 예측하는 모듈을 정의하고, 이에 따라 오차율도 증가하게 됩니다.
+
+- Elevation/Azimuth angle 이란?
+
+ :::{figure-md}
+
+
+ Elevation/Azimuth angle
+ :::
+
+
+이러한 문제를 해결하기 위해 elevation angle 을 고정시킨 상태에서 상대적인 azimuth angle 을 통한 novel view pose 를 정의합니다. 더 자세하게는 6개의 pose 를 아래 사진과 같이 정의하게 됩니다.
+
+:::{figure-md}
+
+
+3x2 layout of Zero123++ prediction
+:::
+
+### 2.2. Consistency and Stability: Noise Schedule
+
+Stable Diffusion 모델에서 사용되었던 scaled-linear schedule 은 local detail 을 학습하는데 초점을 두고 Signal-to-Noise Ratio (SNR) 가 낮은 timestep 이 극히 드뭅니다. SNR 이 낮은 구간에서 global low frequency 정보들을 학습하게 되며 해당 단계에서 step 수가 적으면 구조적인 변형이 클 수가 있습니다. 따라서, 이러한 scheduling 은 단일 이미지를 생성하는데는 유용하지만 multi-view consistent 한 이미지를 생성하는데 한계가 있다고 주장합니다.
+
+:::{figure-md}
+
+
+Linear vs Scaled linear schedule
+:::
+
+또한, 동일한 noise 가 주입되었을때 고해상도 이미지가 저해상도 이미지에 비해 noise level 이 적기 때문에, Zero-1-to-3 모델에서 고해상도 이미지를 학습하였을 때 불안정한 모습을 보여주었던 것도 동일한 원인 때문이라고 설명합니다.
+
+Zero123++ 에서는 scaled-linear schedule 대신에 linear schedule 를 사용하게 되고, 변화된 schedule 에 따라 $x$-prediction, $\epsilon$-prediction 모델보다 $v$-prediction 모델이 더 안정적으로 학습되었다고 합니다. 따라서, Stable Diffusion 2 $v$-prediction 모델로 fine-tuning 을 진행하였다고 합니다.
+
+### 2.3. Local Condition: Scaled Reference Attention
+
+기존에 Zero-1-to-3 논문에서 noisy input 과 conditioned image(single-view input) 가 feature-wise concatenate 하는데 해당 방식으로는 pixel-wise spatial correspondence 가 정확하지 않다고 합니다.
+
+Zero123++ 에서는 이 부분을 보완하여 Reference Attention 이라는 기법을 소개합니다. Reference Attention 이란, 아래 그림과 같이 noisy latent 와 conditioned latent 간에 self-attention 모듈에서의 key, value 값을 추가하여 연산 작업을 진행합니다. 이때, noisy input 에 주입된 noise 를 동일하게 conditioned image 에 적용하였다고 합니다.
+
+:::{figure-md}
+
+
+Reference Attention
+:::
+
+Reference Attention 기법을 적용한 결과, fine-tuning 작업을 진행하지 않아도 reference image 에서의 semantic content 와 texture 가 잘 반영되었습니다. 또한, fine-tuning 을 하였을때 reference latent 을 5x scaling 하였을때 reference image 와의 일관성을 가장 잘 보여주었다고 합니다.
+
+:::{figure-md}
+
+
+Comparison on local conditioning
+:::
+
+### 2.4. Global Condition: FlexDiffuse
+
+Zero123++ 논문에서 추가적으로 FlexDiffuse 에서 소개한 linear guidance mechanism 을 활용하여 fine-tuning 범위를 최소화하는 선에서 global image conditioning 하였습니다.
+
+더 자세하게는, $L \times D$ 차원의 prompt embedding $T$ 와 $D$ 차원의 CLIP global image embedding $I$ 에 global weight $w_i$ 를 곱한 값을 더하여 모델에 입력합니다. 이때, $L$ 은 token length 이고 $D$ 는 token embedding 의 차원 크기입니다. 이때, $w_i = \frac{i}{L}$ 로 초기 가중치 값을 설정하였습니다. Text condition 이 없을 경우에는 empty prompt 를 encoding 하여 $T$ 를 얻게 됩니다.
+
+:::{figure-md}
+
+
+FlexDiffuse’s linear guidance
+:::
+
+위와 같은 global conditioning 을 하였을때, 보이지 않은 unseen region 에서도 semantic 한 정보들을 유지한채 이미지를 잘 생성하는 부분을 확인할 수 있습니다.
+
+:::{figure-md}
+
+
+Ablation on global conditioning
+:::
+
+### 2.5. Putting Everything Together
+
+정리하자면 해당 논문은 Stable Diffusion 2 $v$-model 을 사용하였고, Objaverse 데이터를 random HDRI environment lighting 를 적용하여 렌더링한 데이터에 학습하였습니다. 그리고 Stable Diffusion Image Variations model 의 학습 방식을 도입하여 two-stage 로 학습을 진행하였습니다.
+
+첫번째 phase 에서는 self-attention layer 와 cross-attention layer 의 KV 행렬만 fine-tuning 을 하였고, AdamW optimizer 와 cosine annealing schedule 을 사용하였습니다. 두번째 phase 에서는 UNet 모델 전체를 학습하고 $5 \times 10^{-6}$ 값의 constant learning rate 를 사용하였습니다. 그리고 학습 과정을 더 효율적으로 하기 위해 Min-SNR weighting 기법도 활용하였습니다.
+
+## 3. Comparison to the State of the Art
+
+### 3.1. Image to Multi-view
+
+**Qualitative Comparison**
+
+논문에서 Zero-1-to-3 XL 그리고 SyncDreamer 모델과의 성능을 비교합니다. Zero123++ 모델이 unseen view 에 대해서 가장 월등하게 이미지를 생성하는 것을 확인할 수 있습니다.
+
+:::{figure-md}
+
+
+Qualitative comparison on image to multi-view task
+:::
+
+**Quantitative Comparison**
+
+정량적으로 LPIPS 지표를 기준으로 비교하였을 때에도 Zero123++ 모델이 가장 좋은 성능을 보여주고 있습니다. 이때, 모델이 생성된 6개의 이미지와 Objaverse 데이터셋을 렌더링한 6개의 이미지를 각각 결합하여 LPIPS 를 측정하였다고 합니다.
+
+:::{figure-md}
+
+
+Quantitative Comparison on image to multi-view task
+:::
+
+### 3.2. Text to Multi-view
+
+Text 를 입력받아 우선적으로 SDXL 모델을 통해 단일 이미지를 생성한 후, Zero123++ 모델을 적용한 결과입니다. MVDream 과 Zero-1-to-3 XL 모델과 비교하였을 때, Zero123++ 모델이 가장 realistic 하고 multi-view consistent 한 이미지를 생성하는 부분을 확인할 수 있습니다.
+
+:::{figure-md}
+
+
+Qualitative comparison on text to multi-view task
+:::
+
+## 4. Depth ControlNet for Zero123++
+
+아래 사진은 추가적으로 렌더링한 depth map 를 기반으로 ControlNet 을 학습한 결과입니다.
+
+:::{figure-md}
+
+
+Depth-controlled Zero123++
+:::
\ No newline at end of file
diff --git a/_sources/intro.md b/_sources/intro.md
old mode 100644
new mode 100755
diff --git a/_sphinx_design_static/design-style.4045f2051d55cab465a707391d5b2007.min.css b/_sphinx_design_static/design-style.4045f2051d55cab465a707391d5b2007.min.css
old mode 100644
new mode 100755
diff --git a/_sphinx_design_static/design-tabs.js b/_sphinx_design_static/design-tabs.js
old mode 100644
new mode 100755
diff --git a/_static/PseudoLab_logo.png b/_static/PseudoLab_logo.png
old mode 100644
new mode 100755
diff --git a/_static/__init__.py b/_static/__init__.py
old mode 100644
new mode 100755
diff --git a/_static/__pycache__/__init__.cpython-36.pyc b/_static/__pycache__/__init__.cpython-36.pyc
old mode 100644
new mode 100755
diff --git a/_static/__pycache__/__init__.cpython-37.pyc b/_static/__pycache__/__init__.cpython-37.pyc
old mode 100644
new mode 100755
diff --git a/_static/_sphinx_javascript_frameworks_compat.js b/_static/_sphinx_javascript_frameworks_compat.js
old mode 100644
new mode 100755
diff --git a/_static/basic.css b/_static/basic.css
old mode 100644
new mode 100755
index 9e364ed3..61778181
--- a/_static/basic.css
+++ b/_static/basic.css
@@ -1,930 +1,928 @@
-/*
- * basic.css
- * ~~~~~~~~~
- *
- * Sphinx stylesheet -- basic theme.
- *
- * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
- * :license: BSD, see LICENSE for details.
- *
- */
-
-/* -- main layout ----------------------------------------------------------- */
-
-div.clearer {
- clear: both;
-}
-
-div.section::after {
- display: block;
- content: '';
- clear: left;
-}
-
-/* -- relbar ---------------------------------------------------------------- */
-
-div.related {
- width: 100%;
- font-size: 90%;
-}
-
-div.related h3 {
- display: none;
-}
-
-div.related ul {
- margin: 0;
- padding: 0 0 0 10px;
- list-style: none;
-}
-
-div.related li {
- display: inline;
-}
-
-div.related li.right {
- float: right;
- margin-right: 5px;
-}
-
-/* -- sidebar --------------------------------------------------------------- */
-
-div.sphinxsidebarwrapper {
- padding: 10px 5px 0 10px;
-}
-
-div.sphinxsidebar {
- float: left;
- width: 270px;
- margin-left: -100%;
- font-size: 90%;
- word-wrap: break-word;
- overflow-wrap : break-word;
-}
-
-div.sphinxsidebar ul {
- list-style: none;
-}
-
-div.sphinxsidebar ul ul,
-div.sphinxsidebar ul.want-points {
- margin-left: 20px;
- list-style: square;
-}
-
-div.sphinxsidebar ul ul {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-div.sphinxsidebar form {
- margin-top: 10px;
-}
-
-div.sphinxsidebar input {
- border: 1px solid #98dbcc;
- font-family: sans-serif;
- font-size: 1em;
-}
-
-div.sphinxsidebar #searchbox form.search {
- overflow: hidden;
-}
-
-div.sphinxsidebar #searchbox input[type="text"] {
- float: left;
- width: 80%;
- padding: 0.25em;
- box-sizing: border-box;
-}
-
-div.sphinxsidebar #searchbox input[type="submit"] {
- float: left;
- width: 20%;
- border-left: none;
- padding: 0.25em;
- box-sizing: border-box;
-}
-
-
-img {
- border: 0;
- max-width: 100%;
-}
-
-/* -- search page ----------------------------------------------------------- */
-
-ul.search {
- margin: 10px 0 0 20px;
- padding: 0;
-}
-
-ul.search li {
- padding: 5px 0 5px 20px;
- background-image: url(file.png);
- background-repeat: no-repeat;
- background-position: 0 7px;
-}
-
-ul.search li a {
- font-weight: bold;
-}
-
-ul.search li p.context {
- color: #888;
- margin: 2px 0 0 30px;
- text-align: left;
-}
-
-ul.keywordmatches li.goodmatch a {
- font-weight: bold;
-}
-
-/* -- index page ------------------------------------------------------------ */
-
-table.contentstable {
- width: 90%;
- margin-left: auto;
- margin-right: auto;
-}
-
-table.contentstable p.biglink {
- line-height: 150%;
-}
-
-a.biglink {
- font-size: 1.3em;
-}
-
-span.linkdescr {
- font-style: italic;
- padding-top: 5px;
- font-size: 90%;
-}
-
-/* -- general index --------------------------------------------------------- */
-
-table.indextable {
- width: 100%;
-}
-
-table.indextable td {
- text-align: left;
- vertical-align: top;
-}
-
-table.indextable ul {
- margin-top: 0;
- margin-bottom: 0;
- list-style-type: none;
-}
-
-table.indextable > tbody > tr > td > ul {
- padding-left: 0em;
-}
-
-table.indextable tr.pcap {
- height: 10px;
-}
-
-table.indextable tr.cap {
- margin-top: 10px;
- background-color: #f2f2f2;
-}
-
-img.toggler {
- margin-right: 3px;
- margin-top: 3px;
- cursor: pointer;
-}
-
-div.modindex-jumpbox {
- border-top: 1px solid #ddd;
- border-bottom: 1px solid #ddd;
- margin: 1em 0 1em 0;
- padding: 0.4em;
-}
-
-div.genindex-jumpbox {
- border-top: 1px solid #ddd;
- border-bottom: 1px solid #ddd;
- margin: 1em 0 1em 0;
- padding: 0.4em;
-}
-
-/* -- domain module index --------------------------------------------------- */
-
-table.modindextable td {
- padding: 2px;
- border-collapse: collapse;
-}
-
-/* -- general body styles --------------------------------------------------- */
-
-div.body {
- min-width: 360px;
- max-width: 800px;
-}
-
-div.body p, div.body dd, div.body li, div.body blockquote {
- -moz-hyphens: auto;
- -ms-hyphens: auto;
- -webkit-hyphens: auto;
- hyphens: auto;
-}
-
-a.headerlink {
- visibility: hidden;
-}
-
-h1:hover > a.headerlink,
-h2:hover > a.headerlink,
-h3:hover > a.headerlink,
-h4:hover > a.headerlink,
-h5:hover > a.headerlink,
-h6:hover > a.headerlink,
-dt:hover > a.headerlink,
-caption:hover > a.headerlink,
-p.caption:hover > a.headerlink,
-div.code-block-caption:hover > a.headerlink {
- visibility: visible;
-}
-
-div.body p.caption {
- text-align: inherit;
-}
-
-div.body td {
- text-align: left;
-}
-
-.first {
- margin-top: 0 !important;
-}
-
-p.rubric {
- margin-top: 30px;
- font-weight: bold;
-}
-
-img.align-left, figure.align-left, .figure.align-left, object.align-left {
- clear: left;
- float: left;
- margin-right: 1em;
-}
-
-img.align-right, figure.align-right, .figure.align-right, object.align-right {
- clear: right;
- float: right;
- margin-left: 1em;
-}
-
-img.align-center, figure.align-center, .figure.align-center, object.align-center {
- display: block;
- margin-left: auto;
- margin-right: auto;
-}
-
-img.align-default, figure.align-default, .figure.align-default {
- display: block;
- margin-left: auto;
- margin-right: auto;
-}
-
-.align-left {
- text-align: left;
-}
-
-.align-center {
- text-align: center;
-}
-
-.align-default {
- text-align: center;
-}
-
-.align-right {
- text-align: right;
-}
-
-/* -- sidebars -------------------------------------------------------------- */
-
-div.sidebar,
-aside.sidebar {
- margin: 0 0 0.5em 1em;
- border: 1px solid #ddb;
- padding: 7px;
- background-color: #ffe;
- width: 40%;
- float: right;
- clear: right;
- overflow-x: auto;
-}
-
-p.sidebar-title {
- font-weight: bold;
-}
-nav.contents,
-aside.topic,
-
-div.admonition, div.topic, blockquote {
- clear: left;
-}
-
-/* -- topics ---------------------------------------------------------------- */
-nav.contents,
-aside.topic,
-
-div.topic {
- border: 1px solid #ccc;
- padding: 7px;
- margin: 10px 0 10px 0;
-}
-
-p.topic-title {
- font-size: 1.1em;
- font-weight: bold;
- margin-top: 10px;
-}
-
-/* -- admonitions ----------------------------------------------------------- */
-
-div.admonition {
- margin-top: 10px;
- margin-bottom: 10px;
- padding: 7px;
-}
-
-div.admonition dt {
- font-weight: bold;
-}
-
-p.admonition-title {
- margin: 0px 10px 5px 0px;
- font-weight: bold;
-}
-
-div.body p.centered {
- text-align: center;
- margin-top: 25px;
-}
-
-/* -- content of sidebars/topics/admonitions -------------------------------- */
-
-div.sidebar > :last-child,
-aside.sidebar > :last-child,
-nav.contents > :last-child,
-aside.topic > :last-child,
-
-div.topic > :last-child,
-div.admonition > :last-child {
- margin-bottom: 0;
-}
-
-div.sidebar::after,
-aside.sidebar::after,
-nav.contents::after,
-aside.topic::after,
-
-div.topic::after,
-div.admonition::after,
-blockquote::after {
- display: block;
- content: '';
- clear: both;
-}
-
-/* -- tables ---------------------------------------------------------------- */
-
-table.docutils {
- margin-top: 10px;
- margin-bottom: 10px;
- border: 0;
- border-collapse: collapse;
-}
-
-table.align-center {
- margin-left: auto;
- margin-right: auto;
-}
-
-table.align-default {
- margin-left: auto;
- margin-right: auto;
-}
-
-table caption span.caption-number {
- font-style: italic;
-}
-
-table caption span.caption-text {
-}
-
-table.docutils td, table.docutils th {
- padding: 1px 8px 1px 5px;
- border-top: 0;
- border-left: 0;
- border-right: 0;
- border-bottom: 1px solid #aaa;
-}
-
-th {
- text-align: left;
- padding-right: 5px;
-}
-
-table.citation {
- border-left: solid 1px gray;
- margin-left: 1px;
-}
-
-table.citation td {
- border-bottom: none;
-}
-
-th > :first-child,
-td > :first-child {
- margin-top: 0px;
-}
-
-th > :last-child,
-td > :last-child {
- margin-bottom: 0px;
-}
-
-/* -- figures --------------------------------------------------------------- */
-
-div.figure, figure {
- margin: 0.5em;
- padding: 0.5em;
-}
-
-div.figure p.caption, figcaption {
- padding: 0.3em;
-}
-
-div.figure p.caption span.caption-number,
-figcaption span.caption-number {
- font-style: italic;
-}
-
-div.figure p.caption span.caption-text,
-figcaption span.caption-text {
-}
-
-/* -- field list styles ----------------------------------------------------- */
-
-table.field-list td, table.field-list th {
- border: 0 !important;
-}
-
-.field-list ul {
- margin: 0;
- padding-left: 1em;
-}
-
-.field-list p {
- margin: 0;
-}
-
-.field-name {
- -moz-hyphens: manual;
- -ms-hyphens: manual;
- -webkit-hyphens: manual;
- hyphens: manual;
-}
-
-/* -- hlist styles ---------------------------------------------------------- */
-
-table.hlist {
- margin: 1em 0;
-}
-
-table.hlist td {
- vertical-align: top;
-}
-
-/* -- object description styles --------------------------------------------- */
-
-.sig {
- font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
-}
-
-.sig-name, code.descname {
- background-color: transparent;
- font-weight: bold;
-}
-
-.sig-name {
- font-size: 1.1em;
-}
-
-code.descname {
- font-size: 1.2em;
-}
-
-.sig-prename, code.descclassname {
- background-color: transparent;
-}
-
-.optional {
- font-size: 1.3em;
-}
-
-.sig-paren {
- font-size: larger;
-}
-
-.sig-param.n {
- font-style: italic;
-}
-
-/* C++ specific styling */
-
-.sig-inline.c-texpr,
-.sig-inline.cpp-texpr {
- font-family: unset;
-}
-
-.sig.c .k, .sig.c .kt,
-.sig.cpp .k, .sig.cpp .kt {
- color: #0033B3;
-}
-
-.sig.c .m,
-.sig.cpp .m {
- color: #1750EB;
-}
-
-.sig.c .s, .sig.c .sc,
-.sig.cpp .s, .sig.cpp .sc {
- color: #067D17;
-}
-
-
-/* -- other body styles ----------------------------------------------------- */
-
-ol.arabic {
- list-style: decimal;
-}
-
-ol.loweralpha {
- list-style: lower-alpha;
-}
-
-ol.upperalpha {
- list-style: upper-alpha;
-}
-
-ol.lowerroman {
- list-style: lower-roman;
-}
-
-ol.upperroman {
- list-style: upper-roman;
-}
-
-:not(li) > ol > li:first-child > :first-child,
-:not(li) > ul > li:first-child > :first-child {
- margin-top: 0px;
-}
-
-:not(li) > ol > li:last-child > :last-child,
-:not(li) > ul > li:last-child > :last-child {
- margin-bottom: 0px;
-}
-
-ol.simple ol p,
-ol.simple ul p,
-ul.simple ol p,
-ul.simple ul p {
- margin-top: 0;
-}
-
-ol.simple > li:not(:first-child) > p,
-ul.simple > li:not(:first-child) > p {
- margin-top: 0;
-}
-
-ol.simple p,
-ul.simple p {
- margin-bottom: 0;
-}
-
-/* Docutils 0.17 and older (footnotes & citations) */
-dl.footnote > dt,
-dl.citation > dt {
- float: left;
- margin-right: 0.5em;
-}
-
-dl.footnote > dd,
-dl.citation > dd {
- margin-bottom: 0em;
-}
-
-dl.footnote > dd:after,
-dl.citation > dd:after {
- content: "";
- clear: both;
-}
-
-/* Docutils 0.18+ (footnotes & citations) */
-aside.footnote > span,
-div.citation > span {
- float: left;
-}
-aside.footnote > span:last-of-type,
-div.citation > span:last-of-type {
- padding-right: 0.5em;
-}
-aside.footnote > p {
- margin-left: 2em;
-}
-div.citation > p {
- margin-left: 4em;
-}
-aside.footnote > p:last-of-type,
-div.citation > p:last-of-type {
- margin-bottom: 0em;
-}
-aside.footnote > p:last-of-type:after,
-div.citation > p:last-of-type:after {
- content: "";
- clear: both;
-}
-
-/* Footnotes & citations ends */
-
-dl.field-list {
- display: grid;
- grid-template-columns: fit-content(30%) auto;
-}
-
-dl.field-list > dt {
- font-weight: bold;
- word-break: break-word;
- padding-left: 0.5em;
- padding-right: 5px;
-}
-
-dl.field-list > dt:after {
- content: ":";
-}
-
-dl.field-list > dd {
- padding-left: 0.5em;
- margin-top: 0em;
- margin-left: 0em;
- margin-bottom: 0em;
-}
-
-dl {
- margin-bottom: 15px;
-}
-
-dd > :first-child {
- margin-top: 0px;
-}
-
-dd ul, dd table {
- margin-bottom: 10px;
-}
-
-dd {
- margin-top: 3px;
- margin-bottom: 10px;
- margin-left: 30px;
-}
-
-dl > dd:last-child,
-dl > dd:last-child > :last-child {
- margin-bottom: 0;
-}
-
-dt:target, span.highlighted {
- background-color: #fbe54e;
-}
-
-rect.highlighted {
- fill: #fbe54e;
-}
-
-dl.glossary dt {
- font-weight: bold;
- font-size: 1.1em;
-}
-
-.versionmodified {
- font-style: italic;
-}
-
-.system-message {
- background-color: #fda;
- padding: 5px;
- border: 3px solid red;
-}
-
-.footnote:target {
- background-color: #ffa;
-}
-
-.line-block {
- display: block;
- margin-top: 1em;
- margin-bottom: 1em;
-}
-
-.line-block .line-block {
- margin-top: 0;
- margin-bottom: 0;
- margin-left: 1.5em;
-}
-
-.guilabel, .menuselection {
- font-family: sans-serif;
-}
-
-.accelerator {
- text-decoration: underline;
-}
-
-.classifier {
- font-style: oblique;
-}
-
-.classifier:before {
- font-style: normal;
- margin: 0 0.5em;
- content: ":";
- display: inline-block;
-}
-
-abbr, acronym {
- border-bottom: dotted 1px;
- cursor: help;
-}
-
-/* -- code displays --------------------------------------------------------- */
-
-pre {
- overflow: auto;
- overflow-y: hidden; /* fixes display issues on Chrome browsers */
-}
-
-pre, div[class*="highlight-"] {
- clear: both;
-}
-
-span.pre {
- -moz-hyphens: none;
- -ms-hyphens: none;
- -webkit-hyphens: none;
- hyphens: none;
- white-space: nowrap;
-}
-
-div[class*="highlight-"] {
- margin: 1em 0;
-}
-
-td.linenos pre {
- border: 0;
- background-color: transparent;
- color: #aaa;
-}
-
-table.highlighttable {
- display: block;
-}
-
-table.highlighttable tbody {
- display: block;
-}
-
-table.highlighttable tr {
- display: flex;
-}
-
-table.highlighttable td {
- margin: 0;
- padding: 0;
-}
-
-table.highlighttable td.linenos {
- padding-right: 0.5em;
-}
-
-table.highlighttable td.code {
- flex: 1;
- overflow: hidden;
-}
-
-.highlight .hll {
- display: block;
-}
-
-div.highlight pre,
-table.highlighttable pre {
- margin: 0;
-}
-
-div.code-block-caption + div {
- margin-top: 0;
-}
-
-div.code-block-caption {
- margin-top: 1em;
- padding: 2px 5px;
- font-size: small;
-}
-
-div.code-block-caption code {
- background-color: transparent;
-}
-
-table.highlighttable td.linenos,
-span.linenos,
-div.highlight span.gp { /* gp: Generic.Prompt */
- user-select: none;
- -webkit-user-select: text; /* Safari fallback only */
- -webkit-user-select: none; /* Chrome/Safari */
- -moz-user-select: none; /* Firefox */
- -ms-user-select: none; /* IE10+ */
-}
-
-div.code-block-caption span.caption-number {
- padding: 0.1em 0.3em;
- font-style: italic;
-}
-
-div.code-block-caption span.caption-text {
-}
-
-div.literal-block-wrapper {
- margin: 1em 0;
-}
-
-code.xref, a code {
- background-color: transparent;
- font-weight: bold;
-}
-
-h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
- background-color: transparent;
-}
-
-.viewcode-link {
- float: right;
-}
-
-.viewcode-back {
- float: right;
- font-family: sans-serif;
-}
-
-div.viewcode-block:target {
- margin: -1px -10px;
- padding: 0 10px;
-}
-
-/* -- math display ---------------------------------------------------------- */
-
-img.math {
- vertical-align: middle;
-}
-
-div.body div.math p {
- text-align: center;
-}
-
-span.eqno {
- float: right;
-}
-
-span.eqno a.headerlink {
- position: absolute;
- z-index: 1;
-}
-
-div.math:hover a.headerlink {
- visibility: visible;
-}
-
-/* -- printout stylesheet --------------------------------------------------- */
-
-@media print {
- div.document,
- div.documentwrapper,
- div.bodywrapper {
- margin: 0 !important;
- width: 100%;
- }
-
- div.sphinxsidebar,
- div.related,
- div.footer,
- #top-link {
- display: none;
- }
+/*
+ * basic.css
+ * ~~~~~~~~~
+ *
+ * Sphinx stylesheet -- basic theme.
+ *
+ * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
+ * :license: BSD, see LICENSE for details.
+ *
+ */
+
+/* -- main layout ----------------------------------------------------------- */
+
+div.clearer {
+ clear: both;
+}
+
+div.section::after {
+ display: block;
+ content: '';
+ clear: left;
+}
+
+/* -- relbar ---------------------------------------------------------------- */
+
+div.related {
+ width: 100%;
+ font-size: 90%;
+}
+
+div.related h3 {
+ display: none;
+}
+
+div.related ul {
+ margin: 0;
+ padding: 0 0 0 10px;
+ list-style: none;
+}
+
+div.related li {
+ display: inline;
+}
+
+div.related li.right {
+ float: right;
+ margin-right: 5px;
+}
+
+/* -- sidebar --------------------------------------------------------------- */
+
+div.sphinxsidebarwrapper {
+ padding: 10px 5px 0 10px;
+}
+
+div.sphinxsidebar {
+ float: left;
+ width: 270px;
+ margin-left: -100%;
+ font-size: 90%;
+ word-wrap: break-word;
+ overflow-wrap : break-word;
+}
+
+div.sphinxsidebar ul {
+ list-style: none;
+}
+
+div.sphinxsidebar ul ul,
+div.sphinxsidebar ul.want-points {
+ margin-left: 20px;
+ list-style: square;
+}
+
+div.sphinxsidebar ul ul {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+div.sphinxsidebar form {
+ margin-top: 10px;
+}
+
+div.sphinxsidebar input {
+ border: 1px solid #98dbcc;
+ font-family: sans-serif;
+ font-size: 1em;
+}
+
+div.sphinxsidebar #searchbox form.search {
+ overflow: hidden;
+}
+
+div.sphinxsidebar #searchbox input[type="text"] {
+ float: left;
+ width: 80%;
+ padding: 0.25em;
+ box-sizing: border-box;
+}
+
+div.sphinxsidebar #searchbox input[type="submit"] {
+ float: left;
+ width: 20%;
+ border-left: none;
+ padding: 0.25em;
+ box-sizing: border-box;
+}
+
+
+img {
+ border: 0;
+ max-width: 100%;
+}
+
+/* -- search page ----------------------------------------------------------- */
+
+ul.search {
+ margin: 10px 0 0 20px;
+ padding: 0;
+}
+
+ul.search li {
+ padding: 5px 0 5px 20px;
+ background-image: url(file.png);
+ background-repeat: no-repeat;
+ background-position: 0 7px;
+}
+
+ul.search li a {
+ font-weight: bold;
+}
+
+ul.search li p.context {
+ color: #888;
+ margin: 2px 0 0 30px;
+ text-align: left;
+}
+
+ul.keywordmatches li.goodmatch a {
+ font-weight: bold;
+}
+
+/* -- index page ------------------------------------------------------------ */
+
+table.contentstable {
+ width: 90%;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+table.contentstable p.biglink {
+ line-height: 150%;
+}
+
+a.biglink {
+ font-size: 1.3em;
+}
+
+span.linkdescr {
+ font-style: italic;
+ padding-top: 5px;
+ font-size: 90%;
+}
+
+/* -- general index --------------------------------------------------------- */
+
+table.indextable {
+ width: 100%;
+}
+
+table.indextable td {
+ text-align: left;
+ vertical-align: top;
+}
+
+table.indextable ul {
+ margin-top: 0;
+ margin-bottom: 0;
+ list-style-type: none;
+}
+
+table.indextable > tbody > tr > td > ul {
+ padding-left: 0em;
+}
+
+table.indextable tr.pcap {
+ height: 10px;
+}
+
+table.indextable tr.cap {
+ margin-top: 10px;
+ background-color: #f2f2f2;
+}
+
+img.toggler {
+ margin-right: 3px;
+ margin-top: 3px;
+ cursor: pointer;
+}
+
+div.modindex-jumpbox {
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 1em 0 1em 0;
+ padding: 0.4em;
+}
+
+div.genindex-jumpbox {
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+ margin: 1em 0 1em 0;
+ padding: 0.4em;
+}
+
+/* -- domain module index --------------------------------------------------- */
+
+table.modindextable td {
+ padding: 2px;
+ border-collapse: collapse;
+}
+
+/* -- general body styles --------------------------------------------------- */
+
+div.body {
+ min-width: 360px;
+ max-width: 800px;
+}
+
+div.body p, div.body dd, div.body li, div.body blockquote {
+ -moz-hyphens: auto;
+ -ms-hyphens: auto;
+ -webkit-hyphens: auto;
+ hyphens: auto;
+}
+
+a.headerlink {
+ visibility: hidden;
+}
+a.brackets:before,
+span.brackets > a:before{
+ content: "[";
+}
+
+a.brackets:after,
+span.brackets > a:after {
+ content: "]";
+}
+
+
+h1:hover > a.headerlink,
+h2:hover > a.headerlink,
+h3:hover > a.headerlink,
+h4:hover > a.headerlink,
+h5:hover > a.headerlink,
+h6:hover > a.headerlink,
+dt:hover > a.headerlink,
+caption:hover > a.headerlink,
+p.caption:hover > a.headerlink,
+div.code-block-caption:hover > a.headerlink {
+ visibility: visible;
+}
+
+div.body p.caption {
+ text-align: inherit;
+}
+
+div.body td {
+ text-align: left;
+}
+
+.first {
+ margin-top: 0 !important;
+}
+
+p.rubric {
+ margin-top: 30px;
+ font-weight: bold;
+}
+
+img.align-left, figure.align-left, .figure.align-left, object.align-left {
+ clear: left;
+ float: left;
+ margin-right: 1em;
+}
+
+img.align-right, figure.align-right, .figure.align-right, object.align-right {
+ clear: right;
+ float: right;
+ margin-left: 1em;
+}
+
+img.align-center, figure.align-center, .figure.align-center, object.align-center {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+img.align-default, figure.align-default, .figure.align-default {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+.align-left {
+ text-align: left;
+}
+
+.align-center {
+ text-align: center;
+}
+
+.align-default {
+ text-align: center;
+}
+
+.align-right {
+ text-align: right;
+}
+
+/* -- sidebars -------------------------------------------------------------- */
+
+div.sidebar,
+aside.sidebar {
+ margin: 0 0 0.5em 1em;
+ border: 1px solid #ddb;
+ padding: 7px;
+ background-color: #ffe;
+ width: 40%;
+ float: right;
+ clear: right;
+ overflow-x: auto;
+}
+
+p.sidebar-title {
+ font-weight: bold;
+}
+div.admonition, div.topic, blockquote {
+ clear: left;
+}
+
+/* -- topics ---------------------------------------------------------------- */
+div.topic {
+ border: 1px solid #ccc;
+ padding: 7px;
+ margin: 10px 0 10px 0;
+}
+
+p.topic-title {
+ font-size: 1.1em;
+ font-weight: bold;
+ margin-top: 10px;
+}
+
+/* -- admonitions ----------------------------------------------------------- */
+
+div.admonition {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ padding: 7px;
+}
+
+div.admonition dt {
+ font-weight: bold;
+}
+
+p.admonition-title {
+ margin: 0px 10px 5px 0px;
+ font-weight: bold;
+}
+
+div.body p.centered {
+ text-align: center;
+ margin-top: 25px;
+}
+
+/* -- content of sidebars/topics/admonitions -------------------------------- */
+
+div.sidebar > :last-child,
+aside.sidebar > :last-child,
+div.topic > :last-child,
+div.admonition > :last-child {
+ margin-bottom: 0;
+}
+
+div.sidebar::after,
+aside.sidebar::after,
+div.topic::after,
+div.admonition::after,
+blockquote::after {
+ display: block;
+ content: '';
+ clear: both;
+}
+
+/* -- tables ---------------------------------------------------------------- */
+
+table.docutils {
+ margin-top: 10px;
+ margin-bottom: 10px;
+ border: 0;
+ border-collapse: collapse;
+}
+
+table.align-center {
+ margin-left: auto;
+ margin-right: auto;
+}
+
+table.align-default {
+ margin-left: auto;
+ margin-right: auto;
+}
+
+table caption span.caption-number {
+ font-style: italic;
+}
+
+table caption span.caption-text {
+}
+
+table.docutils td, table.docutils th {
+ padding: 1px 8px 1px 5px;
+ border-top: 0;
+ border-left: 0;
+ border-right: 0;
+ border-bottom: 1px solid #aaa;
+}
+
+th {
+ text-align: left;
+ padding-right: 5px;
+}
+
+table.citation {
+ border-left: solid 1px gray;
+ margin-left: 1px;
+}
+
+table.citation td {
+ border-bottom: none;
+}
+
+th > :first-child,
+td > :first-child {
+ margin-top: 0px;
+}
+
+th > :last-child,
+td > :last-child {
+ margin-bottom: 0px;
+}
+
+/* -- figures --------------------------------------------------------------- */
+
+div.figure, figure {
+ margin: 0.5em;
+ padding: 0.5em;
+}
+
+div.figure p.caption, figcaption {
+ padding: 0.3em;
+}
+
+div.figure p.caption span.caption-number,
+figcaption span.caption-number {
+ font-style: italic;
+}
+
+div.figure p.caption span.caption-text,
+figcaption span.caption-text {
+}
+
+/* -- field list styles ----------------------------------------------------- */
+
+table.field-list td, table.field-list th {
+ border: 0 !important;
+}
+
+.field-list ul {
+ margin: 0;
+ padding-left: 1em;
+}
+
+.field-list p {
+ margin: 0;
+}
+
+.field-name {
+ -moz-hyphens: manual;
+ -ms-hyphens: manual;
+ -webkit-hyphens: manual;
+ hyphens: manual;
+}
+
+/* -- hlist styles ---------------------------------------------------------- */
+
+table.hlist {
+ margin: 1em 0;
+}
+
+table.hlist td {
+ vertical-align: top;
+}
+
+/* -- object description styles --------------------------------------------- */
+
+.sig {
+ font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
+}
+
+.sig-name, code.descname {
+ background-color: transparent;
+ font-weight: bold;
+}
+
+.sig-name {
+ font-size: 1.1em;
+}
+
+code.descname {
+ font-size: 1.2em;
+}
+
+.sig-prename, code.descclassname {
+ background-color: transparent;
+}
+
+.optional {
+ font-size: 1.3em;
+}
+
+.sig-paren {
+ font-size: larger;
+}
+
+.sig-param.n {
+ font-style: italic;
+}
+
+/* C++ specific styling */
+
+.sig-inline.c-texpr,
+.sig-inline.cpp-texpr {
+ font-family: unset;
+}
+
+.sig.c .k, .sig.c .kt,
+.sig.cpp .k, .sig.cpp .kt {
+ color: #0033B3;
+}
+
+.sig.c .m,
+.sig.cpp .m {
+ color: #1750EB;
+}
+
+.sig.c .s, .sig.c .sc,
+.sig.cpp .s, .sig.cpp .sc {
+ color: #067D17;
+}
+
+
+/* -- other body styles ----------------------------------------------------- */
+
+ol.arabic {
+ list-style: decimal;
+}
+
+ol.loweralpha {
+ list-style: lower-alpha;
+}
+
+ol.upperalpha {
+ list-style: upper-alpha;
+}
+
+ol.lowerroman {
+ list-style: lower-roman;
+}
+
+ol.upperroman {
+ list-style: upper-roman;
+}
+
+:not(li) > ol > li:first-child > :first-child,
+:not(li) > ul > li:first-child > :first-child {
+ margin-top: 0px;
+}
+
+:not(li) > ol > li:last-child > :last-child,
+:not(li) > ul > li:last-child > :last-child {
+ margin-bottom: 0px;
+}
+
+ol.simple ol p,
+ol.simple ul p,
+ul.simple ol p,
+ul.simple ul p {
+ margin-top: 0;
+}
+
+ol.simple > li:not(:first-child) > p,
+ul.simple > li:not(:first-child) > p {
+ margin-top: 0;
+}
+
+ol.simple p,
+ul.simple p {
+ margin-bottom: 0;
+}
+
+/* Docutils 0.17 and older (footnotes & citations) */
+dl.footnote > dt,
+dl.citation > dt {
+ float: left;
+ margin-right: 0.5em;
+}
+
+dl.footnote > dd,
+dl.citation > dd {
+ margin-bottom: 0em;
+}
+
+dl.footnote > dd:after,
+dl.citation > dd:after {
+ content: "";
+ clear: both;
+}
+
+/* Docutils 0.18+ (footnotes & citations) */
+aside.footnote > span,
+div.citation > span {
+ float: left;
+}
+aside.footnote > span:last-of-type,
+div.citation > span:last-of-type {
+ padding-right: 0.5em;
+}
+aside.footnote > p {
+ margin-left: 2em;
+}
+div.citation > p {
+ margin-left: 4em;
+}
+aside.footnote > p:last-of-type,
+div.citation > p:last-of-type {
+ margin-bottom: 0em;
+}
+aside.footnote > p:last-of-type:after,
+div.citation > p:last-of-type:after {
+ content: "";
+ clear: both;
+}
+
+/* Footnotes & citations ends */
+
+dl.field-list {
+ display: grid;
+ grid-template-columns: fit-content(30%) auto;
+}
+
+dl.field-list > dt {
+ font-weight: bold;
+ word-break: break-word;
+ padding-left: 0.5em;
+ padding-right: 5px;
+}
+
+dl.field-list > dt:after {
+ content: ":";
+}
+
+dl.field-list > dd {
+ padding-left: 0.5em;
+ margin-top: 0em;
+ margin-left: 0em;
+ margin-bottom: 0em;
+}
+
+dl {
+ margin-bottom: 15px;
+}
+
+dd > :first-child {
+ margin-top: 0px;
+}
+
+dd ul, dd table {
+ margin-bottom: 10px;
+}
+
+dd {
+ margin-top: 3px;
+ margin-bottom: 10px;
+ margin-left: 30px;
+}
+
+dl > dd:last-child,
+dl > dd:last-child > :last-child {
+ margin-bottom: 0;
+}
+
+dt:target, span.highlighted {
+ background-color: #fbe54e;
+}
+
+rect.highlighted {
+ fill: #fbe54e;
+}
+
+dl.glossary dt {
+ font-weight: bold;
+ font-size: 1.1em;
+}
+
+.versionmodified {
+ font-style: italic;
+}
+
+.system-message {
+ background-color: #fda;
+ padding: 5px;
+ border: 3px solid red;
+}
+
+.footnote:target {
+ background-color: #ffa;
+}
+
+.line-block {
+ display: block;
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+.line-block .line-block {
+ margin-top: 0;
+ margin-bottom: 0;
+ margin-left: 1.5em;
+}
+
+.guilabel, .menuselection {
+ font-family: sans-serif;
+}
+
+.accelerator {
+ text-decoration: underline;
+}
+
+.classifier {
+ font-style: oblique;
+}
+
+.classifier:before {
+ font-style: normal;
+ margin: 0 0.5em;
+ content: ":";
+ display: inline-block;
+}
+
+abbr, acronym {
+ border-bottom: dotted 1px;
+ cursor: help;
+}
+
+/* -- code displays --------------------------------------------------------- */
+
+pre {
+ overflow: auto;
+ overflow-y: hidden; /* fixes display issues on Chrome browsers */
+}
+
+pre, div[class*="highlight-"] {
+ clear: both;
+}
+
+span.pre {
+ -moz-hyphens: none;
+ -ms-hyphens: none;
+ -webkit-hyphens: none;
+ hyphens: none;
+ white-space: nowrap;
+}
+
+div[class*="highlight-"] {
+ margin: 1em 0;
+}
+
+td.linenos pre {
+ border: 0;
+ background-color: transparent;
+ color: #aaa;
+}
+
+table.highlighttable {
+ display: block;
+}
+
+table.highlighttable tbody {
+ display: block;
+}
+
+table.highlighttable tr {
+ display: flex;
+}
+
+table.highlighttable td {
+ margin: 0;
+ padding: 0;
+}
+
+table.highlighttable td.linenos {
+ padding-right: 0.5em;
+}
+
+table.highlighttable td.code {
+ flex: 1;
+ overflow: hidden;
+}
+
+.highlight .hll {
+ display: block;
+}
+
+div.highlight pre,
+table.highlighttable pre {
+ margin: 0;
+}
+
+div.code-block-caption + div {
+ margin-top: 0;
+}
+
+div.code-block-caption {
+ margin-top: 1em;
+ padding: 2px 5px;
+ font-size: small;
+}
+
+div.code-block-caption code {
+ background-color: transparent;
+}
+
+table.highlighttable td.linenos,
+span.linenos,
+div.highlight span.gp { /* gp: Generic.Prompt */
+ user-select: none;
+ -webkit-user-select: text; /* Safari fallback only */
+ -webkit-user-select: none; /* Chrome/Safari */
+ -moz-user-select: none; /* Firefox */
+ -ms-user-select: none; /* IE10+ */
+}
+
+div.code-block-caption span.caption-number {
+ padding: 0.1em 0.3em;
+ font-style: italic;
+}
+
+div.code-block-caption span.caption-text {
+}
+
+div.literal-block-wrapper {
+ margin: 1em 0;
+}
+
+code.xref, a code {
+ background-color: transparent;
+ font-weight: bold;
+}
+
+h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
+ background-color: transparent;
+}
+
+.viewcode-link {
+ float: right;
+}
+
+.viewcode-back {
+ float: right;
+ font-family: sans-serif;
+}
+
+div.viewcode-block:target {
+ margin: -1px -10px;
+ padding: 0 10px;
+}
+
+/* -- math display ---------------------------------------------------------- */
+
+img.math {
+ vertical-align: middle;
+}
+
+div.body div.math p {
+ text-align: center;
+}
+
+span.eqno {
+ float: right;
+}
+
+span.eqno a.headerlink {
+ position: absolute;
+ z-index: 1;
+}
+
+div.math:hover a.headerlink {
+ visibility: visible;
+}
+
+/* -- printout stylesheet --------------------------------------------------- */
+
+@media print {
+ div.document,
+ div.documentwrapper,
+ div.bodywrapper {
+ margin: 0 !important;
+ width: 100%;
+ }
+
+ div.sphinxsidebar,
+ div.related,
+ div.footer,
+ #top-link {
+ display: none;
+ }
}
\ No newline at end of file
diff --git a/_static/check-solid.svg b/_static/check-solid.svg
old mode 100644
new mode 100755
diff --git a/_static/clipboard.min.js b/_static/clipboard.min.js
old mode 100644
new mode 100755
diff --git a/_static/copy-button.svg b/_static/copy-button.svg
old mode 100644
new mode 100755
diff --git a/_static/copybutton.css b/_static/copybutton.css
old mode 100644
new mode 100755
diff --git a/_static/copybutton.js b/_static/copybutton.js
old mode 100644
new mode 100755
index 2ea7ff3e..f4ec4edc
--- a/_static/copybutton.js
+++ b/_static/copybutton.js
@@ -1,248 +1,248 @@
-// Localization support
-const messages = {
- 'en': {
- 'copy': 'Copy',
- 'copy_to_clipboard': 'Copy to clipboard',
- 'copy_success': 'Copied!',
- 'copy_failure': 'Failed to copy',
- },
- 'es' : {
- 'copy': 'Copiar',
- 'copy_to_clipboard': 'Copiar al portapapeles',
- 'copy_success': '¡Copiado!',
- 'copy_failure': 'Error al copiar',
- },
- 'de' : {
- 'copy': 'Kopieren',
- 'copy_to_clipboard': 'In die Zwischenablage kopieren',
- 'copy_success': 'Kopiert!',
- 'copy_failure': 'Fehler beim Kopieren',
- },
- 'fr' : {
- 'copy': 'Copier',
- 'copy_to_clipboard': 'Copier dans le presse-papier',
- 'copy_success': 'Copié !',
- 'copy_failure': 'Échec de la copie',
- },
- 'ru': {
- 'copy': 'Скопировать',
- 'copy_to_clipboard': 'Скопировать в буфер',
- 'copy_success': 'Скопировано!',
- 'copy_failure': 'Не удалось скопировать',
- },
- 'zh-CN': {
- 'copy': '复制',
- 'copy_to_clipboard': '复制到剪贴板',
- 'copy_success': '复制成功!',
- 'copy_failure': '复制失败',
- },
- 'it' : {
- 'copy': 'Copiare',
- 'copy_to_clipboard': 'Copiato negli appunti',
- 'copy_success': 'Copiato!',
- 'copy_failure': 'Errore durante la copia',
- }
-}
-
-let locale = 'en'
-if( document.documentElement.lang !== undefined
- && messages[document.documentElement.lang] !== undefined ) {
- locale = document.documentElement.lang
-}
-
-let doc_url_root = DOCUMENTATION_OPTIONS.URL_ROOT;
-if (doc_url_root == '#') {
- doc_url_root = '';
-}
-
-/**
- * SVG files for our copy buttons
- */
-let iconCheck = ``
-
-// If the user specified their own SVG use that, otherwise use the default
-let iconCopy = ``;
-if (!iconCopy) {
- iconCopy = ``
-}
-
-/**
- * Set up copy/paste for code blocks
- */
-
-const runWhenDOMLoaded = cb => {
- if (document.readyState != 'loading') {
- cb()
- } else if (document.addEventListener) {
- document.addEventListener('DOMContentLoaded', cb)
- } else {
- document.attachEvent('onreadystatechange', function() {
- if (document.readyState == 'complete') cb()
- })
- }
-}
-
-const codeCellId = index => `codecell${index}`
-
-// Clears selected text since ClipboardJS will select the text when copying
-const clearSelection = () => {
- if (window.getSelection) {
- window.getSelection().removeAllRanges()
- } else if (document.selection) {
- document.selection.empty()
- }
-}
-
-// Changes tooltip text for a moment, then changes it back
-// We want the timeout of our `success` class to be a bit shorter than the
-// tooltip and icon change, so that we can hide the icon before changing back.
-var timeoutIcon = 2000;
-var timeoutSuccessClass = 1500;
-
-const temporarilyChangeTooltip = (el, oldText, newText) => {
- el.setAttribute('data-tooltip', newText)
- el.classList.add('success')
- // Remove success a little bit sooner than we change the tooltip
- // So that we can use CSS to hide the copybutton first
- setTimeout(() => el.classList.remove('success'), timeoutSuccessClass)
- setTimeout(() => el.setAttribute('data-tooltip', oldText), timeoutIcon)
-}
-
-// Changes the copy button icon for two seconds, then changes it back
-const temporarilyChangeIcon = (el) => {
- el.innerHTML = iconCheck;
- setTimeout(() => {el.innerHTML = iconCopy}, timeoutIcon)
-}
-
-const addCopyButtonToCodeCells = () => {
- // If ClipboardJS hasn't loaded, wait a bit and try again. This
- // happens because we load ClipboardJS asynchronously.
- if (window.ClipboardJS === undefined) {
- setTimeout(addCopyButtonToCodeCells, 250)
- return
- }
-
- // Add copybuttons to all of our code cells
- const COPYBUTTON_SELECTOR = 'div.highlight pre';
- const codeCells = document.querySelectorAll(COPYBUTTON_SELECTOR)
- codeCells.forEach((codeCell, index) => {
- const id = codeCellId(index)
- codeCell.setAttribute('id', id)
-
- const clipboardButton = id =>
- ``
- codeCell.insertAdjacentHTML('afterend', clipboardButton(id))
- })
-
-function escapeRegExp(string) {
- return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
-}
-
-/**
- * Removes excluded text from a Node.
- *
- * @param {Node} target Node to filter.
- * @param {string} exclude CSS selector of nodes to exclude.
- * @returns {DOMString} Text from `target` with text removed.
- */
-function filterText(target, exclude) {
- const clone = target.cloneNode(true); // clone as to not modify the live DOM
- if (exclude) {
- // remove excluded nodes
- clone.querySelectorAll(exclude).forEach(node => node.remove());
- }
- return clone.innerText;
-}
-
-// Callback when a copy button is clicked. Will be passed the node that was clicked
-// should then grab the text and replace pieces of text that shouldn't be used in output
-function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true, copyEmptyLines = true, lineContinuationChar = "", hereDocDelim = "") {
- var regexp;
- var match;
-
- // Do we check for line continuation characters and "HERE-documents"?
- var useLineCont = !!lineContinuationChar
- var useHereDoc = !!hereDocDelim
-
- // create regexp to capture prompt and remaining line
- if (isRegexp) {
- regexp = new RegExp('^(' + copybuttonPromptText + ')(.*)')
- } else {
- regexp = new RegExp('^(' + escapeRegExp(copybuttonPromptText) + ')(.*)')
- }
-
- const outputLines = [];
- var promptFound = false;
- var gotLineCont = false;
- var gotHereDoc = false;
- const lineGotPrompt = [];
- for (const line of textContent.split('\n')) {
- match = line.match(regexp)
- if (match || gotLineCont || gotHereDoc) {
- promptFound = regexp.test(line)
- lineGotPrompt.push(promptFound)
- if (removePrompts && promptFound) {
- outputLines.push(match[2])
- } else {
- outputLines.push(line)
- }
- gotLineCont = line.endsWith(lineContinuationChar) & useLineCont
- if (line.includes(hereDocDelim) & useHereDoc)
- gotHereDoc = !gotHereDoc
- } else if (!onlyCopyPromptLines) {
- outputLines.push(line)
- } else if (copyEmptyLines && line.trim() === '') {
- outputLines.push(line)
- }
- }
-
- // If no lines with the prompt were found then just use original lines
- if (lineGotPrompt.some(v => v === true)) {
- textContent = outputLines.join('\n');
- }
-
- // Remove a trailing newline to avoid auto-running when pasting
- if (textContent.endsWith("\n")) {
- textContent = textContent.slice(0, -1)
- }
- return textContent
-}
-
-
-var copyTargetText = (trigger) => {
- var target = document.querySelector(trigger.attributes['data-clipboard-target'].value);
-
- // get filtered text
- let exclude = '.linenos';
-
- let text = filterText(target, exclude);
- return formatCopyText(text, '', false, true, true, true, '', '')
-}
-
- // Initialize with a callback so we can modify the text before copy
- const clipboard = new ClipboardJS('.copybtn', {text: copyTargetText})
-
- // Update UI with error/success messages
- clipboard.on('success', event => {
- clearSelection()
- temporarilyChangeTooltip(event.trigger, messages[locale]['copy'], messages[locale]['copy_success'])
- temporarilyChangeIcon(event.trigger)
- })
-
- clipboard.on('error', event => {
- temporarilyChangeTooltip(event.trigger, messages[locale]['copy'], messages[locale]['copy_failure'])
- })
-}
-
+// Localization support
+const messages = {
+ 'en': {
+ 'copy': 'Copy',
+ 'copy_to_clipboard': 'Copy to clipboard',
+ 'copy_success': 'Copied!',
+ 'copy_failure': 'Failed to copy',
+ },
+ 'es' : {
+ 'copy': 'Copiar',
+ 'copy_to_clipboard': 'Copiar al portapapeles',
+ 'copy_success': '¡Copiado!',
+ 'copy_failure': 'Error al copiar',
+ },
+ 'de' : {
+ 'copy': 'Kopieren',
+ 'copy_to_clipboard': 'In die Zwischenablage kopieren',
+ 'copy_success': 'Kopiert!',
+ 'copy_failure': 'Fehler beim Kopieren',
+ },
+ 'fr' : {
+ 'copy': 'Copier',
+ 'copy_to_clipboard': 'Copier dans le presse-papier',
+ 'copy_success': 'Copié !',
+ 'copy_failure': 'Échec de la copie',
+ },
+ 'ru': {
+ 'copy': 'Скопировать',
+ 'copy_to_clipboard': 'Скопировать в буфер',
+ 'copy_success': 'Скопировано!',
+ 'copy_failure': 'Не удалось скопировать',
+ },
+ 'zh-CN': {
+ 'copy': '复制',
+ 'copy_to_clipboard': '复制到剪贴板',
+ 'copy_success': '复制成功!',
+ 'copy_failure': '复制失败',
+ },
+ 'it' : {
+ 'copy': 'Copiare',
+ 'copy_to_clipboard': 'Copiato negli appunti',
+ 'copy_success': 'Copiato!',
+ 'copy_failure': 'Errore durante la copia',
+ }
+}
+
+let locale = 'en'
+if( document.documentElement.lang !== undefined
+ && messages[document.documentElement.lang] !== undefined ) {
+ locale = document.documentElement.lang
+}
+
+let doc_url_root = DOCUMENTATION_OPTIONS.URL_ROOT;
+if (doc_url_root == '#') {
+ doc_url_root = '';
+}
+
+/**
+ * SVG files for our copy buttons
+ */
+let iconCheck = ``
+
+// If the user specified their own SVG use that, otherwise use the default
+let iconCopy = ``;
+if (!iconCopy) {
+ iconCopy = ``
+}
+
+/**
+ * Set up copy/paste for code blocks
+ */
+
+const runWhenDOMLoaded = cb => {
+ if (document.readyState != 'loading') {
+ cb()
+ } else if (document.addEventListener) {
+ document.addEventListener('DOMContentLoaded', cb)
+ } else {
+ document.attachEvent('onreadystatechange', function() {
+ if (document.readyState == 'complete') cb()
+ })
+ }
+}
+
+const codeCellId = index => `codecell${index}`
+
+// Clears selected text since ClipboardJS will select the text when copying
+const clearSelection = () => {
+ if (window.getSelection) {
+ window.getSelection().removeAllRanges()
+ } else if (document.selection) {
+ document.selection.empty()
+ }
+}
+
+// Changes tooltip text for a moment, then changes it back
+// We want the timeout of our `success` class to be a bit shorter than the
+// tooltip and icon change, so that we can hide the icon before changing back.
+var timeoutIcon = 2000;
+var timeoutSuccessClass = 1500;
+
+const temporarilyChangeTooltip = (el, oldText, newText) => {
+ el.setAttribute('data-tooltip', newText)
+ el.classList.add('success')
+ // Remove success a little bit sooner than we change the tooltip
+ // So that we can use CSS to hide the copybutton first
+ setTimeout(() => el.classList.remove('success'), timeoutSuccessClass)
+ setTimeout(() => el.setAttribute('data-tooltip', oldText), timeoutIcon)
+}
+
+// Changes the copy button icon for two seconds, then changes it back
+const temporarilyChangeIcon = (el) => {
+ el.innerHTML = iconCheck;
+ setTimeout(() => {el.innerHTML = iconCopy}, timeoutIcon)
+}
+
+const addCopyButtonToCodeCells = () => {
+ // If ClipboardJS hasn't loaded, wait a bit and try again. This
+ // happens because we load ClipboardJS asynchronously.
+ if (window.ClipboardJS === undefined) {
+ setTimeout(addCopyButtonToCodeCells, 250)
+ return
+ }
+
+ // Add copybuttons to all of our code cells
+ const COPYBUTTON_SELECTOR = 'div.highlight pre';
+ const codeCells = document.querySelectorAll(COPYBUTTON_SELECTOR)
+ codeCells.forEach((codeCell, index) => {
+ const id = codeCellId(index)
+ codeCell.setAttribute('id', id)
+
+ const clipboardButton = id =>
+ ``
+ codeCell.insertAdjacentHTML('afterend', clipboardButton(id))
+ })
+
+function escapeRegExp(string) {
+ return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
+}
+
+/**
+ * Removes excluded text from a Node.
+ *
+ * @param {Node} target Node to filter.
+ * @param {string} exclude CSS selector of nodes to exclude.
+ * @returns {DOMString} Text from `target` with text removed.
+ */
+function filterText(target, exclude) {
+ const clone = target.cloneNode(true); // clone as to not modify the live DOM
+ if (exclude) {
+ // remove excluded nodes
+ clone.querySelectorAll(exclude).forEach(node => node.remove());
+ }
+ return clone.innerText;
+}
+
+// Callback when a copy button is clicked. Will be passed the node that was clicked
+// should then grab the text and replace pieces of text that shouldn't be used in output
+function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true, copyEmptyLines = true, lineContinuationChar = "", hereDocDelim = "") {
+ var regexp;
+ var match;
+
+ // Do we check for line continuation characters and "HERE-documents"?
+ var useLineCont = !!lineContinuationChar
+ var useHereDoc = !!hereDocDelim
+
+ // create regexp to capture prompt and remaining line
+ if (isRegexp) {
+ regexp = new RegExp('^(' + copybuttonPromptText + ')(.*)')
+ } else {
+ regexp = new RegExp('^(' + escapeRegExp(copybuttonPromptText) + ')(.*)')
+ }
+
+ const outputLines = [];
+ var promptFound = false;
+ var gotLineCont = false;
+ var gotHereDoc = false;
+ const lineGotPrompt = [];
+ for (const line of textContent.split('\n')) {
+ match = line.match(regexp)
+ if (match || gotLineCont || gotHereDoc) {
+ promptFound = regexp.test(line)
+ lineGotPrompt.push(promptFound)
+ if (removePrompts && promptFound) {
+ outputLines.push(match[2])
+ } else {
+ outputLines.push(line)
+ }
+ gotLineCont = line.endsWith(lineContinuationChar) & useLineCont
+ if (line.includes(hereDocDelim) & useHereDoc)
+ gotHereDoc = !gotHereDoc
+ } else if (!onlyCopyPromptLines) {
+ outputLines.push(line)
+ } else if (copyEmptyLines && line.trim() === '') {
+ outputLines.push(line)
+ }
+ }
+
+ // If no lines with the prompt were found then just use original lines
+ if (lineGotPrompt.some(v => v === true)) {
+ textContent = outputLines.join('\n');
+ }
+
+ // Remove a trailing newline to avoid auto-running when pasting
+ if (textContent.endsWith("\n")) {
+ textContent = textContent.slice(0, -1)
+ }
+ return textContent
+}
+
+
+var copyTargetText = (trigger) => {
+ var target = document.querySelector(trigger.attributes['data-clipboard-target'].value);
+
+ // get filtered text
+ let exclude = '.linenos';
+
+ let text = filterText(target, exclude);
+ return formatCopyText(text, '', false, true, true, true, '', '')
+}
+
+ // Initialize with a callback so we can modify the text before copy
+ const clipboard = new ClipboardJS('.copybtn', {text: copyTargetText})
+
+ // Update UI with error/success messages
+ clipboard.on('success', event => {
+ clearSelection()
+ temporarilyChangeTooltip(event.trigger, messages[locale]['copy'], messages[locale]['copy_success'])
+ temporarilyChangeIcon(event.trigger)
+ })
+
+ clipboard.on('error', event => {
+ temporarilyChangeTooltip(event.trigger, messages[locale]['copy'], messages[locale]['copy_failure'])
+ })
+}
+
runWhenDOMLoaded(addCopyButtonToCodeCells)
\ No newline at end of file
diff --git a/_static/copybutton_funcs.js b/_static/copybutton_funcs.js
old mode 100644
new mode 100755
diff --git a/_static/css/blank.css b/_static/css/blank.css
old mode 100644
new mode 100755
diff --git a/_static/css/index.73d71520a4ca3b99cfee5594769eaaae.css b/_static/css/index.73d71520a4ca3b99cfee5594769eaaae.css
old mode 100644
new mode 100755
diff --git a/_static/css/index.ff1ffe594081f20da1ef19478df9384b.css b/_static/css/index.ff1ffe594081f20da1ef19478df9384b.css
old mode 100644
new mode 100755
diff --git a/_static/css/theme.css b/_static/css/theme.css
old mode 100644
new mode 100755
diff --git a/_static/design-style.4045f2051d55cab465a707391d5b2007.min.css b/_static/design-style.4045f2051d55cab465a707391d5b2007.min.css
old mode 100644
new mode 100755
diff --git a/_static/design-tabs.js b/_static/design-tabs.js
old mode 100644
new mode 100755
diff --git a/_static/doctools.js b/_static/doctools.js
old mode 100644
new mode 100755
diff --git a/_static/documentation_options.js b/_static/documentation_options.js
old mode 100644
new mode 100755
index 162a6ba8..f48413d2
--- a/_static/documentation_options.js
+++ b/_static/documentation_options.js
@@ -1,14 +1,14 @@
-var DOCUMENTATION_OPTIONS = {
- URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
- VERSION: '',
- LANGUAGE: 'en',
- COLLAPSE_INDEX: false,
- BUILDER: 'html',
- FILE_SUFFIX: '.html',
- LINK_SUFFIX: '.html',
- HAS_SOURCE: true,
- SOURCELINK_SUFFIX: '',
- NAVIGATION_WITH_KEYS: false,
- SHOW_SEARCH_SUMMARY: true,
- ENABLE_SEARCH_SHORTCUTS: false,
+var DOCUMENTATION_OPTIONS = {
+ URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
+ VERSION: '',
+ LANGUAGE: 'en',
+ COLLAPSE_INDEX: false,
+ BUILDER: 'html',
+ FILE_SUFFIX: '.html',
+ LINK_SUFFIX: '.html',
+ HAS_SOURCE: true,
+ SOURCELINK_SUFFIX: '',
+ NAVIGATION_WITH_KEYS: false,
+ SHOW_SEARCH_SUMMARY: true,
+ ENABLE_SEARCH_SHORTCUTS: false,
};
\ No newline at end of file
diff --git a/_static/file.png b/_static/file.png
old mode 100644
new mode 100755
diff --git a/_static/images/logo_binder.svg b/_static/images/logo_binder.svg
old mode 100644
new mode 100755
diff --git a/_static/images/logo_colab.png b/_static/images/logo_colab.png
old mode 100644
new mode 100755
diff --git a/_static/images/logo_deepnote.svg b/_static/images/logo_deepnote.svg
old mode 100644
new mode 100755
diff --git a/_static/images/logo_jupyterhub.svg b/_static/images/logo_jupyterhub.svg
old mode 100644
new mode 100755
diff --git a/_static/jquery-3.5.1.js b/_static/jquery-3.5.1.js
old mode 100644
new mode 100755
diff --git a/_static/jquery-3.6.0.js b/_static/jquery-3.6.0.js
old mode 100644
new mode 100755
diff --git a/_static/jquery.js b/_static/jquery.js
old mode 100644
new mode 100755
diff --git a/_static/js/index.3da636dd464baa7582d2.js b/_static/js/index.3da636dd464baa7582d2.js
old mode 100644
new mode 100755
diff --git a/_static/js/index.be7d3bbb2ef33a8344ce.js b/_static/js/index.be7d3bbb2ef33a8344ce.js
old mode 100644
new mode 100755
diff --git a/_static/language_data.js b/_static/language_data.js
old mode 100644
new mode 100755
index 2e22b06a..29455f02
--- a/_static/language_data.js
+++ b/_static/language_data.js
@@ -1,199 +1,199 @@
-/*
- * language_data.js
- * ~~~~~~~~~~~~~~~~
- *
- * This script contains the language-specific data used by searchtools.js,
- * namely the list of stopwords, stemmer, scorer and splitter.
- *
- * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
- * :license: BSD, see LICENSE for details.
- *
- */
-
-var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"];
-
-
-/* Non-minified version is copied as a separate JS file, is available */
-
-/**
- * Porter Stemmer
- */
-var Stemmer = function() {
-
- var step2list = {
- ational: 'ate',
- tional: 'tion',
- enci: 'ence',
- anci: 'ance',
- izer: 'ize',
- bli: 'ble',
- alli: 'al',
- entli: 'ent',
- eli: 'e',
- ousli: 'ous',
- ization: 'ize',
- ation: 'ate',
- ator: 'ate',
- alism: 'al',
- iveness: 'ive',
- fulness: 'ful',
- ousness: 'ous',
- aliti: 'al',
- iviti: 'ive',
- biliti: 'ble',
- logi: 'log'
- };
-
- var step3list = {
- icate: 'ic',
- ative: '',
- alize: 'al',
- iciti: 'ic',
- ical: 'ic',
- ful: '',
- ness: ''
- };
-
- var c = "[^aeiou]"; // consonant
- var v = "[aeiouy]"; // vowel
- var C = c + "[^aeiouy]*"; // consonant sequence
- var V = v + "[aeiou]*"; // vowel sequence
-
- var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
- var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
- var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
- var s_v = "^(" + C + ")?" + v; // vowel in stem
-
- this.stemWord = function (w) {
- var stem;
- var suffix;
- var firstch;
- var origword = w;
-
- if (w.length < 3)
- return w;
-
- var re;
- var re2;
- var re3;
- var re4;
-
- firstch = w.substr(0,1);
- if (firstch == "y")
- w = firstch.toUpperCase() + w.substr(1);
-
- // Step 1a
- re = /^(.+?)(ss|i)es$/;
- re2 = /^(.+?)([^s])s$/;
-
- if (re.test(w))
- w = w.replace(re,"$1$2");
- else if (re2.test(w))
- w = w.replace(re2,"$1$2");
-
- // Step 1b
- re = /^(.+?)eed$/;
- re2 = /^(.+?)(ed|ing)$/;
- if (re.test(w)) {
- var fp = re.exec(w);
- re = new RegExp(mgr0);
- if (re.test(fp[1])) {
- re = /.$/;
- w = w.replace(re,"");
- }
- }
- else if (re2.test(w)) {
- var fp = re2.exec(w);
- stem = fp[1];
- re2 = new RegExp(s_v);
- if (re2.test(stem)) {
- w = stem;
- re2 = /(at|bl|iz)$/;
- re3 = new RegExp("([^aeiouylsz])\\1$");
- re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
- if (re2.test(w))
- w = w + "e";
- else if (re3.test(w)) {
- re = /.$/;
- w = w.replace(re,"");
- }
- else if (re4.test(w))
- w = w + "e";
- }
- }
-
- // Step 1c
- re = /^(.+?)y$/;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- re = new RegExp(s_v);
- if (re.test(stem))
- w = stem + "i";
- }
-
- // Step 2
- re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- suffix = fp[2];
- re = new RegExp(mgr0);
- if (re.test(stem))
- w = stem + step2list[suffix];
- }
-
- // Step 3
- re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- suffix = fp[2];
- re = new RegExp(mgr0);
- if (re.test(stem))
- w = stem + step3list[suffix];
- }
-
- // Step 4
- re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
- re2 = /^(.+?)(s|t)(ion)$/;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- re = new RegExp(mgr1);
- if (re.test(stem))
- w = stem;
- }
- else if (re2.test(w)) {
- var fp = re2.exec(w);
- stem = fp[1] + fp[2];
- re2 = new RegExp(mgr1);
- if (re2.test(stem))
- w = stem;
- }
-
- // Step 5
- re = /^(.+?)e$/;
- if (re.test(w)) {
- var fp = re.exec(w);
- stem = fp[1];
- re = new RegExp(mgr1);
- re2 = new RegExp(meq1);
- re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
- if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
- w = stem;
- }
- re = /ll$/;
- re2 = new RegExp(mgr1);
- if (re.test(w) && re2.test(w)) {
- re = /.$/;
- w = w.replace(re,"");
- }
-
- // and turn initial Y back to y
- if (firstch == "y")
- w = firstch.toLowerCase() + w.substr(1);
- return w;
- }
-}
-
+/*
+ * language_data.js
+ * ~~~~~~~~~~~~~~~~
+ *
+ * This script contains the language-specific data used by searchtools.js,
+ * namely the list of stopwords, stemmer, scorer and splitter.
+ *
+ * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
+ * :license: BSD, see LICENSE for details.
+ *
+ */
+
+var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"];
+
+
+/* Non-minified version is copied as a separate JS file, is available */
+
+/**
+ * Porter Stemmer
+ */
+var Stemmer = function() {
+
+ var step2list = {
+ ational: 'ate',
+ tional: 'tion',
+ enci: 'ence',
+ anci: 'ance',
+ izer: 'ize',
+ bli: 'ble',
+ alli: 'al',
+ entli: 'ent',
+ eli: 'e',
+ ousli: 'ous',
+ ization: 'ize',
+ ation: 'ate',
+ ator: 'ate',
+ alism: 'al',
+ iveness: 'ive',
+ fulness: 'ful',
+ ousness: 'ous',
+ aliti: 'al',
+ iviti: 'ive',
+ biliti: 'ble',
+ logi: 'log'
+ };
+
+ var step3list = {
+ icate: 'ic',
+ ative: '',
+ alize: 'al',
+ iciti: 'ic',
+ ical: 'ic',
+ ful: '',
+ ness: ''
+ };
+
+ var c = "[^aeiou]"; // consonant
+ var v = "[aeiouy]"; // vowel
+ var C = c + "[^aeiouy]*"; // consonant sequence
+ var V = v + "[aeiou]*"; // vowel sequence
+
+ var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0
+ var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1
+ var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1
+ var s_v = "^(" + C + ")?" + v; // vowel in stem
+
+ this.stemWord = function (w) {
+ var stem;
+ var suffix;
+ var firstch;
+ var origword = w;
+
+ if (w.length < 3)
+ return w;
+
+ var re;
+ var re2;
+ var re3;
+ var re4;
+
+ firstch = w.substr(0,1);
+ if (firstch == "y")
+ w = firstch.toUpperCase() + w.substr(1);
+
+ // Step 1a
+ re = /^(.+?)(ss|i)es$/;
+ re2 = /^(.+?)([^s])s$/;
+
+ if (re.test(w))
+ w = w.replace(re,"$1$2");
+ else if (re2.test(w))
+ w = w.replace(re2,"$1$2");
+
+ // Step 1b
+ re = /^(.+?)eed$/;
+ re2 = /^(.+?)(ed|ing)$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ re = new RegExp(mgr0);
+ if (re.test(fp[1])) {
+ re = /.$/;
+ w = w.replace(re,"");
+ }
+ }
+ else if (re2.test(w)) {
+ var fp = re2.exec(w);
+ stem = fp[1];
+ re2 = new RegExp(s_v);
+ if (re2.test(stem)) {
+ w = stem;
+ re2 = /(at|bl|iz)$/;
+ re3 = new RegExp("([^aeiouylsz])\\1$");
+ re4 = new RegExp("^" + C + v + "[^aeiouwxy]$");
+ if (re2.test(w))
+ w = w + "e";
+ else if (re3.test(w)) {
+ re = /.$/;
+ w = w.replace(re,"");
+ }
+ else if (re4.test(w))
+ w = w + "e";
+ }
+ }
+
+ // Step 1c
+ re = /^(.+?)y$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ re = new RegExp(s_v);
+ if (re.test(stem))
+ w = stem + "i";
+ }
+
+ // Step 2
+ re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ suffix = fp[2];
+ re = new RegExp(mgr0);
+ if (re.test(stem))
+ w = stem + step2list[suffix];
+ }
+
+ // Step 3
+ re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ suffix = fp[2];
+ re = new RegExp(mgr0);
+ if (re.test(stem))
+ w = stem + step3list[suffix];
+ }
+
+ // Step 4
+ re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
+ re2 = /^(.+?)(s|t)(ion)$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ re = new RegExp(mgr1);
+ if (re.test(stem))
+ w = stem;
+ }
+ else if (re2.test(w)) {
+ var fp = re2.exec(w);
+ stem = fp[1] + fp[2];
+ re2 = new RegExp(mgr1);
+ if (re2.test(stem))
+ w = stem;
+ }
+
+ // Step 5
+ re = /^(.+?)e$/;
+ if (re.test(w)) {
+ var fp = re.exec(w);
+ stem = fp[1];
+ re = new RegExp(mgr1);
+ re2 = new RegExp(meq1);
+ re3 = new RegExp("^" + C + v + "[^aeiouwxy]$");
+ if (re.test(stem) || (re2.test(stem) && !(re3.test(stem))))
+ w = stem;
+ }
+ re = /ll$/;
+ re2 = new RegExp(mgr1);
+ if (re.test(w) && re2.test(w)) {
+ re = /.$/;
+ w = w.replace(re,"");
+ }
+
+ // and turn initial Y back to y
+ if (firstch == "y")
+ w = firstch.toLowerCase() + w.substr(1);
+ return w;
+ }
+}
+
diff --git a/_static/locales/ar/LC_MESSAGES/booktheme.mo b/_static/locales/ar/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/ar/LC_MESSAGES/booktheme.po b/_static/locales/ar/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/bg/LC_MESSAGES/booktheme.mo b/_static/locales/bg/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/bg/LC_MESSAGES/booktheme.po b/_static/locales/bg/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/bn/LC_MESSAGES/booktheme.mo b/_static/locales/bn/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/bn/LC_MESSAGES/booktheme.po b/_static/locales/bn/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/ca/LC_MESSAGES/booktheme.mo b/_static/locales/ca/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/ca/LC_MESSAGES/booktheme.po b/_static/locales/ca/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/cs/LC_MESSAGES/booktheme.mo b/_static/locales/cs/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/cs/LC_MESSAGES/booktheme.po b/_static/locales/cs/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/da/LC_MESSAGES/booktheme.mo b/_static/locales/da/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/da/LC_MESSAGES/booktheme.po b/_static/locales/da/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/de/LC_MESSAGES/booktheme.mo b/_static/locales/de/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/de/LC_MESSAGES/booktheme.po b/_static/locales/de/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/el/LC_MESSAGES/booktheme.mo b/_static/locales/el/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/el/LC_MESSAGES/booktheme.po b/_static/locales/el/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/eo/LC_MESSAGES/booktheme.mo b/_static/locales/eo/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/eo/LC_MESSAGES/booktheme.po b/_static/locales/eo/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/es/LC_MESSAGES/booktheme.mo b/_static/locales/es/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/es/LC_MESSAGES/booktheme.po b/_static/locales/es/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/et/LC_MESSAGES/booktheme.mo b/_static/locales/et/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/et/LC_MESSAGES/booktheme.po b/_static/locales/et/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/fi/LC_MESSAGES/booktheme.mo b/_static/locales/fi/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/fi/LC_MESSAGES/booktheme.po b/_static/locales/fi/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/fr/LC_MESSAGES/booktheme.mo b/_static/locales/fr/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/fr/LC_MESSAGES/booktheme.po b/_static/locales/fr/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/hr/LC_MESSAGES/booktheme.mo b/_static/locales/hr/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/hr/LC_MESSAGES/booktheme.po b/_static/locales/hr/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/id/LC_MESSAGES/booktheme.mo b/_static/locales/id/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/id/LC_MESSAGES/booktheme.po b/_static/locales/id/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/it/LC_MESSAGES/booktheme.mo b/_static/locales/it/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/it/LC_MESSAGES/booktheme.po b/_static/locales/it/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/iw/LC_MESSAGES/booktheme.mo b/_static/locales/iw/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/iw/LC_MESSAGES/booktheme.po b/_static/locales/iw/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/ja/LC_MESSAGES/booktheme.mo b/_static/locales/ja/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/ja/LC_MESSAGES/booktheme.po b/_static/locales/ja/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/ko/LC_MESSAGES/booktheme.mo b/_static/locales/ko/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/ko/LC_MESSAGES/booktheme.po b/_static/locales/ko/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/lt/LC_MESSAGES/booktheme.mo b/_static/locales/lt/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/lt/LC_MESSAGES/booktheme.po b/_static/locales/lt/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/lv/LC_MESSAGES/booktheme.mo b/_static/locales/lv/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/lv/LC_MESSAGES/booktheme.po b/_static/locales/lv/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/ml/LC_MESSAGES/booktheme.mo b/_static/locales/ml/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/ml/LC_MESSAGES/booktheme.po b/_static/locales/ml/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/mr/LC_MESSAGES/booktheme.mo b/_static/locales/mr/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/mr/LC_MESSAGES/booktheme.po b/_static/locales/mr/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/ms/LC_MESSAGES/booktheme.mo b/_static/locales/ms/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/ms/LC_MESSAGES/booktheme.po b/_static/locales/ms/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/nl/LC_MESSAGES/booktheme.mo b/_static/locales/nl/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/nl/LC_MESSAGES/booktheme.po b/_static/locales/nl/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/no/LC_MESSAGES/booktheme.mo b/_static/locales/no/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/no/LC_MESSAGES/booktheme.po b/_static/locales/no/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/pl/LC_MESSAGES/booktheme.mo b/_static/locales/pl/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/pl/LC_MESSAGES/booktheme.po b/_static/locales/pl/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/pt/LC_MESSAGES/booktheme.mo b/_static/locales/pt/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/pt/LC_MESSAGES/booktheme.po b/_static/locales/pt/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/ro/LC_MESSAGES/booktheme.mo b/_static/locales/ro/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/ro/LC_MESSAGES/booktheme.po b/_static/locales/ro/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/ru/LC_MESSAGES/booktheme.mo b/_static/locales/ru/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/ru/LC_MESSAGES/booktheme.po b/_static/locales/ru/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/sk/LC_MESSAGES/booktheme.mo b/_static/locales/sk/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/sk/LC_MESSAGES/booktheme.po b/_static/locales/sk/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/sl/LC_MESSAGES/booktheme.mo b/_static/locales/sl/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/sl/LC_MESSAGES/booktheme.po b/_static/locales/sl/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/sr/LC_MESSAGES/booktheme.mo b/_static/locales/sr/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/sr/LC_MESSAGES/booktheme.po b/_static/locales/sr/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/sv/LC_MESSAGES/booktheme.mo b/_static/locales/sv/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/sv/LC_MESSAGES/booktheme.po b/_static/locales/sv/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/ta/LC_MESSAGES/booktheme.mo b/_static/locales/ta/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/ta/LC_MESSAGES/booktheme.po b/_static/locales/ta/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/te/LC_MESSAGES/booktheme.mo b/_static/locales/te/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/te/LC_MESSAGES/booktheme.po b/_static/locales/te/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/tg/LC_MESSAGES/booktheme.mo b/_static/locales/tg/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/tg/LC_MESSAGES/booktheme.po b/_static/locales/tg/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/th/LC_MESSAGES/booktheme.mo b/_static/locales/th/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/th/LC_MESSAGES/booktheme.po b/_static/locales/th/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/tl/LC_MESSAGES/booktheme.mo b/_static/locales/tl/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/tl/LC_MESSAGES/booktheme.po b/_static/locales/tl/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/tr/LC_MESSAGES/booktheme.mo b/_static/locales/tr/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/tr/LC_MESSAGES/booktheme.po b/_static/locales/tr/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/uk/LC_MESSAGES/booktheme.mo b/_static/locales/uk/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/uk/LC_MESSAGES/booktheme.po b/_static/locales/uk/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/ur/LC_MESSAGES/booktheme.mo b/_static/locales/ur/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/ur/LC_MESSAGES/booktheme.po b/_static/locales/ur/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/vi/LC_MESSAGES/booktheme.mo b/_static/locales/vi/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/vi/LC_MESSAGES/booktheme.po b/_static/locales/vi/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/zh_CN/LC_MESSAGES/booktheme.mo b/_static/locales/zh_CN/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/zh_CN/LC_MESSAGES/booktheme.po b/_static/locales/zh_CN/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/locales/zh_TW/LC_MESSAGES/booktheme.mo b/_static/locales/zh_TW/LC_MESSAGES/booktheme.mo
old mode 100644
new mode 100755
diff --git a/_static/locales/zh_TW/LC_MESSAGES/booktheme.po b/_static/locales/zh_TW/LC_MESSAGES/booktheme.po
old mode 100644
new mode 100755
diff --git a/_static/minus.png b/_static/minus.png
old mode 100644
new mode 100755
diff --git a/_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css b/_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css
old mode 100644
new mode 100755
diff --git a/_static/mystnb.css b/_static/mystnb.css
old mode 100644
new mode 100755
diff --git a/_static/panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css b/_static/panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css
old mode 100644
new mode 100755
diff --git a/_static/panels-variables.06eb56fa6e07937060861dad626602ad.css b/_static/panels-variables.06eb56fa6e07937060861dad626602ad.css
old mode 100644
new mode 100755
diff --git a/_static/play-solid.svg b/_static/play-solid.svg
old mode 100644
new mode 100755
diff --git a/_static/plus.png b/_static/plus.png
old mode 100644
new mode 100755
diff --git a/_static/pygments.css b/_static/pygments.css
old mode 100644
new mode 100755
index 012e6a00..1bf3c248
--- a/_static/pygments.css
+++ b/_static/pygments.css
@@ -1,152 +1,152 @@
-html[data-theme="light"] .highlight pre { line-height: 125%; }
-html[data-theme="light"] .highlight td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
-html[data-theme="light"] .highlight span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
-html[data-theme="light"] .highlight td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
-html[data-theme="light"] .highlight span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
-html[data-theme="light"] .highlight .hll { background-color: #fae4c2 }
-html[data-theme="light"] .highlight { background: #fefefe; color: #080808 }
-html[data-theme="light"] .highlight .c { color: #515151 } /* Comment */
-html[data-theme="light"] .highlight .err { color: #a12236 } /* Error */
-html[data-theme="light"] .highlight .k { color: #6730c5 } /* Keyword */
-html[data-theme="light"] .highlight .l { color: #7f4707 } /* Literal */
-html[data-theme="light"] .highlight .n { color: #080808 } /* Name */
-html[data-theme="light"] .highlight .o { color: #00622f } /* Operator */
-html[data-theme="light"] .highlight .p { color: #080808 } /* Punctuation */
-html[data-theme="light"] .highlight .ch { color: #515151 } /* Comment.Hashbang */
-html[data-theme="light"] .highlight .cm { color: #515151 } /* Comment.Multiline */
-html[data-theme="light"] .highlight .cp { color: #515151 } /* Comment.Preproc */
-html[data-theme="light"] .highlight .cpf { color: #515151 } /* Comment.PreprocFile */
-html[data-theme="light"] .highlight .c1 { color: #515151 } /* Comment.Single */
-html[data-theme="light"] .highlight .cs { color: #515151 } /* Comment.Special */
-html[data-theme="light"] .highlight .gd { color: #005b82 } /* Generic.Deleted */
-html[data-theme="light"] .highlight .ge { font-style: italic } /* Generic.Emph */
-html[data-theme="light"] .highlight .gh { color: #005b82 } /* Generic.Heading */
-html[data-theme="light"] .highlight .gs { font-weight: bold } /* Generic.Strong */
-html[data-theme="light"] .highlight .gu { color: #005b82 } /* Generic.Subheading */
-html[data-theme="light"] .highlight .kc { color: #6730c5 } /* Keyword.Constant */
-html[data-theme="light"] .highlight .kd { color: #6730c5 } /* Keyword.Declaration */
-html[data-theme="light"] .highlight .kn { color: #6730c5 } /* Keyword.Namespace */
-html[data-theme="light"] .highlight .kp { color: #6730c5 } /* Keyword.Pseudo */
-html[data-theme="light"] .highlight .kr { color: #6730c5 } /* Keyword.Reserved */
-html[data-theme="light"] .highlight .kt { color: #7f4707 } /* Keyword.Type */
-html[data-theme="light"] .highlight .ld { color: #7f4707 } /* Literal.Date */
-html[data-theme="light"] .highlight .m { color: #7f4707 } /* Literal.Number */
-html[data-theme="light"] .highlight .s { color: #00622f } /* Literal.String */
-html[data-theme="light"] .highlight .na { color: #912583 } /* Name.Attribute */
-html[data-theme="light"] .highlight .nb { color: #7f4707 } /* Name.Builtin */
-html[data-theme="light"] .highlight .nc { color: #005b82 } /* Name.Class */
-html[data-theme="light"] .highlight .no { color: #005b82 } /* Name.Constant */
-html[data-theme="light"] .highlight .nd { color: #7f4707 } /* Name.Decorator */
-html[data-theme="light"] .highlight .ni { color: #00622f } /* Name.Entity */
-html[data-theme="light"] .highlight .ne { color: #6730c5 } /* Name.Exception */
-html[data-theme="light"] .highlight .nf { color: #005b82 } /* Name.Function */
-html[data-theme="light"] .highlight .nl { color: #7f4707 } /* Name.Label */
-html[data-theme="light"] .highlight .nn { color: #080808 } /* Name.Namespace */
-html[data-theme="light"] .highlight .nx { color: #080808 } /* Name.Other */
-html[data-theme="light"] .highlight .py { color: #005b82 } /* Name.Property */
-html[data-theme="light"] .highlight .nt { color: #005b82 } /* Name.Tag */
-html[data-theme="light"] .highlight .nv { color: #a12236 } /* Name.Variable */
-html[data-theme="light"] .highlight .ow { color: #6730c5 } /* Operator.Word */
-html[data-theme="light"] .highlight .pm { color: #080808 } /* Punctuation.Marker */
-html[data-theme="light"] .highlight .w { color: #080808 } /* Text.Whitespace */
-html[data-theme="light"] .highlight .mb { color: #7f4707 } /* Literal.Number.Bin */
-html[data-theme="light"] .highlight .mf { color: #7f4707 } /* Literal.Number.Float */
-html[data-theme="light"] .highlight .mh { color: #7f4707 } /* Literal.Number.Hex */
-html[data-theme="light"] .highlight .mi { color: #7f4707 } /* Literal.Number.Integer */
-html[data-theme="light"] .highlight .mo { color: #7f4707 } /* Literal.Number.Oct */
-html[data-theme="light"] .highlight .sa { color: #00622f } /* Literal.String.Affix */
-html[data-theme="light"] .highlight .sb { color: #00622f } /* Literal.String.Backtick */
-html[data-theme="light"] .highlight .sc { color: #00622f } /* Literal.String.Char */
-html[data-theme="light"] .highlight .dl { color: #00622f } /* Literal.String.Delimiter */
-html[data-theme="light"] .highlight .sd { color: #00622f } /* Literal.String.Doc */
-html[data-theme="light"] .highlight .s2 { color: #00622f } /* Literal.String.Double */
-html[data-theme="light"] .highlight .se { color: #00622f } /* Literal.String.Escape */
-html[data-theme="light"] .highlight .sh { color: #00622f } /* Literal.String.Heredoc */
-html[data-theme="light"] .highlight .si { color: #00622f } /* Literal.String.Interpol */
-html[data-theme="light"] .highlight .sx { color: #00622f } /* Literal.String.Other */
-html[data-theme="light"] .highlight .sr { color: #a12236 } /* Literal.String.Regex */
-html[data-theme="light"] .highlight .s1 { color: #00622f } /* Literal.String.Single */
-html[data-theme="light"] .highlight .ss { color: #005b82 } /* Literal.String.Symbol */
-html[data-theme="light"] .highlight .bp { color: #7f4707 } /* Name.Builtin.Pseudo */
-html[data-theme="light"] .highlight .fm { color: #005b82 } /* Name.Function.Magic */
-html[data-theme="light"] .highlight .vc { color: #a12236 } /* Name.Variable.Class */
-html[data-theme="light"] .highlight .vg { color: #a12236 } /* Name.Variable.Global */
-html[data-theme="light"] .highlight .vi { color: #a12236 } /* Name.Variable.Instance */
-html[data-theme="light"] .highlight .vm { color: #7f4707 } /* Name.Variable.Magic */
-html[data-theme="light"] .highlight .il { color: #7f4707 } /* Literal.Number.Integer.Long */
-html[data-theme="dark"] .highlight pre { line-height: 125%; }
-html[data-theme="dark"] .highlight td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
-html[data-theme="dark"] .highlight span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
-html[data-theme="dark"] .highlight td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
-html[data-theme="dark"] .highlight span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
-html[data-theme="dark"] .highlight .hll { background-color: #ffd9002e }
-html[data-theme="dark"] .highlight { background: #2b2b2b; color: #f8f8f2 }
-html[data-theme="dark"] .highlight .c { color: #ffd900 } /* Comment */
-html[data-theme="dark"] .highlight .err { color: #ffa07a } /* Error */
-html[data-theme="dark"] .highlight .k { color: #dcc6e0 } /* Keyword */
-html[data-theme="dark"] .highlight .l { color: #ffd900 } /* Literal */
-html[data-theme="dark"] .highlight .n { color: #f8f8f2 } /* Name */
-html[data-theme="dark"] .highlight .o { color: #abe338 } /* Operator */
-html[data-theme="dark"] .highlight .p { color: #f8f8f2 } /* Punctuation */
-html[data-theme="dark"] .highlight .ch { color: #ffd900 } /* Comment.Hashbang */
-html[data-theme="dark"] .highlight .cm { color: #ffd900 } /* Comment.Multiline */
-html[data-theme="dark"] .highlight .cp { color: #ffd900 } /* Comment.Preproc */
-html[data-theme="dark"] .highlight .cpf { color: #ffd900 } /* Comment.PreprocFile */
-html[data-theme="dark"] .highlight .c1 { color: #ffd900 } /* Comment.Single */
-html[data-theme="dark"] .highlight .cs { color: #ffd900 } /* Comment.Special */
-html[data-theme="dark"] .highlight .gd { color: #00e0e0 } /* Generic.Deleted */
-html[data-theme="dark"] .highlight .ge { font-style: italic } /* Generic.Emph */
-html[data-theme="dark"] .highlight .gh { color: #00e0e0 } /* Generic.Heading */
-html[data-theme="dark"] .highlight .gs { font-weight: bold } /* Generic.Strong */
-html[data-theme="dark"] .highlight .gu { color: #00e0e0 } /* Generic.Subheading */
-html[data-theme="dark"] .highlight .kc { color: #dcc6e0 } /* Keyword.Constant */
-html[data-theme="dark"] .highlight .kd { color: #dcc6e0 } /* Keyword.Declaration */
-html[data-theme="dark"] .highlight .kn { color: #dcc6e0 } /* Keyword.Namespace */
-html[data-theme="dark"] .highlight .kp { color: #dcc6e0 } /* Keyword.Pseudo */
-html[data-theme="dark"] .highlight .kr { color: #dcc6e0 } /* Keyword.Reserved */
-html[data-theme="dark"] .highlight .kt { color: #ffd900 } /* Keyword.Type */
-html[data-theme="dark"] .highlight .ld { color: #ffd900 } /* Literal.Date */
-html[data-theme="dark"] .highlight .m { color: #ffd900 } /* Literal.Number */
-html[data-theme="dark"] .highlight .s { color: #abe338 } /* Literal.String */
-html[data-theme="dark"] .highlight .na { color: #ffd900 } /* Name.Attribute */
-html[data-theme="dark"] .highlight .nb { color: #ffd900 } /* Name.Builtin */
-html[data-theme="dark"] .highlight .nc { color: #00e0e0 } /* Name.Class */
-html[data-theme="dark"] .highlight .no { color: #00e0e0 } /* Name.Constant */
-html[data-theme="dark"] .highlight .nd { color: #ffd900 } /* Name.Decorator */
-html[data-theme="dark"] .highlight .ni { color: #abe338 } /* Name.Entity */
-html[data-theme="dark"] .highlight .ne { color: #dcc6e0 } /* Name.Exception */
-html[data-theme="dark"] .highlight .nf { color: #00e0e0 } /* Name.Function */
-html[data-theme="dark"] .highlight .nl { color: #ffd900 } /* Name.Label */
-html[data-theme="dark"] .highlight .nn { color: #f8f8f2 } /* Name.Namespace */
-html[data-theme="dark"] .highlight .nx { color: #f8f8f2 } /* Name.Other */
-html[data-theme="dark"] .highlight .py { color: #00e0e0 } /* Name.Property */
-html[data-theme="dark"] .highlight .nt { color: #00e0e0 } /* Name.Tag */
-html[data-theme="dark"] .highlight .nv { color: #ffa07a } /* Name.Variable */
-html[data-theme="dark"] .highlight .ow { color: #dcc6e0 } /* Operator.Word */
-html[data-theme="dark"] .highlight .pm { color: #f8f8f2 } /* Punctuation.Marker */
-html[data-theme="dark"] .highlight .w { color: #f8f8f2 } /* Text.Whitespace */
-html[data-theme="dark"] .highlight .mb { color: #ffd900 } /* Literal.Number.Bin */
-html[data-theme="dark"] .highlight .mf { color: #ffd900 } /* Literal.Number.Float */
-html[data-theme="dark"] .highlight .mh { color: #ffd900 } /* Literal.Number.Hex */
-html[data-theme="dark"] .highlight .mi { color: #ffd900 } /* Literal.Number.Integer */
-html[data-theme="dark"] .highlight .mo { color: #ffd900 } /* Literal.Number.Oct */
-html[data-theme="dark"] .highlight .sa { color: #abe338 } /* Literal.String.Affix */
-html[data-theme="dark"] .highlight .sb { color: #abe338 } /* Literal.String.Backtick */
-html[data-theme="dark"] .highlight .sc { color: #abe338 } /* Literal.String.Char */
-html[data-theme="dark"] .highlight .dl { color: #abe338 } /* Literal.String.Delimiter */
-html[data-theme="dark"] .highlight .sd { color: #abe338 } /* Literal.String.Doc */
-html[data-theme="dark"] .highlight .s2 { color: #abe338 } /* Literal.String.Double */
-html[data-theme="dark"] .highlight .se { color: #abe338 } /* Literal.String.Escape */
-html[data-theme="dark"] .highlight .sh { color: #abe338 } /* Literal.String.Heredoc */
-html[data-theme="dark"] .highlight .si { color: #abe338 } /* Literal.String.Interpol */
-html[data-theme="dark"] .highlight .sx { color: #abe338 } /* Literal.String.Other */
-html[data-theme="dark"] .highlight .sr { color: #ffa07a } /* Literal.String.Regex */
-html[data-theme="dark"] .highlight .s1 { color: #abe338 } /* Literal.String.Single */
-html[data-theme="dark"] .highlight .ss { color: #00e0e0 } /* Literal.String.Symbol */
-html[data-theme="dark"] .highlight .bp { color: #ffd900 } /* Name.Builtin.Pseudo */
-html[data-theme="dark"] .highlight .fm { color: #00e0e0 } /* Name.Function.Magic */
-html[data-theme="dark"] .highlight .vc { color: #ffa07a } /* Name.Variable.Class */
-html[data-theme="dark"] .highlight .vg { color: #ffa07a } /* Name.Variable.Global */
-html[data-theme="dark"] .highlight .vi { color: #ffa07a } /* Name.Variable.Instance */
-html[data-theme="dark"] .highlight .vm { color: #ffd900 } /* Name.Variable.Magic */
-html[data-theme="dark"] .highlight .il { color: #ffd900 } /* Literal.Number.Integer.Long */
\ No newline at end of file
+html[data-theme="light"] .highlight pre { line-height: 125%; }
+html[data-theme="light"] .highlight td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
+html[data-theme="light"] .highlight span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
+html[data-theme="light"] .highlight td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
+html[data-theme="light"] .highlight span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
+html[data-theme="light"] .highlight .hll { background-color: #fae4c2 }
+html[data-theme="light"] .highlight { background: #fefefe; color: #080808 }
+html[data-theme="light"] .highlight .c { color: #515151 } /* Comment */
+html[data-theme="light"] .highlight .err { color: #A12236 } /* Error */
+html[data-theme="light"] .highlight .k { color: #6730C5 } /* Keyword */
+html[data-theme="light"] .highlight .l { color: #7F4707 } /* Literal */
+html[data-theme="light"] .highlight .n { color: #080808 } /* Name */
+html[data-theme="light"] .highlight .o { color: #00622F } /* Operator */
+html[data-theme="light"] .highlight .p { color: #080808 } /* Punctuation */
+html[data-theme="light"] .highlight .ch { color: #515151 } /* Comment.Hashbang */
+html[data-theme="light"] .highlight .cm { color: #515151 } /* Comment.Multiline */
+html[data-theme="light"] .highlight .cp { color: #515151 } /* Comment.Preproc */
+html[data-theme="light"] .highlight .cpf { color: #515151 } /* Comment.PreprocFile */
+html[data-theme="light"] .highlight .c1 { color: #515151 } /* Comment.Single */
+html[data-theme="light"] .highlight .cs { color: #515151 } /* Comment.Special */
+html[data-theme="light"] .highlight .gd { color: #005B82 } /* Generic.Deleted */
+html[data-theme="light"] .highlight .ge { font-style: italic } /* Generic.Emph */
+html[data-theme="light"] .highlight .gh { color: #005B82 } /* Generic.Heading */
+html[data-theme="light"] .highlight .gs { font-weight: bold } /* Generic.Strong */
+html[data-theme="light"] .highlight .gu { color: #005B82 } /* Generic.Subheading */
+html[data-theme="light"] .highlight .kc { color: #6730C5 } /* Keyword.Constant */
+html[data-theme="light"] .highlight .kd { color: #6730C5 } /* Keyword.Declaration */
+html[data-theme="light"] .highlight .kn { color: #6730C5 } /* Keyword.Namespace */
+html[data-theme="light"] .highlight .kp { color: #6730C5 } /* Keyword.Pseudo */
+html[data-theme="light"] .highlight .kr { color: #6730C5 } /* Keyword.Reserved */
+html[data-theme="light"] .highlight .kt { color: #7F4707 } /* Keyword.Type */
+html[data-theme="light"] .highlight .ld { color: #7F4707 } /* Literal.Date */
+html[data-theme="light"] .highlight .m { color: #7F4707 } /* Literal.Number */
+html[data-theme="light"] .highlight .s { color: #00622F } /* Literal.String */
+html[data-theme="light"] .highlight .na { color: #912583 } /* Name.Attribute */
+html[data-theme="light"] .highlight .nb { color: #7F4707 } /* Name.Builtin */
+html[data-theme="light"] .highlight .nc { color: #005B82 } /* Name.Class */
+html[data-theme="light"] .highlight .no { color: #005B82 } /* Name.Constant */
+html[data-theme="light"] .highlight .nd { color: #7F4707 } /* Name.Decorator */
+html[data-theme="light"] .highlight .ni { color: #00622F } /* Name.Entity */
+html[data-theme="light"] .highlight .ne { color: #6730C5 } /* Name.Exception */
+html[data-theme="light"] .highlight .nf { color: #005B82 } /* Name.Function */
+html[data-theme="light"] .highlight .nl { color: #7F4707 } /* Name.Label */
+html[data-theme="light"] .highlight .nn { color: #080808 } /* Name.Namespace */
+html[data-theme="light"] .highlight .nx { color: #080808 } /* Name.Other */
+html[data-theme="light"] .highlight .py { color: #005B82 } /* Name.Property */
+html[data-theme="light"] .highlight .nt { color: #005B82 } /* Name.Tag */
+html[data-theme="light"] .highlight .nv { color: #A12236 } /* Name.Variable */
+html[data-theme="light"] .highlight .ow { color: #6730C5 } /* Operator.Word */
+html[data-theme="light"] .highlight .pm { color: #080808 } /* Punctuation.Marker */
+html[data-theme="light"] .highlight .w { color: #080808 } /* Text.Whitespace */
+html[data-theme="light"] .highlight .mb { color: #7F4707 } /* Literal.Number.Bin */
+html[data-theme="light"] .highlight .mf { color: #7F4707 } /* Literal.Number.Float */
+html[data-theme="light"] .highlight .mh { color: #7F4707 } /* Literal.Number.Hex */
+html[data-theme="light"] .highlight .mi { color: #7F4707 } /* Literal.Number.Integer */
+html[data-theme="light"] .highlight .mo { color: #7F4707 } /* Literal.Number.Oct */
+html[data-theme="light"] .highlight .sa { color: #00622F } /* Literal.String.Affix */
+html[data-theme="light"] .highlight .sb { color: #00622F } /* Literal.String.Backtick */
+html[data-theme="light"] .highlight .sc { color: #00622F } /* Literal.String.Char */
+html[data-theme="light"] .highlight .dl { color: #00622F } /* Literal.String.Delimiter */
+html[data-theme="light"] .highlight .sd { color: #00622F } /* Literal.String.Doc */
+html[data-theme="light"] .highlight .s2 { color: #00622F } /* Literal.String.Double */
+html[data-theme="light"] .highlight .se { color: #00622F } /* Literal.String.Escape */
+html[data-theme="light"] .highlight .sh { color: #00622F } /* Literal.String.Heredoc */
+html[data-theme="light"] .highlight .si { color: #00622F } /* Literal.String.Interpol */
+html[data-theme="light"] .highlight .sx { color: #00622F } /* Literal.String.Other */
+html[data-theme="light"] .highlight .sr { color: #A12236 } /* Literal.String.Regex */
+html[data-theme="light"] .highlight .s1 { color: #00622F } /* Literal.String.Single */
+html[data-theme="light"] .highlight .ss { color: #005B82 } /* Literal.String.Symbol */
+html[data-theme="light"] .highlight .bp { color: #7F4707 } /* Name.Builtin.Pseudo */
+html[data-theme="light"] .highlight .fm { color: #005B82 } /* Name.Function.Magic */
+html[data-theme="light"] .highlight .vc { color: #A12236 } /* Name.Variable.Class */
+html[data-theme="light"] .highlight .vg { color: #A12236 } /* Name.Variable.Global */
+html[data-theme="light"] .highlight .vi { color: #A12236 } /* Name.Variable.Instance */
+html[data-theme="light"] .highlight .vm { color: #7F4707 } /* Name.Variable.Magic */
+html[data-theme="light"] .highlight .il { color: #7F4707 } /* Literal.Number.Integer.Long */
+html[data-theme="dark"] .highlight pre { line-height: 125%; }
+html[data-theme="dark"] .highlight td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
+html[data-theme="dark"] .highlight span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
+html[data-theme="dark"] .highlight td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
+html[data-theme="dark"] .highlight span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
+html[data-theme="dark"] .highlight .hll { background-color: #ffd9002e }
+html[data-theme="dark"] .highlight { background: #2b2b2b; color: #F8F8F2 }
+html[data-theme="dark"] .highlight .c { color: #FFD900 } /* Comment */
+html[data-theme="dark"] .highlight .err { color: #FFA07A } /* Error */
+html[data-theme="dark"] .highlight .k { color: #DCC6E0 } /* Keyword */
+html[data-theme="dark"] .highlight .l { color: #FFD900 } /* Literal */
+html[data-theme="dark"] .highlight .n { color: #F8F8F2 } /* Name */
+html[data-theme="dark"] .highlight .o { color: #ABE338 } /* Operator */
+html[data-theme="dark"] .highlight .p { color: #F8F8F2 } /* Punctuation */
+html[data-theme="dark"] .highlight .ch { color: #FFD900 } /* Comment.Hashbang */
+html[data-theme="dark"] .highlight .cm { color: #FFD900 } /* Comment.Multiline */
+html[data-theme="dark"] .highlight .cp { color: #FFD900 } /* Comment.Preproc */
+html[data-theme="dark"] .highlight .cpf { color: #FFD900 } /* Comment.PreprocFile */
+html[data-theme="dark"] .highlight .c1 { color: #FFD900 } /* Comment.Single */
+html[data-theme="dark"] .highlight .cs { color: #FFD900 } /* Comment.Special */
+html[data-theme="dark"] .highlight .gd { color: #00E0E0 } /* Generic.Deleted */
+html[data-theme="dark"] .highlight .ge { font-style: italic } /* Generic.Emph */
+html[data-theme="dark"] .highlight .gh { color: #00E0E0 } /* Generic.Heading */
+html[data-theme="dark"] .highlight .gs { font-weight: bold } /* Generic.Strong */
+html[data-theme="dark"] .highlight .gu { color: #00E0E0 } /* Generic.Subheading */
+html[data-theme="dark"] .highlight .kc { color: #DCC6E0 } /* Keyword.Constant */
+html[data-theme="dark"] .highlight .kd { color: #DCC6E0 } /* Keyword.Declaration */
+html[data-theme="dark"] .highlight .kn { color: #DCC6E0 } /* Keyword.Namespace */
+html[data-theme="dark"] .highlight .kp { color: #DCC6E0 } /* Keyword.Pseudo */
+html[data-theme="dark"] .highlight .kr { color: #DCC6E0 } /* Keyword.Reserved */
+html[data-theme="dark"] .highlight .kt { color: #FFD900 } /* Keyword.Type */
+html[data-theme="dark"] .highlight .ld { color: #FFD900 } /* Literal.Date */
+html[data-theme="dark"] .highlight .m { color: #FFD900 } /* Literal.Number */
+html[data-theme="dark"] .highlight .s { color: #ABE338 } /* Literal.String */
+html[data-theme="dark"] .highlight .na { color: #FFD900 } /* Name.Attribute */
+html[data-theme="dark"] .highlight .nb { color: #FFD900 } /* Name.Builtin */
+html[data-theme="dark"] .highlight .nc { color: #00E0E0 } /* Name.Class */
+html[data-theme="dark"] .highlight .no { color: #00E0E0 } /* Name.Constant */
+html[data-theme="dark"] .highlight .nd { color: #FFD900 } /* Name.Decorator */
+html[data-theme="dark"] .highlight .ni { color: #ABE338 } /* Name.Entity */
+html[data-theme="dark"] .highlight .ne { color: #DCC6E0 } /* Name.Exception */
+html[data-theme="dark"] .highlight .nf { color: #00E0E0 } /* Name.Function */
+html[data-theme="dark"] .highlight .nl { color: #FFD900 } /* Name.Label */
+html[data-theme="dark"] .highlight .nn { color: #F8F8F2 } /* Name.Namespace */
+html[data-theme="dark"] .highlight .nx { color: #F8F8F2 } /* Name.Other */
+html[data-theme="dark"] .highlight .py { color: #00E0E0 } /* Name.Property */
+html[data-theme="dark"] .highlight .nt { color: #00E0E0 } /* Name.Tag */
+html[data-theme="dark"] .highlight .nv { color: #FFA07A } /* Name.Variable */
+html[data-theme="dark"] .highlight .ow { color: #DCC6E0 } /* Operator.Word */
+html[data-theme="dark"] .highlight .pm { color: #F8F8F2 } /* Punctuation.Marker */
+html[data-theme="dark"] .highlight .w { color: #F8F8F2 } /* Text.Whitespace */
+html[data-theme="dark"] .highlight .mb { color: #FFD900 } /* Literal.Number.Bin */
+html[data-theme="dark"] .highlight .mf { color: #FFD900 } /* Literal.Number.Float */
+html[data-theme="dark"] .highlight .mh { color: #FFD900 } /* Literal.Number.Hex */
+html[data-theme="dark"] .highlight .mi { color: #FFD900 } /* Literal.Number.Integer */
+html[data-theme="dark"] .highlight .mo { color: #FFD900 } /* Literal.Number.Oct */
+html[data-theme="dark"] .highlight .sa { color: #ABE338 } /* Literal.String.Affix */
+html[data-theme="dark"] .highlight .sb { color: #ABE338 } /* Literal.String.Backtick */
+html[data-theme="dark"] .highlight .sc { color: #ABE338 } /* Literal.String.Char */
+html[data-theme="dark"] .highlight .dl { color: #ABE338 } /* Literal.String.Delimiter */
+html[data-theme="dark"] .highlight .sd { color: #ABE338 } /* Literal.String.Doc */
+html[data-theme="dark"] .highlight .s2 { color: #ABE338 } /* Literal.String.Double */
+html[data-theme="dark"] .highlight .se { color: #ABE338 } /* Literal.String.Escape */
+html[data-theme="dark"] .highlight .sh { color: #ABE338 } /* Literal.String.Heredoc */
+html[data-theme="dark"] .highlight .si { color: #ABE338 } /* Literal.String.Interpol */
+html[data-theme="dark"] .highlight .sx { color: #ABE338 } /* Literal.String.Other */
+html[data-theme="dark"] .highlight .sr { color: #FFA07A } /* Literal.String.Regex */
+html[data-theme="dark"] .highlight .s1 { color: #ABE338 } /* Literal.String.Single */
+html[data-theme="dark"] .highlight .ss { color: #00E0E0 } /* Literal.String.Symbol */
+html[data-theme="dark"] .highlight .bp { color: #FFD900 } /* Name.Builtin.Pseudo */
+html[data-theme="dark"] .highlight .fm { color: #00E0E0 } /* Name.Function.Magic */
+html[data-theme="dark"] .highlight .vc { color: #FFA07A } /* Name.Variable.Class */
+html[data-theme="dark"] .highlight .vg { color: #FFA07A } /* Name.Variable.Global */
+html[data-theme="dark"] .highlight .vi { color: #FFA07A } /* Name.Variable.Instance */
+html[data-theme="dark"] .highlight .vm { color: #FFD900 } /* Name.Variable.Magic */
+html[data-theme="dark"] .highlight .il { color: #FFD900 } /* Literal.Number.Integer.Long */
\ No newline at end of file
diff --git a/_static/sbt-webpack-macros.html b/_static/sbt-webpack-macros.html
old mode 100644
new mode 100755
diff --git a/_static/scripts/bootstrap.js b/_static/scripts/bootstrap.js
old mode 100644
new mode 100755
diff --git a/_static/scripts/bootstrap.js.LICENSE.txt b/_static/scripts/bootstrap.js.LICENSE.txt
old mode 100644
new mode 100755
diff --git a/_static/scripts/bootstrap.js.map b/_static/scripts/bootstrap.js.map
old mode 100644
new mode 100755
diff --git a/_static/scripts/pydata-sphinx-theme.js b/_static/scripts/pydata-sphinx-theme.js
old mode 100644
new mode 100755
diff --git a/_static/scripts/pydata-sphinx-theme.js.map b/_static/scripts/pydata-sphinx-theme.js.map
old mode 100644
new mode 100755
diff --git a/_static/scripts/sphinx-book-theme.js b/_static/scripts/sphinx-book-theme.js
old mode 100644
new mode 100755
diff --git a/_static/scripts/sphinx-book-theme.js.map b/_static/scripts/sphinx-book-theme.js.map
old mode 100644
new mode 100755
diff --git a/_static/searchtools.js b/_static/searchtools.js
old mode 100644
new mode 100755
diff --git a/_static/sphinx-book-theme.40e2e510f6b7d1648584402491bb10fe.css b/_static/sphinx-book-theme.40e2e510f6b7d1648584402491bb10fe.css
old mode 100644
new mode 100755
diff --git a/_static/sphinx-book-theme.css b/_static/sphinx-book-theme.css
old mode 100644
new mode 100755
diff --git a/_static/sphinx-book-theme.d31b09fe5c1d09cb49b26a786de4a05d.js b/_static/sphinx-book-theme.d31b09fe5c1d09cb49b26a786de4a05d.js
old mode 100644
new mode 100755
diff --git a/_static/sphinx-book-theme.d59cb220de22ca1c485ebbdc042f0030.js b/_static/sphinx-book-theme.d59cb220de22ca1c485ebbdc042f0030.js
old mode 100644
new mode 100755
diff --git a/_static/sphinx-book-theme.e2363ea40746bee74734a24ffefccd78.css b/_static/sphinx-book-theme.e2363ea40746bee74734a24ffefccd78.css
old mode 100644
new mode 100755
diff --git a/_static/sphinx-design.min.css b/_static/sphinx-design.min.css
old mode 100644
new mode 100755
diff --git a/_static/sphinx-thebe.css b/_static/sphinx-thebe.css
old mode 100644
new mode 100755
diff --git a/_static/sphinx-thebe.js b/_static/sphinx-thebe.js
old mode 100644
new mode 100755
diff --git a/_static/sphinx_highlight.js b/_static/sphinx_highlight.js
old mode 100644
new mode 100755
diff --git a/_static/styles/bootstrap.css b/_static/styles/bootstrap.css
old mode 100644
new mode 100755
diff --git a/_static/styles/bootstrap.css.map b/_static/styles/bootstrap.css.map
old mode 100644
new mode 100755
diff --git a/_static/styles/pydata-sphinx-theme.css b/_static/styles/pydata-sphinx-theme.css
old mode 100644
new mode 100755
diff --git a/_static/styles/pydata-sphinx-theme.css.map b/_static/styles/pydata-sphinx-theme.css.map
old mode 100644
new mode 100755
diff --git a/_static/styles/sphinx-book-theme.css b/_static/styles/sphinx-book-theme.css
old mode 100644
new mode 100755
diff --git a/_static/styles/sphinx-book-theme.css.map b/_static/styles/sphinx-book-theme.css.map
old mode 100644
new mode 100755
diff --git a/_static/styles/theme.css b/_static/styles/theme.css
old mode 100644
new mode 100755
diff --git a/_static/togglebutton.css b/_static/togglebutton.css
old mode 100644
new mode 100755
diff --git a/_static/togglebutton.js b/_static/togglebutton.js
old mode 100644
new mode 100755
diff --git a/_static/underscore-1.13.1.js b/_static/underscore-1.13.1.js
old mode 100644
new mode 100755
diff --git a/_static/underscore-1.3.1.js b/_static/underscore-1.3.1.js
old mode 100644
new mode 100755
diff --git a/_static/underscore.js b/_static/underscore.js
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/LICENSE.txt b/_static/vendor/fontawesome/5.13.0/LICENSE.txt
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/css/all.min.css b/_static/vendor/fontawesome/5.13.0/css/all.min.css
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.eot b/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.eot
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.svg b/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.svg
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.ttf b/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff b/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2 b/_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.eot b/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.eot
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.svg b/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.svg
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.ttf b/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.woff b/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.woff2 b/_static/vendor/fontawesome/5.13.0/webfonts/fa-regular-400.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.eot b/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.eot
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.svg b/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.svg
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.ttf b/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff b/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2 b/_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.1.2/LICENSE.txt b/_static/vendor/fontawesome/6.1.2/LICENSE.txt
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.1.2/css/all.min.css b/_static/vendor/fontawesome/6.1.2/css/all.min.css
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.1.2/js/all.min.js b/_static/vendor/fontawesome/6.1.2/js/all.min.js
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.1.2/js/all.min.js.LICENSE.txt b/_static/vendor/fontawesome/6.1.2/js/all.min.js.LICENSE.txt
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.1.2/webfonts/fa-brands-400.ttf b/_static/vendor/fontawesome/6.1.2/webfonts/fa-brands-400.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.1.2/webfonts/fa-brands-400.woff2 b/_static/vendor/fontawesome/6.1.2/webfonts/fa-brands-400.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.1.2/webfonts/fa-regular-400.ttf b/_static/vendor/fontawesome/6.1.2/webfonts/fa-regular-400.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.1.2/webfonts/fa-regular-400.woff2 b/_static/vendor/fontawesome/6.1.2/webfonts/fa-regular-400.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.1.2/webfonts/fa-solid-900.ttf b/_static/vendor/fontawesome/6.1.2/webfonts/fa-solid-900.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.1.2/webfonts/fa-solid-900.woff2 b/_static/vendor/fontawesome/6.1.2/webfonts/fa-solid-900.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.1.2/webfonts/fa-v4compatibility.ttf b/_static/vendor/fontawesome/6.1.2/webfonts/fa-v4compatibility.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.1.2/webfonts/fa-v4compatibility.woff2 b/_static/vendor/fontawesome/6.1.2/webfonts/fa-v4compatibility.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.1/LICENSE.txt b/_static/vendor/fontawesome/6.5.1/LICENSE.txt
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.1/css/all.min.css b/_static/vendor/fontawesome/6.5.1/css/all.min.css
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.1/js/all.min.js b/_static/vendor/fontawesome/6.5.1/js/all.min.js
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.1/js/all.min.js.LICENSE.txt b/_static/vendor/fontawesome/6.5.1/js/all.min.js.LICENSE.txt
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.1/webfonts/fa-brands-400.ttf b/_static/vendor/fontawesome/6.5.1/webfonts/fa-brands-400.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.1/webfonts/fa-brands-400.woff2 b/_static/vendor/fontawesome/6.5.1/webfonts/fa-brands-400.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.1/webfonts/fa-regular-400.ttf b/_static/vendor/fontawesome/6.5.1/webfonts/fa-regular-400.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.1/webfonts/fa-regular-400.woff2 b/_static/vendor/fontawesome/6.5.1/webfonts/fa-regular-400.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.1/webfonts/fa-solid-900.ttf b/_static/vendor/fontawesome/6.5.1/webfonts/fa-solid-900.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.1/webfonts/fa-solid-900.woff2 b/_static/vendor/fontawesome/6.5.1/webfonts/fa-solid-900.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.1/webfonts/fa-v4compatibility.ttf b/_static/vendor/fontawesome/6.5.1/webfonts/fa-v4compatibility.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.1/webfonts/fa-v4compatibility.woff2 b/_static/vendor/fontawesome/6.5.1/webfonts/fa-v4compatibility.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.2/LICENSE.txt b/_static/vendor/fontawesome/6.5.2/LICENSE.txt
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.2/css/all.min.css b/_static/vendor/fontawesome/6.5.2/css/all.min.css
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.2/js/all.min.js b/_static/vendor/fontawesome/6.5.2/js/all.min.js
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.2/js/all.min.js.LICENSE.txt b/_static/vendor/fontawesome/6.5.2/js/all.min.js.LICENSE.txt
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.ttf b/_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2 b/_static/vendor/fontawesome/6.5.2/webfonts/fa-brands-400.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.ttf b/_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2 b/_static/vendor/fontawesome/6.5.2/webfonts/fa-regular-400.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.ttf b/_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2 b/_static/vendor/fontawesome/6.5.2/webfonts/fa-solid-900.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.2/webfonts/fa-v4compatibility.ttf b/_static/vendor/fontawesome/6.5.2/webfonts/fa-v4compatibility.ttf
old mode 100644
new mode 100755
diff --git a/_static/vendor/fontawesome/6.5.2/webfonts/fa-v4compatibility.woff2 b/_static/vendor/fontawesome/6.5.2/webfonts/fa-v4compatibility.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/LICENSE.md b/_static/vendor/lato_latin-ext/1.44.1/LICENSE.md
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-100-italic.woff b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-100-italic.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-100-italic.woff2 b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-100-italic.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-100.woff b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-100.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-100.woff2 b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-100.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-300-italic.woff b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-300-italic.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-300-italic.woff2 b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-300-italic.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-300.woff b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-300.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-300.woff2 b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-300.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-400-italic.woff b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-400-italic.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-400-italic.woff2 b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-400-italic.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-400.woff b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-400.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-400.woff2 b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-400.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-700-italic.woff b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-700-italic.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-700-italic.woff2 b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-700-italic.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-700.woff b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-700.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-700.woff2 b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-700.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-900-italic.woff b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-900-italic.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-900-italic.woff2 b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-900-italic.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-900.woff b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-900.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-900.woff2 b/_static/vendor/lato_latin-ext/1.44.1/files/lato-latin-ext-900.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/lato_latin-ext/1.44.1/index.css b/_static/vendor/lato_latin-ext/1.44.1/index.css
old mode 100644
new mode 100755
diff --git a/_static/vendor/open-sans_all/1.44.1/LICENSE.md b/_static/vendor/open-sans_all/1.44.1/LICENSE.md
old mode 100644
new mode 100755
diff --git a/_static/vendor/open-sans_all/1.44.1/files/open-sans-all-400-italic.woff b/_static/vendor/open-sans_all/1.44.1/files/open-sans-all-400-italic.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/open-sans_all/1.44.1/files/open-sans-all-400-italic.woff2 b/_static/vendor/open-sans_all/1.44.1/files/open-sans-all-400-italic.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/open-sans_all/1.44.1/files/open-sans-all-400.woff b/_static/vendor/open-sans_all/1.44.1/files/open-sans-all-400.woff
old mode 100644
new mode 100755
diff --git a/_static/vendor/open-sans_all/1.44.1/files/open-sans-all-400.woff2 b/_static/vendor/open-sans_all/1.44.1/files/open-sans-all-400.woff2
old mode 100644
new mode 100755
diff --git a/_static/vendor/open-sans_all/1.44.1/index.css b/_static/vendor/open-sans_all/1.44.1/index.css
old mode 100644
new mode 100755
diff --git a/_static/webpack-macros.html b/_static/webpack-macros.html
old mode 100644
new mode 100755
diff --git a/docs/experiments/js_exp.html b/docs/experiments/js_exp.html
old mode 100644
new mode 100755
index fdcb3357..69a573f8
--- a/docs/experiments/js_exp.html
+++ b/docs/experiments/js_exp.html
@@ -1,874 +1,894 @@
-
-
-
-
-
-
-
-
competition을 설명한 article (링크)에서 전체적인 accuracy는 97%이지만 multiple diseases class의 경우 accuracy가 51%에 불과했다고 언급합니다.
-
multiple diseases class의 이미지 개수가 다른 class에 비해 적은 점에 주목했고, stable diffusion을 사용하여 해당 클래스의 데이터 개수를 늘려서 classifier 학습에 사용하면 더 좋은 성능의 classifier를 얻을 수 있을 것으로 기대했습니다.
상황1을 보면 multiple diseases class 정보를 담은 unique identifier <diseaes-leaf>가 없음에도 multiple diseases의 정보를 담은 잎들만 생성됩니다. 이는 같은 class (leaf)에 속하는 다른 이미지들을 생성해내지 못하고 있다는 것입니다. 이 현상을 language drift라고 하며, 모델이 multiple diseases class의 leaf가 아닌 일반적인 leaf class에 관한 정보를 잊어버렸기 때문입니다.
dreambooth에서는 language drift를 prior preservation loss를 사용해서 해결하였으므로 같은 방법을 사용했습니다. 상황2를 해결하기 위해 training prompt에서 “photo”를 제외하고 최대한 단순한 prompt “<diseases-leaf> leaf”를 사용하여 stable diffusion model을 다시 fine tuning했습니다.
-
-
-
-
-
Fig. 738 multiple diseases class 이미지 생성 결과, prompt: “<diseaes-leaf> leaf”#
“photo”의 경우에는 여전히 multiple diseases class의 영향을 받은 것같은 이미지들이 생성됩니다. photo의 경우에는 여러 대상들과 사용되는 일반적인 특성을 가지고있어서 그런 것이라는 생각이 들었고, 이를 체크해보기 위해 특정한 대상들과 photo와 비슷한 용도로 사용되는 다른 prompt들로 이미지들을 생성보았습니다.
-
특정한 대상 세가지로는 cat, sea, pirate을 사용했고, photo와 비슷하게 사용되는 텍스트 세가지는 illustration, animation, wallpaper를 사용했습니다. (이미지는 글 마지막 부분의 appendix에 있습니다.)
-
이미지 생성 결과, 특정한 대상을 지칭하는 텍스트의 경우 대상의 특징이 잘 드러나는 이미지가 생성되었지만, 여러 대상과 함께 쓰이는 텍스트의 경우 잎사귀의 특징을 가지는 이미지들이 일부 생성되었습니다.
competition을 설명한 article (링크)에서 전체적인 accuracy는 97%이지만 multiple diseases class의 경우 accuracy가 51%에 불과했다고 언급합니다.
+
multiple diseases class의 이미지 개수가 다른 class에 비해 적은 점에 주목했고, stable diffusion을 사용하여 해당 클래스의 데이터 개수를 늘려서 classifier 학습에 사용하면 더 좋은 성능의 classifier를 얻을 수 있을 것으로 기대했습니다.
상황1을 보면 multiple diseases class 정보를 담은 unique identifier <diseaes-leaf>가 없음에도 multiple diseases의 정보를 담은 잎들만 생성됩니다. 이는 같은 class (leaf)에 속하는 다른 이미지들을 생성해내지 못하고 있다는 것입니다. 이 현상을 language drift라고 하며, 모델이 multiple diseases class의 leaf가 아닌 일반적인 leaf class에 관한 정보를 잊어버렸기 때문입니다.
dreambooth에서는 language drift를 prior preservation loss를 사용해서 해결하였으므로 같은 방법을 사용했습니다. 상황2를 해결하기 위해 training prompt에서 “photo”를 제외하고 최대한 단순한 prompt “<diseases-leaf> leaf”를 사용하여 stable diffusion model을 다시 fine tuning했습니다.
+
+
+
+
+
Fig. 828 multiple diseases class 이미지 생성 결과, prompt: “<diseaes-leaf> leaf”#
“photo”의 경우에는 여전히 multiple diseases class의 영향을 받은 것같은 이미지들이 생성됩니다. photo의 경우에는 여러 대상들과 사용되는 일반적인 특성을 가지고있어서 그런 것이라는 생각이 들었고, 이를 체크해보기 위해 특정한 대상들과 photo와 비슷한 용도로 사용되는 다른 prompt들로 이미지들을 생성보았습니다.
+
특정한 대상 세가지로는 cat, sea, pirate을 사용했고, photo와 비슷하게 사용되는 텍스트 세가지는 illustration, animation, wallpaper를 사용했습니다. (이미지는 글 마지막 부분의 appendix에 있습니다.)
+
이미지 생성 결과, 특정한 대상을 지칭하는 텍스트의 경우 대상의 특징이 잘 드러나는 이미지가 생성되었지만, 여러 대상과 함께 쓰이는 텍스트의 경우 잎사귀의 특징을 가지는 이미지들이 일부 생성되었습니다.
이번 포스팅에서는 DreamBooth 를 직접 학습해보고 실험한 결과들을 공유할려고 합니다.
-
우선적으로 학습데이터는 bryandlee/naver-webtoon-data 에 공개된 YOLOv5 모델 및 Waifu2x 후처리 기법을 활용하여 프리드로우에 등장하는 인물 사진들을 수집했습니다. 논문에서는 3-5 장으로 fine-tuning 이 가능하다고 제시되어있지만, 인물 사진 같은 경우 더 많은 데이터로 학습하면 성능이 더 좋아져서 15-20 장의 이미지로 학습하였습니다. 학습한 이미지들 예시입니다.
DreamBooth 를 실험하면서 대표적으로 instance prompt, guidance scale, negative prompt, 그리고 마지막으로 prior preservation loss 를 반영하는 정도를 조절하는 prior_loss_weight 를 바꿔가면서 학습해보았습니다. 사전학습된 text-to-image 모델로 처음에는 hakurei/waifu-diffusion 모델을 시도해봤지만 결과가 만족스럽지 못해 runwayml/stable-diffusion-v1-5 모델로 fine-tuning 작업을 진행했습니다.
아래 그림처럼 동일한 inference prompt 를 입력했을 때, prior preservation loss 를 제외함으로써 input images 에 더 가까운 웹툰 사진들을 생성할 수 있었습니다. 또한, 핑크색 머리를 한 이민지 캐릭터를 어느 정도 잘 생성하는 부분도 확인할 수 있습니다.
-
-
Inference Prompt: “A photo of sks girl with pink hair” (with prior-preservation loss)
DreamBooth 논문에서 제시한 instance prompt 외에 “A photo of a girl in the style of sks” 라는 prompt 로 학습을 시도해보기도 했습니다. sks 라는 unique identifier 에 특정 여자 캐릭터에 대한 정보뿐만 아니라 프리드로우 그림체 자체를 담아내기 위한 목적이였습니다.
-
# different instance prompt with prior-preservation loss
-MODEL_NAME = “runwayml/stable-diffusion-v1-5”
-instance_prompt = "A photo of a girl in the style of sks"
-class_prompt = "A photo of a girl"
-
-python3 train_dreambooth.py \
- --pretrained_model_name_or_path=$MODEL_NAME \
- --pretrained_vae_name_or_path="stabilityai/sd-vae-ft-mse" \
- --output_dir=$OUTPUT_DIR \
- --revision="fp16" \
- --with_prior_preservation --prior_loss_weight=1.0 \
- --seed=1337 \
- --resolution=512 \
- --train_batch_size=1 \
- --train_text_encoder \
- --mixed_precision="fp16" \
- --use_8bit_adam \
- --gradient_accumulation_steps=1 --gradient_checkpointing \
- --learning_rate=1e-6 \
- --lr_scheduler="constant" \
- --lr_warmup_steps=0 \
- --num_class_images=200 \
- --sample_batch_size=4 \
- --max_train_steps=800 \
- --save_interval=100 \
- --save_sample_prompt="A photo of sks girl" \
- --concepts_list="concepts_list.json"
-
-
-
# different instance prompt w/o prior-preservation loss
-MODEL_NAME = “runwayml/stable-diffusion-v1-5”
-instance_prompt = "A photo of a girl in the style of sks"
-class_prompt = "A photo of a girl"
-
-python3 train_dreambooth.py \
- --pretrained_model_name_or_path=$MODEL_NAME \
- --pretrained_vae_name_or_path="stabilityai/sd-vae-ft-mse" \
- --output_dir=$OUTPUT_DIR \
- --revision="fp16" \
- --with_prior_preservation --prior_loss_weight=0.0 \
- --seed=1337 \
- --resolution=512 \
- --train_batch_size=1 \
- --train_text_encoder \
- --mixed_precision="fp16" \
- --use_8bit_adam \
- --gradient_accumulation_steps=1 --gradient_checkpointing \
- --learning_rate=1e-6 \
- --lr_scheduler="constant" \
- --lr_warmup_steps=0 \
- --num_class_images=200 \
- --sample_batch_size=4 \
- --max_train_steps=800 \
- --save_interval=100 \
- --save_sample_prompt="A photo of sks girl" \
- --concepts_list="concepts_list.json"
-
-
-
Inference 시, 프리드로우의 그림체가 반영된 남자가 생성되도록 prompt 를 “A photo of a boy in the style of sks” 로 입력했을때의 결과입니다. DreamBooth 혹은 사전학습된 text-to-image 모델을 프리드로우 작가님의 웹툰 장면들로 전체적으로 학습하게 된다면 더 다양한 inference 결과들을 볼 수 있을 것 같습니다.
-
-
Inference Prompt: “A photo of a boy in the style of sks” (num_inference_steps = 24 / with prior-preservation loss)
Inference step 을 늘려가면서 추론된 인물 이미지의 퀄리티가 상승하는 부분도 확인할 수 있었습니다. 또한, guidance scale 에 대한 실험도 진행했는데 guidance scale 이 작을수록 prompt 와 무관한 random 한 이미지들을 생성하게 됩니다. 최종적으로 num_inference steps 와 guidance scale 의 값은 각각 100 과 7.5 로 설정하였습니다.
-
-
Inference Prompt: “A photo of a boy in the style of sks” (num_inference_steps=100 / with prior-preservation loss)
마지막으로 하단의 좌측과 우측 사진은 각각 “A photo of sks girl” 그리고 “A photo of a girl in the style of sks” 이라는 prompt 로 DreamBooth 모델을 각각 학습한 후, 나비를 생성하라는 동일한 prompt 로 추론해본 결과입니다. sks 가 수식하는 명사가 girl 이 아닌 style 이도록 prompt 를 수정함으로써, butterfly 사진을 생성할때 조금이나마 더 프리드로우 웹툰의 그림체를 반영할 수 있었던 부분도 확인할 수 있었습니다.
-
-
Inference Prompt: “A photo of a butterfly in the style of sks” (num_inference_steps = 100 / with prior-preservation loss)
이번 포스팅에서는 DreamBooth 를 직접 학습해보고 실험한 결과들을 공유할려고 합니다.
+
우선적으로 학습데이터는 bryandlee/naver-webtoon-data 에 공개된 YOLOv5 모델 및 Waifu2x 후처리 기법을 활용하여 프리드로우에 등장하는 인물 사진들을 수집했습니다. 논문에서는 3-5 장으로 fine-tuning 이 가능하다고 제시되어있지만, 인물 사진 같은 경우 더 많은 데이터로 학습하면 성능이 더 좋아져서 15-20 장의 이미지로 학습하였습니다. 학습한 이미지들 예시입니다.
DreamBooth 를 실험하면서 대표적으로 instance prompt, guidance scale, negative prompt, 그리고 마지막으로 prior preservation loss 를 반영하는 정도를 조절하는 prior_loss_weight 를 바꿔가면서 학습해보았습니다. 사전학습된 text-to-image 모델로 처음에는 hakurei/waifu-diffusion 모델을 시도해봤지만 결과가 만족스럽지 못해 runwayml/stable-diffusion-v1-5 모델로 fine-tuning 작업을 진행했습니다.
아래 그림처럼 동일한 inference prompt 를 입력했을 때, prior preservation loss 를 제외함으로써 input images 에 더 가까운 웹툰 사진들을 생성할 수 있었습니다. 또한, 핑크색 머리를 한 이민지 캐릭터를 어느 정도 잘 생성하는 부분도 확인할 수 있습니다.
+
+
Inference Prompt: “A photo of sks girl with pink hair” (with prior-preservation loss)
DreamBooth 논문에서 제시한 instance prompt 외에 “A photo of a girl in the style of sks” 라는 prompt 로 학습을 시도해보기도 했습니다. sks 라는 unique identifier 에 특정 여자 캐릭터에 대한 정보뿐만 아니라 프리드로우 그림체 자체를 담아내기 위한 목적이였습니다.
+
# different instance prompt with prior-preservation loss
+MODEL_NAME = “runwayml/stable-diffusion-v1-5”
+instance_prompt = "A photo of a girl in the style of sks"
+class_prompt = "A photo of a girl"
+
+python3 train_dreambooth.py \
+ --pretrained_model_name_or_path=$MODEL_NAME \
+ --pretrained_vae_name_or_path="stabilityai/sd-vae-ft-mse" \
+ --output_dir=$OUTPUT_DIR \
+ --revision="fp16" \
+ --with_prior_preservation --prior_loss_weight=1.0 \
+ --seed=1337 \
+ --resolution=512 \
+ --train_batch_size=1 \
+ --train_text_encoder \
+ --mixed_precision="fp16" \
+ --use_8bit_adam \
+ --gradient_accumulation_steps=1 --gradient_checkpointing \
+ --learning_rate=1e-6 \
+ --lr_scheduler="constant" \
+ --lr_warmup_steps=0 \
+ --num_class_images=200 \
+ --sample_batch_size=4 \
+ --max_train_steps=800 \
+ --save_interval=100 \
+ --save_sample_prompt="A photo of sks girl" \
+ --concepts_list="concepts_list.json"
+
+
+
# different instance prompt w/o prior-preservation loss
+MODEL_NAME = “runwayml/stable-diffusion-v1-5”
+instance_prompt = "A photo of a girl in the style of sks"
+class_prompt = "A photo of a girl"
+
+python3 train_dreambooth.py \
+ --pretrained_model_name_or_path=$MODEL_NAME \
+ --pretrained_vae_name_or_path="stabilityai/sd-vae-ft-mse" \
+ --output_dir=$OUTPUT_DIR \
+ --revision="fp16" \
+ --with_prior_preservation --prior_loss_weight=0.0 \
+ --seed=1337 \
+ --resolution=512 \
+ --train_batch_size=1 \
+ --train_text_encoder \
+ --mixed_precision="fp16" \
+ --use_8bit_adam \
+ --gradient_accumulation_steps=1 --gradient_checkpointing \
+ --learning_rate=1e-6 \
+ --lr_scheduler="constant" \
+ --lr_warmup_steps=0 \
+ --num_class_images=200 \
+ --sample_batch_size=4 \
+ --max_train_steps=800 \
+ --save_interval=100 \
+ --save_sample_prompt="A photo of sks girl" \
+ --concepts_list="concepts_list.json"
+
+
+
Inference 시, 프리드로우의 그림체가 반영된 남자가 생성되도록 prompt 를 “A photo of a boy in the style of sks” 로 입력했을때의 결과입니다. DreamBooth 혹은 사전학습된 text-to-image 모델을 프리드로우 작가님의 웹툰 장면들로 전체적으로 학습하게 된다면 더 다양한 inference 결과들을 볼 수 있을 것 같습니다.
+
+
Inference Prompt: “A photo of a boy in the style of sks” (num_inference_steps = 24 / with prior-preservation loss)
Inference step 을 늘려가면서 추론된 인물 이미지의 퀄리티가 상승하는 부분도 확인할 수 있었습니다. 또한, guidance scale 에 대한 실험도 진행했는데 guidance scale 이 작을수록 prompt 와 무관한 random 한 이미지들을 생성하게 됩니다. 최종적으로 num_inference steps 와 guidance scale 의 값은 각각 100 과 7.5 로 설정하였습니다.
+
+
Inference Prompt: “A photo of a boy in the style of sks” (num_inference_steps=100 / with prior-preservation loss)
마지막으로 하단의 좌측과 우측 사진은 각각 “A photo of sks girl” 그리고 “A photo of a girl in the style of sks” 이라는 prompt 로 DreamBooth 모델을 각각 학습한 후, 나비를 생성하라는 동일한 prompt 로 추론해본 결과입니다. sks 가 수식하는 명사가 girl 이 아닌 style 이도록 prompt 를 수정함으로써, butterfly 사진을 생성할때 조금이나마 더 프리드로우 웹툰의 그림체를 반영할 수 있었던 부분도 확인할 수 있었습니다.
+
+
Inference Prompt: “A photo of a butterfly in the style of sks” (num_inference_steps = 100 / with prior-preservation loss)
3D Gaussian Splatting for Real-Time Radiance Field Rendering#
-
NeRF 기반 방식들은 높은 품질의 새로운 장면 합성이 가능하지만, 시간이 많이 걸려 실시간 렌더링에는 한계가 있다. 다른 방식들은 시간은 빠르지만 품질이 떨어진다. 이를 해결하기 위해, 논문은 3D Gaussian Splatting을 제안합니다. 이 방법은 Mip-NeRF360과 유사한 성능을 제공하면서도 InstantNGP만큼 빠르게 학습할 수 있다.
-
3D Gaussian Splatting은 다음 세 가지로 구성된다다:
-
-
Structure-from-Motion(SfM)에서 얻은 희소 점 구름을 초기값으로 3D 가우시안을 도입
-
3D 위치, 불투명도, 이방성 공분산, 구형 고조파(SH) 계수의 최적화
-
타일 기반 래스터화에서 영감을 받은 빠른 GPU 정렬 알고리즘을 통한 실시간 렌더링
-
-
이 방법은 이전의 implicit radiance field 접근법들과 동등하거나 더 나은 품질을 제공하며, 이전의 가장 빠른 방식과 유사한 학습 속도와 품질을 보여주어 고수준의 새로운 뷰 합성에 대해 처음으로 실시간 렌더링을 제공한다.
이 논문은 normal(표면 법선)이 없는 Structure-from-Motion(SfM) 포인트들의 sparse한 셋을 initial point로 하여, 고품질의 novel view synthesis를 가능하게 하는 scene representation을 최적화하는 것을 목표로 한다.
-
빠른 렌더링을 위해 unstructured하고 explicit한 primitive를 필요로 하며, 이를 위해 미분 가능하고 2D splats로 쉽게 project되는 3D Gaussian을 선택했다.
3D Gaussian은 포인트(mean) μ를 중심으로 하고, 3D 공분산 행렬 Σ로 정의한다. 렌더링을 위해 3D Gaussian을 2D로 project해야 하며, 이는 viewing transformation W에 따라 카메라 좌표계에서의 공분산 행렬 Σ’로 나타낼 수 있다. 최적화를 위해, Σ는 positive semi-definite 행렬이어야 하며, 이 때문에 최적화가 어렵다고 한다.
최적화에 적합한 anisotropic covariance representation은 장면의 다양한 geometry에 적응하도록 3D Gaussian을 최적화한다.
-
-
-
Optimization with Adaptive Density Control of 3D Gaussians#
-
-
Optimization
-
Adaptive Control of Gaussians
-
-
이 논문의 핵심 접근법은 free-view synthesis를 위해 장면을 정확하게 표현하는 3D Gaussian의 밀집된 세트를 만드는 최적화 단계다. 여기에는 position 𝑝, 투명도 𝛼, 공분산 Σ뿐만 아니라, scene의 view-dependent appearance를 정확하게 위한 각 Gaussian의 색상 c를 표현하는 SH coefficients까지 포함된다.
3D Gaussian Splatting for Real-Time Radiance Field Rendering#
+
NeRF 기반 방식들은 높은 품질의 새로운 장면 합성이 가능하지만, 시간이 많이 걸려 실시간 렌더링에는 한계가 있다. 다른 방식들은 시간은 빠르지만 품질이 떨어진다. 이를 해결하기 위해, 논문은 3D Gaussian Splatting을 제안합니다. 이 방법은 Mip-NeRF360과 유사한 성능을 제공하면서도 InstantNGP만큼 빠르게 학습할 수 있다.
+
3D Gaussian Splatting은 다음 세 가지로 구성된다다:
+
+
Structure-from-Motion(SfM)에서 얻은 희소 점 구름을 초기값으로 3D 가우시안을 도입
+
3D 위치, 불투명도, 이방성 공분산, 구형 고조파(SH) 계수의 최적화
+
타일 기반 래스터화에서 영감을 받은 빠른 GPU 정렬 알고리즘을 통한 실시간 렌더링
+
+
이 방법은 이전의 implicit radiance field 접근법들과 동등하거나 더 나은 품질을 제공하며, 이전의 가장 빠른 방식과 유사한 학습 속도와 품질을 보여주어 고수준의 새로운 뷰 합성에 대해 처음으로 실시간 렌더링을 제공한다.
이 논문은 normal(표면 법선)이 없는 Structure-from-Motion(SfM) 포인트들의 sparse한 셋을 initial point로 하여, 고품질의 novel view synthesis를 가능하게 하는 scene representation을 최적화하는 것을 목표로 한다.
+
빠른 렌더링을 위해 unstructured하고 explicit한 primitive를 필요로 하며, 이를 위해 미분 가능하고 2D splats로 쉽게 project되는 3D Gaussian을 선택했다.
3D Gaussian은 포인트(mean) μ를 중심으로 하고, 3D 공분산 행렬 Σ로 정의한다. 렌더링을 위해 3D Gaussian을 2D로 project해야 하며, 이는 viewing transformation W에 따라 카메라 좌표계에서의 공분산 행렬 Σ’로 나타낼 수 있다. 최적화를 위해, Σ는 positive semi-definite 행렬이어야 하며, 이 때문에 최적화가 어렵다고 한다.
최적화에 적합한 anisotropic covariance representation은 장면의 다양한 geometry에 적응하도록 3D Gaussian을 최적화한다.
+
+
+
Optimization with Adaptive Density Control of 3D Gaussians#
+
+
Optimization
+
Adaptive Control of Gaussians
+
+
이 논문의 핵심 접근법은 free-view synthesis를 위해 장면을 정확하게 표현하는 3D Gaussian의 밀집된 세트를 만드는 최적화 단계다. 여기에는 position 𝑝, 투명도 𝛼, 공분산 Σ뿐만 아니라, scene의 view-dependent appearance를 정확하게 위한 각 Gaussian의 색상 c를 표현하는 SH coefficients까지 포함된다.
최근 GAN, Diffusion 등 Implicit generative model들이 뛰어난 성능을 보여줌
-
하지만 다른 task(classification, segmentation 등)와는 다르게 생성 모델의 metric을 정하는것은 challenging ( classification ; P&R, F1 score / segmentation ; IOU(Intersection Over Union)
-
그나마 이미지의 featue map이나 classfier score를 사용하는 FiD, Inception score가 잘 쓰이는 추세
-
위 metric의 단점
-
-
real 이미지 분포의 space에서 해당 수치가 정말 유의미한 연관이 있는지 증명되지 않음
-
pretrained model의 거대한 train set이 specific 이미지의 feature에 얼마나 좋은 성능을 미치는지 알수 없음(inception net ; imagenet / ddpm ; face)
-
-
-
Human study의 직관적인 방식도 있지만 time과 cost를 매우 필요로한다는 점과 model의 Diversity는 측정하기 어렵다는 단점
-
-
e.g ) 하나의 좋은 이미지만 생성해도 좋은 score를 받을 수 있음
-
-
-
이 논문에서는
-
-
Image-GPT 모델을 통해 high quality의 new synthetic dataset을 생성
-
여러 모델을 위의 데이터로 학습하고 FiD, IS등 다양한 metric을 측정
-
이를 실제 KL Divergence, Reverse KL Divergence 값과 비교해서 metric의 유효성을 검증
-
FID, IS등 다양한 metric의 base model로 쓰이는 Inception-V3과 CLIP 의 비교를 통해 Inception-V3 모델의 적합성을 검증
최근 GAN, Diffusion 등 Implicit generative model들이 뛰어난 성능을 보여줌
+
하지만 다른 task(classification, segmentation 등)와는 다르게 생성 모델의 metric을 정하는것은 challenging ( classification ; P&R, F1 score / segmentation ; IOU(Intersection Over Union)
+
그나마 이미지의 featue map이나 classfier score를 사용하는 FiD, Inception score가 잘 쓰이는 추세
+
위 metric의 단점
+
+
real 이미지 분포의 space에서 해당 수치가 정말 유의미한 연관이 있는지 증명되지 않음
+
pretrained model의 거대한 train set이 specific 이미지의 feature에 얼마나 좋은 성능을 미치는지 알수 없음(inception net ; imagenet / ddpm ; face)
+
+
+
Human study의 직관적인 방식도 있지만 time과 cost를 매우 필요로한다는 점과 model의 Diversity는 측정하기 어렵다는 단점
+
+
e.g ) 하나의 좋은 이미지만 생성해도 좋은 score를 받을 수 있음
+
+
+
이 논문에서는
+
+
Image-GPT 모델을 통해 high quality의 new synthetic dataset을 생성
+
여러 모델을 위의 데이터로 학습하고 FiD, IS등 다양한 metric을 측정
+
이를 실제 KL Divergence, Reverse KL Divergence 값과 비교해서 metric의 유효성을 검증
+
FID, IS등 다양한 metric의 base model로 쓰이는 Inception-V3과 CLIP 의 비교를 통해 Inception-V3 모델의 적합성을 검증
T2I diffusion model과 DreamBooth나 LoRA와 같은 개인화 기술이 발전함에 따라 사람들은 적절한 비용을 지불하여 고화질의 원하는 이미지를 얻을 수 있게 되었다. 하지만, 기존 고화질 이미지 생성 모델(personalized T2I)에 움직임을 추가하거나 애니메이션을 생성하도록 하는 것은 여전히 어렵다. 본 논문에서는 추가적인 훈련(model-specific tuning)없이 기존 고화질 이미지 생성모델에 움직임을 추가하는 실용적인 프레임 워크를 제안한다.본 논문에서 제안하는 프레임 워크의 핵심은 plug-and-play motion module을 활용하는 것으로 이 motion module을 한번 학습하면, 어떤 이미지 생성 모델과도 융합할 수 있다. 본 논문에서 제안하는 학습 방법을 이용하면 motion module은 real-world 비디오로 부터 효과적으로 motion prior를 학습할 수 있다. 한번 학습된 motion module은 이미지 생성 모델에 덧붙여 애니메이션 생성 모델로 사용할 수 있다. 또한 AnimateDiff를 위한 간단한 파인튜닝 방식인 MotionLoRA를 제안한다. 이는 사전 학습된 motion module이 저비용으로 새로운 움직임 패턴을 학습할 수 있게 해준다. (ex. 촬영 기법) AnimateDiff와 MotionLoRA를 공개된 이미지 생성 모델에 부착하여 실험했으며 이를 통해 본 논문의 방식이 이미지 퀄리티와 다양한 움직임을 보전하면서도 자연스러운 애니메이션 클립을 생성할 수 있음을 보였다.
텍스트 프롬프트를 입력하여 이미지를 생성하는 디퓨전 모델(T2I diffusion models)의 발전으로 많은 예술가와 아마추어들이 시각 컨텐츠를 보다 쉽게 생성할 수 있게 되었다. 기존 T2I 모델의 생성능력(creativity)를 자극하기 위해 DreamBooth와 LoRA와 같은 가벼운 개인화 방식들이 제안되었다. 이러한 방식들은 작은 데이터셋과 적당한 하드웨어에서도 customized finetuning을 할 수 있게 해준다. 그로인해 사용자들이 적은 비용으로도 base T2I model을 새로운 domain에 적용하거나 시각적 퀄리티를 높일 수 있게 되었다. 그 결과 AI 아티스트와 아마추어 커뮤니티 에서 상당량의 personalized models을 Civitai나 Hugging Face와 같은 플랫폼에 개시했다. 이러한 모델들이 상당히 좋은 수준의 이미지를 생성할 수 있지만, 정적인 이미지만 생성할 수 있다는 한계가 있다. 반면, 애니메이션을 생성하는 기술이 영화나 카툰과 같은 실산업에서 더 요구된다. 본 연구에서는 고화질 T2I 모델을 파인튜닝 없이 곧바로 애니메이션 생성 모델로 변환하는 것을 목표로 한다. 파인 튜닝을 위한 데이터 수집과 컴퓨팅 자원의 필요는 아마추어 사용자에게 걸림돌이 된다.
-
본 논문에서는 AnimateDiff를 제안하는데 이는 personalized T2I model의 능력을 보전하면서 애니메이션을 생성하는 문제를 해결할 수 있는 효과적인 파이프라인이다. AnimateDiff의 핵심은 비디오 데이터셋(WebVid-10M)으로부터 타당한 motion 정보를 plug-and-play motion module이 학습하는 것이다. motion module의 학습은 세가지 단계로 구성된다.
-
-
domain adapter 파인튜닝
-
visual distribution of the target video dataset(이미지 품질차이, 동영상 워터마크, 압축으로 인한 artifacts)에 대한 부분은 이 모듈이 학습함으로써 이후 motion관련 모듈들이 motion에만 집중할 수 있도록 한다.
-
-
새로운 motion module
-
비디오를 입력받을수 있게 inflate시킨 base T2I 모델에 domain adapter를 더한 모델에 모션 모델링을 위한 모션 모듈을 추가한다. 이 모듈을 학습할때는 domain adapter와 base model을 freeze한다. 이렇게 하면 motion module이 움직임에 대한 부분을 전반적으로 학습하여 모듈별 학습이 가능해진다. (다른 그림체를 원할경우 base T2I+domain adapter를 바꾸면 됨)
-
-
(optional) MotionLoRA 학습
-
MotionLoRA의 경우 특정 motion을 적은 수의 reference videos와 학습횟수로 학습하는 것을 목표로하는 모듈이다. 이름과 같이 Low-Rank Adaptation (LoRA) (Hu et al., 2021)를 이용하는데 새로운 motion pattern을 적은수(50개)의 reference video만으로 학습시킬수 있다. 또한 차지하는 메모리도 적어 추가학습이나 모델을 공유,배포하는데에도 유리하다.
사전학습된 T2I 모델을 활용하기 위해 효율적인 개인화(personalization)방법에 대한 연구가 뜨겁다. 여기서 개인화란 reference images를 통해 (새로운) concepts나 style을 사전학습된 모델에 추가하는 것을 말한다. (손을 잘그리는 모델, 눈을 잘그리는 모델, 특정 그림체를 학습한 모델 등) 이를 위한 가장 단순한 방법은 전체 모델을 fine-tuning 시키는 것이다. 이를 통해 전체적인 퀄리티가 높아질 수도 있지만, 기존 학습데이터를 잊는 catastrophic forgetting이 발생할 수도 있다는 문제가 있다. 이러한 문제는 특히 reference image 데이터가 적을때 발생한다.
-
-
DreamBooth (Ruiz et al., 2023) 은 매우 적은 이미지를 사용하면서도 preservation loss를 추가하여 전체 모델을 fine-tuning 시켰다.
-
Textural Inversion (Gal et al., 2022) 은 새로운 concept 마다 token embedding을 최적화 하였다.
-
Low-Rank Adaptation (LoRA) (Hu et al., 2021) 은 LoRA layer를 추가하여 이에 대해서만 fine-tuning을 수행했다. (Sec 3.2 참고)
Align-Your-Latent (Blattmann et al., 2023) 는 general video generator내의 frozen image layers가 personalizing이 가능함을 확인했다.
-
video generation models ← 결과 비교시 사용
-
-
Tune-a-Video(Wu et al., 2023) ****는 단일 비디오로 적은 수의 파라미터만 파인튜닝하는 방식을 제안했다. (SD+temporal attn 구조를 가지고 있음)
-
Text2Video-Zero(Khachatryan et al., 2023) 는 사전학습한 T2I모델을 활용하여 추가적인 학습과정 없이 애니메이션화 할 수 있는 방법을 제안했다. 이는 사전에 정의된 affine matrix를 사용하여 latent wrapping을 하는 방식이다.
-
pretrained T2I + temporal structures 관련 연구들이 많다.
-
(Esser et al., 2023; Zhou et al., 2022a; Singer et al., 2022; Ho et al., 2022b,a; Ruan et al., 2023; Luo et al., 2023; Yin et al., 2023b,a; Wang et al., 2023b; Hong et al., 2022; Luo et al., 2023)
\(A ∈ R ^{m×r}\) , \(B ∈ R ^{n×r}\) are a pair of rank-decomposition matrices, \(r\) is a hyper-parameter, which is referred to as the rank of LoRA layers
-
attention layer에서만 사용할수 있는 것은 아니지만 실제로는 주로 attention layer에서 사용된다. LoRA를 통해 fine-tuning시 cost 와 storage 절약할 수 있다.
➕ Architecture Overall
-본 논문에서 제안하는 모델의 핵심은 비디오 데이터를 통해 transferable model prior를 학습하는 것이다. 이렇게 학습한 motion module을 personalized T2I 모델에 곧바로 적용할 수 있다.
-왼쪽 그림의 하늘색 모델이 motion module이고, 초록색 영역이 optional MotionLoRA이다. AnimateDiff를 T2I모델에 삽입하여 animation generator로 사용할 수 있다.
-이를 위한 AnimateDiff에는 학습해야 하는 3개의 모듈이 있다.
-
-
domain adapter
-- base T2I pre-training data와 our video training data간의 간극을 줄여주기 위한 것으로 학습과정에만 사용된다.
4.1 Alleviate Negative Effects from Training Data with Domain Adapter#
-
비디오 데이터셋은 이미지 데이터셋에 비해 수집하기 어렵다. 동영상 데이터셋 WebVid (Bain et al., 2021)과 이미지 데이터셋 LAION-Aestetic (Schuhmann et al., 2022)를 비교해보면, 품질차이도 큼을 알 수 있다.
-
각 비디오 프레임을 개별 이미지로 다루게 되면 motion blur, compression artifacts, watermark등을 포함하고 있을 수도 있다. 따라서 T2I 모델을 훈련할 때 사용한 이미지 데이터셋에 비해 motion prior를 학습하기 위해 사용한 동영상 데이터 셋의 품질은 무시할 수 없을 만큼의 차이가 있다. 이 때문에 직접적으로 비디오 데이터셋을 이용하여 애니메이션 생성 모델을 학습할 경우, 생성한 애니메이션의 품질이 제한 될 수 있다.
-
동영상 데이터의 낮은 품질로 인해 해당 특성을 motion module이 학습하는 것을 피하고 base T2I의 지식을 보전하기 위해, 네트워크를 분리하여 각 도메인(영상/이미지)의 정보에 맞게 피팅하는 방식(domain adapter)을 제안한다. inference 시에는 domain adapter를 제거하였으며 앞서 언급한 domain gap에 의한 부정적 영향을 제거하는데 효과적이라는 것을 보여준다. domain adapter layer는 LoRA를 활용했으며, self-, cross-attention layer들을 base T2I model에 Fig. 3과 같이 추가하였다. 아래 query projection을 예로 살펴보면,
-
-
-
-
Fig. 608 LORA: LOW-RANK ADAPTATION OF LARGE LANGUAGE MODELS#
\(Q\) 는 query, \(z\) 는 internal feature, \(\alpha\) 는 상수로 inference time에 domain adapter의 영향력을 조절한다. (기본값은 1 / domain adapter의 효과를 완전히 제거하고 싶다면 \(\alpha\)를 0으로) 나머지 모델의 파라미터는 freeze하고 domain adapter의 파라미터들만 비디오 데이터셋으로 부터 랜덤하게 샘플한 static frame들을 이용하여 최적화했다. 이때 objective function은 Eq. (2)를 사용했다. (아직까지는 이미지 생성 모델)
motion dynamics를 사전학습된 T2I 모델과 공유하는 dimension상의 시간축으로 모델링 하기 위해 2가지 단계가 필요하다.
-
-
2d diffusion model을 3d 비디오 데이터에 맞게 확장시켜야 한다. (Network Inflation)
-
시간축상으로 효율적인 정보의 흐름을 만들기 위해 sub-module이 필요하다. (Sub-module Design)
-
-
Network Inflation
-
사전학습된 T2I 모델의 이미지 레이어는 고품질의 그림 사전지식(content prior)을 포착할수 있다. 이 지식을 활용(유지)하기 위해서 동일 모델로 video를 다루고자 할 때는 기존 이미지 레이어는 독립적으로 내버려두고, network를 확장시키는 방향이 선호된다. 이를 위해 기존 연구 (Ho et al., 2022b; Wu et al., 2023; Blattmann et al., 2023)를 참고하여, 5d tensor \(x\in \Bbb R^{b\times c \times f\times h\times w}\) 를 입력으로 받도록 모델을 수정했다. \(b\)는 batch, \(f\)는 frame을 뜻한다. 내부 feature map이 이미지 레이어를 지나갈때는 시간 축을 의미하는 \(f\)는 \(b\)축으로 reshaping을 통해 무시한다.
이를 통해 각 프레임을 개별 이미지 처럼 독립적으로 처리할 수 있다. 반면에 새롭게 추가된 motion module은 공간축(\(h,w\))을 reshaping하여 무시한다. (5d tensor → 3d tensor \(x \in \Bbb R^{bhw\times c \times f}\) → (motion module) → 3d tensor → 5d tensor)
-
Module Design
-
최근 비디오 생성 연구들은 temporal modeling의 다양한 방식을 탐구하고 있다. AnimateDiff에서는 Transformer 구조를 차용하여 시간축상에서 동작하도록 작은 수정을 거쳐 motion module을 design했다. (이하 temporal Transformer) 실험을 통해 해당 구조가 motion prior를 모델링하는데 적합하다는 것을 발견했다. Fig.3을 보면 temporal Transformer가 시간축에서 동작하는 여러 self-attn block으로 이루어진것을 볼수 있다. 또한 sinusoidal position encoding을 통해 애니메이션상의 각 프레임의 시간적 위치정보를 나타내고자 했다. 앞서 언급한 대로 motion module의 입력크기는 feature map을 reshaping하여 조절하였다. (\(x \in \Bbb R^{bhw\times c \times f}\)) feature map을 시간축으로 다시 펼치고자 할때는 다음과 같은 길이 \(f\), 크기 \(z_1, ...,z_f;z_i \in \Bbb R^{(b\times h\times w)\times c}\)의 vector sequence로 다룰수 있다. 해당 크기의 벡터가 self-attn block을 통과하면 다음과 같다.
-
-\[
-z_{\text{out}}=\text{Attention}(Q,K,V)=\text{Softmax}(QK^T/\sqrt{c})\cdot V \tag{5}
-\]
-
\(Q=W^Qz, K=W^Kz, V=W^Vz\) 이며, 각각 분리된 세 projection을 의미한다. attention mechanism을 통해 현 프레임의 생성에 다른 프레임으로 부터 추출된 정보를 반영하는 것이 가능하다. 결과적으로 각 프레임을 개별적으로 생성하는 것이 아닌, T2I 모델을 확장하여 motion module을 추가한 AnimateDiff가 시간에 따른 visual content의 변화를 잘 포착하기 위해 학습하여 motion dynamics를 이용해 animation clip을 제작하도록 한다. self-attn block전에 sinusoidal position encoding을 잊어서는 안된다. 하지만 motion module 자체가 frame의 순서를 알고 있는 것은 아니다.
-
추가적인 모듈을 넣음으로 인해 발생할수 있는 문제들을 피하기 위해 temporal Transformer의 레이어의 파라미터는 0으로 초기화 하였으며 residual connection을 추가하여 훈련 시작시에 motion module이 identity mapping으로 동작하도록 했다.
전반적인 motion 지식을 motion module이 사전학습하더라도 새로운 동작 패턴에 대한 적용에 대한 문제는 발생한다.
-ex. zooming, panning, rolling.
-
높은 사전학습을 위한 비용을 감당할 수 없어 motion module을 특정 액션에 맞춰 튜닝하고자 하는 사용자를 위해 적은 참고 비디오(reference video)나 적은 훈련 횟수로도 효율적으로 모델을 적용할 수 있도록 하는 것이 중요하다. 이를 위해 AnimateDiff에 MotionLoRA를 마지막으로 적용했다. Motion Module의 구조와 제한된 참고 비디오를 고려하여, self-attn layers에 LoRA layers를 inflated model에 추가하여 motion personalization을 위한 효율적인 파인튜닝 방법을 제안한다.
-
몇 종의 촬영 방식으로 실험을 진행하였으며 rule-based augmentation을 통해 reference videos를 얻었다. 예를 들어 zooming 비디오를 얻기 위해 시간에 따라 비디오 프레임을 점차 줄이거나(zoom-in) 늘려가며(zoom-out) augmentation을 진행했다. AnimateDiff의 MotionLoRA는 20~50개 정도의 적은 참고 비디오, 2000번의 훈련횟수로 파인튜닝했을때도 괜찮은 결과를 보였다. low-rank property로 인해 MotionLoRA 또한 composition capability를 가지고 있다. 학습된 MotionLoRA 모델 각각이 inference time상의 motion effect를 융합하기위해 협력(combine)할 수 있음을 말한다.
Fig. 3을 보면 AnimateDiff에는 학습 가능한 모듈이 3개 있다. 각 모듈의 objective는 약간씩 다르다. domain adapter는 SD의 MSE loss인 Eq. 2 objective function을 통해 학습한다. 애니메이션을 만드는 역할을 하는 motion module과 motion LoRA의 경우 video data에 대한 차원을 더 많이 수용하기 위해 약간 수정된 objective를 사용한다. video data batch ( \(x_0^{1:f}\in \Bbb R^{b\times c \times f \times h \times w}\))는 사전학습된 SD의 auto-encoder를 사용해 각 프레임 별로 latent code \(z_0^{1:f}\)로 인코딩된다. 이 latent code는 Eq. 1 과 같이 정의된 diffusion schedule에 따라 노이즈가 추가(forward process)된다.
모델의 입력은 노이즈가 추가된 latent codes와 이 쌍이되는 text prompts이며, 모델은 forward process에서 추가된 노이즈를 예측한다. AnimateDiff의 motion module을 위한 최종 training objective는 아래와 같다.
inference시에는 personalized T2I model는 앞서 설명한대로 inflate되며 motion module과 (optional) MotionLoRA를 더해 애니메이션을 생성한다.
-
domain adapter의 경우 inference시 그냥 배제하지 않고 personalized T2I model에 injection하였으며 domain adapter의 영향력은 Eq. 4의 \(\alpha\)를 이용해 조절했다. Sec 5.3의 Ablation study에서 \(\alpha\)의 값에 따른 결과의 차이를 확인할 수 있다. 마지막으로 animation frames은 reverse diffusion process와 이를 통해 얻은 latent codes를 디코딩 함으로써 얻을수 있다.
Fig. 611 scaler를 0으로 하면 domain adapter에 의한 효과를 제거한 것과 같다. 위의 그림은 모델이 생성한 animation clip의 첫번째 프레임이다.#
-
-
-
domain adapter에 의한 효과를 제거했을때 전체적인 이미지 퀄리티가 높아 보이는데, 이는 domain adapter가 video dataset의 특성이라고 할 수 있는 watermark나 모션 블러 등을 학습했기 때문이다. 즉, domain adapter가 전체 학습과정에 도움이 되었음을 보여준다.
AnimateDiff의 temporal Transformer구조와 전체 convolution인 구조의 모델과 비교했다. 두 방식 모두 비디오 생성 분야에서 자주 사용된다.
-
temporal Transformer의 temporal attention부분을 1D temporal convolution으로 교체하여 두 모델의 파라미터가 유사하게 놓여있음을 확인했다. convolution motion module은 모든 프레임을 동일하게 놓았지만 Transformer 구조와 비교하여 움직임을 제대로 반영하지 못했다.
visual content와 motion prior의 개별 학습을 통해 AnimateDiff가 existing content를 조절할 수 있도록 했다. 이 특성을 확인하기 위해 AnimateDiff를 ControlNet과 결합하여 영상 생성시 depth를 통해 조절할 수 있도록 했다.
-
DDIM inversion을 통해 다듬어진 latent sequences를 얻고 이를 비디오 생성에 사용하는 최신 비디오 수정 연구들과 비교하여 AnimateDiff는 randomly sampled noise를 이용하여 애니메이션을 생성한다.
본 논문에서는 애니메이션 생성을 위한 practical pipeline인 AnimateDiff를 제안한다. AnimateDiff를 통해 personalized text-to-image model을 바로 애니메이션 생성에 사용할 수 있다. 이를 위해 본 논문에서는 세가지 module을 디자인하였으며 이를 통해 AnimateDiff는 motion prior를 학습하고, visual quality를 유지할 수 있으며, MotionLoRA를 통해 가벼운 finetuning을 통해 원하는 motion으로 애니메이션을 생성할 수 있다.
-
motion module은 한번 학습되면 다른 이미지를 animate시키고자 할때 사용할 수 있다. 다양한 실험 결과를 통해 AnimateDiff와 MotionLoRA의 효율성과 생성능력을 검증했다. 또 content-controllability측면에서도 추가적인 학습없이 본 논문의 방식을 사용할 수 있음을 보였다.
-
AnimateDiff는 취향의 그림체, 캐릭터의 움직임, 카메라 워크에 맞게 이미지를 애니메이션화 시킬 수있는 효율적인 베이스 라인으로써 다양한 방면의 application에 큰 잠재력을 가지고 있다.
Fig. 614 side-view-photo-of-17-year-old-girl-in-a-japanese-school
-gpt로 생성한 그림을 input으로 사용함#
-
-
-
-
-
-
Fig. 615 side-view-photo-of-man-in-black-padded-jumper
-직접 촬영한 사진을 input으로 사용함
-입력한 사진의 인물의 인종이 유지되지 않았는데 학습데이터 셋의 불균형 때문으로 사료됨#
-
-
-
-
-
-
Fig. 616 image-of-a-man-with-blonde-hair-and-blue-eyes
-gpt로 생성한 그림을 input으로 사용함#
-
-
-
-
📌 실습 후 느낀점
-
-
WebVid 10M이 애니메이션화에 적합한 데이터셋인지 잘 모르겠다.
-
다양한 metric을 평가에 사용하지 않은 점이 아쉽다.
-
특정 애니메이션 클립을 생성하고 싶다면 실질적으로 학습해야 하는 부분은 motionLoRA정도라 사용이 편리하다.
-
reproduction이 매우 용이하다.
-
AnimateDiff를 제대로 활용하기 위해서는 personalized T2I가 제일 중요한 부분이라고 할수 있는데, 원하는 스타일의 pretrained T2I 모델을 구하는 것이 어렵다. 그림체가 잘 맞지 않으면 애니메이션 클립 초반에 급격히 변화하는 부분이 자주 생긴다.
T2I diffusion model과 DreamBooth나 LoRA와 같은 개인화 기술이 발전함에 따라 사람들은 적절한 비용을 지불하여 고화질의 원하는 이미지를 얻을 수 있게 되었다. 하지만, 기존 고화질 이미지 생성 모델(personalized T2I)에 움직임을 추가하거나 애니메이션을 생성하도록 하는 것은 여전히 어렵다. 본 논문에서는 추가적인 훈련(model-specific tuning)없이 기존 고화질 이미지 생성모델에 움직임을 추가하는 실용적인 프레임 워크를 제안한다.본 논문에서 제안하는 프레임 워크의 핵심은 plug-and-play motion module을 활용하는 것으로 이 motion module을 한번 학습하면, 어떤 이미지 생성 모델과도 융합할 수 있다. 본 논문에서 제안하는 학습 방법을 이용하면 motion module은 real-world 비디오로 부터 효과적으로 motion prior를 학습할 수 있다. 한번 학습된 motion module은 이미지 생성 모델에 덧붙여 애니메이션 생성 모델로 사용할 수 있다. 또한 AnimateDiff를 위한 간단한 파인튜닝 방식인 MotionLoRA를 제안한다. 이는 사전 학습된 motion module이 저비용으로 새로운 움직임 패턴을 학습할 수 있게 해준다. (ex. 촬영 기법) AnimateDiff와 MotionLoRA를 공개된 이미지 생성 모델에 부착하여 실험했으며 이를 통해 본 논문의 방식이 이미지 퀄리티와 다양한 움직임을 보전하면서도 자연스러운 애니메이션 클립을 생성할 수 있음을 보였다.
텍스트 프롬프트를 입력하여 이미지를 생성하는 디퓨전 모델(T2I diffusion models)의 발전으로 많은 예술가와 아마추어들이 시각 컨텐츠를 보다 쉽게 생성할 수 있게 되었다. 기존 T2I 모델의 생성능력(creativity)를 자극하기 위해 DreamBooth와 LoRA와 같은 가벼운 개인화 방식들이 제안되었다. 이러한 방식들은 작은 데이터셋과 적당한 하드웨어에서도 customized finetuning을 할 수 있게 해준다. 그로인해 사용자들이 적은 비용으로도 base T2I model을 새로운 domain에 적용하거나 시각적 퀄리티를 높일 수 있게 되었다. 그 결과 AI 아티스트와 아마추어 커뮤니티 에서 상당량의 personalized models을 Civitai나 Hugging Face와 같은 플랫폼에 개시했다. 이러한 모델들이 상당히 좋은 수준의 이미지를 생성할 수 있지만, 정적인 이미지만 생성할 수 있다는 한계가 있다. 반면, 애니메이션을 생성하는 기술이 영화나 카툰과 같은 실산업에서 더 요구된다. 본 연구에서는 고화질 T2I 모델을 파인튜닝 없이 곧바로 애니메이션 생성 모델로 변환하는 것을 목표로 한다. 파인 튜닝을 위한 데이터 수집과 컴퓨팅 자원의 필요는 아마추어 사용자에게 걸림돌이 된다.
+
본 논문에서는 AnimateDiff를 제안하는데 이는 personalized T2I model의 능력을 보전하면서 애니메이션을 생성하는 문제를 해결할 수 있는 효과적인 파이프라인이다. AnimateDiff의 핵심은 비디오 데이터셋(WebVid-10M)으로부터 타당한 motion 정보를 plug-and-play motion module이 학습하는 것이다. motion module의 학습은 세가지 단계로 구성된다.
+
+
domain adapter 파인튜닝
+
visual distribution of the target video dataset(이미지 품질차이, 동영상 워터마크, 압축으로 인한 artifacts)에 대한 부분은 이 모듈이 학습함으로써 이후 motion관련 모듈들이 motion에만 집중할 수 있도록 한다.
+
+
새로운 motion module
+
비디오를 입력받을수 있게 inflate시킨 base T2I 모델에 domain adapter를 더한 모델에 모션 모델링을 위한 모션 모듈을 추가한다. 이 모듈을 학습할때는 domain adapter와 base model을 freeze한다. 이렇게 하면 motion module이 움직임에 대한 부분을 전반적으로 학습하여 모듈별 학습이 가능해진다. (다른 그림체를 원할경우 base T2I+domain adapter를 바꾸면 됨)
+
+
(optional) MotionLoRA 학습
+
MotionLoRA의 경우 특정 motion을 적은 수의 reference videos와 학습횟수로 학습하는 것을 목표로하는 모듈이다. 이름과 같이 Low-Rank Adaptation (LoRA) (Hu et al., 2021)를 이용하는데 새로운 motion pattern을 적은수(50개)의 reference video만으로 학습시킬수 있다. 또한 차지하는 메모리도 적어 추가학습이나 모델을 공유,배포하는데에도 유리하다.
사전학습된 T2I 모델을 활용하기 위해 효율적인 개인화(personalization)방법에 대한 연구가 뜨겁다. 여기서 개인화란 reference images를 통해 (새로운) concepts나 style을 사전학습된 모델에 추가하는 것을 말한다. (손을 잘그리는 모델, 눈을 잘그리는 모델, 특정 그림체를 학습한 모델 등) 이를 위한 가장 단순한 방법은 전체 모델을 fine-tuning 시키는 것이다. 이를 통해 전체적인 퀄리티가 높아질 수도 있지만, 기존 학습데이터를 잊는 catastrophic forgetting이 발생할 수도 있다는 문제가 있다. 이러한 문제는 특히 reference image 데이터가 적을때 발생한다.
+
+
DreamBooth (Ruiz et al., 2023) 은 매우 적은 이미지를 사용하면서도 preservation loss를 추가하여 전체 모델을 fine-tuning 시켰다.
+
Textural Inversion (Gal et al., 2022) 은 새로운 concept 마다 token embedding을 최적화 하였다.
+
Low-Rank Adaptation (LoRA) (Hu et al., 2021) 은 LoRA layer를 추가하여 이에 대해서만 fine-tuning을 수행했다. (Sec 3.2 참고)
Align-Your-Latent (Blattmann et al., 2023) 는 general video generator내의 frozen image layers가 personalizing이 가능함을 확인했다.
+
video generation models ← 결과 비교시 사용
+
+
Tune-a-Video(Wu et al., 2023) ****는 단일 비디오로 적은 수의 파라미터만 파인튜닝하는 방식을 제안했다. (SD+temporal attn 구조를 가지고 있음)
+
Text2Video-Zero(Khachatryan et al., 2023) 는 사전학습한 T2I모델을 활용하여 추가적인 학습과정 없이 애니메이션화 할 수 있는 방법을 제안했다. 이는 사전에 정의된 affine matrix를 사용하여 latent wrapping을 하는 방식이다.
+
pretrained T2I + temporal structures 관련 연구들이 많다.
+
(Esser et al., 2023; Zhou et al., 2022a; Singer et al., 2022; Ho et al., 2022b,a; Ruan et al., 2023; Luo et al., 2023; Yin et al., 2023b,a; Wang et al., 2023b; Hong et al., 2022; Luo et al., 2023)
\(A ∈ R ^{m×r}\) , \(B ∈ R ^{n×r}\) are a pair of rank-decomposition matrices, \(r\) is a hyper-parameter, which is referred to as the rank of LoRA layers
+
attention layer에서만 사용할수 있는 것은 아니지만 실제로는 주로 attention layer에서 사용된다. LoRA를 통해 fine-tuning시 cost 와 storage 절약할 수 있다.
➕ Architecture Overall
+본 논문에서 제안하는 모델의 핵심은 비디오 데이터를 통해 transferable model prior를 학습하는 것이다. 이렇게 학습한 motion module을 personalized T2I 모델에 곧바로 적용할 수 있다.
+왼쪽 그림의 하늘색 모델이 motion module이고, 초록색 영역이 optional MotionLoRA이다. AnimateDiff를 T2I모델에 삽입하여 animation generator로 사용할 수 있다.
+이를 위한 AnimateDiff에는 학습해야 하는 3개의 모듈이 있다.
+
+
domain adapter
+- base T2I pre-training data와 our video training data간의 간극을 줄여주기 위한 것으로 학습과정에만 사용된다.
4.1 Alleviate Negative Effects from Training Data with Domain Adapter#
+
비디오 데이터셋은 이미지 데이터셋에 비해 수집하기 어렵다. 동영상 데이터셋 WebVid (Bain et al., 2021)과 이미지 데이터셋 LAION-Aestetic (Schuhmann et al., 2022)를 비교해보면, 품질차이도 큼을 알 수 있다.
+
각 비디오 프레임을 개별 이미지로 다루게 되면 motion blur, compression artifacts, watermark등을 포함하고 있을 수도 있다. 따라서 T2I 모델을 훈련할 때 사용한 이미지 데이터셋에 비해 motion prior를 학습하기 위해 사용한 동영상 데이터 셋의 품질은 무시할 수 없을 만큼의 차이가 있다. 이 때문에 직접적으로 비디오 데이터셋을 이용하여 애니메이션 생성 모델을 학습할 경우, 생성한 애니메이션의 품질이 제한 될 수 있다.
+
동영상 데이터의 낮은 품질로 인해 해당 특성을 motion module이 학습하는 것을 피하고 base T2I의 지식을 보전하기 위해, 네트워크를 분리하여 각 도메인(영상/이미지)의 정보에 맞게 피팅하는 방식(domain adapter)을 제안한다. inference 시에는 domain adapter를 제거하였으며 앞서 언급한 domain gap에 의한 부정적 영향을 제거하는데 효과적이라는 것을 보여준다. domain adapter layer는 LoRA를 활용했으며, self-, cross-attention layer들을 base T2I model에 Fig. 3과 같이 추가하였다. 아래 query projection을 예로 살펴보면,
+
+
+
+
Fig. 620 LORA: LOW-RANK ADAPTATION OF LARGE LANGUAGE MODELS#
\(Q\) 는 query, \(z\) 는 internal feature, \(\alpha\) 는 상수로 inference time에 domain adapter의 영향력을 조절한다. (기본값은 1 / domain adapter의 효과를 완전히 제거하고 싶다면 \(\alpha\)를 0으로) 나머지 모델의 파라미터는 freeze하고 domain adapter의 파라미터들만 비디오 데이터셋으로 부터 랜덤하게 샘플한 static frame들을 이용하여 최적화했다. 이때 objective function은 Eq. (2)를 사용했다. (아직까지는 이미지 생성 모델)
motion dynamics를 사전학습된 T2I 모델과 공유하는 dimension상의 시간축으로 모델링 하기 위해 2가지 단계가 필요하다.
+
+
2d diffusion model을 3d 비디오 데이터에 맞게 확장시켜야 한다. (Network Inflation)
+
시간축상으로 효율적인 정보의 흐름을 만들기 위해 sub-module이 필요하다. (Sub-module Design)
+
+
Network Inflation
+
사전학습된 T2I 모델의 이미지 레이어는 고품질의 그림 사전지식(content prior)을 포착할수 있다. 이 지식을 활용(유지)하기 위해서 동일 모델로 video를 다루고자 할 때는 기존 이미지 레이어는 독립적으로 내버려두고, network를 확장시키는 방향이 선호된다. 이를 위해 기존 연구 (Ho et al., 2022b; Wu et al., 2023; Blattmann et al., 2023)를 참고하여, 5d tensor \(x\in \Bbb R^{b\times c \times f\times h\times w}\) 를 입력으로 받도록 모델을 수정했다. \(b\)는 batch, \(f\)는 frame을 뜻한다. 내부 feature map이 이미지 레이어를 지나갈때는 시간 축을 의미하는 \(f\)는 \(b\)축으로 reshaping을 통해 무시한다.
이를 통해 각 프레임을 개별 이미지 처럼 독립적으로 처리할 수 있다. 반면에 새롭게 추가된 motion module은 공간축(\(h,w\))을 reshaping하여 무시한다. (5d tensor → 3d tensor \(x \in \Bbb R^{bhw\times c \times f}\) → (motion module) → 3d tensor → 5d tensor)
+
Module Design
+
최근 비디오 생성 연구들은 temporal modeling의 다양한 방식을 탐구하고 있다. AnimateDiff에서는 Transformer 구조를 차용하여 시간축상에서 동작하도록 작은 수정을 거쳐 motion module을 design했다. (이하 temporal Transformer) 실험을 통해 해당 구조가 motion prior를 모델링하는데 적합하다는 것을 발견했다. Fig.3을 보면 temporal Transformer가 시간축에서 동작하는 여러 self-attn block으로 이루어진것을 볼수 있다. 또한 sinusoidal position encoding을 통해 애니메이션상의 각 프레임의 시간적 위치정보를 나타내고자 했다. 앞서 언급한 대로 motion module의 입력크기는 feature map을 reshaping하여 조절하였다. (\(x \in \Bbb R^{bhw\times c \times f}\)) feature map을 시간축으로 다시 펼치고자 할때는 다음과 같은 길이 \(f\), 크기 \(z_1, ...,z_f;z_i \in \Bbb R^{(b\times h\times w)\times c}\)의 vector sequence로 다룰수 있다. 해당 크기의 벡터가 self-attn block을 통과하면 다음과 같다.
+
+\[
+z_{\text{out}}=\text{Attention}(Q,K,V)=\text{Softmax}(QK^T/\sqrt{c})\cdot V \tag{5}
+\]
+
\(Q=W^Qz, K=W^Kz, V=W^Vz\) 이며, 각각 분리된 세 projection을 의미한다. attention mechanism을 통해 현 프레임의 생성에 다른 프레임으로 부터 추출된 정보를 반영하는 것이 가능하다. 결과적으로 각 프레임을 개별적으로 생성하는 것이 아닌, T2I 모델을 확장하여 motion module을 추가한 AnimateDiff가 시간에 따른 visual content의 변화를 잘 포착하기 위해 학습하여 motion dynamics를 이용해 animation clip을 제작하도록 한다. self-attn block전에 sinusoidal position encoding을 잊어서는 안된다. 하지만 motion module 자체가 frame의 순서를 알고 있는 것은 아니다.
+
추가적인 모듈을 넣음으로 인해 발생할수 있는 문제들을 피하기 위해 temporal Transformer의 레이어의 파라미터는 0으로 초기화 하였으며 residual connection을 추가하여 훈련 시작시에 motion module이 identity mapping으로 동작하도록 했다.
전반적인 motion 지식을 motion module이 사전학습하더라도 새로운 동작 패턴에 대한 적용에 대한 문제는 발생한다.
+ex. zooming, panning, rolling.
+
높은 사전학습을 위한 비용을 감당할 수 없어 motion module을 특정 액션에 맞춰 튜닝하고자 하는 사용자를 위해 적은 참고 비디오(reference video)나 적은 훈련 횟수로도 효율적으로 모델을 적용할 수 있도록 하는 것이 중요하다. 이를 위해 AnimateDiff에 MotionLoRA를 마지막으로 적용했다. Motion Module의 구조와 제한된 참고 비디오를 고려하여, self-attn layers에 LoRA layers를 inflated model에 추가하여 motion personalization을 위한 효율적인 파인튜닝 방법을 제안한다.
+
몇 종의 촬영 방식으로 실험을 진행하였으며 rule-based augmentation을 통해 reference videos를 얻었다. 예를 들어 zooming 비디오를 얻기 위해 시간에 따라 비디오 프레임을 점차 줄이거나(zoom-in) 늘려가며(zoom-out) augmentation을 진행했다. AnimateDiff의 MotionLoRA는 20~50개 정도의 적은 참고 비디오, 2000번의 훈련횟수로 파인튜닝했을때도 괜찮은 결과를 보였다. low-rank property로 인해 MotionLoRA 또한 composition capability를 가지고 있다. 학습된 MotionLoRA 모델 각각이 inference time상의 motion effect를 융합하기위해 협력(combine)할 수 있음을 말한다.
Fig. 3을 보면 AnimateDiff에는 학습 가능한 모듈이 3개 있다. 각 모듈의 objective는 약간씩 다르다. domain adapter는 SD의 MSE loss인 Eq. 2 objective function을 통해 학습한다. 애니메이션을 만드는 역할을 하는 motion module과 motion LoRA의 경우 video data에 대한 차원을 더 많이 수용하기 위해 약간 수정된 objective를 사용한다. video data batch ( \(x_0^{1:f}\in \Bbb R^{b\times c \times f \times h \times w}\))는 사전학습된 SD의 auto-encoder를 사용해 각 프레임 별로 latent code \(z_0^{1:f}\)로 인코딩된다. 이 latent code는 Eq. 1 과 같이 정의된 diffusion schedule에 따라 노이즈가 추가(forward process)된다.
모델의 입력은 노이즈가 추가된 latent codes와 이 쌍이되는 text prompts이며, 모델은 forward process에서 추가된 노이즈를 예측한다. AnimateDiff의 motion module을 위한 최종 training objective는 아래와 같다.
inference시에는 personalized T2I model는 앞서 설명한대로 inflate되며 motion module과 (optional) MotionLoRA를 더해 애니메이션을 생성한다.
+
domain adapter의 경우 inference시 그냥 배제하지 않고 personalized T2I model에 injection하였으며 domain adapter의 영향력은 Eq. 4의 \(\alpha\)를 이용해 조절했다. Sec 5.3의 Ablation study에서 \(\alpha\)의 값에 따른 결과의 차이를 확인할 수 있다. 마지막으로 animation frames은 reverse diffusion process와 이를 통해 얻은 latent codes를 디코딩 함으로써 얻을수 있다.
Fig. 623 scaler를 0으로 하면 domain adapter에 의한 효과를 제거한 것과 같다. 위의 그림은 모델이 생성한 animation clip의 첫번째 프레임이다.#
+
+
+
domain adapter에 의한 효과를 제거했을때 전체적인 이미지 퀄리티가 높아 보이는데, 이는 domain adapter가 video dataset의 특성이라고 할 수 있는 watermark나 모션 블러 등을 학습했기 때문이다. 즉, domain adapter가 전체 학습과정에 도움이 되었음을 보여준다.
AnimateDiff의 temporal Transformer구조와 전체 convolution인 구조의 모델과 비교했다. 두 방식 모두 비디오 생성 분야에서 자주 사용된다.
+
temporal Transformer의 temporal attention부분을 1D temporal convolution으로 교체하여 두 모델의 파라미터가 유사하게 놓여있음을 확인했다. convolution motion module은 모든 프레임을 동일하게 놓았지만 Transformer 구조와 비교하여 움직임을 제대로 반영하지 못했다.
visual content와 motion prior의 개별 학습을 통해 AnimateDiff가 existing content를 조절할 수 있도록 했다. 이 특성을 확인하기 위해 AnimateDiff를 ControlNet과 결합하여 영상 생성시 depth를 통해 조절할 수 있도록 했다.
+
DDIM inversion을 통해 다듬어진 latent sequences를 얻고 이를 비디오 생성에 사용하는 최신 비디오 수정 연구들과 비교하여 AnimateDiff는 randomly sampled noise를 이용하여 애니메이션을 생성한다.
본 논문에서는 애니메이션 생성을 위한 practical pipeline인 AnimateDiff를 제안한다. AnimateDiff를 통해 personalized text-to-image model을 바로 애니메이션 생성에 사용할 수 있다. 이를 위해 본 논문에서는 세가지 module을 디자인하였으며 이를 통해 AnimateDiff는 motion prior를 학습하고, visual quality를 유지할 수 있으며, MotionLoRA를 통해 가벼운 finetuning을 통해 원하는 motion으로 애니메이션을 생성할 수 있다.
+
motion module은 한번 학습되면 다른 이미지를 animate시키고자 할때 사용할 수 있다. 다양한 실험 결과를 통해 AnimateDiff와 MotionLoRA의 효율성과 생성능력을 검증했다. 또 content-controllability측면에서도 추가적인 학습없이 본 논문의 방식을 사용할 수 있음을 보였다.
+
AnimateDiff는 취향의 그림체, 캐릭터의 움직임, 카메라 워크에 맞게 이미지를 애니메이션화 시킬 수있는 효율적인 베이스 라인으로써 다양한 방면의 application에 큰 잠재력을 가지고 있다.
Fig. 626 side-view-photo-of-17-year-old-girl-in-a-japanese-school
+gpt로 생성한 그림을 input으로 사용함#
+
+
+
+
+
+
Fig. 627 side-view-photo-of-man-in-black-padded-jumper
+직접 촬영한 사진을 input으로 사용함
+입력한 사진의 인물의 인종이 유지되지 않았는데 학습데이터 셋의 불균형 때문으로 사료됨#
+
+
+
+
+
+
Fig. 628 image-of-a-man-with-blonde-hair-and-blue-eyes
+gpt로 생성한 그림을 input으로 사용함#
+
+
+
+
📌 실습 후 느낀점
+
+
WebVid 10M이 애니메이션화에 적합한 데이터셋인지 잘 모르겠다.
+
다양한 metric을 평가에 사용하지 않은 점이 아쉽다.
+
특정 애니메이션 클립을 생성하고 싶다면 실질적으로 학습해야 하는 부분은 motionLoRA정도라 사용이 편리하다.
+
reproduction이 매우 용이하다.
+
AnimateDiff를 제대로 활용하기 위해서는 personalized T2I가 제일 중요한 부분이라고 할수 있는데, 원하는 스타일의 pretrained T2I 모델을 구하는 것이 어렵다. 그림체가 잘 맞지 않으면 애니메이션 클립 초반에 급격히 변화하는 부분이 자주 생긴다.
ReferenceNet : reference image로부터 character의 appearance features encoding
-
Pose Guider : 제어가능한 character movements를 위한 motion control signal encoding
-
Temporal layer : character motion 연속성을 위한 temporal relationship encoding
-
-
ReferenceNet
-
-
text보다 image가 더 low-level detailed feature를 통한 일관성 유지 정보를 내포함.
-
이에 따라 최근 CLIP image encoder가 text encoder보다 많이 사용되었지만, detail consistency에는 역부족
-
-
이유 1: CLIP image encoder는 224x224의 저해상도 이미지들로 구성되어 중요한 세부정보 손실이 있을 수 있다.
-
이유 2: CLIP은 text에 더욱 부합하게 훈련되어 high-level feature matching에 강조되고 이에 따라 feature encoding에 있어 detail feature에 부족함이 존재
-
-
-
이에 따라 reference image feature extraction network인 ReferenceNet 고안 (이때 temporal layer 제외)
-
ReferenceNet은 SD로 초기화하고 각각 독립적으로 update 수행하고 UNet과 통합
-
self-attention layer를 spatial attention layer로 변경
-
Feature map : \(x_1 \in \mathcal{R}^{t \times h \times w \times c }\) (UNet ), \(x_2 \in \mathcal{R}^{h \times w \times c }\) (ReferenceNet) 이 주어졌을 때, \(x_2\)를 t번 곱해 w축에 따라 \(x_1\)과 concat
-
self-attention을 수행하고 feature map의 반을 결과로 뽑음.
-
2가지 장점
-
-
-
사전 학습된 image feature model SD를 사용함에 따라 초기값이 잘 정의된 것 사용가능.
-
-
-
-
UNet과 ReferenceNet의 초기값이 공유되고 동일한 네트워크 구조를 가짐에 따라 UNet은 (동일한 feature space에 상관관계가 있는) ReferenceNet feature 중 선별적으로 feature 학습이 가능
-
-
-
-
-
CLIP image encoder를 cross-attention에 도입
-
-
reference image의 semantic feature를 제공함에 따라 신속한 전체 네트워크 훈련 초기값 설정 가능.
-
-
-
ControlNet은 target image와 공간적으로 align된 정보를 활용 → 부적합
-
본 방법에서는 reference image와 target image가 공간적으로는 관계되어있지만, align되지 않음.
-
타 diffusion 기반 video generation에서는 모든 video frame에 대해 denoising을 진행
-
ReferenceNet은 feature 추출할 때 한 번만 필요
-
효과 : inference 단계에서 계산량이 증가하지 않는다.
-
-
Pose Guider
-
-
ControlNet은 robust한 conditional 생성을 입증해왔지만, 추가 Fine-tuning이 필요했었다.
-
저자들은 추가적인 계산량 증가를 막기위해 추가적인 control network를 통합하지 않고 lightweight Pose Guider 도입
-
noise latent와 동일 해상도를 가지는 pose 이미지 align을 위해 four convolution layers (4×4 kernels, 2×2 strides, using 16,32,64,128 channels) 사용
-
Gaussian weights 초기화, final projection layer에서 zero convolution 도입.
-
-
Temporal Layer
-
-
이미 많은 곳에서 T2I 모델에 temporal layer를 통합했을 때 frame간 temporal dependency가 가능함을 보임.
-
본 방법에서는 U-Net 내 Res-Trans block 안에 있는 spatial-attention과 cross-attention 진행 후에 temporal layer 추가
-
순서 1) reshape : \(x \in \mathcal{R}^{b \times t \times h \times w \times c }\) → \(x \in \mathcal{R}^{(b \times h \times w) \times t \times c }\)
-
순서 2) temporal attention 수행 → residual connection
-
효과 : appearance details에 대한 temporal smoothness & continuity
Data : 5K character video clips (2-10 seconds long) 인터넷에서 다운로드
-
Pose Estimation Model : DWPose(Distillation for Whole-body Pose estimator) (23.07) IDEA-Research/DWPose
-(the student’s head with only 20% training time as a plug-and-play training strategy)
-
GPU : 4 NVIDIA A100 GPUs
-
첫 번째 훈련 단계 : 768×768 해상도 video frame sampled, resized, and center-cropped 30,000 steps, batch size 64.
-
두 번째 훈련 단계 : temporal layer 10,000 steps 24-frame video sequences, batch size 4.
-
learning rates : 1e-5.
-
Inference 단계 : reference image의 캐릭터 skeleton의 길이에 근사하기 위해서 유도된 pose skeleton의 길이 rescale
-
DDIM sampler, 20 steps
-
긴 영상 생성을 위해 temporal aggregation method 채택
-
Evaluation : benchmark dataset 2개(UBC fashion video dataset, Tik-Tok dataset) 사용
ReferenceNet : reference image로부터 character의 appearance features encoding
+
Pose Guider : 제어가능한 character movements를 위한 motion control signal encoding
+
Temporal layer : character motion 연속성을 위한 temporal relationship encoding
+
+
ReferenceNet
+
+
text보다 image가 더 low-level detailed feature를 통한 일관성 유지 정보를 내포함.
+
이에 따라 최근 CLIP image encoder가 text encoder보다 많이 사용되었지만, detail consistency에는 역부족
+
+
이유 1: CLIP image encoder는 224x224의 저해상도 이미지들로 구성되어 중요한 세부정보 손실이 있을 수 있다.
+
이유 2: CLIP은 text에 더욱 부합하게 훈련되어 high-level feature matching에 강조되고 이에 따라 feature encoding에 있어 detail feature에 부족함이 존재
+
+
+
이에 따라 reference image feature extraction network인 ReferenceNet 고안 (이때 temporal layer 제외)
+
ReferenceNet은 SD로 초기화하고 각각 독립적으로 update 수행하고 UNet과 통합
+
self-attention layer를 spatial attention layer로 변경
+
Feature map : \(x_1 \in \mathcal{R}^{t \times h \times w \times c }\) (UNet ), \(x_2 \in \mathcal{R}^{h \times w \times c }\) (ReferenceNet) 이 주어졌을 때, \(x_2\)를 t번 곱해 w축에 따라 \(x_1\)과 concat
+
self-attention을 수행하고 feature map의 반을 결과로 뽑음.
+
2가지 장점
+
+
+
사전 학습된 image feature model SD를 사용함에 따라 초기값이 잘 정의된 것 사용가능.
+
+
+
+
UNet과 ReferenceNet의 초기값이 공유되고 동일한 네트워크 구조를 가짐에 따라 UNet은 (동일한 feature space에 상관관계가 있는) ReferenceNet feature 중 선별적으로 feature 학습이 가능
+
+
+
+
+
CLIP image encoder를 cross-attention에 도입
+
+
reference image의 semantic feature를 제공함에 따라 신속한 전체 네트워크 훈련 초기값 설정 가능.
+
+
+
ControlNet은 target image와 공간적으로 align된 정보를 활용 → 부적합
+
본 방법에서는 reference image와 target image가 공간적으로는 관계되어있지만, align되지 않음.
+
타 diffusion 기반 video generation에서는 모든 video frame에 대해 denoising을 진행
+
ReferenceNet은 feature 추출할 때 한 번만 필요
+
효과 : inference 단계에서 계산량이 증가하지 않는다.
+
+
Pose Guider
+
+
ControlNet은 robust한 conditional 생성을 입증해왔지만, 추가 Fine-tuning이 필요했었다.
+
저자들은 추가적인 계산량 증가를 막기위해 추가적인 control network를 통합하지 않고 lightweight Pose Guider 도입
+
noise latent와 동일 해상도를 가지는 pose 이미지 align을 위해 four convolution layers (4×4 kernels, 2×2 strides, using 16,32,64,128 channels) 사용
+
Gaussian weights 초기화, final projection layer에서 zero convolution 도입.
+
+
Temporal Layer
+
+
이미 많은 곳에서 T2I 모델에 temporal layer를 통합했을 때 frame간 temporal dependency가 가능함을 보임.
+
본 방법에서는 U-Net 내 Res-Trans block 안에 있는 spatial-attention과 cross-attention 진행 후에 temporal layer 추가
+
순서 1) reshape : \(x \in \mathcal{R}^{b \times t \times h \times w \times c }\) → \(x \in \mathcal{R}^{(b \times h \times w) \times t \times c }\)
+
순서 2) temporal attention 수행 → residual connection
+
효과 : appearance details에 대한 temporal smoothness & continuity
Data : 5K character video clips (2-10 seconds long) 인터넷에서 다운로드
+
Pose Estimation Model : DWPose(Distillation for Whole-body Pose estimator) (23.07) IDEA-Research/DWPose
+(the student’s head with only 20% training time as a plug-and-play training strategy)
+
GPU : 4 NVIDIA A100 GPUs
+
첫 번째 훈련 단계 : 768×768 해상도 video frame sampled, resized, and center-cropped 30,000 steps, batch size 64.
+
두 번째 훈련 단계 : temporal layer 10,000 steps 24-frame video sequences, batch size 4.
+
learning rates : 1e-5.
+
Inference 단계 : reference image의 캐릭터 skeleton의 길이에 근사하기 위해서 유도된 pose skeleton의 길이 rescale
+
DDIM sampler, 20 steps
+
긴 영상 생성을 위해 temporal aggregation method 채택
+
Evaluation : benchmark dataset 2개(UBC fashion video dataset, Tik-Tok dataset) 사용
\(\Delta W_t\) = t 시점에서 그 다음 시간 간격까지 증가한 W 의 값
-\(= W_{t+\Delta t} - W_t\)
-= \(\epsilon_t \sqrt {\Delta t}\)
-
-
-
이해
-
-
\(\Delta W_t = W_{t+\Delta t} - W_t = \epsilon_t \sqrt {\Delta t}\) 라고 정의해 본 근거를
-위의 Requirements 에서 찾아보면..
-
-
확률 변수 \(\epsilon\) 를 도입함으로써 stochasticity 부여
-
\(\Delta t\) 를 도입함으로써 시간 간격도 고려 가능
-
-
-
그렇다면 왜 하필 \(\sqrt {\Delta t}\) 를 곱했을까?
-
-
\(\Delta t\) 가 0 에 가까워질 때, \(\sqrt{\Delta t}\) 는 천천히 0 에 수렴함.
-만약 TIME t 가 continuous 하다면, \(\Delta t\) 는 매우 작은 값이 됨.
-\(\Delta W_t = \epsilon_t {\Delta t}\) 라면 \(\Delta W_t\) 가 너무 작아짐.
-
\(\Delta t\) 가 커질 때, \(\sqrt{\Delta t}\) 는 천천히 커짐
-
-
-
주의할 사항
-
-
i.i.d \(\epsilon_t \sim N(0, 1)\) 이므로,
-\(\Delta W_t = \epsilon_t \sqrt {\Delta t}\) 에서 \(\Delta W_0\) 와 \(\Delta W_1\) 은 서로 독립인 것이 맞지만,
-\(W_0\) 과 \(W_1\) 이 독립이라는 말은 아님.
Brownian Bridge 는 Standard Wiener Process 의 Conditional Probability Distribution 이다.
-Starting state W(0) 과 Ending state W(T) 의 값에 Conditioned 되어 있다.
-아래와 같이 정의될 수 있다.
아래의 그림을 보면, 0 이라는 시작값과 123 이라는 마지막 값에 conditioned 되어 있는 것을 확인할 수 있다. Brownian Bridge 의 분산은 0 에서 시작해서 증가하다가, T/2 시점에서 최대가 되었다가, 이후로는 감소하여 마지막엔 0 에 수렴하게된다.
-
-
-
-
Fig. 342 \(W_0\) = 0 에서 \(W_1000\) = 123 까지 100개의 Brownian Bridge 를 샘플링한 결과#
-
-
-
-
Abstrcat
-
-
-
-
Fig. 343 Conditional Diffusion Models 와 BBDM 의 비교#
-
-
-
-
기존의 Diffusion 모델들은,
-Image-to-Image 변환을 Conditional generation process 로 다룸.
-이로 인해, 매우 상이한 도메인 사이의 변환에는 어려움이 있음.
-
이를 해결하기 위해,
-본 논문은 Brownian Bridge에 기반한 Image-to-Image 변환 방법을 제시함
-
BBDM 은 Conditional generation process 가 아닌
-Stochastic Brownian Bridge Process 로 두 도메인 사이의 변환을 모델링하므로, Bidirectional Diffusion Process 임.
-
Brownian Bridge diffusion process 를 Image-to-Image 변환에 접목한 최초의 논문임
-
BBDM 모델의 훌륭한 성능을 실험적으로 증명함
-
-
-
-
-
Introduction
-
-
I2I 변환에서 Non-diffusion models 의 한계
-
-
Pix2Pix 와 같은 conditional GANs 는 fideltiy 가 높았으나,
-학습이 어렵고, DIversity 가 떨어진다.
-
-
Diversity 가 떨어지는 이유 : conditional GANs 는 input image 를 output image 에 one-to-one mapping 하는 방법을 학습하기 때문
-
-
-
VAE 같은 생성형 모델들은 GANs 만큼의 I2I 성능이 안나오고,
-Applicability 가 GANs 보다 떨어진다.
-
-
-
I2I 변환에서 conditional diffusion models 의 한계
-
-
conditional diffusion models 는 reference image 의 encoded feature 를 직접 U-Net 에 통합시킴으로써 diffusion models 의 reverse process 를 guide 함
-
하지만 이렇게 생성된 결과가 desired conditional distribution 을 추론해낸다는 명료한 이론적 근거가 없음
-
대부분의 conditional diffusion models 는 generalization 이 잘 안되므로,
-conditional input domain 과 output domain 이 유사한
-몇몇 applications 에서만 잘 활용될 수 있음
-
-
ex. inpainting 혹은 super-resolution
-
-
-
LDM 이 latent space 에서 diffusion process 를 수행함으로써
-generalization 을 개선하긴 했으나 여전히 conditional generation process 임
-
LDM 의 경우, 복잡한 attention mechanism 으로 multi-modal condition 이 주어지므로, 이론적 근거를 제시하기가 더 힘듦
\(\Delta W_t\) = t 시점에서 그 다음 시간 간격까지 증가한 W 의 값
+\(= W_{t+\Delta t} - W_t\)
+= \(\epsilon_t \sqrt {\Delta t}\)
+
+
+
이해
+
+
\(\Delta W_t = W_{t+\Delta t} - W_t = \epsilon_t \sqrt {\Delta t}\) 라고 정의해 본 근거를
+위의 Requirements 에서 찾아보면..
+
+
확률 변수 \(\epsilon\) 를 도입함으로써 stochasticity 부여
+
\(\Delta t\) 를 도입함으로써 시간 간격도 고려 가능
+
+
+
그렇다면 왜 하필 \(\sqrt {\Delta t}\) 를 곱했을까?
+
+
\(\Delta t\) 가 0 에 가까워질 때, \(\sqrt{\Delta t}\) 는 천천히 0 에 수렴함.
+만약 TIME t 가 continuous 하다면, \(\Delta t\) 는 매우 작은 값이 됨.
+\(\Delta W_t = \epsilon_t {\Delta t}\) 라면 \(\Delta W_t\) 가 너무 작아짐.
+
\(\Delta t\) 가 커질 때, \(\sqrt{\Delta t}\) 는 천천히 커짐
+
+
+
주의할 사항
+
+
i.i.d \(\epsilon_t \sim N(0, 1)\) 이므로,
+\(\Delta W_t = \epsilon_t \sqrt {\Delta t}\) 에서 \(\Delta W_0\) 와 \(\Delta W_1\) 은 서로 독립인 것이 맞지만,
+\(W_0\) 과 \(W_1\) 이 독립이라는 말은 아님.
Brownian Bridge 는 Standard Wiener Process 의 Conditional Probability Distribution 이다.
+Starting state W(0) 과 Ending state W(T) 의 값에 Conditioned 되어 있다.
+아래와 같이 정의될 수 있다.
아래의 그림을 보면, 0 이라는 시작값과 123 이라는 마지막 값에 conditioned 되어 있는 것을 확인할 수 있다. Brownian Bridge 의 분산은 0 에서 시작해서 증가하다가, T/2 시점에서 최대가 되었다가, 이후로는 감소하여 마지막엔 0 에 수렴하게된다.
+
+
+
+
Fig. 342 \(W_0\) = 0 에서 \(W_1000\) = 123 까지 100개의 Brownian Bridge 를 샘플링한 결과#
+
+
+
+
Abstrcat
+
+
+
+
Fig. 343 Conditional Diffusion Models 와 BBDM 의 비교#
+
+
+
+
기존의 Diffusion 모델들은,
+Image-to-Image 변환을 Conditional generation process 로 다룸.
+이로 인해, 매우 상이한 도메인 사이의 변환에는 어려움이 있음.
+
이를 해결하기 위해,
+본 논문은 Brownian Bridge에 기반한 Image-to-Image 변환 방법을 제시함
+
BBDM 은 Conditional generation process 가 아닌
+Stochastic Brownian Bridge Process 로 두 도메인 사이의 변환을 모델링하므로, Bidirectional Diffusion Process 임.
+
Brownian Bridge diffusion process 를 Image-to-Image 변환에 접목한 최초의 논문임
+
BBDM 모델의 훌륭한 성능을 실험적으로 증명함
+
+
+
+
+
Introduction
+
+
I2I 변환에서 Non-diffusion models 의 한계
+
+
Pix2Pix 와 같은 conditional GANs 는 fideltiy 가 높았으나,
+학습이 어렵고, DIversity 가 떨어진다.
+
+
Diversity 가 떨어지는 이유 : conditional GANs 는 input image 를 output image 에 one-to-one mapping 하는 방법을 학습하기 때문
+
+
+
VAE 같은 생성형 모델들은 GANs 만큼의 I2I 성능이 안나오고,
+Applicability 가 GANs 보다 떨어진다.
+
+
+
I2I 변환에서 conditional diffusion models 의 한계
+
+
conditional diffusion models 는 reference image 의 encoded feature 를 직접 U-Net 에 통합시킴으로써 diffusion models 의 reverse process 를 guide 함
+
하지만 이렇게 생성된 결과가 desired conditional distribution 을 추론해낸다는 명료한 이론적 근거가 없음
+
대부분의 conditional diffusion models 는 generalization 이 잘 안되므로,
+conditional input domain 과 output domain 이 유사한
+몇몇 applications 에서만 잘 활용될 수 있음
+
+
ex. inpainting 혹은 super-resolution
+
+
+
LDM 이 latent space 에서 diffusion process 를 수행함으로써
+generalization 을 개선하긴 했으나 여전히 conditional generation process 임
+
LDM 의 경우, 복잡한 attention mechanism 으로 multi-modal condition 이 주어지므로, 이론적 근거를 제시하기가 더 힘듦
본 논문에서는 Creative Generation의 일환으로, 새롭고 창의적인 개념을 생성하는 내용을 다룹니다. 최근 text-to-image 생성 기술과 Personalization 기술이 크게 발전함에 따라 이미지 생성 뿐만 아니라 개인화된 개념을 생설할 수 있게 되었습니다. 이러한 강력한 모델을 사용하여 모델에 명시적으로 설명되지 않은 새로운 창의적 개념을 생성할 수 있을까요?
Text-Guided Sysnthesis
-대부분의 text-guided 생성 기술은 pretrain 된 텍스트 인코더에서 추출한 임베딩을 diffusion 모델에 직접 conditioning합니다. 즉, 텍스트 데이터를 처리하여 이미지 생성 과정에 통합하는 방식입니다. 본 논문에서는 Latent Diffusion Model과 Diffusion prior model을 활용해서 creative generation에서의 이점을 보입니다.
-
Diffusion Prior
-Diffusion Prior 모델은 입력된 텍스트 임베딩을 CLIP의 latent space에서 해당하는 이미지 임베딩으로 매핑합니다. 이후 디코더는 CLIP의 이미지 임베딩에 condition이 부여된 이미지를 생성하기 위해 훈련됩니다.
-
Personalization
-Personalization은 text-guided synthesis 맥락에서 사용자가 입력한 텍스트 프롬프트에 맞는 주제나 스타일을 표현하는 새로운 이미지를 생성하는 것을 목표로 합니다. 일반적으로 새로운 개념을 학습시키기 위해 임베딩을 최적화하거나 denoising 네트워크를 finetuning 하는 방법을 활용합니다. 하지만 본 연구에서는 Creative Generation에 초첨을 맞추고 새로운 개념을 생성하고 기발한 장면을 생성하는 것을 목표로 합니다.
-
Creative Generation
-창의적 내용을 생성하는 것은 다양한 접근 방법이 있습니다. Xu et al 에서는 set-evolution 방법을 활용해 3D 형태의 모델링을 제안했습니다. Elgammal et al 에서는 GAN의 맥락에서 창의적 생성을 탐구하며, 기존 스타일에서의 편차를 극대화하는 방식으로 새로운 스타일을 학습했습니다. Sbai et al 에서는 새로운 손실 함수를 도립했습니다. 본 연구에서는 주어진 카테고리와 일치하도록 최적화하면서도 그 카테고리의 기존 개념들과 다른 새로운 개념을 찾는 방식으로 창의적 생성에 접근했습니다. 본 방법을 통해 새로운 개념들은 서로 혼합될 수 있으며 더 유연한 생성 과정을 갖게됩니다.
Latent Diffusion Models
-Latent Diffusion Model에서는 오토인코더의 latent space 내에서 diffusion 과정이 진행됩니다. 먼저, 인고더 \(E\)는 주어진 이미지 \(x\)를 latent code \(z\)로 매핑하는 것을 목표로 합니다. 이때, z=E(x)가 됩니다. 동시에 디코더 D는 원본 입력 이미지를 재구성하도록 합니다. DDPM의 경우 아래 주어진 손실을 최소화하도록 학습합니다.
denoising network \(\epsilon \theta\) 는 잠재 코드 \(zt\)에 추가된 잡음 \(\epsilon\)을 제거합니다. 이 과정에서 현재 시간 단계 t와 조건 벡터 c도 고려됩니다.
-
Diffusion Prior
-일반적으로 Diffusion model은 CLIP 텍스트 인코딩에서 직접 파생된 조건 벡터 \(c\)를 활용하여 주어진 텍스트 프롬프트 \(y\)에 대해 훈련됩니다. \(Ramesh et al\)에서 text-to-image 생성 문제를 2가지 단계로 decompose 합니다. 먼저, Diffusion Prior 모델을 활용하여 주어진 텍스트 프롬프트로부터 이미지 임베딩을 예측합니다. 다음으로, 이 이미지 임베딩에 조건을 부여하여 이미지를 생성하는 diffusion decoder로 보내집니다. 훈련 또한 일반적으로 두 독립적인 단계로 이루어집니다.
Diffusion 디코더는 이미지 임베딩을 조건 \(c\)와 위 Latent Diffusion Model에 정의된 손실을 활용하여 훈련됩니다. 그 다음 diffusion prior model \(P\theta\)는 임베딩 \(e_{t}\)로부터 denoise 된 이미지 임베딩 \(e\)를 직접 예측합니다. 이 두 단계 접근법은 이미지 다양성을 향상시키며 중간 CLIP 이미지 임베딩에 직접 접근하고 해당 공간에서 직접 제약을 할 수 있게 합니다.
ConceptLab은 생성하고자 하는 새로운 개념을 대표하는 단일 임베딩 \(v_{*}\)를 최적화합니다. 이후 주어진 카테고리에 유사하면서도 기존 멤버들과 다른 특성을 가지도록 손실 집합을 계산합니다. 훈련하는 동안, 현재 생성된 새로운 개념을 바탕으로 negative contraints를 더하기 위해 pretrained BLIP-2 VQA 모델을 활용합니다.
본 연구에서는 두가지 제약 조건을 바탕으로 하여 새로운 개념을 대표하는 임베딩 \(v_{*}\)와 각 제약 조건 간의 유사도를 측정합니다.
-우선, \(v_{*}\)와 각 제약 단어 \(c\)를 동일한 무작위 샘플링된 프롬프트 y에 통합합니다. 각 문장은 CLIP 텍스트 임베딩으로 인코딩되며, 이것이 텍스트 제약 조건을 정의합니다. 텍스트 프롬프트를 diffusion prior 모델에 통과시키면, 프롬프트의 특정 인스턴스가 생성됩니다. 이러한 방식으로 \(E_{y}(v_{*}\)가 diffusion prior를 통과하면 모든 \(v_{*}\)가 텍스트 제약 조건과 일치하도록 일관된 생성을 얻을 수 있습니다. 반면, 긍정 및 부정 제약 조건은 가능한 광범위하게 유지하고자 diffusion prior를 통과하지 않습니다. 이에 따라 본 연구에서의 손실 함수는 다음과 같이 정의됩니다:
많은 부정적 제약 조건을 수동으로 적용하는 것은 힘들고, 광범위한 카테고리의 가장 관련성 높은 멤버들을 정확하게 대표하지 못할 수도 있습니다. 이를 해결하기 위해, 훈련 중 부정적 제약 조건 집합을 점진적으로 확장하는 adaptive scheme을 제안합니다. 생성된 이미지를 사전 훈련된 BLIP-2 VQA 모델에 질의하여 이미지에 현재 존재하는 카테고리의 멤버가 무엇인지 식별하도록 합니다. 이후 결과로 나온 인스턴스를 훈련의 나머지 부분에 대한 부정적 제약 조건에 추가합니다.
-
-
-
-
Fig. 423 여러 단계에 걸쳐 생성된 이미지 결과를 보여줍니다. 훈련 과정에서 부정적 제약 조건이 지속적으로 조정되고 확장되었음을 보여줍니다.#
주어진 개념 셋에 대해 개념을 혼합하기 위해 먼저 각 개념에서 이미지를 생성하여 이미지 제약 조건 \(C_{im}\) 을 만듭니다. 각 이미지는 CLIP 이미지 인코더 \(E_{im}(c)\)를 통과하여 임베딩 세트를 생성합니다. 학습 가능한 개념 \(v_{mix}\)를 주어진 임베딩에 더 가깝게 만드는 수정된 손실 함수를 적용합니다.:
이 손실 함수는 생성된 개념이나 실제 이미지에 적용될 수 있으며, 창의적인 생성물의 계층ㅇ적 생성을 위해 반복적으로 적용될 수 있습니다. 또, 생성된 결과물에 대한 각 개념의 영향을 더 잘 제어하기 위해 가중치 항목이 추가적으로 적용될 수 있습니다.
-
-
-
-
Fig. 424 그림에는 훈련에 사용된 긍정적 개념이 왼쪽에 표시되어 있습니다. 이는 모델이 어떤 개념을 기반으로 창의적 이미지를 생성했는지를 알 수 있습니다. 모든 결과는 Adaptive Negative 기법을 활용했습니다.#
-
-
-
-
-
-
Fig. 425 ConceptLab이 제안한 다양한 이미지로 프롬프트와 Adaptive Negative 기법을 적용했습니다.#
-
-
-
-
-
-
Fig. 426 ConceptLab은 생성된 개념들을 혼합하여 새롭고 독특한 창조물을 반복적으로 학습할 수 있습니다. 그림의 가장 윗줄에서는 Adaptive Negative 기법을 적용하여 학습된 개념들을 보여줍니다. 이어지는 줄에서는 Evolutionary Generation 과정을 통해 얻어진 개념들을 보여줍니다.#
위 그림들에서 볼 수 있듯이 모든 결과는 Adaptive Negative를 적용하였고 훈련 시드를 달리하며 다양한 개념을 생성할 수 있는 능력이 있음을 볼 수 있습니다. 또, ConceptLab은 학습된 창의적 개념을 새로운 장면에 배치할 수 있습니다. 이 생성물들은 배경 변경, 스타일 변경, 새로운 창조등 다양하게 활용 가능합니다.
-
-
-
-
Fig. 427 ConceptLab을 활용한 Concept Mixing의 결과를 보여줍니다.#
Concept Mixing은 다양한 실제 개념들의 독특한 특성을 합쳐 하이브리드 개념을 형성하는 방법을 보여줍니다. 이 방법은 오직 긍정적 제약 조건만을 활용합니다. 예를 들어, 첫 번째 줄에는 랍스터의 주요 특징(생상과 집게발)을 거북이의 특징(등껍질)과 융합하는 것을 볼 수 있습니다.
-
-
-
-
Fig. 428 위 그림은 ConceptLab에 의해 학습된 개념들이 여러 세대에 걸쳐 어떻게 발전하는지 보여줍니다.#
ConceptLab은 Stable Diffusion2와 Kandinsky 2.1 두 모델과 함께 평가했습니다. Kandinsky의 경우, 더 유리한 결과를 위해 부정적 프롬프트는 Latent Diffusion Model이 아닌 Diffusion Prior Model에 적용했습니다.
정량적 평가를 위해 각 방법이 긍정적 개념을 포함하며, 주어진 부정적 개념과 닮지 않은 이미지를 생성하는 능력을 측정했습니다. 평가에는 애완동물, 식물, 과일, 가구, 악기의 5가지 카테고리를 활용했습니다. 각 도메인에 세 가지 다른 부정적 개념 쌍을 고려하고, 각 조합에 대해 ConceptLab을 5개의 랜덤 시드로 훈련하여 총 75개의 학습된 개념을 얻었습니다. 각 학습된 개념에 대해 “A photo of a \(S_{*}\) 프롬프트를 활용하여 32개의 이미지를 생성했습니다. Stable Diffusionr과 kandinsky 모델에서는 부정적 프롬프트를 사용하고, 같은 긍정적 및 부정적 개념 쌍에 대해 160개의 이미지를 생성합니다. 측정 기준으로는 먼저 각 개념의 긍정적 유사성을 타겟 카테고리와의 CLIP 공간 유사성 계산을 통해 특정됩니다. 다음으로는 긍정적 제약과 부정적 제약 사이의 거리를 측정합니다. 이는 생성된 이미지와 모든 부정적 개념 사이의 최대 유사성 계산을 통해 이루어집니다. 결과적으로 ConceptLab은 5가지 모든 도메인에서 긍정적 CLIP 유사성에서 일관되게 우월한 성능을 보였고 타겟 카테고리에 속하는 이미지를 신뢰성 있게 생성했습니다. 또한, 부정적 거리 측정에서 ConceptLab은 모든 카테고리에서 Stable Diffusion을, 4가지 카테고리에서 Kandinsky를 능가했습니다.
Personalization과 유사하게, 학습된 개념을 포함하는 프롬프트를 사용하여 새로운 이미지를 생성하는 것이 항상 개념의 특성을 다양한 프롬프트에 걸쳐 유지하지는 못합니다. 또, 최적화 과정 자체가 항상 원하는 결과를 가져오지는 않습니다. “비행기”나 “물고기”와 같은 일부 클래스의 경우 ConceptLab은 창의적 개념을 생성하는데 여전히 어려움이 있습니다. 이는 BLIP-2에 의해 생성되는 부정적 제약과 관련이 있습니다.
본 논문에서는 text-to-image diffusion model을 활용하여 창의적 생성을 위한 새로운 접근 방법을 소개했습니다. 주어진 광범위한 카테고리에 속하는 새로운 개념을 학습하기 위해 Diffusion Prior 모델 사용을 제안했습니다. 또, Prior Constraints라는 긍정적 및 부정적 제약 조건들을 diffusion prior 출력에 적용했습니다. 최적화 과정에서는 VQA 모델을 활용하여 독특하면서도 기존 멤버들과의 명확한 구별을 보장했습니다. 이후 실험을 통해 본 방법의 효과성을 입증했으며 시각적으로 다양하고 매력적인 개념을 생성할 수 있었습니다.
본 논문에서는 Creative Generation의 일환으로, 새롭고 창의적인 개념을 생성하는 내용을 다룹니다. 최근 text-to-image 생성 기술과 Personalization 기술이 크게 발전함에 따라 이미지 생성 뿐만 아니라 개인화된 개념을 생설할 수 있게 되었습니다. 이러한 강력한 모델을 사용하여 모델에 명시적으로 설명되지 않은 새로운 창의적 개념을 생성할 수 있을까요?
Text-Guided Sysnthesis
+대부분의 text-guided 생성 기술은 pretrain 된 텍스트 인코더에서 추출한 임베딩을 diffusion 모델에 직접 conditioning합니다. 즉, 텍스트 데이터를 처리하여 이미지 생성 과정에 통합하는 방식입니다. 본 논문에서는 Latent Diffusion Model과 Diffusion prior model을 활용해서 creative generation에서의 이점을 보입니다.
+
Diffusion Prior
+Diffusion Prior 모델은 입력된 텍스트 임베딩을 CLIP의 latent space에서 해당하는 이미지 임베딩으로 매핑합니다. 이후 디코더는 CLIP의 이미지 임베딩에 condition이 부여된 이미지를 생성하기 위해 훈련됩니다.
+
Personalization
+Personalization은 text-guided synthesis 맥락에서 사용자가 입력한 텍스트 프롬프트에 맞는 주제나 스타일을 표현하는 새로운 이미지를 생성하는 것을 목표로 합니다. 일반적으로 새로운 개념을 학습시키기 위해 임베딩을 최적화하거나 denoising 네트워크를 finetuning 하는 방법을 활용합니다. 하지만 본 연구에서는 Creative Generation에 초첨을 맞추고 새로운 개념을 생성하고 기발한 장면을 생성하는 것을 목표로 합니다.
+
Creative Generation
+창의적 내용을 생성하는 것은 다양한 접근 방법이 있습니다. Xu et al 에서는 set-evolution 방법을 활용해 3D 형태의 모델링을 제안했습니다. Elgammal et al 에서는 GAN의 맥락에서 창의적 생성을 탐구하며, 기존 스타일에서의 편차를 극대화하는 방식으로 새로운 스타일을 학습했습니다. Sbai et al 에서는 새로운 손실 함수를 도립했습니다. 본 연구에서는 주어진 카테고리와 일치하도록 최적화하면서도 그 카테고리의 기존 개념들과 다른 새로운 개념을 찾는 방식으로 창의적 생성에 접근했습니다. 본 방법을 통해 새로운 개념들은 서로 혼합될 수 있으며 더 유연한 생성 과정을 갖게됩니다.
Latent Diffusion Models
+Latent Diffusion Model에서는 오토인코더의 latent space 내에서 diffusion 과정이 진행됩니다. 먼저, 인고더 \(E\)는 주어진 이미지 \(x\)를 latent code \(z\)로 매핑하는 것을 목표로 합니다. 이때, z=E(x)가 됩니다. 동시에 디코더 D는 원본 입력 이미지를 재구성하도록 합니다. DDPM의 경우 아래 주어진 손실을 최소화하도록 학습합니다.
denoising network \(\epsilon \theta\) 는 잠재 코드 \(zt\)에 추가된 잡음 \(\epsilon\)을 제거합니다. 이 과정에서 현재 시간 단계 t와 조건 벡터 c도 고려됩니다.
+
Diffusion Prior
+일반적으로 Diffusion model은 CLIP 텍스트 인코딩에서 직접 파생된 조건 벡터 \(c\)를 활용하여 주어진 텍스트 프롬프트 \(y\)에 대해 훈련됩니다. \(Ramesh et al\)에서 text-to-image 생성 문제를 2가지 단계로 decompose 합니다. 먼저, Diffusion Prior 모델을 활용하여 주어진 텍스트 프롬프트로부터 이미지 임베딩을 예측합니다. 다음으로, 이 이미지 임베딩에 조건을 부여하여 이미지를 생성하는 diffusion decoder로 보내집니다. 훈련 또한 일반적으로 두 독립적인 단계로 이루어집니다.
Diffusion 디코더는 이미지 임베딩을 조건 \(c\)와 위 Latent Diffusion Model에 정의된 손실을 활용하여 훈련됩니다. 그 다음 diffusion prior model \(P\theta\)는 임베딩 \(e_{t}\)로부터 denoise 된 이미지 임베딩 \(e\)를 직접 예측합니다. 이 두 단계 접근법은 이미지 다양성을 향상시키며 중간 CLIP 이미지 임베딩에 직접 접근하고 해당 공간에서 직접 제약을 할 수 있게 합니다.
ConceptLab은 생성하고자 하는 새로운 개념을 대표하는 단일 임베딩 \(v_{*}\)를 최적화합니다. 이후 주어진 카테고리에 유사하면서도 기존 멤버들과 다른 특성을 가지도록 손실 집합을 계산합니다. 훈련하는 동안, 현재 생성된 새로운 개념을 바탕으로 negative contraints를 더하기 위해 pretrained BLIP-2 VQA 모델을 활용합니다.
본 연구에서는 두가지 제약 조건을 바탕으로 하여 새로운 개념을 대표하는 임베딩 \(v_{*}\)와 각 제약 조건 간의 유사도를 측정합니다.
+우선, \(v_{*}\)와 각 제약 단어 \(c\)를 동일한 무작위 샘플링된 프롬프트 y에 통합합니다. 각 문장은 CLIP 텍스트 임베딩으로 인코딩되며, 이것이 텍스트 제약 조건을 정의합니다. 텍스트 프롬프트를 diffusion prior 모델에 통과시키면, 프롬프트의 특정 인스턴스가 생성됩니다. 이러한 방식으로 \(E_{y}(v_{*}\)가 diffusion prior를 통과하면 모든 \(v_{*}\)가 텍스트 제약 조건과 일치하도록 일관된 생성을 얻을 수 있습니다. 반면, 긍정 및 부정 제약 조건은 가능한 광범위하게 유지하고자 diffusion prior를 통과하지 않습니다. 이에 따라 본 연구에서의 손실 함수는 다음과 같이 정의됩니다:
많은 부정적 제약 조건을 수동으로 적용하는 것은 힘들고, 광범위한 카테고리의 가장 관련성 높은 멤버들을 정확하게 대표하지 못할 수도 있습니다. 이를 해결하기 위해, 훈련 중 부정적 제약 조건 집합을 점진적으로 확장하는 adaptive scheme을 제안합니다. 생성된 이미지를 사전 훈련된 BLIP-2 VQA 모델에 질의하여 이미지에 현재 존재하는 카테고리의 멤버가 무엇인지 식별하도록 합니다. 이후 결과로 나온 인스턴스를 훈련의 나머지 부분에 대한 부정적 제약 조건에 추가합니다.
+
+
+
+
Fig. 423 여러 단계에 걸쳐 생성된 이미지 결과를 보여줍니다. 훈련 과정에서 부정적 제약 조건이 지속적으로 조정되고 확장되었음을 보여줍니다.#
주어진 개념 셋에 대해 개념을 혼합하기 위해 먼저 각 개념에서 이미지를 생성하여 이미지 제약 조건 \(C_{im}\) 을 만듭니다. 각 이미지는 CLIP 이미지 인코더 \(E_{im}(c)\)를 통과하여 임베딩 세트를 생성합니다. 학습 가능한 개념 \(v_{mix}\)를 주어진 임베딩에 더 가깝게 만드는 수정된 손실 함수를 적용합니다.:
이 손실 함수는 생성된 개념이나 실제 이미지에 적용될 수 있으며, 창의적인 생성물의 계층ㅇ적 생성을 위해 반복적으로 적용될 수 있습니다. 또, 생성된 결과물에 대한 각 개념의 영향을 더 잘 제어하기 위해 가중치 항목이 추가적으로 적용될 수 있습니다.
+
+
+
+
Fig. 424 그림에는 훈련에 사용된 긍정적 개념이 왼쪽에 표시되어 있습니다. 이는 모델이 어떤 개념을 기반으로 창의적 이미지를 생성했는지를 알 수 있습니다. 모든 결과는 Adaptive Negative 기법을 활용했습니다.#
+
+
+
+
+
+
Fig. 425 ConceptLab이 제안한 다양한 이미지로 프롬프트와 Adaptive Negative 기법을 적용했습니다.#
+
+
+
+
+
+
Fig. 426 ConceptLab은 생성된 개념들을 혼합하여 새롭고 독특한 창조물을 반복적으로 학습할 수 있습니다. 그림의 가장 윗줄에서는 Adaptive Negative 기법을 적용하여 학습된 개념들을 보여줍니다. 이어지는 줄에서는 Evolutionary Generation 과정을 통해 얻어진 개념들을 보여줍니다.#
위 그림들에서 볼 수 있듯이 모든 결과는 Adaptive Negative를 적용하였고 훈련 시드를 달리하며 다양한 개념을 생성할 수 있는 능력이 있음을 볼 수 있습니다. 또, ConceptLab은 학습된 창의적 개념을 새로운 장면에 배치할 수 있습니다. 이 생성물들은 배경 변경, 스타일 변경, 새로운 창조등 다양하게 활용 가능합니다.
+
+
+
+
Fig. 427 ConceptLab을 활용한 Concept Mixing의 결과를 보여줍니다.#
Concept Mixing은 다양한 실제 개념들의 독특한 특성을 합쳐 하이브리드 개념을 형성하는 방법을 보여줍니다. 이 방법은 오직 긍정적 제약 조건만을 활용합니다. 예를 들어, 첫 번째 줄에는 랍스터의 주요 특징(생상과 집게발)을 거북이의 특징(등껍질)과 융합하는 것을 볼 수 있습니다.
+
+
+
+
Fig. 428 위 그림은 ConceptLab에 의해 학습된 개념들이 여러 세대에 걸쳐 어떻게 발전하는지 보여줍니다.#
ConceptLab은 Stable Diffusion2와 Kandinsky 2.1 두 모델과 함께 평가했습니다. Kandinsky의 경우, 더 유리한 결과를 위해 부정적 프롬프트는 Latent Diffusion Model이 아닌 Diffusion Prior Model에 적용했습니다.
정량적 평가를 위해 각 방법이 긍정적 개념을 포함하며, 주어진 부정적 개념과 닮지 않은 이미지를 생성하는 능력을 측정했습니다. 평가에는 애완동물, 식물, 과일, 가구, 악기의 5가지 카테고리를 활용했습니다. 각 도메인에 세 가지 다른 부정적 개념 쌍을 고려하고, 각 조합에 대해 ConceptLab을 5개의 랜덤 시드로 훈련하여 총 75개의 학습된 개념을 얻었습니다. 각 학습된 개념에 대해 “A photo of a \(S_{*}\) 프롬프트를 활용하여 32개의 이미지를 생성했습니다. Stable Diffusionr과 kandinsky 모델에서는 부정적 프롬프트를 사용하고, 같은 긍정적 및 부정적 개념 쌍에 대해 160개의 이미지를 생성합니다. 측정 기준으로는 먼저 각 개념의 긍정적 유사성을 타겟 카테고리와의 CLIP 공간 유사성 계산을 통해 특정됩니다. 다음으로는 긍정적 제약과 부정적 제약 사이의 거리를 측정합니다. 이는 생성된 이미지와 모든 부정적 개념 사이의 최대 유사성 계산을 통해 이루어집니다. 결과적으로 ConceptLab은 5가지 모든 도메인에서 긍정적 CLIP 유사성에서 일관되게 우월한 성능을 보였고 타겟 카테고리에 속하는 이미지를 신뢰성 있게 생성했습니다. 또한, 부정적 거리 측정에서 ConceptLab은 모든 카테고리에서 Stable Diffusion을, 4가지 카테고리에서 Kandinsky를 능가했습니다.
Personalization과 유사하게, 학습된 개념을 포함하는 프롬프트를 사용하여 새로운 이미지를 생성하는 것이 항상 개념의 특성을 다양한 프롬프트에 걸쳐 유지하지는 못합니다. 또, 최적화 과정 자체가 항상 원하는 결과를 가져오지는 않습니다. “비행기”나 “물고기”와 같은 일부 클래스의 경우 ConceptLab은 창의적 개념을 생성하는데 여전히 어려움이 있습니다. 이는 BLIP-2에 의해 생성되는 부정적 제약과 관련이 있습니다.
본 논문에서는 text-to-image diffusion model을 활용하여 창의적 생성을 위한 새로운 접근 방법을 소개했습니다. 주어진 광범위한 카테고리에 속하는 새로운 개념을 학습하기 위해 Diffusion Prior 모델 사용을 제안했습니다. 또, Prior Constraints라는 긍정적 및 부정적 제약 조건들을 diffusion prior 출력에 적용했습니다. 최적화 과정에서는 VQA 모델을 활용하여 독특하면서도 기존 멤버들과의 명확한 구별을 보장했습니다. 이후 실험을 통해 본 방법의 효과성을 입증했으며 시각적으로 다양하고 매력적인 개념을 생성할 수 있었습니다.
기존의 Text-to-Image 모델들은 text prompt로 생성할 이미지의 특징을 조절할 수 있었습니다. 하지만 이런 prompt-based control만으로 이미지의 특징을 조절하는데 한계가 있었습니다. 이 논문에서는 image-based condition을 추가적으로 줘서 생성되는 이미지의 특징을 더 잘 조절하는 ControlNet이라는 신경망 구조를 제안합니다.
-
아래 그림은 “a high quality, detailed, and professional image”라는 prompt와 왼쪽 아래의 Canny edge를 input으로 받아서 오른쪽의 이미지들을 생성한 것입니다. 이런 식으로 추가적인 image-based condition (아래 그림에서는 Canny edge)를 input으로 받아 이미지를 생성하는 것이 ControlNet이 하는 역할입니다.
우선, copy를 사용하는 이유는 기존에 방대한 양의 데이터로 학습시킨 pretrained model의 성능을 유지하기 위해서입니다. 또한, ControlNet의 학습 데이터가 양이 적은 경우에 오버피팅을 피할 수 있는 효과도 있을 것입니다.
-
zero convolution이란 weight랑 bias가 0으로 초기화한 1x1 convolution을 말합니다. zero convolution을 사용할 경우 훈련이 시작되기 전에는 input에 대해 pretrained model과 ControlNet의 output이 똑같아집니다. 따라서 기존 모델이랑 똑같은 input, output을 가지게되므로 기존 모델의 성능을 유지할 수 있으며, 추가적인 훈련이 fine tuning을 하는 것과 비슷하므로 scratch부터 학습하는 것에 비해 빠르게 훈련시킬 수 있게됩니다.
-
그러면 zero convolution은 어떻게 이를 가능하게 하는지 좀 더 자세히 알아봅시다.
\(\mathbf{x}\)는 input feature map, \(\mathcal{F}\)는 neural network block, \(\Theta\)는 \(\mathcal{F}\)의 parameter, \(\mathbf{y}\)는 output을 의미합니다. 위 그림의 (b)를 수식으로 표현하기위해 \(\mathcal{F}\)의 trainable copy를 만들어서 parameter를 \(\Theta_{c}\)라고하고 \(\Theta\)는 고정시켜두겠습니다. 또한, zero convolution은 \(\mathcal{Z}\)로 표현하고 두 zero convolution의 parameter를 각각 \(\Theta_{z1}, \Theta_{z2}\)로 두겠습니다. 그러면 (b)에서 condition \(\mathbf{c}\)에 대한 output \(\mathbf{y}_{c}\)는 아래와 같이 표현할 수 있습니다.
그런데 \(\mathcal{Z}\)의 weight와 bias의 초깃값이 0이므로 훈련이 진행되지 않았을 경우 \(\mathbf{y}_{c}=\mathbf{y}\)입니다. 따라서 훈련 시작 전에는 ControlNet과 기존 모델이 같은 결과를 내므로 기존 모델의 성능을 보존할 수 있습니다.
-
그런데 weight랑 bias가 전부 0으로 초기화되어있으면 gradient가 0이라서 훈련이 안 되는거 아닐까요? 이를 확인하기 위해 다음과 같이 간단한 경우를 생각해보죠.
입니다. 따라서 첫 번째 gradient step에서 weight는 0이 아닌 값으로 가게되고, \(\frac{\partial y}{\partial x}\neq0\)이 되므로 훈련이 됩니다. 여기서 핵심적인 가정이 \(x\neq0\)인데 이 부분은 잘 훈련된 pretrained model을 사용하고 있기 때문에 위배될 가능성이 낮을 것입니다.
-
지금까지 얘기한 ControlNet block 구조를 pretrained Stable diffusion에 적용한 전체 구조는 아래 그림과 같습니다.
training을 할 때 50%의 확률로 prompt \(\mathbf{c}_{t}\)를 empty string으로 바꿔주었다고 합니다. 이는 prompt가 주어지지않을 경우 모델이 \(\mathbf{c}_{f}\)로부터 semantics를 더 배우는 경향이 있기 때문에 이미지 생성을 \(\mathbf{c}_{f}\)로 조절하는 능력을 향상시켜줄 수 있다고 합니다.
코드는 공식 구현(링크)에서 가져왔습니다. 아래 코드는 parameter를 0으로 초기화하는 코드로 zero convolution을 만들 때 사용됩니다.
-
defzero_module(module):
-"""
- Zero out the parameters of a module and return it.
- """
- forpinmodule.parameters():
- p.detach().zero_()
- returnmodule
-
-
-
아래 코드는 기본적으로 nn.Sequential과 같은데 time step같은 추가적인 input을 받아줄 수 있게 만든 것입니다.
-
classTimestepEmbedSequential(nn.Sequential,TimestepBlock):
-"""
- A sequential module that passes timestep embeddings to the children that
- support it as an extra input.
- """
-
- defforward(self,x,emb,context=None):
- forlayerinself:
- ifisinstance(layer,TimestepBlock):
- x=layer(x,emb)
- elifisinstance(layer,SpatialTransformer):
- x=layer(x,context)
- else:
- x=layer(x)
- returnx
-
-
-
아래 코드는 공식 github의 cldm/cldm.py에 있는 ControlNet class입니다. init 부분은 길어서 생략했습니다.
기존의 Text-to-Image 모델들은 text prompt로 생성할 이미지의 특징을 조절할 수 있었습니다. 하지만 이런 prompt-based control만으로 이미지의 특징을 조절하는데 한계가 있었습니다. 이 논문에서는 image-based condition을 추가적으로 줘서 생성되는 이미지의 특징을 더 잘 조절하는 ControlNet이라는 신경망 구조를 제안합니다.
+
아래 그림은 “a high quality, detailed, and professional image”라는 prompt와 왼쪽 아래의 Canny edge를 input으로 받아서 오른쪽의 이미지들을 생성한 것입니다. 이런 식으로 추가적인 image-based condition (아래 그림에서는 Canny edge)를 input으로 받아 이미지를 생성하는 것이 ControlNet이 하는 역할입니다.
우선, copy를 사용하는 이유는 기존에 방대한 양의 데이터로 학습시킨 pretrained model의 성능을 유지하기 위해서입니다. 또한, ControlNet의 학습 데이터가 양이 적은 경우에 오버피팅을 피할 수 있는 효과도 있을 것입니다.
+
zero convolution이란 weight랑 bias가 0으로 초기화한 1x1 convolution을 말합니다. zero convolution을 사용할 경우 훈련이 시작되기 전에는 input에 대해 pretrained model과 ControlNet의 output이 똑같아집니다. 따라서 기존 모델이랑 똑같은 input, output을 가지게되므로 기존 모델의 성능을 유지할 수 있으며, 추가적인 훈련이 fine tuning을 하는 것과 비슷하므로 scratch부터 학습하는 것에 비해 빠르게 훈련시킬 수 있게됩니다.
+
그러면 zero convolution은 어떻게 이를 가능하게 하는지 좀 더 자세히 알아봅시다.
\(\mathbf{x}\)는 input feature map, \(\mathcal{F}\)는 neural network block, \(\Theta\)는 \(\mathcal{F}\)의 parameter, \(\mathbf{y}\)는 output을 의미합니다. 위 그림의 (b)를 수식으로 표현하기위해 \(\mathcal{F}\)의 trainable copy를 만들어서 parameter를 \(\Theta_{c}\)라고하고 \(\Theta\)는 고정시켜두겠습니다. 또한, zero convolution은 \(\mathcal{Z}\)로 표현하고 두 zero convolution의 parameter를 각각 \(\Theta_{z1}, \Theta_{z2}\)로 두겠습니다. 그러면 (b)에서 condition \(\mathbf{c}\)에 대한 output \(\mathbf{y}_{c}\)는 아래와 같이 표현할 수 있습니다.
그런데 \(\mathcal{Z}\)의 weight와 bias의 초깃값이 0이므로 훈련이 진행되지 않았을 경우 \(\mathbf{y}_{c}=\mathbf{y}\)입니다. 따라서 훈련 시작 전에는 ControlNet과 기존 모델이 같은 결과를 내므로 기존 모델의 성능을 보존할 수 있습니다.
+
그런데 weight랑 bias가 전부 0으로 초기화되어있으면 gradient가 0이라서 훈련이 안 되는거 아닐까요? 이를 확인하기 위해 다음과 같이 간단한 경우를 생각해보죠.
입니다. 따라서 첫 번째 gradient step에서 weight는 0이 아닌 값으로 가게되고, \(\frac{\partial y}{\partial x}\neq0\)이 되므로 훈련이 됩니다. 여기서 핵심적인 가정이 \(x\neq0\)인데 이 부분은 잘 훈련된 pretrained model을 사용하고 있기 때문에 위배될 가능성이 낮을 것입니다.
+
지금까지 얘기한 ControlNet block 구조를 pretrained Stable diffusion에 적용한 전체 구조는 아래 그림과 같습니다.
training을 할 때 50%의 확률로 prompt \(\mathbf{c}_{t}\)를 empty string으로 바꿔주었다고 합니다. 이는 prompt가 주어지지않을 경우 모델이 \(\mathbf{c}_{f}\)로부터 semantics를 더 배우는 경향이 있기 때문에 이미지 생성을 \(\mathbf{c}_{f}\)로 조절하는 능력을 향상시켜줄 수 있다고 합니다.
코드는 공식 구현(링크)에서 가져왔습니다. 아래 코드는 parameter를 0으로 초기화하는 코드로 zero convolution을 만들 때 사용됩니다.
+
defzero_module(module):
+"""
+ Zero out the parameters of a module and return it.
+ """
+ forpinmodule.parameters():
+ p.detach().zero_()
+ returnmodule
+
+
+
아래 코드는 기본적으로 nn.Sequential과 같은데 time step같은 추가적인 input을 받아줄 수 있게 만든 것입니다.
+
classTimestepEmbedSequential(nn.Sequential,TimestepBlock):
+"""
+ A sequential module that passes timestep embeddings to the children that
+ support it as an extra input.
+ """
+
+ defforward(self,x,emb,context=None):
+ forlayerinself:
+ ifisinstance(layer,TimestepBlock):
+ x=layer(x,emb)
+ elifisinstance(layer,SpatialTransformer):
+ x=layer(x,context)
+ else:
+ x=layer(x)
+ returnx
+
+
+
아래 코드는 공식 github의 cldm/cldm.py에 있는 ControlNet class입니다. init 부분은 길어서 생략했습니다.
Fig. 103 vibrant portrait of Salvador Dali with a robotic half face from DALLE2#
-
-
-
위 그림은 DALLE2 가 생성해낸 “vibrant portrait of Salvador Dali with a robotic half face” 이미지입니다.
-실제 Salvador dali 의 모습이 보이네요.
-게다가 Salvador dali 의 초현실주의적 그림체가 반영된 것 같기도 합니다.
-놀라운 이미지입니다.
-
아래의 corgi 그림은 어떤가요 ?
-
-
-
-
Fig. 104 a corgi’s head depicted as an explosion of a nebula from DALLE2#
-
-
-
corgi 의 모습을 성운의 폭발로 묘사해달라고 했을 때 생성된 그림입니다.
-아래의 그림은, 실제 NASA 에서 촬영한 초신성 폭발의 잔해입니다.
-
정말 그럴듯하지 않나요?
-
-
-
-
Fig. 105 This mosaic image, one of the largest ever taken by NASA’s Hubble Space Telescope of the Crab Nebula, is a six-light-year-wide expanding remnant of a star’s supernova explosion.#
-
-
-
-
-
-
-
학습 목표 및 주의사항
-
-
본 포스팅에서는 DALLE2 paper 의 내용을 비선형적으로 살펴봅니다.
-마치 오픈월드 게임처럼 말이죠.
-핵심이 되는 질문들을 던지며, DALLE2 의 아키텍쳐를 파헤쳐 볼 겁니다.
The fundamental principles of training CLIP are quite simple:
-
-
First, all images and their associated captions are passed through their respective encoders, mapping all objects into an m-dimensional space.
-
Then, the cosine similarity of each (image, text) pair is computed.
-
The training objective is to simultaneously maximize the cosine similarity between N correct encoded image/caption pairs and minimize the cosine similarity between N - N incorrect encoded image/caption pairs.
-
-
-
-
-
-
-
DALL-E 2 는 CLIP 과 Diffusion Model 을 통합시켰습니다. (최초는 x)
-
하지만 CLIP 을 사용하는 것이 정답은 아닙니다.
-DALL-E 2 는 22년 5월, CLIP 을 사용하지 않은 IMAGEN 에게 SOTA 를 내주었습니다.
-
-
-
-
-
-
아키텍쳐 찍먹하기
-
특정 이미지 내의 Semantics 와 style 을 모두 포착해낼 수 있는 CLIP 의 이미지 표현 능력을 끌어올리기 위해서,
-저자들은 CLIP 과 Diffusion 모델을 통합한 Two-stage model 을 제안합니다.
-이것이 바로 DALLE2 인데요.
-저자들은 이 모델을 unCLIP 이라고 부릅니다.
-
-
-
-
Fig. 106 A high level overview of the architecture.#
-
-
-
DALLE2 paper 의 그림은 좀 복잡해보이니,
-Assembly AI 의 Youtube 에서 제공하는 좀 더 단순화된 그림을 살펴볼게요.
-
-
-
-
Fig. 107 A high level overview of the architecture from AssemblyAI youtube.#
Prior : 텍스트 캡션을 받아서, 상응하는 CLIP image embedding 을 생성합니다.
-
-
본 논문에서는 Autogregressive prior 와 Diffusion prior 를 비교하는 실험 수행했습니다.
-
Diffusion prior 가 computationally efficient 하고, 고품질 이미지 생성합니다.
-따라서 후반부에는 Diffusion prior 만 사용해서 실험합니다.
-
-
-
Decoder : CLIP image embedding 을 받아서, 이미지를 생성합니다.
-
-
Diffusion 모델만 사용했습니다.
-
-
-
-
-
-
-
-
왜 CLIP 이랑 Diffusion 을 사용했을까요?
-
-
CLIP
-
-
CLIP 이 images representation 을 학습하는데 에 큰 성공을 거두고 있었습니다.
-
CLIP embeddings 는 image distribution shift 에 robust 했습니다.
-
CLIP embeddings 는 zero-shot capabilities 가 뛰어났습니다.
-
다양한 vision & language tasks 에 fine-tuned 되어 SOTA 를 달성해냈습니다.
-
-
-
Diffusion
-
-
Diffusion 은 image 와 video generation taks 에서 SOTA 를 갱신하는 중이었죠.
-
non-deterministic 하게 만들 수 있습니다.
-이러한 Decoder 덕분에, CLIP image embedding 과 같은
-image representation 에 존재하지 않는 non-essential 한 details 는 변주하면서,
-image representation 의 semantics 와 style 은 유지할 수 있죠.
-
-
-
-
-
Fig. 108 Variations of an input image by encoding with CLIP and then decoding with a diffusion model.#
-
-
-
위 왼쪽의 그림처럼, Salvador dali 의 그림에서 중요한 objects 들은 보존됩니다.
-하지만 그들이 표현되는 방식이나 전체적인 그림의 style 은 조금씩 바뀝니다.
-그럼에도, Salvador dali 특유의 초현실주의적 화풍은 유지되는 것 같네요.
-Diffusion Decoder 덕분에, Non-essential details 는
-마치 변주곡처럼 매번 새롭게 연주해낼 수 있는겁니다.
-
-
-
-
-
-
-
아키텍쳐 파헤치기
-
-
-
-
Fig. 109 A high level overview of the architecture from AssemblyAI youtube.#
사실 Prior 은 CLIP text embedding 만 조건으로 받는 것이 아니라 Caption 자체도 받습니다.
-(물론 embedding vector 로 받겠죠)
-CLIP text embedding 과, 그 Caption 은 서로 1대1 대응되기 때문에,
-Duel-conditioning 이 문제될 것은 없다고 저자들은 변론합니다.
-
샘플 퀄리티를 높이기 위해서 2개의 CLIP image embeddings 를 생성한 후
-주어진 CLIP text embedding 과 더 높은 dot product 를 갖는 CLIP image embedding 을 사용했다고 합니다.
-
-
-
-
-
Decoder
-
-
Input
-
-
CLIP text embedding
-
Generated CLIP Image embedding
-
-
-
Output
-
-
Generated Image
-
-
-
설명
-
-
modified GLIDE model 을 Decoder 로 사용했습니다.
-→ 따라서, projected CLIP text embeddings 를 아키텍쳐에 통합시킬 수 있다고 주장합니다.
-
-어떻게 통합시키냐하면,
-
-
-
GLIDE timestep embedding 에 추가하고,
-
4개의 extra context tokens 을 만들어서 GLIDE text encoder 의 output sequence 에 concat 하는거죠.
-
-이 방법으로 CLIP image embeddings 를 받아서, 원본 영상을 생성하는 것 입니다.
GLIDE 를 수정해 사용함으로써 GLIDE 가 가지고 있던
-text-conditional photorealistic image generation capabilities 를 활용할 수 있다고 주장합니다.
-
-
-
-
-
-
-
-
-
-
그렇다면 왜 Prior 가 필요할까요?
-
-
To obtain a full generative model of images,
-we combine the CLIP image embedding decoder with a prior model,
-which generates possible CLIP image embeddings from a given text caption
-
-
라고 하지만.. 딱히 와닿지는 않습니다.
-하지만 아직 실망하긴 이릅니다.
-Prior 의 유무에 따라, 생성된 이미지의 품질을 비교하는 실험을 수행했다고 합니다.
-한번 살펴볼까요?
-
-
아래 세 가지 아키텍쳐를 비교하는 실험 수행
-(1) GLIDE 모델처럼, text 의 token embeddings 만 조건으로 주어 실험
-(2) 추가적으로, CLIP text embeddings 를 조건으로 주어 실험
-(3) 추가적으로, CLIP image embeddings 를 생성해내는 Prior 를 갖추고 실험
-
-실험 결과, (3) 이 가장 훌륭했습니다.
-특히 image diversity 가 뛰어났습니다.
-
-
-
-
-
Fig. 111 3가지 경우의 아키텍쳐에 따른 실험 결과 from AssemblyAI youtube.#
-
-
-
-
-
-
Fig. 112 Samples using different conditioning signals for the same decoder.#
-
-
-
그렇지만, 의문이 말끔히 해소되지는 않습니다.
-왜냐하면..
-
-
95% 의 학습 시간 동안, (3) 방식으로 학습한 Decoder 를,
-(1) 과 (2) 방식에 그대로 적용해 실험했습니다.
-따라서 공정한 실험이라고 보긴 어려울 것 같습니다.
-
Decoder 를, True CLIP Image embeddings 와 Generated CLIP Image embeddings 로
-각각 학습시켰을 때의 성능 비교 실험은 없습니다.
-
-개인적으로 저는 이러한 결과들을 보고,
-Prior 를 반드시 써야하는 근거에 대한 설득력이 떨어진다고 생각했습니다.
-
-
-
-
-
-
왜 CLIP 을 써야할까요?
-
-
CLIP 은 어떤 객체를 묘사한 텍스트와, 그 객체의 시각적 발현 사이의 의미론적 관계를 학습했습니다.
-따라서 저자들은 이러한 CLIP 의 능력이 Text-to-Image task 에서 매우 중요하다고 주장합니다.
-
CLIP 을 활용한 덕분에 이미지를 Manipulation 할 수 있습니다.
-
-
-
-
-
Fig. 113 Text diffs applied to images by interpolating between their CLIP image embeddings and a normalised difference of the CLIP text embeddings produced from the two descriptions.#
-
-
-
어떻게 이미지를 Manipulation 하는지는 곧 자세히 살펴보겠습니다.
-
-
-
-
-
그래서 이 모델은 뭐가 좋은가요?
-
-
Evaluation 결과, Diversity 가 뛰어났습니다.
-
-
모델을 평가하기 위해서,
-주어진 Caption 에 대한 GLIDE 의 생성물과 unCLIP 의 생성물을 사람들에게 제시하고,
-Photorealism, Caption Similarity, Diversity 에 대해서 점수를 매기도록 했습니다.
-
-
-
-
-
Fig. 114 Samples when increasing guidance scale for both unCLIP and GLIDE.#
-
-
-
-
-
-
Fig. 115 Comparison of unCLIP and GLIDE for different evaluations.#
-
-
-
-
-
-
Fig. 116 FID versus guidance scale for unCLIP and GLIDE.#
-
-
-
결론은 다음과 같습니다.
-
-
GLIDE 에 비해서 Photorealism, Caption Similarity, 은 Comparable 했습니다.
-(안 좋다.)
-
하지만, Diversity 는 훨씬 뛰어났습니다.
-
-
-
-
-
-
Image Manipulations 가 가능합니다.
-
-
Bipartite Representation
-
-
unCLIP 구조 덕분에,
-주어진 이미지 x 를 (z_i, x_T) 와 같은 bipartite latent representation 로 인코딩 가능합니다.
-
이 latent space 를 활용해서, Image manipulation 을 수행할 수 있습니다.
-
x_T 는 DDIM inversion 을 z_i 가 condition 된 x 에 적용해 얻으며,
-Decoder 가 x 를 복원하는데 필요한 잔여 정보들을 지닙니다.
-
-
-
-
-
-
Variations
-
-
-
-
Fig. 117 Variations of an input image by encoding with CLIP and then decoding with a diffusion model.#
-
-
-
-
Non-essential details 를 변주하기 위해서,
-bipartite representation 에 DDIM with η > 0 for sampling decoder 를 적용합니다.
-
η = 0 일 때, decoder 는 deterministic 해지고 x 자체를 복원해냅니다.
-
η 가 커질수록, sampling steps 에는 stochasticity 가 생기고,
-원본 이미지 x 근처에서 perceptually “centereed” 된 variations 를 만들어낼 것입니다.
-
η 를 키우면, 우리는 CLIP image embedding 에 어떤 정보가 존재하고 어떤 정보가 유실되었는지 탐색 가능합니다.
-→ 즉, CLIP latent space 를 탐색해낼 수 있는거죠 !
-
-
-
-
-
-
Interpolations
-
-
-
-
Fig. 118 Variations between two images by interpolating their CLIP image embedding and then decoding with a diffusion model.#
-
-
-
-
이런 것도 됩니다.
-input image 두 장의 CLIP image embeddings 를 interpolation 해서 Decoder 에 준다면,
-interpolated image 를 생성할 수 있습니다.
-
-
-
-
-
-
Text Diffs
-
-
-
-
Fig. 119 Text diffs applied to images by interpolating between their CLIP image embeddings and a normalised difference of the CLIP text embeddings produced from the two descriptions.#
-
-
-
-
어떤 이미지와 그 캡션이 주어져있을 때,
-그 이미지를 우리가 원하는 target text prompt 에 맞게 조작할 수도 있습니다.
Text to Image Generation models 의 시각적 추론 능력 3가지를 평가하기 위한 데이터셋 제공합니다.
-
최근의 모델들이 object recognition skill 은 상대적으로 뛰어나지만,
-object counting 및 spaial relation 이해 능력은 떨어짐을 발견했습니다.
-
Text to Image Generation models 에 존재하는
-gender 및 skin tone biases 를 측정하는 evaluation metrics 와 그 분석 결과를 제시한 최초의 논문 입니다.
-
-
web 에서 image-text pairs 를 학습한 현재 T2I 생성 모델들은
-특정한 gender/skin tone biases 를 학습했음을 보여주었습니다.
-
-
-
-
-
-
-
Fig. 126 Overview of DALL-EVAL evaluation process.#
-
-
-
-
Social Bias Evaluation 측정 방법 (Sec. 4.2.1 참고)
-
-
-
-
Fig. 127 Overview of DALL-EVAL’s social bias evaluation process.#
-
-
-
DALL-EVAL 의 자세한 social bias evaluation process 는 다음과 같습니다.
-
-
우선 Diagnostic prompts 로 이미지들을 생성합니다.
-
-
ex) “a person who works as a nurse”
-
총 252개의 Diagnostic prompts 제공
-
-
-
Gender, Skin tone, Attributes 를 생성된 이미지로부터 탐지합니다.
-
-
using automated detection models and verify the reliability of detection models with human evaluation
-
Gender
-
-
BLIP-2 라는 모델에 생성된 영상을 주면서 영상 내 사람의 성별을 맞추게 합니다.
-BLIP-2 의 답변을 기반으로 Gender Bias 측정합니다.
-
-
-
Skin tone
-
-
신경망으로 facial landmark 를 추출하고, illumination 을 측정합니다.
-
-
-
Attributes
-
-
BLIP-2 라는 모델에 생성된 영상을 주면서 영상 내 사람의 복장을 맞추게 합니다.
-BLIP-2 의 답변을 기반으로 Attributes Bias 측정합니다.
-
-
-
-
-
탐지된 Gender, Skin tone, Attributes 가
-unbiased uniform distribution 으로부터 얼마나 skewed 되어있는지 측정합니다.
-
-
-
-
-
-
실험 결과
-
-
-
-
Fig. 128 Gender, skin tone, and attribute detection results with automated and expert human evaluation.#
-
-
-
-
-
-
Fig. 129 Per-profession examples and average gender bias or average skin tone bias of images.#
-
-
-
-
-
-
Fig. 130 Comparison of overall gender and skin tone bias of each model.#
-
-
-
-
-
위 실험 결과와 같이, DALL-EVAL 은 Text-to-Image models 를 정량적으로 평가하는데에 성공했습니다.
-Satble Diffusion 처럼 웹크롤링을 활용해 데이터를 학습한 모델은 Bias 가 존재했습니다.
-이처럼 생성형 AI 의 Bias 를 측정하기 위한 다양한 노력이 지속되고 있습니다.
-미래에는 생성형 AI 가 더 안전하게 활용될 수 있기를 기대합니다.
Fig. 103 vibrant portrait of Salvador Dali with a robotic half face from DALLE2#
+
+
+
위 그림은 DALLE2 가 생성해낸 “vibrant portrait of Salvador Dali with a robotic half face” 이미지입니다.
+실제 Salvador dali 의 모습이 보이네요.
+게다가 Salvador dali 의 초현실주의적 그림체가 반영된 것 같기도 합니다.
+놀라운 이미지입니다.
+
아래의 corgi 그림은 어떤가요 ?
+
+
+
+
Fig. 104 a corgi’s head depicted as an explosion of a nebula from DALLE2#
+
+
+
corgi 의 모습을 성운의 폭발로 묘사해달라고 했을 때 생성된 그림입니다.
+아래의 그림은, 실제 NASA 에서 촬영한 초신성 폭발의 잔해입니다.
+
정말 그럴듯하지 않나요?
+
+
+
+
Fig. 105 This mosaic image, one of the largest ever taken by NASA’s Hubble Space Telescope of the Crab Nebula, is a six-light-year-wide expanding remnant of a star’s supernova explosion.#
+
+
+
+
+
+
+
학습 목표 및 주의사항
+
+
본 포스팅에서는 DALLE2 paper 의 내용을 비선형적으로 살펴봅니다.
+마치 오픈월드 게임처럼 말이죠.
+핵심이 되는 질문들을 던지며, DALLE2 의 아키텍쳐를 파헤쳐 볼 겁니다.
The fundamental principles of training CLIP are quite simple:
+
+
First, all images and their associated captions are passed through their respective encoders, mapping all objects into an m-dimensional space.
+
Then, the cosine similarity of each (image, text) pair is computed.
+
The training objective is to simultaneously maximize the cosine similarity between N correct encoded image/caption pairs and minimize the cosine similarity between N - N incorrect encoded image/caption pairs.
+
+
+
+
+
+
+
DALL-E 2 는 CLIP 과 Diffusion Model 을 통합시켰습니다. (최초는 x)
+
하지만 CLIP 을 사용하는 것이 정답은 아닙니다.
+DALL-E 2 는 22년 5월, CLIP 을 사용하지 않은 IMAGEN 에게 SOTA 를 내주었습니다.
+
+
+
+
+
+
아키텍쳐 찍먹하기
+
특정 이미지 내의 Semantics 와 style 을 모두 포착해낼 수 있는 CLIP 의 이미지 표현 능력을 끌어올리기 위해서,
+저자들은 CLIP 과 Diffusion 모델을 통합한 Two-stage model 을 제안합니다.
+이것이 바로 DALLE2 인데요.
+저자들은 이 모델을 unCLIP 이라고 부릅니다.
+
+
+
+
Fig. 106 A high level overview of the architecture.#
+
+
+
DALLE2 paper 의 그림은 좀 복잡해보이니,
+Assembly AI 의 Youtube 에서 제공하는 좀 더 단순화된 그림을 살펴볼게요.
+
+
+
+
Fig. 107 A high level overview of the architecture from AssemblyAI youtube.#
Prior : 텍스트 캡션을 받아서, 상응하는 CLIP image embedding 을 생성합니다.
+
+
본 논문에서는 Autogregressive prior 와 Diffusion prior 를 비교하는 실험 수행했습니다.
+
Diffusion prior 가 computationally efficient 하고, 고품질 이미지 생성합니다.
+따라서 후반부에는 Diffusion prior 만 사용해서 실험합니다.
+
+
+
Decoder : CLIP image embedding 을 받아서, 이미지를 생성합니다.
+
+
Diffusion 모델만 사용했습니다.
+
+
+
+
+
+
+
+
왜 CLIP 이랑 Diffusion 을 사용했을까요?
+
+
CLIP
+
+
CLIP 이 images representation 을 학습하는데 에 큰 성공을 거두고 있었습니다.
+
CLIP embeddings 는 image distribution shift 에 robust 했습니다.
+
CLIP embeddings 는 zero-shot capabilities 가 뛰어났습니다.
+
다양한 vision & language tasks 에 fine-tuned 되어 SOTA 를 달성해냈습니다.
+
+
+
Diffusion
+
+
Diffusion 은 image 와 video generation taks 에서 SOTA 를 갱신하는 중이었죠.
+
non-deterministic 하게 만들 수 있습니다.
+이러한 Decoder 덕분에, CLIP image embedding 과 같은
+image representation 에 존재하지 않는 non-essential 한 details 는 변주하면서,
+image representation 의 semantics 와 style 은 유지할 수 있죠.
+
+
+
+
+
Fig. 108 Variations of an input image by encoding with CLIP and then decoding with a diffusion model.#
+
+
+
위 왼쪽의 그림처럼, Salvador dali 의 그림에서 중요한 objects 들은 보존됩니다.
+하지만 그들이 표현되는 방식이나 전체적인 그림의 style 은 조금씩 바뀝니다.
+그럼에도, Salvador dali 특유의 초현실주의적 화풍은 유지되는 것 같네요.
+Diffusion Decoder 덕분에, Non-essential details 는
+마치 변주곡처럼 매번 새롭게 연주해낼 수 있는겁니다.
+
+
+
+
+
+
+
아키텍쳐 파헤치기
+
+
+
+
Fig. 109 A high level overview of the architecture from AssemblyAI youtube.#
사실 Prior 은 CLIP text embedding 만 조건으로 받는 것이 아니라 Caption 자체도 받습니다.
+(물론 embedding vector 로 받겠죠)
+CLIP text embedding 과, 그 Caption 은 서로 1대1 대응되기 때문에,
+Duel-conditioning 이 문제될 것은 없다고 저자들은 변론합니다.
+
샘플 퀄리티를 높이기 위해서 2개의 CLIP image embeddings 를 생성한 후
+주어진 CLIP text embedding 과 더 높은 dot product 를 갖는 CLIP image embedding 을 사용했다고 합니다.
+
+
+
+
+
Decoder
+
+
Input
+
+
CLIP text embedding
+
Generated CLIP Image embedding
+
+
+
Output
+
+
Generated Image
+
+
+
설명
+
+
modified GLIDE model 을 Decoder 로 사용했습니다.
+→ 따라서, projected CLIP text embeddings 를 아키텍쳐에 통합시킬 수 있다고 주장합니다.
+
+어떻게 통합시키냐하면,
+
+
+
GLIDE timestep embedding 에 추가하고,
+
4개의 extra context tokens 을 만들어서 GLIDE text encoder 의 output sequence 에 concat 하는거죠.
+
+이 방법으로 CLIP image embeddings 를 받아서, 원본 영상을 생성하는 것 입니다.
GLIDE 를 수정해 사용함으로써 GLIDE 가 가지고 있던
+text-conditional photorealistic image generation capabilities 를 활용할 수 있다고 주장합니다.
+
+
+
+
+
+
+
+
+
+
그렇다면 왜 Prior 가 필요할까요?
+
+
To obtain a full generative model of images,
+we combine the CLIP image embedding decoder with a prior model,
+which generates possible CLIP image embeddings from a given text caption
+
+
라고 하지만.. 딱히 와닿지는 않습니다.
+하지만 아직 실망하긴 이릅니다.
+Prior 의 유무에 따라, 생성된 이미지의 품질을 비교하는 실험을 수행했다고 합니다.
+한번 살펴볼까요?
+
+
아래 세 가지 아키텍쳐를 비교하는 실험 수행
+(1) GLIDE 모델처럼, text 의 token embeddings 만 조건으로 주어 실험
+(2) 추가적으로, CLIP text embeddings 를 조건으로 주어 실험
+(3) 추가적으로, CLIP image embeddings 를 생성해내는 Prior 를 갖추고 실험
+
+실험 결과, (3) 이 가장 훌륭했습니다.
+특히 image diversity 가 뛰어났습니다.
+
+
+
+
+
Fig. 111 3가지 경우의 아키텍쳐에 따른 실험 결과 from AssemblyAI youtube.#
+
+
+
+
+
+
Fig. 112 Samples using different conditioning signals for the same decoder.#
+
+
+
그렇지만, 의문이 말끔히 해소되지는 않습니다.
+왜냐하면..
+
+
95% 의 학습 시간 동안, (3) 방식으로 학습한 Decoder 를,
+(1) 과 (2) 방식에 그대로 적용해 실험했습니다.
+따라서 공정한 실험이라고 보긴 어려울 것 같습니다.
+
Decoder 를, True CLIP Image embeddings 와 Generated CLIP Image embeddings 로
+각각 학습시켰을 때의 성능 비교 실험은 없습니다.
+
+개인적으로 저는 이러한 결과들을 보고,
+Prior 를 반드시 써야하는 근거에 대한 설득력이 떨어진다고 생각했습니다.
+
+
+
+
+
+
왜 CLIP 을 써야할까요?
+
+
CLIP 은 어떤 객체를 묘사한 텍스트와, 그 객체의 시각적 발현 사이의 의미론적 관계를 학습했습니다.
+따라서 저자들은 이러한 CLIP 의 능력이 Text-to-Image task 에서 매우 중요하다고 주장합니다.
+
CLIP 을 활용한 덕분에 이미지를 Manipulation 할 수 있습니다.
+
+
+
+
+
Fig. 113 Text diffs applied to images by interpolating between their CLIP image embeddings and a normalised difference of the CLIP text embeddings produced from the two descriptions.#
+
+
+
어떻게 이미지를 Manipulation 하는지는 곧 자세히 살펴보겠습니다.
+
+
+
+
+
그래서 이 모델은 뭐가 좋은가요?
+
+
Evaluation 결과, Diversity 가 뛰어났습니다.
+
+
모델을 평가하기 위해서,
+주어진 Caption 에 대한 GLIDE 의 생성물과 unCLIP 의 생성물을 사람들에게 제시하고,
+Photorealism, Caption Similarity, Diversity 에 대해서 점수를 매기도록 했습니다.
+
+
+
+
+
Fig. 114 Samples when increasing guidance scale for both unCLIP and GLIDE.#
+
+
+
+
+
+
Fig. 115 Comparison of unCLIP and GLIDE for different evaluations.#
+
+
+
+
+
+
Fig. 116 FID versus guidance scale for unCLIP and GLIDE.#
+
+
+
결론은 다음과 같습니다.
+
+
GLIDE 에 비해서 Photorealism, Caption Similarity, 은 Comparable 했습니다.
+(안 좋다.)
+
하지만, Diversity 는 훨씬 뛰어났습니다.
+
+
+
+
+
+
Image Manipulations 가 가능합니다.
+
+
Bipartite Representation
+
+
unCLIP 구조 덕분에,
+주어진 이미지 x 를 (z_i, x_T) 와 같은 bipartite latent representation 로 인코딩 가능합니다.
+
이 latent space 를 활용해서, Image manipulation 을 수행할 수 있습니다.
+
x_T 는 DDIM inversion 을 z_i 가 condition 된 x 에 적용해 얻으며,
+Decoder 가 x 를 복원하는데 필요한 잔여 정보들을 지닙니다.
+
+
+
+
+
+
Variations
+
+
+
+
Fig. 117 Variations of an input image by encoding with CLIP and then decoding with a diffusion model.#
+
+
+
+
Non-essential details 를 변주하기 위해서,
+bipartite representation 에 DDIM with η > 0 for sampling decoder 를 적용합니다.
+
η = 0 일 때, decoder 는 deterministic 해지고 x 자체를 복원해냅니다.
+
η 가 커질수록, sampling steps 에는 stochasticity 가 생기고,
+원본 이미지 x 근처에서 perceptually “centereed” 된 variations 를 만들어낼 것입니다.
+
η 를 키우면, 우리는 CLIP image embedding 에 어떤 정보가 존재하고 어떤 정보가 유실되었는지 탐색 가능합니다.
+→ 즉, CLIP latent space 를 탐색해낼 수 있는거죠 !
+
+
+
+
+
+
Interpolations
+
+
+
+
Fig. 118 Variations between two images by interpolating their CLIP image embedding and then decoding with a diffusion model.#
+
+
+
+
이런 것도 됩니다.
+input image 두 장의 CLIP image embeddings 를 interpolation 해서 Decoder 에 준다면,
+interpolated image 를 생성할 수 있습니다.
+
+
+
+
+
+
Text Diffs
+
+
+
+
Fig. 119 Text diffs applied to images by interpolating between their CLIP image embeddings and a normalised difference of the CLIP text embeddings produced from the two descriptions.#
+
+
+
+
어떤 이미지와 그 캡션이 주어져있을 때,
+그 이미지를 우리가 원하는 target text prompt 에 맞게 조작할 수도 있습니다.
Text to Image Generation models 의 시각적 추론 능력 3가지를 평가하기 위한 데이터셋 제공합니다.
+
최근의 모델들이 object recognition skill 은 상대적으로 뛰어나지만,
+object counting 및 spaial relation 이해 능력은 떨어짐을 발견했습니다.
+
Text to Image Generation models 에 존재하는
+gender 및 skin tone biases 를 측정하는 evaluation metrics 와 그 분석 결과를 제시한 최초의 논문 입니다.
+
+
web 에서 image-text pairs 를 학습한 현재 T2I 생성 모델들은
+특정한 gender/skin tone biases 를 학습했음을 보여주었습니다.
+
+
+
+
+
+
+
Fig. 126 Overview of DALL-EVAL evaluation process.#
+
+
+
+
Social Bias Evaluation 측정 방법 (Sec. 4.2.1 참고)
+
+
+
+
Fig. 127 Overview of DALL-EVAL’s social bias evaluation process.#
+
+
+
DALL-EVAL 의 자세한 social bias evaluation process 는 다음과 같습니다.
+
+
우선 Diagnostic prompts 로 이미지들을 생성합니다.
+
+
ex) “a person who works as a nurse”
+
총 252개의 Diagnostic prompts 제공
+
+
+
Gender, Skin tone, Attributes 를 생성된 이미지로부터 탐지합니다.
+
+
using automated detection models and verify the reliability of detection models with human evaluation
+
Gender
+
+
BLIP-2 라는 모델에 생성된 영상을 주면서 영상 내 사람의 성별을 맞추게 합니다.
+BLIP-2 의 답변을 기반으로 Gender Bias 측정합니다.
+
+
+
Skin tone
+
+
신경망으로 facial landmark 를 추출하고, illumination 을 측정합니다.
+
+
+
Attributes
+
+
BLIP-2 라는 모델에 생성된 영상을 주면서 영상 내 사람의 복장을 맞추게 합니다.
+BLIP-2 의 답변을 기반으로 Attributes Bias 측정합니다.
+
+
+
+
+
탐지된 Gender, Skin tone, Attributes 가
+unbiased uniform distribution 으로부터 얼마나 skewed 되어있는지 측정합니다.
+
+
+
+
+
+
실험 결과
+
+
+
+
Fig. 128 Gender, skin tone, and attribute detection results with automated and expert human evaluation.#
+
+
+
+
+
+
Fig. 129 Per-profession examples and average gender bias or average skin tone bias of images.#
+
+
+
+
+
+
Fig. 130 Comparison of overall gender and skin tone bias of each model.#
+
+
+
+
+
위 실험 결과와 같이, DALL-EVAL 은 Text-to-Image models 를 정량적으로 평가하는데에 성공했습니다.
+Satble Diffusion 처럼 웹크롤링을 활용해 데이터를 학습한 모델은 Bias 가 존재했습니다.
+이처럼 생성형 AI 의 Bias 를 측정하기 위한 다양한 노력이 지속되고 있습니다.
+미래에는 생성형 AI 가 더 안전하게 활용될 수 있기를 기대합니다.
# https://keras.io/examples/generative/ddim/
-classDiffusionModel(keras.Model):
- def__init__(self,image_size,widths,block_depth):
- super().__init__()
-
- self.normalizer=layers.Normalization()
- self.network=get_network(image_size,widths,block_depth)# unet 구조
-
- defdenormalize(self,images):
- # convert the pixel values back to 0-1 range
- images=self.normalizer.mean+images*self.normalizer.variance**0.5
- returntf.clip_by_value(images,0.0,1.0)
-
- defdiffusion_schedule(self,diffusion_times):
- # diffusion times -> angles
- start_angle=tf.acos(max_signal_rate)
- end_angle=tf.acos(min_signal_rate)
-
- diffusion_angles=start_angle+diffusion_times*(end_angle-start_angle)
-
- # angles -> signal and noise rates
- signal_rates=tf.cos(diffusion_angles)
- noise_rates=tf.sin(diffusion_angles)
- # note that their squared sum is always: sin^2(x) + cos^2(x) = 1
-
- returnnoise_rates,signal_rates
-
- defdenoise(self,noisy_images,noise_rates,signal_rates,training):
- # the exponential moving average weights are used at evaluation
- iftraining:
- network=self.network
- else:
- network=self.ema_network
-
- # predict noise component and calculate the image component using it
- pred_noises=network([noisy_images,noise_rates**2],training=training)
- pred_images=(noisy_images-noise_rates*pred_noises)/signal_rates
-
- returnpred_noises,pred_images
-
-
-
- deftrain_step(self,images):
- # normalize images to have standard deviation of 1, like the noises
- images=self.normalizer(images,training=True)
- noises=tf.random.normal(shape=(batch_size,image_size,image_size,3))
-
- # sample uniform random diffusion times
- diffusion_times=tf.random.uniform(
- shape=(batch_size,1,1,1),minval=0.0,maxval=1.0
- )
- noise_rates,signal_rates=self.diffusion_schedule(diffusion_times)
- # mix the images with noises accordingly
- noisy_images=signal_rates*images+noise_rates*noises
-
- withtf.GradientTape()astape:
- # train the network to separate noisy images to their components
- pred_noises,pred_images=self.denoise(
- noisy_images,noise_rates,signal_rates,training=True
- )
-
- noise_loss=self.loss(noises,pred_noises)# used for training
- image_loss=self.loss(images,pred_images)# only used as metric
-
- gradients=tape.gradient(noise_loss,self.network.trainable_weights)
- self.optimizer.apply_gradients(zip(gradients,self.network.trainable_weights))
-
- self.noise_loss_tracker.update_state(noise_loss)
- self.image_loss_tracker.update_state(image_loss)
-
- return{m.name:m.result()forminself.metrics[:-1]}
-
- defreverse_diffusion(self,initial_noise,diffusion_steps):
- # reverse diffusion = sampling
- num_images=initial_noise.shape[0]
- step_size=1.0/diffusion_steps
-
- # important line:
- # at the first sampling step, the "noisy image" is pure noise
- # but its signal rate is assumed to be nonzero (min_signal_rate)
- next_noisy_images=initial_noise
- forstepinrange(diffusion_steps):
- noisy_images=next_noisy_images
-
- # separate the current noisy image to its components
- diffusion_times=tf.ones((num_images,1,1,1))-step*step_size
- noise_rates,signal_rates=self.diffusion_schedule(diffusion_times)
- pred_noises,pred_images=self.denoise(
- noisy_images,noise_rates,signal_rates,training=False
- )
- # network used in eval mode
-
- # remix the predicted components using the next signal and noise rates
- next_diffusion_times=diffusion_times-step_size
- next_noise_rates,next_signal_rates=self.diffusion_schedule(
- next_diffusion_times
- )
- next_noisy_images=(
- next_signal_rates*pred_images+next_noise_rates*pred_noises
- )
- # this new noisy image will be used in the next step
-
- returnpred_images
-
- defgenerate(self,num_images,diffusion_steps):
- # noise -> images -> denormalized images
- initial_noise=tf.random.normal(shape=(num_images,image_size,image_size,3))
- generated_images=self.reverse_diffusion(initial_noise,diffusion_steps)
- generated_images=self.denormalize(generated_images)
- returngenerated_images
-
# https://keras.io/examples/generative/ddim/
+classDiffusionModel(keras.Model):
+ def__init__(self,image_size,widths,block_depth):
+ super().__init__()
+
+ self.normalizer=layers.Normalization()
+ self.network=get_network(image_size,widths,block_depth)# unet 구조
+
+ defdenormalize(self,images):
+ # convert the pixel values back to 0-1 range
+ images=self.normalizer.mean+images*self.normalizer.variance**0.5
+ returntf.clip_by_value(images,0.0,1.0)
+
+ defdiffusion_schedule(self,diffusion_times):
+ # diffusion times -> angles
+ start_angle=tf.acos(max_signal_rate)
+ end_angle=tf.acos(min_signal_rate)
+
+ diffusion_angles=start_angle+diffusion_times*(end_angle-start_angle)
+
+ # angles -> signal and noise rates
+ signal_rates=tf.cos(diffusion_angles)
+ noise_rates=tf.sin(diffusion_angles)
+ # note that their squared sum is always: sin^2(x) + cos^2(x) = 1
+
+ returnnoise_rates,signal_rates
+
+ defdenoise(self,noisy_images,noise_rates,signal_rates,training):
+ # the exponential moving average weights are used at evaluation
+ iftraining:
+ network=self.network
+ else:
+ network=self.ema_network
+
+ # predict noise component and calculate the image component using it
+ pred_noises=network([noisy_images,noise_rates**2],training=training)
+ pred_images=(noisy_images-noise_rates*pred_noises)/signal_rates
+
+ returnpred_noises,pred_images
+
+
+
+ deftrain_step(self,images):
+ # normalize images to have standard deviation of 1, like the noises
+ images=self.normalizer(images,training=True)
+ noises=tf.random.normal(shape=(batch_size,image_size,image_size,3))
+
+ # sample uniform random diffusion times
+ diffusion_times=tf.random.uniform(
+ shape=(batch_size,1,1,1),minval=0.0,maxval=1.0
+ )
+ noise_rates,signal_rates=self.diffusion_schedule(diffusion_times)
+ # mix the images with noises accordingly
+ noisy_images=signal_rates*images+noise_rates*noises
+
+ withtf.GradientTape()astape:
+ # train the network to separate noisy images to their components
+ pred_noises,pred_images=self.denoise(
+ noisy_images,noise_rates,signal_rates,training=True
+ )
+
+ noise_loss=self.loss(noises,pred_noises)# used for training
+ image_loss=self.loss(images,pred_images)# only used as metric
+
+ gradients=tape.gradient(noise_loss,self.network.trainable_weights)
+ self.optimizer.apply_gradients(zip(gradients,self.network.trainable_weights))
+
+ self.noise_loss_tracker.update_state(noise_loss)
+ self.image_loss_tracker.update_state(image_loss)
+
+ return{m.name:m.result()forminself.metrics[:-1]}
+
+ defreverse_diffusion(self,initial_noise,diffusion_steps):
+ # reverse diffusion = sampling
+ num_images=initial_noise.shape[0]
+ step_size=1.0/diffusion_steps
+
+ # important line:
+ # at the first sampling step, the "noisy image" is pure noise
+ # but its signal rate is assumed to be nonzero (min_signal_rate)
+ next_noisy_images=initial_noise
+ forstepinrange(diffusion_steps):
+ noisy_images=next_noisy_images
+
+ # separate the current noisy image to its components
+ diffusion_times=tf.ones((num_images,1,1,1))-step*step_size
+ noise_rates,signal_rates=self.diffusion_schedule(diffusion_times)
+ pred_noises,pred_images=self.denoise(
+ noisy_images,noise_rates,signal_rates,training=False
+ )
+ # network used in eval mode
+
+ # remix the predicted components using the next signal and noise rates
+ next_diffusion_times=diffusion_times-step_size
+ next_noise_rates,next_signal_rates=self.diffusion_schedule(
+ next_diffusion_times
+ )
+ next_noisy_images=(
+ next_signal_rates*pred_images+next_noise_rates*pred_noises
+ )
+ # this new noisy image will be used in the next step
+
+ returnpred_images
+
+ defgenerate(self,num_images,diffusion_steps):
+ # noise -> images -> denormalized images
+ initial_noise=tf.random.normal(shape=(num_images,image_size,image_size,3))
+ generated_images=self.reverse_diffusion(initial_noise,diffusion_steps)
+ generated_images=self.denormalize(generated_images)
+ returngenerated_images
+
Diffusion model은 variational inference로 학습시켜 데이터를 생성하는 parameterized Markov chain. Diffusion model은 Markov가 데이터가 normal distribution의 형태를 할 때까지 noise를 더해가는 diffusion process와 이를 역으로 거치며 학습하는 reverse process로 구성됨.
-
Diffusion model은 정의하기 쉽고 학습시키는 것도 편리함. 또한 높은 품질의 sample(output)도 생성이 가능.
-
-
-
Variational inference(변분추론): 사후확률(posterior) 분포 \(p(z
-|x)\)를 다루기 쉬운 확률분포 \(q(z)\)로 근사(approximation)하는 것
-
Parameterize: 하나의 표현식에 대해 다른 parameter를 사용하여 다시 표현하는 과정. 이 과정에서 보통 parameter의 개수를 표현 식의 차수보다 적은 수로 선택(ex. 3차 표현식 –> 2개 parameter 사용)하므로, 낮은 차수로의 mapping 함수(ex. 3D –> 2D)가 생성
-
Markov chain: 어떤 상태에서 다른 상태로 넘어갈 때, 바로 전 단계의 상태에만 영향을 받는 확률 과정
\(L_{1:T-1}\)는 forward progress posterior를 예측하는 loss. \(\mathbf{x}_{t-1}\)에서 noise를 더해 \(\mathbf{x}_{t}\)를 만들었을때, 그 과정을 복원 \(p(\mathbf{x}_{t-1}|\mathbf{x}_t)\) 하는 과정을 학습.
학습 시에는 특정 step의 이미지가 얼마나 gaussian noise가 추가되었는지를 예측하도록 학습된다.
-
코드에서는 랜덤 노이즈와 시간 단계 t로 노이즈가 추가된 이미지를 얻고 해당 이미지를 보고 모델이 노이즈를 예측
-
-
-
-
defp_losses(self,x_start,t,noise=None):
- b,c,h,w=x_start.shape
- noise=default(noise,lambda:torch.randn_like(x_start))
-
- # noise sample
-
- x=self.q_sample(x_start=x_start,t=t,noise=noise)
-
- # if doing self-conditioning, 50% of the time, predict x_start from current set of times
- # and condition with unet with that
- # this technique will slow down training by 25%, but seems to lower FID significantly
-
- x_self_cond=None
- ifself.self_conditionandrandom()<0.5:
- withtorch.no_grad():
- x_self_cond=self.model_predictions(x,t).pred_x_start
- x_self_cond.detach_()
-
- # predict and take gradient step
-
- model_out=self.model(x,t,x_self_cond)
-
- ifself.objective=='pred_noise':
- target=noise
- elifself.objective=='pred_x0':
- target=x_start
- elifself.objective=='pred_v':
- v=self.predict_v(x_start,t,noise)
- target=v
- else:
- raiseValueError(f'unknown objective {self.objective}')
-
- loss=self.loss_fn(model_out,target,reduction='none')
- loss=reduce(loss,'b ... -> b (...)','mean')
-
- loss=loss*extract(self.loss_weight,t,loss.shape)
- returnloss.mean()
-
-
-
-
Algorithm 2: Sampling
-
-
Network를 학습하고 나면, gaussian noise에서 시작해서 순차적으로 denoising 하는 것이 가능하다. (by parameterized markovian chain)
-
코드에서는 noise 제거 후 소량의 noise를 다시 추가하고 있음
-
-
-
-
@torch.no_grad()
-defp_sample(self,x,t:int,x_self_cond=None):
- b,*_,device=*x.shape,x.device
- batched_times=torch.full((b,),t,device=x.device,dtype=torch.long)
- model_mean,_,model_log_variance,x_start=self.p_mean_variance(x=x,t=batched_times,x_self_cond=x_self_cond,clip_denoised=True)
- noise=torch.randn_like(x)ift>0else0.# no noise if t == 0
- pred_img=model_mean+(0.5*model_log_variance).exp()*noise
- returnpred_img,x_start
-
classAttention(nn.Module):
- def__init__(self,dim,heads=4,dim_head=32):
- super().__init__()
- self.scale=dim_head**-0.5
- self.heads=heads
- hidden_dim=dim_head*heads
-
- self.to_qkv=nn.Conv2d(dim,hidden_dim*3,1,bias=False)
- self.to_out=nn.Conv2d(hidden_dim,dim,1)
-
- defforward(self,x):
- b,c,h,w=x.shape
- qkv=self.to_qkv(x).chunk(3,dim=1)
- q,k,v=map(lambdat:rearrange(t,'b (h c) x y -> b h c (x y)',h=self.heads),qkv)
-
- q=q*self.scale
-
- sim=einsum('b h d i, b h d j -> b h i j',q,k)
- attn=sim.softmax(dim=-1)
- out=einsum('b h i j, b h d j -> b h i d',attn,v)
-
- out=rearrange(out,'b h (x y) d -> b (h d) x y',x=h,y=w)
- returnself.to_out(out)
-
-
-
-
Linear attention
-
-
classLinearAttention(nn.Module):
- def__init__(self,dim,heads=4,dim_head=32):
- super().__init__()
- self.scale=dim_head**-0.5
- self.heads=heads
- hidden_dim=dim_head*heads
- self.to_qkv=nn.Conv2d(dim,hidden_dim*3,1,bias=False)
-
- self.to_out=nn.Sequential(
- nn.Conv2d(hidden_dim,dim,1),
- LayerNorm(dim)
- )
-
- defforward(self,x):
- b,c,h,w=x.shape
- qkv=self.to_qkv(x).chunk(3,dim=1)
- q,k,v=map(lambdat:rearrange(t,'b (h c) x y -> b h c (x y)',h=self.heads),qkv)
-
- q=q.softmax(dim=-2)
- k=k.softmax(dim=-1)
-
- q=q*self.scale
- v=v/(h*w)
-
- context=torch.einsum('b h d n, b h e n -> b h d e',k,v)
-
- out=torch.einsum('b h d e, b h d n -> b h e n',context,q)
- out=rearrange(out,'b h c (x y) -> b (h c) x y',h=self.heads,x=h,y=w)
- returnself.to_out(out)
-
-
-
-
Diffusion time \(T\)는 각 residual block에 transformer sinusoidal positional embedding이 추가돼서 구분됨
Diffusion model은 variational inference로 학습시켜 데이터를 생성하는 parameterized Markov chain. Diffusion model은 Markov가 데이터가 normal distribution의 형태를 할 때까지 noise를 더해가는 diffusion process와 이를 역으로 거치며 학습하는 reverse process로 구성됨.
+
Diffusion model은 정의하기 쉽고 학습시키는 것도 편리함. 또한 높은 품질의 sample(output)도 생성이 가능.
+
+
+
Variational inference(변분추론): 사후확률(posterior) 분포 \(p(z
+|x)\)를 다루기 쉬운 확률분포 \(q(z)\)로 근사(approximation)하는 것
+
Parameterize: 하나의 표현식에 대해 다른 parameter를 사용하여 다시 표현하는 과정. 이 과정에서 보통 parameter의 개수를 표현 식의 차수보다 적은 수로 선택(ex. 3차 표현식 –> 2개 parameter 사용)하므로, 낮은 차수로의 mapping 함수(ex. 3D –> 2D)가 생성
+
Markov chain: 어떤 상태에서 다른 상태로 넘어갈 때, 바로 전 단계의 상태에만 영향을 받는 확률 과정
\(L_{1:T-1}\)는 forward progress posterior를 예측하는 loss. \(\mathbf{x}_{t-1}\)에서 noise를 더해 \(\mathbf{x}_{t}\)를 만들었을때, 그 과정을 복원 \(p(\mathbf{x}_{t-1}|\mathbf{x}_t)\) 하는 과정을 학습.
학습 시에는 특정 step의 이미지가 얼마나 gaussian noise가 추가되었는지를 예측하도록 학습된다.
+
코드에서는 랜덤 노이즈와 시간 단계 t로 노이즈가 추가된 이미지를 얻고 해당 이미지를 보고 모델이 노이즈를 예측
+
+
+
+
defp_losses(self,x_start,t,noise=None):
+ b,c,h,w=x_start.shape
+ noise=default(noise,lambda:torch.randn_like(x_start))
+
+ # noise sample
+
+ x=self.q_sample(x_start=x_start,t=t,noise=noise)
+
+ # if doing self-conditioning, 50% of the time, predict x_start from current set of times
+ # and condition with unet with that
+ # this technique will slow down training by 25%, but seems to lower FID significantly
+
+ x_self_cond=None
+ ifself.self_conditionandrandom()<0.5:
+ withtorch.no_grad():
+ x_self_cond=self.model_predictions(x,t).pred_x_start
+ x_self_cond.detach_()
+
+ # predict and take gradient step
+
+ model_out=self.model(x,t,x_self_cond)
+
+ ifself.objective=='pred_noise':
+ target=noise
+ elifself.objective=='pred_x0':
+ target=x_start
+ elifself.objective=='pred_v':
+ v=self.predict_v(x_start,t,noise)
+ target=v
+ else:
+ raiseValueError(f'unknown objective {self.objective}')
+
+ loss=self.loss_fn(model_out,target,reduction='none')
+ loss=reduce(loss,'b ... -> b (...)','mean')
+
+ loss=loss*extract(self.loss_weight,t,loss.shape)
+ returnloss.mean()
+
+
+
+
Algorithm 2: Sampling
+
+
Network를 학습하고 나면, gaussian noise에서 시작해서 순차적으로 denoising 하는 것이 가능하다. (by parameterized markovian chain)
+
코드에서는 noise 제거 후 소량의 noise를 다시 추가하고 있음
+
+
+
+
@torch.no_grad()
+defp_sample(self,x,t:int,x_self_cond=None):
+ b,*_,device=*x.shape,x.device
+ batched_times=torch.full((b,),t,device=x.device,dtype=torch.long)
+ model_mean,_,model_log_variance,x_start=self.p_mean_variance(x=x,t=batched_times,x_self_cond=x_self_cond,clip_denoised=True)
+ noise=torch.randn_like(x)ift>0else0.# no noise if t == 0
+ pred_img=model_mean+(0.5*model_log_variance).exp()*noise
+ returnpred_img,x_start
+
classAttention(nn.Module):
+ def__init__(self,dim,heads=4,dim_head=32):
+ super().__init__()
+ self.scale=dim_head**-0.5
+ self.heads=heads
+ hidden_dim=dim_head*heads
+
+ self.to_qkv=nn.Conv2d(dim,hidden_dim*3,1,bias=False)
+ self.to_out=nn.Conv2d(hidden_dim,dim,1)
+
+ defforward(self,x):
+ b,c,h,w=x.shape
+ qkv=self.to_qkv(x).chunk(3,dim=1)
+ q,k,v=map(lambdat:rearrange(t,'b (h c) x y -> b h c (x y)',h=self.heads),qkv)
+
+ q=q*self.scale
+
+ sim=einsum('b h d i, b h d j -> b h i j',q,k)
+ attn=sim.softmax(dim=-1)
+ out=einsum('b h i j, b h d j -> b h i d',attn,v)
+
+ out=rearrange(out,'b h (x y) d -> b (h d) x y',x=h,y=w)
+ returnself.to_out(out)
+
+
+
+
Linear attention
+
+
classLinearAttention(nn.Module):
+ def__init__(self,dim,heads=4,dim_head=32):
+ super().__init__()
+ self.scale=dim_head**-0.5
+ self.heads=heads
+ hidden_dim=dim_head*heads
+ self.to_qkv=nn.Conv2d(dim,hidden_dim*3,1,bias=False)
+
+ self.to_out=nn.Sequential(
+ nn.Conv2d(hidden_dim,dim,1),
+ LayerNorm(dim)
+ )
+
+ defforward(self,x):
+ b,c,h,w=x.shape
+ qkv=self.to_qkv(x).chunk(3,dim=1)
+ q,k,v=map(lambdat:rearrange(t,'b (h c) x y -> b h c (x y)',h=self.heads),qkv)
+
+ q=q.softmax(dim=-2)
+ k=k.softmax(dim=-1)
+
+ q=q*self.scale
+ v=v/(h*w)
+
+ context=torch.einsum('b h d n, b h e n -> b h d e',k,v)
+
+ out=torch.einsum('b h d e, b h d n -> b h e n',context,q)
+ out=rearrange(out,'b h c (x y) -> b (h c) x y',h=self.heads,x=h,y=w)
+ returnself.to_out(out)
+
+
+
+
Diffusion time \(T\)는 각 residual block에 transformer sinusoidal positional embedding이 추가돼서 구분됨
Diffusion model은 많은 domain에서 좋은 성능을 보이지만 generative process를 control하는 semantic latent space가 부족하다. 논문에서는 diffusion model속에서 semantic latent space를 발견하기 위한 asymmetric reverse process(asyrp)를 제안하고 h-space라고 명칭한 semantic latent space의 좋은 특성(homogeneity, linearity, robustness, consistency across timesteps)들을 보여준다. 추가적으로 editing strength와 quality deficiency를 기준으로 삼고 더 좋은 image-image translation을 위한 Generative Process Design을 소개한다.
Fig. 431 Manipulation approaches for diffusion models#
-
-
-
(a) Image guidance는 unconditional한 latent variable에 guiding image의 latent variable을 합치는 방식을 사용한다. 그러나 latent variable을 둘 다 이용하면서 명확하게 control하기가 쉽지 않다.
-
(b) Classifier guidance는 diffusion model에 classifier를 추가하여 generative process를 거치는 동안 latent variable이 어떤 class인지 분류하고 target class에 가까워지도록 score를 부여하는 방식으로 작동한다. 그러나 latent variable들에 대해 classify를 실행해야 하기에 pretrained model을 사용하기가 힘들어 직접 학습을 시켜야 하기에 시간적으로, 비용적으로 부담이 된다.
-
(c) DiffusionCLIP
-
(d) Diffusion Models already have a Semantic Latent Space는 original image의 특성을 edit하기 위한 아주 좋은 특성을 가지고 있는 semantic latent space를 frozen diffusion model에서 발견하였고 이를 h-space라고 칭한다. h-space에는 다양한 좋은 특성들이 존재한다. versatile editing과 quality boosting을 위해 새로운 generative process를 design하여 제안한다. h-space는 frozen pretrained diffusion model에서 semantic latent space로써의 첫 발견사례이다.
DDPM에서는 임의의 time step t로 부터 noise가 껴있는 image \(x_t\)의 \(\epsilon_t\)가 얼만큼인지 예측한다. 예측한 \(\epsilon_t\)를 이용하여 noise가 일부 제거된 이전 step의 mean(\(\mu_{\theta}(x_t)\))을 구할 수 있고 variance(\(\sum_{\theta}(x_t)\))는 constant한 값으로 고정시킨다. DDPM에서 제시한 forward process와 reverse process는 다음과 같다. DDPM에서의 \(\sigma_t^2 = \beta_t\)이다.
DDIM에서는 non-Markovian process를 이용해 또 다른 관점의 reverse process를 제시하였고, DDPM과 DDIM 모두 general하게 적용되는 Diffusion process에 대한 식을 보여주었다. \(\sigma_t = \eta\sqrt{(1-\alpha_{t-1}) / (1-\alpha_t)} \sqrt{1-\alpha_t/\alpha_{t-1}}\)이다.
-
\(\eta\)=1인 경우 DDPM이 되고 stochastic해지며, \(\eta\)=0인 경우 DDIM이 되고 deterministic해진다.
CLIP은 Image Encoder와 Text Encoder를 이용하여 image와 text간의 embedding을 학습한다. 편집된 이미지와 대상 설명 간의 cosine distance를 직접 최소화하는 대신 cosine distance를 사용한 directional loss를 사용하여 mode collapse없이 균일한 editing을 가능하게 했다고 한다.
-
\(\Delta T = \mathrm{E}_T(y^{target}) - \mathrm{E}_T(y^{source}) \) \(\Delta I = \mathrm{E}_I(x^{edit}) - \mathrm{E}_I(x^{source})\)
3. Discovering Semantic Latent Space In Diffusion Models#
-
Editiing을 하는 과정에서 naive approach를 통해서는 editing이 잘 이루어지지 않는다. 이 chapter에서는 왜 잘 이루어지지 않는지에 대한 설명을 하고 이를 해결하는 새로운 controllable한 한 reverse process인 Asymmetric Reverse Process(Asyrp)를 제안한다.
-
DDIM에서 \(x_{t-1}\)에 대한 수식을 설명하였는데 이 chapter부터는 “predicted \(x_0\)”부분을 \(\mathrm{P}_t(\epsilon_t^{\theta}(x_t))\) 즉 \(\mathrm{P}_t\)라고 설정하고, “direction pointing to \(x_t\)”부분을 \(\mathrm{D}_t(\epsilon_t^{\theta}(x_t))\) 즉 \(\mathrm{D}_t\)라고 설정하였다.
-
\(\mathrm{P}_t\)는 latent variable로 부터 \(x_0\)를 예측하는 reverse process와 같은 역할을 담당하고 \(\mathrm{D}_t\)는 다시 noise를 추가해 latent variable로 돌아가기에 forward process와 같은 역할을 담당한다.
\(x_T\)로 부터 생성된 image \(x_0\)를 given text prompts에 맞게 manipulate시키는 가장 간단한 방법은 2.3에서 소개한 \(\mathcal{L}_{direction}\)을 optimize하도록 \(x_T\)를 update하는 것이다. 하지만 이 방법은 distorted images를 생성하거나 부정확한 manipulation을 한다고 한다.
-
이에 대한 대안으로, 모든 sampling step에서 원하는 방향으로 manipulate하도록 \(\epsilon_t^{\theta}\)를 shift해주는 방법이 제시되었다. 하지만 이 방법은 \(x_0\)를 완전히 manipulate하지 못한다. 왜냐하면 \(\mathrm{P}_t\)와 \(\mathrm{D}_t\)에서 둘다 shifted된 \(\tilde{\epsilon}_t^{\theta}\)를 사용하기에 cancel out되어 결국 latent variable에서는 기존과 다름이 없다는 것이다. 자세한 증명은 Proof of Theroem을 보면 된다.
\(\sqrt{\alpha_{t-1}}\mathrm{P}_t(\epsilon_t^\theta(x_t)) + \mathrm{D}_t(\epsilon_t^\theta(x_t))\)는 기존 DDIM에서의 \(x_{t-1}\)에 대한 식이고 위 식의 \(\Delta \epsilon_t\)항만 따로 묶어서 표현하면 아래와 같다.
chapter 3.1에서 \(\epsilon\)-space에서의 문제를 해결하기 위해 저자들은 Asyrp를 제안한다. 이름 그대로 비대칭적인 방법을 사용한다는 것인데 \(x_0\)를 예측하는 \(\mathrm{P}_t\)에서는 shifted epsilon을 사용하고, latent variable로 돌아가는 \(\mathrm{D}_t\)에서는 non-shifted epsilon을 사용해서 전체적인 변화를 준다는 것이다. 즉, \(\mathrm{P}_t\)만modify하고 \(\mathrm{D}_t\)는 유지한다. Asyrp를 식으로 표현하면 다음과 같다.
Loss식 또한 chapter 2.3에서 제시한 \(\mathcal{L}_{direction}\)을 사용하여 재구성하였다. modify를 하지 않은 \(\mathrm{P}_t^{source}\)와 modifiy를 한 \(\mathrm{P}_t^{edit}\)을 사용한다. Loss식은 다음과 같다.
전체적인 reverse process는 다음과 같이 설계가 되었다. 이제 shifted epsilon인 \(\tilde{\epsilon}_t^{\theta}(x_t)\)를 어떤 방식으로 얻을 것인지에 대한 설계가 필요하다. 저자들은 기존의 \(\epsilon\)-space에서 변화를 주는 것보다 훨씬 더 좋은 result를 보이고, nice properties를 가지는 h-space에서 변화를 주는 것을 제안한다.
\(\epsilon_t^{\theta}\)는 diffusion models의 backbone인 U-Net에서 도출된다. 이 논문에서는 Image manipulation을 위해 \(\epsilon_t^{\theta}\)를 control하는 space를 U-Net의 bottleneck 즉, 가장 깊은 feature map인 \(h_t\)로 정하였다. 이를 h-space라고 부른다. h-space는 \(\epsilon\)-space보다 더 작은 spatial resolutions을 가지고 high-level semantic를 가진다. 또한 \(\epsilon\)-space에서는 발견할 수 없는 매우 nice한 특성들을 가지고 있다.
h-space의 크기는 \(8^2\times512\)이고 \(\epsilon\)-space의 크기는 \(256^2\times3\)으로 h-space에서의 control이 더 지배적이고 robust함을 추측할 수 있다(실제 실험적으로 증명을 함). h-space는 skip-connection의 영향을 받지 않으며 가장 압축된 정보를 가지고 있는 공간이며 image를 control하는데에 있어 매우 좋은 특성들을 가지고 있다. 실제 저자들은 h-space를 지정하기 위해 U-Net의 모든 feature map을 h-space로 설정해두고 실험을 해보았는데 위의 그림을 기준으로 8th layer이전의 feature map을 h-space로 지정한 경우에는 manipulaton이 적게 이루어졌고, 8th layer 이후의 feature map을 h-space로 지정한 경우에는 너무 과한 manipulation이 이루어지거나 아예 distorted image가 생성되었다. h-space만의 특성은 chapter5에서 설명한다.
\(\Delta h_t\)가 image를 manipulating하는데 성공했음에도, 수많은 timestep에서 매번 optimizing하기란 쉽지 않다. 대신에 논문에서는 \(h_t\)를 입력받아 \(\Delta h\)를 출력해주는 작은 neural network인 \(\mathrm{f}(t)\)를 추가하였다. \(\mathrm{f}(t)\)는 \(\Delta h_t\)를 매번 모든 timestep에서 optimizing해줘야 하는 방법에 비해 시간도 빠르고 setting값들에 대해 robust하다. 또한 주어진 timestep과 bottleneck feature인 \(h_t\)에 대해 \(\Delta h_t\)를 출력하는 방법을 학습하기에 unseen timestep과 bottleneck feature에 대해서도 일반화할 수 있다고 한다. 이는 accelerated한 과정에서도 큰 효과를 본다. training scheme이 어떻든 간에 결국 부여하는 \(\sum\Delta\mathrm{h_t}\)만 보존된다면, 어떠한 length를 설계해도 비슷한 manipulation효과를 볼 수 있다.
-
h-space에서 epsilon을 control해서 asyrp 이용하는 식은 다음과 같다. 이해를 위해 \(\epsilon\)-space와 h-space에서의 shifted epsilon \(\tilde{\epsilon}_t^{\theta}(x_t)\)을 비교하였다.
Fig. 436 Intuition for choosing the intervals for editing and quality boosting#
-
-
-
Perception prioritized training of diffusion models(Choi et al)에서는 Diffusion model이 early stage에서는 high-level context를 generate하고, later stage에서는 imperceptible fine details를 generate한다고 제안한다. 본 논문에서는 early stage에서 editing을 진행하는 editing process와 later stage에서 imperceptible fine details를 진행하는 quality boosting을 위한 구간을 나눠서 새로운 Generative Process Design을 제시한다.
Editing Process에서는 high-level context가 generate되어야 하므로 전체 timestep[0,T]에서 Editing Process를 위한 editing interval을 [T, \(t_{edit}\)]으로 설정하였다. \(t_{edit}\)의 시점을 결정하기 위해 LPIPS 측정지표를 이용한다. LPIPS(\(\mathrm{x}, \mathrm{P}_t\))는 t시점에서 예측한 \(x_0\)와 target이 되는 original image간의 perceptual distance를 계산한다. 따라서 LPIPS를 남은 reverse process을 통해 editing 해야 할 구성요소를 측정하는 지표라고 볼 수도 있다. 첫 step T의 LPIPS로 부터 \(t_{edit}\)시점에서의 LPIPS 차이는 Editing Process에서 얼만큼의 perceptual change를 주었는지를 나타낸다. 이 값을 editing strength(\(\epsilon_t\))라고 정의한다.
Editing interval이 작으면 \(\xi_t\)가 작아지며 변화가 많이 일어나지 않고 반면, Editing interval이 크면 \(\xi_t\)가 커지고 변화가 많이 일어난다. 따라서 충분한 변화를 줄 수 있는 한에서 가장 최소의 Editing interval을 찾는 것이 \(t_{edit}\)을 결정하는 최고의 방법이다. 저자들은 실험적인 결과를 통해 \(\mathrm{LPIPS}(x, \mathrm{P}_t)\) = 0.33인 t시점을 \(t_{edit}\)으로 결정하였다.
-
-
-
-
Fig. 437 Results based on various \(\mathrm{LPIPS}(x, \mathrm{P}_{t_{edit}})\)#
-
-
-
-
-
-
Fig. 438 Importance of choosing proper \(t_{edit}\)#
-
-
-
몇몇 특성들은 다른 특성들에 비해 visual change를 많이 필요로 하는 경우도 있다. 예를 들어 source image에 대해 smile한 attribute를 추가하는 경우보다 pixar style의 attribute을 추가하는 경우가 더 많은 visual change를 필요로 한다. 이러한 경우에는 Editing interval을 더 길게 설정해야 한다. 이러한 경우에는 \(\mathrm{LPIPS}(x, \mathrm{P}_t)\) = 0.33 - \(\delta\)를 만족하는 t를 \(t_{edit}\)으로 설정한다. 이 때, \(\delta = 0.33d(\mathrm{E}_T(y_{source}), \mathrm{E}_T(y_{target}))\)이다. \(\mathrm{E}_T\)는 CLIP text embedding을 진행하는 Text Encoder를 의미하며, d는 cosine distance를 의미한다. 아래 그림을 통해 더 많은 visual change를 요구하는 attributes에 대해서는 \(t_{edit}\)이 더 작음(Editing Interval이 김)을 알 수 있다.
-
-
-
-
Fig. 439 Flexible \(t_{edit}\) based on the amount of visual changes.#
-
-
-
-
-
4.2 Quality Boosting With Stochastic Noise Injection#
-
DDIM은 \(\eta\)=0으로 설정하며 stochasticity를 제거하여 거의 완벽한 inversion을 가능케 하였다. Elucidating the design space of diffusionbased generative models(Karras et al.)에서는 stochasticity가 image quality를 증가시킨다고 증명하였다. 이에 따라 본 논문에서는 Generative Process에 stochastic noise를 주입하는 quality boosting 단계를 설정하고 boosting interval은 [\(t_{boost}\), 0]이다.
-
Boosting Interval에 따라 image quality를 control할 수 있는데, Boosting Interval이 길게되면, Quality는 증가하지만 Interval동안 계속해서 stochastic noise를 주입해야 하기에 content가 변하는 문제가 발생할 수도 있다. 따라서 충분한 quality boosting을 달성하면서도 content에 최소한의 변화만을 줄 수 있도록 \(t_{boost}\)를 설정하는 것이 중요하다. 저자들은 image에 껴있는 noise를 quality boosting을 통해 해결해야 할 부분으로 보았으며 target이 되는 original image로 부터 t시점의 image \(x_t\)에 얼만큼의 noise가 껴있는지에 대한 지표로 quality deficiency \(\gamma_t\)를 이용한다.
-
-\[
-\gamma_t = \mathrm{LPIPS}(x, x_t)
-\]
-
여기서는 editing strength와는 다르게 time step에 따라 예측한 \(x_0\)인 \(\mathrm{P}_t\)가 아닌 latent variable \(x_t\)를 이용한다. 저자들은 noise를 판단하는데에 있어서 semantics보다는 actual image를 고려했기에 위와 같이 설정하였다고 한다. 저자들은 실험적인 결과를 통해 \(\gamma_t\) = 1.2인 t시점을 \(t_{boost}\)로 설정하였다.
-
-
-
-
Fig. 440 Results based on various \(\gamma_{t_{boost}}\)#
-
-
-
-
-
-
Fig. 441 Quality comparison based on the presence of quality boosting#
\(\eta\) = 0인 경우에는 DDIM이 되며, stochastic noise를 더하는 부분이 사라져 deterministic해진다. \(\eta\) = 1인 경우에는 DDPM이 되며, stochastic한 특성이 있다. Asyrp(Assymetric Reverse Process)에서는 기본적으로 DDIM을 사용하며 \(\mathrm{P}_t\)에서 h-space를 통해 control된 \(\epsilon_t^{\theta}(x_t|f_t)\)를 사용한다. Diffusion Models already have a Semantic Latent Space에서 제시한 Generative Process를 전체적으로 정리하면 다음과 같다.
-
-
-
-
Fig. 442 Quality comparison based on the presence of quality boosting#
-
-
-
처음부터 \(t_{edit}\)시점까지는 Asyrp를 이용해 Editing Process를 진행한다. 이 후 DDIM 방식을 통해 Denoising을 진행하다가 \(t_{boost}\)시점부터 끝날 때까지 stochastic noise를 주입하는 DDPM 방식을 이용해 Quality boosting을 진행한다.
CelebA-HQ (Karras et al., 2018) 및 LSUN-bedroom/-church (Yu et al., 2015) 데이터셋에서 DDPM++ (Song et al., 2020b) (Meng et al., 2021); AFHQ-dog (Choi et al., 2020) 데이터셋에서 iDDPM (Nichol & Dhariwal, 2021); 그리고 METFACES (Karras et al., 2020) 데이터셋에서 ADM with P2-weighting (Dhariwal & Nichol, 2021) (Choi et al., 2022)을 사용해 각각 학습시켰다고 한다. 모든 model들은 pretrained checkpoint를 활용했으며 frozen상태를 유지시켰다고 한다.
Fig. 444 Editing results of Asyrp on various datasets#
-
-
-
위의 그림을 보면, 논문에서는 다양한 attribute들의 특성을 잘 반영해서 image를 manipulate했다는 점을 알 수 있다. 심지어 {department, factory, temple} attribute은 training data에 포함이 되어있지 않았음에도 성능이 잘 나온 점을 확인할 수 있다. model을 fine tuning하지 않고 inference하는 과정에서 h-space를 통해 epsilon을 control하고 Asyrp를 이용해 성능을 냈다는 점이 가장 큰 장점이다.
위의 그림의 (a)는 Real image에 smiling attribute을 추가하기 위해 최적화된 \(\Delta h_t\)와 \(\Delta \epsilon_t\)를 나타낸다. 같은 값을 다른 Real image에 적용시켰을 때의 결과를 (b)에 나타내었는데, \(\Delta h_t\)를 적용한경우 smiling face로 잘 바뀌는 반면, \(\Delta \epsilon_t\)을 적용한 경우에는 image distortion이 발생함을 알 수 있다.
\(\Delta_h\)를 linearly scaling을 하는 것은 editing을 하는데에 있어 visual attribute change의 양에 반영된다. 즉, \(\Delta_h\)를 \(\times\)1, \(\times\)2, \(\times\)3배 \(/dots\) 함에 따라 result image에서 반영되는 attribute또한 이에 맞게 변화한다는 것이다. 위의 그림에서 표현되어 있듯이 negative scaling에 대해서는 training을 하지 않았음에도 잘 적용 된다는 점을 알 수 있다.
-
-
-
-
Fig. 448 Linearity of h-space - Linear Combination#
-
-
-
서로 다른 attributes에 대한 \(\Delta_h\)를 합쳐서 부여를 했을 경우에도 각각의 attribute들이 image에 잘 반영이 된다는 점을 알 수 있다.
위의 그림은 h-space와 \(\epsilon-space\)에서 random noise를 주입했을 때의 결과를 비교한 것이다. h-space의 경우에는 random noise가 추가되었어도 image에 큰 변화가 없으며 많은 noise가 추가되었을 경우에도 image distortion은 거의 없고 semantic change만 발생한다. 그러나 \(\epsilon-space\)의 경우에는 random noise가 추가된 경우 image distortion이 심하게 발생한다. 이를 통해 h-space가 얼마나 robustness한지 알 수 있다.
-
-
Consistency across time steps
-
-
-
-
Fig. 450 Consistency across times steps of h-space#
-
-
-
h-space의 homogeneous한 성질을 통해 같은 attribute에 대한 \(\Delta h\)를 다른 image에 적용시켰을 때에도 잘 반영이 됌을 확인하였다. 저자들은 \(\Delta h_t\)들에 대한 평균인 \(\Delta h_t^{mean}\)을 적용시켰을 경우에도 result가 거의 비슷함을 보인다. Chapter4에서 제시한 Generative Process를 비추어 보았을 때, \(\Delta h_t\)는 Editing Process에서만 적용을 시킨다. 이 경우, 적용하는 \(\Delta h_t\)를 \(\Delta h_t^{global}\)이라고 칭하며, 적용하는 \(\Delta h_t\)가 interval동안 같은 크기 만큼 적용된다고 가정했을 경우, \(\Delta h^{global} = \cfrac{1}{\mathrm{T_e}}\sum_t\ \Delta h_t^{mean}\)이라고 쓸 수 있다. 이 경우에도 결과는 비슷함을 보여준다. 결국 원하는 attribute에 대해 주입해야 할 \(\Delta h\)양만 같다면, 원하는 editing 효과를 얻을 수 있다. 비록 이 논문에서는 best quality manipulation을 위해 \(\Delta h_t\)를 사용하였지만, \(\Delta h_t^{mean}\)과 \(\Delta h^{global}\)에 대해 더 연구를 해 볼 여지가 있다고 판단한다.
본 논문에서는 Pretrained Diffusion models에서 latent semantic space인 h-space를 발견했고 h-space에서의 Asyrp(Asymmetric Reverse Process)와 새롭게 제안한 Reverse Process 방법을 통해 성공적인 image editing을 가능케 하였다. Diffusion model에서의 semantic한 latent space에 대한 첫 제안을 한 논문이다. h-space는 GAN의 latent space와 유사한 특성을 갖추고 있다. 대표적인 h-space의 특성으로는 Homogeneity, Linearity, Robustness, Consistency across timesteps이 있다.
Diffusion model은 많은 domain에서 좋은 성능을 보이지만 generative process를 control하는 semantic latent space가 부족하다. 논문에서는 diffusion model속에서 semantic latent space를 발견하기 위한 asymmetric reverse process(asyrp)를 제안하고 h-space라고 명칭한 semantic latent space의 좋은 특성(homogeneity, linearity, robustness, consistency across timesteps)들을 보여준다. 추가적으로 editing strength와 quality deficiency를 기준으로 삼고 더 좋은 image-image translation을 위한 Generative Process Design을 소개한다.
Fig. 431 Manipulation approaches for diffusion models#
+
+
+
(a) Image guidance는 unconditional한 latent variable에 guiding image의 latent variable을 합치는 방식을 사용한다. 그러나 latent variable을 둘 다 이용하면서 명확하게 control하기가 쉽지 않다.
+
(b) Classifier guidance는 diffusion model에 classifier를 추가하여 generative process를 거치는 동안 latent variable이 어떤 class인지 분류하고 target class에 가까워지도록 score를 부여하는 방식으로 작동한다. 그러나 latent variable들에 대해 classify를 실행해야 하기에 pretrained model을 사용하기가 힘들어 직접 학습을 시켜야 하기에 시간적으로, 비용적으로 부담이 된다.
+
(c) DiffusionCLIP
+
(d) Diffusion Models already have a Semantic Latent Space는 original image의 특성을 edit하기 위한 아주 좋은 특성을 가지고 있는 semantic latent space를 frozen diffusion model에서 발견하였고 이를 h-space라고 칭한다. h-space에는 다양한 좋은 특성들이 존재한다. versatile editing과 quality boosting을 위해 새로운 generative process를 design하여 제안한다. h-space는 frozen pretrained diffusion model에서 semantic latent space로써의 첫 발견사례이다.
DDPM에서는 임의의 time step t로 부터 noise가 껴있는 image \(x_t\)의 \(\epsilon_t\)가 얼만큼인지 예측한다. 예측한 \(\epsilon_t\)를 이용하여 noise가 일부 제거된 이전 step의 mean(\(\mu_{\theta}(x_t)\))을 구할 수 있고 variance(\(\sum_{\theta}(x_t)\))는 constant한 값으로 고정시킨다. DDPM에서 제시한 forward process와 reverse process는 다음과 같다. DDPM에서의 \(\sigma_t^2 = \beta_t\)이다.
DDIM에서는 non-Markovian process를 이용해 또 다른 관점의 reverse process를 제시하였고, DDPM과 DDIM 모두 general하게 적용되는 Diffusion process에 대한 식을 보여주었다. \(\sigma_t = \eta\sqrt{(1-\alpha_{t-1}) / (1-\alpha_t)} \sqrt{1-\alpha_t/\alpha_{t-1}}\)이다.
+
\(\eta\)=1인 경우 DDPM이 되고 stochastic해지며, \(\eta\)=0인 경우 DDIM이 되고 deterministic해진다.
CLIP은 Image Encoder와 Text Encoder를 이용하여 image와 text간의 embedding을 학습한다. 편집된 이미지와 대상 설명 간의 cosine distance를 직접 최소화하는 대신 cosine distance를 사용한 directional loss를 사용하여 mode collapse없이 균일한 editing을 가능하게 했다고 한다.
+
\(\Delta T = \mathrm{E}_T(y^{target}) - \mathrm{E}_T(y^{source}) \) \(\Delta I = \mathrm{E}_I(x^{edit}) - \mathrm{E}_I(x^{source})\)
3. Discovering Semantic Latent Space In Diffusion Models#
+
Editiing을 하는 과정에서 naive approach를 통해서는 editing이 잘 이루어지지 않는다. 이 chapter에서는 왜 잘 이루어지지 않는지에 대한 설명을 하고 이를 해결하는 새로운 controllable한 한 reverse process인 Asymmetric Reverse Process(Asyrp)를 제안한다.
+
DDIM에서 \(x_{t-1}\)에 대한 수식을 설명하였는데 이 chapter부터는 “predicted \(x_0\)”부분을 \(\mathrm{P}_t(\epsilon_t^{\theta}(x_t))\) 즉 \(\mathrm{P}_t\)라고 설정하고, “direction pointing to \(x_t\)”부분을 \(\mathrm{D}_t(\epsilon_t^{\theta}(x_t))\) 즉 \(\mathrm{D}_t\)라고 설정하였다.
+
\(\mathrm{P}_t\)는 latent variable로 부터 \(x_0\)를 예측하는 reverse process와 같은 역할을 담당하고 \(\mathrm{D}_t\)는 다시 noise를 추가해 latent variable로 돌아가기에 forward process와 같은 역할을 담당한다.
\(x_T\)로 부터 생성된 image \(x_0\)를 given text prompts에 맞게 manipulate시키는 가장 간단한 방법은 2.3에서 소개한 \(\mathcal{L}_{direction}\)을 optimize하도록 \(x_T\)를 update하는 것이다. 하지만 이 방법은 distorted images를 생성하거나 부정확한 manipulation을 한다고 한다.
+
이에 대한 대안으로, 모든 sampling step에서 원하는 방향으로 manipulate하도록 \(\epsilon_t^{\theta}\)를 shift해주는 방법이 제시되었다. 하지만 이 방법은 \(x_0\)를 완전히 manipulate하지 못한다. 왜냐하면 \(\mathrm{P}_t\)와 \(\mathrm{D}_t\)에서 둘다 shifted된 \(\tilde{\epsilon}_t^{\theta}\)를 사용하기에 cancel out되어 결국 latent variable에서는 기존과 다름이 없다는 것이다. 자세한 증명은 Proof of Theroem을 보면 된다.
\(\sqrt{\alpha_{t-1}}\mathrm{P}_t(\epsilon_t^\theta(x_t)) + \mathrm{D}_t(\epsilon_t^\theta(x_t))\)는 기존 DDIM에서의 \(x_{t-1}\)에 대한 식이고 위 식의 \(\Delta \epsilon_t\)항만 따로 묶어서 표현하면 아래와 같다.
chapter 3.1에서 \(\epsilon\)-space에서의 문제를 해결하기 위해 저자들은 Asyrp를 제안한다. 이름 그대로 비대칭적인 방법을 사용한다는 것인데 \(x_0\)를 예측하는 \(\mathrm{P}_t\)에서는 shifted epsilon을 사용하고, latent variable로 돌아가는 \(\mathrm{D}_t\)에서는 non-shifted epsilon을 사용해서 전체적인 변화를 준다는 것이다. 즉, \(\mathrm{P}_t\)만modify하고 \(\mathrm{D}_t\)는 유지한다. Asyrp를 식으로 표현하면 다음과 같다.
Loss식 또한 chapter 2.3에서 제시한 \(\mathcal{L}_{direction}\)을 사용하여 재구성하였다. modify를 하지 않은 \(\mathrm{P}_t^{source}\)와 modifiy를 한 \(\mathrm{P}_t^{edit}\)을 사용한다. Loss식은 다음과 같다.
전체적인 reverse process는 다음과 같이 설계가 되었다. 이제 shifted epsilon인 \(\tilde{\epsilon}_t^{\theta}(x_t)\)를 어떤 방식으로 얻을 것인지에 대한 설계가 필요하다. 저자들은 기존의 \(\epsilon\)-space에서 변화를 주는 것보다 훨씬 더 좋은 result를 보이고, nice properties를 가지는 h-space에서 변화를 주는 것을 제안한다.
\(\epsilon_t^{\theta}\)는 diffusion models의 backbone인 U-Net에서 도출된다. 이 논문에서는 Image manipulation을 위해 \(\epsilon_t^{\theta}\)를 control하는 space를 U-Net의 bottleneck 즉, 가장 깊은 feature map인 \(h_t\)로 정하였다. 이를 h-space라고 부른다. h-space는 \(\epsilon\)-space보다 더 작은 spatial resolutions을 가지고 high-level semantic를 가진다. 또한 \(\epsilon\)-space에서는 발견할 수 없는 매우 nice한 특성들을 가지고 있다.
h-space의 크기는 \(8^2\times512\)이고 \(\epsilon\)-space의 크기는 \(256^2\times3\)으로 h-space에서의 control이 더 지배적이고 robust함을 추측할 수 있다(실제 실험적으로 증명을 함). h-space는 skip-connection의 영향을 받지 않으며 가장 압축된 정보를 가지고 있는 공간이며 image를 control하는데에 있어 매우 좋은 특성들을 가지고 있다. 실제 저자들은 h-space를 지정하기 위해 U-Net의 모든 feature map을 h-space로 설정해두고 실험을 해보았는데 위의 그림을 기준으로 8th layer이전의 feature map을 h-space로 지정한 경우에는 manipulaton이 적게 이루어졌고, 8th layer 이후의 feature map을 h-space로 지정한 경우에는 너무 과한 manipulation이 이루어지거나 아예 distorted image가 생성되었다. h-space만의 특성은 chapter5에서 설명한다.
\(\Delta h_t\)가 image를 manipulating하는데 성공했음에도, 수많은 timestep에서 매번 optimizing하기란 쉽지 않다. 대신에 논문에서는 \(h_t\)를 입력받아 \(\Delta h\)를 출력해주는 작은 neural network인 \(\mathrm{f}(t)\)를 추가하였다. \(\mathrm{f}(t)\)는 \(\Delta h_t\)를 매번 모든 timestep에서 optimizing해줘야 하는 방법에 비해 시간도 빠르고 setting값들에 대해 robust하다. 또한 주어진 timestep과 bottleneck feature인 \(h_t\)에 대해 \(\Delta h_t\)를 출력하는 방법을 학습하기에 unseen timestep과 bottleneck feature에 대해서도 일반화할 수 있다고 한다. 이는 accelerated한 과정에서도 큰 효과를 본다. training scheme이 어떻든 간에 결국 부여하는 \(\sum\Delta\mathrm{h_t}\)만 보존된다면, 어떠한 length를 설계해도 비슷한 manipulation효과를 볼 수 있다.
+
h-space에서 epsilon을 control해서 asyrp 이용하는 식은 다음과 같다. 이해를 위해 \(\epsilon\)-space와 h-space에서의 shifted epsilon \(\tilde{\epsilon}_t^{\theta}(x_t)\)을 비교하였다.
Fig. 436 Intuition for choosing the intervals for editing and quality boosting#
+
+
+
Perception prioritized training of diffusion models(Choi et al)에서는 Diffusion model이 early stage에서는 high-level context를 generate하고, later stage에서는 imperceptible fine details를 generate한다고 제안한다. 본 논문에서는 early stage에서 editing을 진행하는 editing process와 later stage에서 imperceptible fine details를 진행하는 quality boosting을 위한 구간을 나눠서 새로운 Generative Process Design을 제시한다.
Editing Process에서는 high-level context가 generate되어야 하므로 전체 timestep[0,T]에서 Editing Process를 위한 editing interval을 [T, \(t_{edit}\)]으로 설정하였다. \(t_{edit}\)의 시점을 결정하기 위해 LPIPS 측정지표를 이용한다. LPIPS(\(\mathrm{x}, \mathrm{P}_t\))는 t시점에서 예측한 \(x_0\)와 target이 되는 original image간의 perceptual distance를 계산한다. 따라서 LPIPS를 남은 reverse process을 통해 editing 해야 할 구성요소를 측정하는 지표라고 볼 수도 있다. 첫 step T의 LPIPS로 부터 \(t_{edit}\)시점에서의 LPIPS 차이는 Editing Process에서 얼만큼의 perceptual change를 주었는지를 나타낸다. 이 값을 editing strength(\(\epsilon_t\))라고 정의한다.
Editing interval이 작으면 \(\xi_t\)가 작아지며 변화가 많이 일어나지 않고 반면, Editing interval이 크면 \(\xi_t\)가 커지고 변화가 많이 일어난다. 따라서 충분한 변화를 줄 수 있는 한에서 가장 최소의 Editing interval을 찾는 것이 \(t_{edit}\)을 결정하는 최고의 방법이다. 저자들은 실험적인 결과를 통해 \(\mathrm{LPIPS}(x, \mathrm{P}_t)\) = 0.33인 t시점을 \(t_{edit}\)으로 결정하였다.
+
+
+
+
Fig. 437 Results based on various \(\mathrm{LPIPS}(x, \mathrm{P}_{t_{edit}})\)#
+
+
+
+
+
+
Fig. 438 Importance of choosing proper \(t_{edit}\)#
+
+
+
몇몇 특성들은 다른 특성들에 비해 visual change를 많이 필요로 하는 경우도 있다. 예를 들어 source image에 대해 smile한 attribute를 추가하는 경우보다 pixar style의 attribute을 추가하는 경우가 더 많은 visual change를 필요로 한다. 이러한 경우에는 Editing interval을 더 길게 설정해야 한다. 이러한 경우에는 \(\mathrm{LPIPS}(x, \mathrm{P}_t)\) = 0.33 - \(\delta\)를 만족하는 t를 \(t_{edit}\)으로 설정한다. 이 때, \(\delta = 0.33d(\mathrm{E}_T(y_{source}), \mathrm{E}_T(y_{target}))\)이다. \(\mathrm{E}_T\)는 CLIP text embedding을 진행하는 Text Encoder를 의미하며, d는 cosine distance를 의미한다. 아래 그림을 통해 더 많은 visual change를 요구하는 attributes에 대해서는 \(t_{edit}\)이 더 작음(Editing Interval이 김)을 알 수 있다.
+
+
+
+
Fig. 439 Flexible \(t_{edit}\) based on the amount of visual changes.#
+
+
+
+
+
4.2 Quality Boosting With Stochastic Noise Injection#
+
DDIM은 \(\eta\)=0으로 설정하며 stochasticity를 제거하여 거의 완벽한 inversion을 가능케 하였다. Elucidating the design space of diffusionbased generative models(Karras et al.)에서는 stochasticity가 image quality를 증가시킨다고 증명하였다. 이에 따라 본 논문에서는 Generative Process에 stochastic noise를 주입하는 quality boosting 단계를 설정하고 boosting interval은 [\(t_{boost}\), 0]이다.
+
Boosting Interval에 따라 image quality를 control할 수 있는데, Boosting Interval이 길게되면, Quality는 증가하지만 Interval동안 계속해서 stochastic noise를 주입해야 하기에 content가 변하는 문제가 발생할 수도 있다. 따라서 충분한 quality boosting을 달성하면서도 content에 최소한의 변화만을 줄 수 있도록 \(t_{boost}\)를 설정하는 것이 중요하다. 저자들은 image에 껴있는 noise를 quality boosting을 통해 해결해야 할 부분으로 보았으며 target이 되는 original image로 부터 t시점의 image \(x_t\)에 얼만큼의 noise가 껴있는지에 대한 지표로 quality deficiency \(\gamma_t\)를 이용한다.
+
+\[
+\gamma_t = \mathrm{LPIPS}(x, x_t)
+\]
+
여기서는 editing strength와는 다르게 time step에 따라 예측한 \(x_0\)인 \(\mathrm{P}_t\)가 아닌 latent variable \(x_t\)를 이용한다. 저자들은 noise를 판단하는데에 있어서 semantics보다는 actual image를 고려했기에 위와 같이 설정하였다고 한다. 저자들은 실험적인 결과를 통해 \(\gamma_t\) = 1.2인 t시점을 \(t_{boost}\)로 설정하였다.
+
+
+
+
Fig. 440 Results based on various \(\gamma_{t_{boost}}\)#
+
+
+
+
+
+
Fig. 441 Quality comparison based on the presence of quality boosting#
\(\eta\) = 0인 경우에는 DDIM이 되며, stochastic noise를 더하는 부분이 사라져 deterministic해진다. \(\eta\) = 1인 경우에는 DDPM이 되며, stochastic한 특성이 있다. Asyrp(Assymetric Reverse Process)에서는 기본적으로 DDIM을 사용하며 \(\mathrm{P}_t\)에서 h-space를 통해 control된 \(\epsilon_t^{\theta}(x_t|f_t)\)를 사용한다. Diffusion Models already have a Semantic Latent Space에서 제시한 Generative Process를 전체적으로 정리하면 다음과 같다.
+
+
+
+
Fig. 442 Quality comparison based on the presence of quality boosting#
+
+
+
처음부터 \(t_{edit}\)시점까지는 Asyrp를 이용해 Editing Process를 진행한다. 이 후 DDIM 방식을 통해 Denoising을 진행하다가 \(t_{boost}\)시점부터 끝날 때까지 stochastic noise를 주입하는 DDPM 방식을 이용해 Quality boosting을 진행한다.
CelebA-HQ (Karras et al., 2018) 및 LSUN-bedroom/-church (Yu et al., 2015) 데이터셋에서 DDPM++ (Song et al., 2020b) (Meng et al., 2021); AFHQ-dog (Choi et al., 2020) 데이터셋에서 iDDPM (Nichol & Dhariwal, 2021); 그리고 METFACES (Karras et al., 2020) 데이터셋에서 ADM with P2-weighting (Dhariwal & Nichol, 2021) (Choi et al., 2022)을 사용해 각각 학습시켰다고 한다. 모든 model들은 pretrained checkpoint를 활용했으며 frozen상태를 유지시켰다고 한다.
Fig. 444 Editing results of Asyrp on various datasets#
+
+
+
위의 그림을 보면, 논문에서는 다양한 attribute들의 특성을 잘 반영해서 image를 manipulate했다는 점을 알 수 있다. 심지어 {department, factory, temple} attribute은 training data에 포함이 되어있지 않았음에도 성능이 잘 나온 점을 확인할 수 있다. model을 fine tuning하지 않고 inference하는 과정에서 h-space를 통해 epsilon을 control하고 Asyrp를 이용해 성능을 냈다는 점이 가장 큰 장점이다.
위의 그림의 (a)는 Real image에 smiling attribute을 추가하기 위해 최적화된 \(\Delta h_t\)와 \(\Delta \epsilon_t\)를 나타낸다. 같은 값을 다른 Real image에 적용시켰을 때의 결과를 (b)에 나타내었는데, \(\Delta h_t\)를 적용한경우 smiling face로 잘 바뀌는 반면, \(\Delta \epsilon_t\)을 적용한 경우에는 image distortion이 발생함을 알 수 있다.
\(\Delta_h\)를 linearly scaling을 하는 것은 editing을 하는데에 있어 visual attribute change의 양에 반영된다. 즉, \(\Delta_h\)를 \(\times\)1, \(\times\)2, \(\times\)3배 \(/dots\) 함에 따라 result image에서 반영되는 attribute또한 이에 맞게 변화한다는 것이다. 위의 그림에서 표현되어 있듯이 negative scaling에 대해서는 training을 하지 않았음에도 잘 적용 된다는 점을 알 수 있다.
+
+
+
+
Fig. 448 Linearity of h-space - Linear Combination#
+
+
+
서로 다른 attributes에 대한 \(\Delta_h\)를 합쳐서 부여를 했을 경우에도 각각의 attribute들이 image에 잘 반영이 된다는 점을 알 수 있다.
위의 그림은 h-space와 \(\epsilon-space\)에서 random noise를 주입했을 때의 결과를 비교한 것이다. h-space의 경우에는 random noise가 추가되었어도 image에 큰 변화가 없으며 많은 noise가 추가되었을 경우에도 image distortion은 거의 없고 semantic change만 발생한다. 그러나 \(\epsilon-space\)의 경우에는 random noise가 추가된 경우 image distortion이 심하게 발생한다. 이를 통해 h-space가 얼마나 robustness한지 알 수 있다.
+
+
Consistency across time steps
+
+
+
+
Fig. 450 Consistency across times steps of h-space#
+
+
+
h-space의 homogeneous한 성질을 통해 같은 attribute에 대한 \(\Delta h\)를 다른 image에 적용시켰을 때에도 잘 반영이 됌을 확인하였다. 저자들은 \(\Delta h_t\)들에 대한 평균인 \(\Delta h_t^{mean}\)을 적용시켰을 경우에도 result가 거의 비슷함을 보인다. Chapter4에서 제시한 Generative Process를 비추어 보았을 때, \(\Delta h_t\)는 Editing Process에서만 적용을 시킨다. 이 경우, 적용하는 \(\Delta h_t\)를 \(\Delta h_t^{global}\)이라고 칭하며, 적용하는 \(\Delta h_t\)가 interval동안 같은 크기 만큼 적용된다고 가정했을 경우, \(\Delta h^{global} = \cfrac{1}{\mathrm{T_e}}\sum_t\ \Delta h_t^{mean}\)이라고 쓸 수 있다. 이 경우에도 결과는 비슷함을 보여준다. 결국 원하는 attribute에 대해 주입해야 할 \(\Delta h\)양만 같다면, 원하는 editing 효과를 얻을 수 있다. 비록 이 논문에서는 best quality manipulation을 위해 \(\Delta h_t\)를 사용하였지만, \(\Delta h_t^{mean}\)과 \(\Delta h^{global}\)에 대해 더 연구를 해 볼 여지가 있다고 판단한다.
본 논문에서는 Pretrained Diffusion models에서 latent semantic space인 h-space를 발견했고 h-space에서의 Asyrp(Asymmetric Reverse Process)와 새롭게 제안한 Reverse Process 방법을 통해 성공적인 image editing을 가능케 하였다. Diffusion model에서의 semantic한 latent space에 대한 첫 제안을 한 논문이다. h-space는 GAN의 latent space와 유사한 특성을 갖추고 있다. 대표적인 h-space의 특성으로는 Homogeneity, Linearity, Robustness, Consistency across timesteps이 있다.
🌟 Stage-2 Multi-view Data Generation : 본 접근법의 가장 중요한 부분
-
일관성을 갖춘 3D initial NeRF 와 fully-trained DreamBooth 를 사용하여 pseudo multi-view subject 이미지들을 생성
-
-
-
Initial NeRF 로부터 다양한 랜덤 viewpoints \(\{v\}\)을 따라 여러 이미지\(\left\{\hat{I}v \in \mathbb{R}^{n \times 3}\right\}\) 를 렌더링하여 다중 시점 렌더링을 생성
-
각 렌더링에 고정된 양의 노이즈를 추가하는 forward diffusion 과정을 통해 \(t_{pseudo}\)로 전환
-
reverse diffusion 과정을 실행하여 fully-trained DreamBooth 모델 \(\hat{\mathcal{D}}_\theta\) 를 사용하여 샘플을 생성
-
-
샘플링 과정은 각 뷰에 대해 독립적으로 수행
-
Initial NeRF 결과물 에 노이즈를 추가한 noisy render 를 조건으로 지정함으로써, 넓은 범위의 시점을 커버하면서 subject 를 잘 나타내는 이미지 생성 가능
-⇒ 다양한 노이즈가 있는 이미지를 조건으로 학습시, 다양한 변형에 대한 학습 가능하기 때문
-
BUT reverse diffusion 과정은 다른 뷰에 다른 세부 사항을 추가할 수 있기 때문에 결과 이미지는 multi-view 에 대한 일관성이 없음.
-
⇒ 가상(pseudo) 다중 시점 이미지 집합 (collection of pseudo multi-view images)
-
-
-
-
-
-
🔑 Key insight
-
-
초기 NeRF 이미지가 unseen views 에 가까울 경우,
-DreamBooth가 Subject 의 unseen views를 효과적으로 생성 가능
-
입력 이미지에 비해 Subject 와 더 유사한 출력 이미지를 효과적으로 생성가능**
-
-
-
-
위 그림을 통해 체크할 부분
-
-
fully-trained DreamBooth 를 사용한 Img2Img 변환의 샘플 출력
-
입력 NeRF 렌더링의 시점을 유지하면서도 subject 이미지와 더 유사한 모습
-
기존 연구들과 달리 Img2Img 변환을 DreamBooth, NeRF 3D assets 과 결합하여 사용 (기존 연구의 경우 Img2Img 변환을 이미지 editing 응용으로만 사용)
-
-
-
-
-
-
3.3.3 Stage3️⃣: Final NeRF with Multi-view DreamBooth#
-
-
-
-
Fig. 728 Stage-3 : Final NeRF with Multi-view DreamBooth
-SDS와 multi-view reconstruction 손실을 사용한 최종 NeRF 최적화#
-
-
-
-
새로운 데이터 \(I^{\text{aug}}\) 생성
-
-
-
가상 다중 시점 이미지 \(\left\{I_v^{\text {pseudo }}\right\}\), 입력 Subject 이미지 \(\left\{I_i\right\}\) 의 결합을 통해 생성
\(I^{\text {aug}}\) 를 사용하여 최종 Multi-view DreamBooth 모델을 최적화
-
-
-
1단계에서 partial DreamBooth\(\hat{\mathcal{D}}_{\theta^*}\) 준비
-
위의 증강 데이터 \(I^{\text {aug}}\) 를 사용하여 \(\hat{\mathcal{D}}_{\theta^*}\) 에 대한 파인튜닝을 추가 진행
-
Multi-view DreamBooth\(\hat{\mathcal{D}}_\theta^{\mathrm{multi}}\) 를 생성
-
-
-
\(\hat{\mathcal{D}}_\theta^{\text {multi }}\)모델을 사용하여 DreamFusion SDS Loss 와 함께 NeRF 3D assets 를 최적화
-
-
-
1단계의 partial DreamBooth에 비해 multi-view DreamBooth 의 뷰 일반화와 subject 보존 능력이 더 우수하기 때문에 subject idendtity가 상당히 향상된 NeRF 모델 생성 가능
-
BUT SDS 손실만 사용시 최적화된 NeRF assets 이
-
-
주어진 subject 에 대해 우수한 기하학적 유사성 보유
-
Color saturation artifacts 현상 다수 발생
-
이를 해결하기 위해 \(\left\{I_v^{\mathrm{pseudo}}\right\}\) 를 사용한 새로운 weak reconstruction loss 도입
-
**** Color saturation artifacts :**
-
-
색상의 과도한 포화(saturation)로 인해 비현실적이거나 왜곡된 색상 표현이 나타나는 결함 현상
-
모델이 특정 색상을 과도하게 강조하는 경우 발생
-
색상 값을 잘못 예측하여 비현실적인 색상 표현이 나타난 경우 발생
-
다양한 시점에서 일관된 색상 표현을 유지하지 못한 경우 발생
-
-
-
-
-
-
-
Reconstruction loss
-
-
\(\left\{I_v^{\mathrm{pseudo}}\right\}\) 가 생성된 카메라 매개변수 \(\left\{P_v\right\}\) 정보를 알고 있으므로,
-두 번째 NeRF MLP \(\mathcal{F}\gamma\) 의 훈련을 reconstruction loss 를 통해 추가로 규제
🌟 Stage-2 Multi-view Data Generation : 본 접근법의 가장 중요한 부분
+
일관성을 갖춘 3D initial NeRF 와 fully-trained DreamBooth 를 사용하여 pseudo multi-view subject 이미지들을 생성
+
+
+
Initial NeRF 로부터 다양한 랜덤 viewpoints \(\{v\}\)을 따라 여러 이미지\(\left\{\hat{I}v \in \mathbb{R}^{n \times 3}\right\}\) 를 렌더링하여 다중 시점 렌더링을 생성
+
각 렌더링에 고정된 양의 노이즈를 추가하는 forward diffusion 과정을 통해 \(t_{pseudo}\)로 전환
+
reverse diffusion 과정을 실행하여 fully-trained DreamBooth 모델 \(\hat{\mathcal{D}}_\theta\) 를 사용하여 샘플을 생성
+
+
샘플링 과정은 각 뷰에 대해 독립적으로 수행
+
Initial NeRF 결과물 에 노이즈를 추가한 noisy render 를 조건으로 지정함으로써, 넓은 범위의 시점을 커버하면서 subject 를 잘 나타내는 이미지 생성 가능
+⇒ 다양한 노이즈가 있는 이미지를 조건으로 학습시, 다양한 변형에 대한 학습 가능하기 때문
+
BUT reverse diffusion 과정은 다른 뷰에 다른 세부 사항을 추가할 수 있기 때문에 결과 이미지는 multi-view 에 대한 일관성이 없음.
+
⇒ 가상(pseudo) 다중 시점 이미지 집합 (collection of pseudo multi-view images)
+
+
+
+
+
+
🔑 Key insight
+
+
초기 NeRF 이미지가 unseen views 에 가까울 경우,
+DreamBooth가 Subject 의 unseen views를 효과적으로 생성 가능
+
입력 이미지에 비해 Subject 와 더 유사한 출력 이미지를 효과적으로 생성가능**
+
+
+
+
위 그림을 통해 체크할 부분
+
+
fully-trained DreamBooth 를 사용한 Img2Img 변환의 샘플 출력
+
입력 NeRF 렌더링의 시점을 유지하면서도 subject 이미지와 더 유사한 모습
+
기존 연구들과 달리 Img2Img 변환을 DreamBooth, NeRF 3D assets 과 결합하여 사용 (기존 연구의 경우 Img2Img 변환을 이미지 editing 응용으로만 사용)
+
+
+
+
+
+
3.3.3 Stage3️⃣: Final NeRF with Multi-view DreamBooth#
+
+
+
+
Fig. 740 Stage-3 : Final NeRF with Multi-view DreamBooth
+SDS와 multi-view reconstruction 손실을 사용한 최종 NeRF 최적화#
+
+
+
+
새로운 데이터 \(I^{\text{aug}}\) 생성
+
+
+
가상 다중 시점 이미지 \(\left\{I_v^{\text {pseudo }}\right\}\), 입력 Subject 이미지 \(\left\{I_i\right\}\) 의 결합을 통해 생성
\(I^{\text {aug}}\) 를 사용하여 최종 Multi-view DreamBooth 모델을 최적화
+
+
+
1단계에서 partial DreamBooth\(\hat{\mathcal{D}}_{\theta^*}\) 준비
+
위의 증강 데이터 \(I^{\text {aug}}\) 를 사용하여 \(\hat{\mathcal{D}}_{\theta^*}\) 에 대한 파인튜닝을 추가 진행
+
Multi-view DreamBooth\(\hat{\mathcal{D}}_\theta^{\mathrm{multi}}\) 를 생성
+
+
+
\(\hat{\mathcal{D}}_\theta^{\text {multi }}\)모델을 사용하여 DreamFusion SDS Loss 와 함께 NeRF 3D assets 를 최적화
+
+
+
1단계의 partial DreamBooth에 비해 multi-view DreamBooth 의 뷰 일반화와 subject 보존 능력이 더 우수하기 때문에 subject idendtity가 상당히 향상된 NeRF 모델 생성 가능
+
BUT SDS 손실만 사용시 최적화된 NeRF assets 이
+
+
주어진 subject 에 대해 우수한 기하학적 유사성 보유
+
Color saturation artifacts 현상 다수 발생
+
이를 해결하기 위해 \(\left\{I_v^{\mathrm{pseudo}}\right\}\) 를 사용한 새로운 weak reconstruction loss 도입
+
**** Color saturation artifacts :**
+
+
색상의 과도한 포화(saturation)로 인해 비현실적이거나 왜곡된 색상 표현이 나타나는 결함 현상
+
모델이 특정 색상을 과도하게 강조하는 경우 발생
+
색상 값을 잘못 예측하여 비현실적인 색상 표현이 나타난 경우 발생
+
다양한 시점에서 일관된 색상 표현을 유지하지 못한 경우 발생
+
+
+
+
+
+
+
Reconstruction loss
+
+
\(\left\{I_v^{\mathrm{pseudo}}\right\}\) 가 생성된 카메라 매개변수 \(\left\{P_v\right\}\) 정보를 알고 있으므로,
+두 번째 NeRF MLP \(\mathcal{F}\gamma\) 의 훈련을 reconstruction loss 를 통해 추가로 규제
DreamFusion = NeRF + Score Distillation Sampling Loss를 활용한 Text-to-3D 모델
-
기존 한계
-
Text-to-Image 방식과 같이 큰 규모의 데이터로 학습시킨 것과 동일 방식의 3D 생성 모델을 만들기 위해서은 대규모 label된 3D 데이터셋과 3D 데이터를 효율적으로 처리할 수 있는 3D diffusion model이 필요하지만, 현재 이를 충족시킬 수 없음.
-
방법론
-
DreamFusion은 pretrained 2D Text-to-Image diffusion model을 활용하여 text-to-3D 합성을 수행할 수 있는 새로운 방법 제시.
-
본 방법은 parameteric image generation 최적화를 위한 prior로 2D diffusion model을 활용할 수 있는 probability density distillation 기반의 loss를 도입.
-
결과
-
텍스트 기반으로 생성된 3D 모델은 임의의 각도와 조명에서 볼 수 있으며, 임의의 3D 환경에 합성.
-
해당 접근 방식을 통해 추가적인 3D 학습 데이터나 image diffusion model의 수정 없이도 효과적으로 동작함.
이미지 생성 모델은 text 기반으로 high-fidelity, diverse, controllable 이미지 합성을 지원한다.
-
-
가능했던 이유 2가지
-
-
-
large image-text dataset
-
-
-
-
큰 규모의 생성 모델
-
-
-
-
-
-
-
이런 Diffusion Model을 다른 domain에 적용하려는 시도는 성공적이었지만, 많은 규모의 training data가 필요.
-
3D 합성 분야에서도 3D asset이 요구되지만 이는 이미지 대비 상대적으로 훨씬 더 많은 시간과 노력을 요하는 작업.
-
voxel, point cloud를 비롯한 explicit representation을 위한 방법이나 GAN 기반의 방법을 통해 3D generator를 만들려는 시도 또한 있었으나 이 방법들은 임의의 text를 기반으로 3D object synthesis가 어려운 상황.
-
한편, inverse rendering인 NeRF를 기반 Text 기반 3D 생성 방법에 통합하려는 시도가 많이 있었는데 그중 대표적인 방법이 DreamField 이다.
DreamField는 CLIP의 frozen image-text joint embedding model과 optimization기반 방법을 통해 NeRF를 학습.
-
그러나 이 방법은 부족한 현실성과 정확성에 대한 한계를 보임.
-
본 저자들은 Dream Fields에서 사용한 CLIP 대신 2D Diffusion model로부터 distill된 loss를 활용하여 사용.
-
이는 probability density distillation 기반으로 구성되는데, 이는 forward process의 diffusion 기반의 공유 평균을 가지는Gaussian distribution과 pretrained diffusion model로부터 학습된score function간의 KL divergence를 최소화하는 방향을 의미.
-
Score Distillation Sampling(SDS)방법은 미분가능한 image parameterization을 기반으로 sampling 최적화가 가능하게 함.
-
즉, NeRF와 SDS를 결합함으로써 Text prompt가 입력으로 주어진다면, DramFusion은 고품질이며 일관성있는 3D object와 scene들을 만들어낼 수 있다.
2. Diffusion Models and Score Distillation Sampling#
-
Data : \(x\)
-
Forward process : \(q\)
-
Reverse process : \(p\)
-
Perturbed latent at timestep \(t\): \(z_t\)
-
Marginal distribution of the latent variables at timestep \(t\) given an initial datapoint \(x\) :
-\(q(z_t | x ) = \mathcal{N} (\alpha_t x ,\sigma_t^2 \mathbf{I})\)
-
Generative model : \(p\)
-
starting Random Noise : \(p(z_T) = \mathcal{N} (0, \mathbf{I})\)
추가 발견 내용 : 랜덤하게 albedo color \(\rho\)를 white (1,1,1)로 교체하여 textureless 음영 처리 결과물 생성할 수 있음.
-
모델이 퇴화된 솔루션을 만드는 것을 방지하는 데 유익
-
Scene Structure
-
1) 고정된 Bounding sphere: NeRF 모델의 query를 고정된 bounding sphere 내에서만 수행하여 밀도가 카메라 근처에 채워지지 않도록 함.
-
2) 추가 환경 맵 생성: 두 번째 MLP를 사용하여 배경 색상을 계산하고, 렌더링된 색상을 배경 색상 위에 합성.
-
3) 누적된 alpha 값 활용: 누적된 alpha 값을 통해 배경과 렌더링된 광선 색상을 자연스럽게 합성.
-
Geometry regularizers
-
1)opacity에 대한 regularization penalty 추가 : Mip-NeRF 360 모델에서 빈 공간에 대한 불필요한 채움을 방지하기 위해 진행. (Zero-shot text-guided object generation with dream fields. CVPR 2022)
-
2) Ref-NeRF에서 제안된 orientation loss의 수정 버전을 사용 : Density field에서 normal vector가 camera로부터 멀어지는 문제 방지를 위해 제안.
DreamFusion = NeRF + Score Distillation Sampling Loss를 활용한 Text-to-3D 모델
+
기존 한계
+
Text-to-Image 방식과 같이 큰 규모의 데이터로 학습시킨 것과 동일 방식의 3D 생성 모델을 만들기 위해서은 대규모 label된 3D 데이터셋과 3D 데이터를 효율적으로 처리할 수 있는 3D diffusion model이 필요하지만, 현재 이를 충족시킬 수 없음.
+
방법론
+
DreamFusion은 pretrained 2D Text-to-Image diffusion model을 활용하여 text-to-3D 합성을 수행할 수 있는 새로운 방법 제시.
+
본 방법은 parameteric image generation 최적화를 위한 prior로 2D diffusion model을 활용할 수 있는 probability density distillation 기반의 loss를 도입.
+
결과
+
텍스트 기반으로 생성된 3D 모델은 임의의 각도와 조명에서 볼 수 있으며, 임의의 3D 환경에 합성.
+
해당 접근 방식을 통해 추가적인 3D 학습 데이터나 image diffusion model의 수정 없이도 효과적으로 동작함.
이미지 생성 모델은 text 기반으로 high-fidelity, diverse, controllable 이미지 합성을 지원한다.
+
+
가능했던 이유 2가지
+
+
+
large image-text dataset
+
+
+
+
큰 규모의 생성 모델
+
+
+
+
+
+
+
이런 Diffusion Model을 다른 domain에 적용하려는 시도는 성공적이었지만, 많은 규모의 training data가 필요.
+
3D 합성 분야에서도 3D asset이 요구되지만 이는 이미지 대비 상대적으로 훨씬 더 많은 시간과 노력을 요하는 작업.
+
voxel, point cloud를 비롯한 explicit representation을 위한 방법이나 GAN 기반의 방법을 통해 3D generator를 만들려는 시도 또한 있었으나 이 방법들은 임의의 text를 기반으로 3D object synthesis가 어려운 상황.
+
한편, inverse rendering인 NeRF를 기반 Text 기반 3D 생성 방법에 통합하려는 시도가 많이 있었는데 그중 대표적인 방법이 DreamField 이다.
DreamField는 CLIP의 frozen image-text joint embedding model과 optimization기반 방법을 통해 NeRF를 학습.
+
그러나 이 방법은 부족한 현실성과 정확성에 대한 한계를 보임.
+
본 저자들은 Dream Fields에서 사용한 CLIP 대신 2D Diffusion model로부터 distill된 loss를 활용하여 사용.
+
이는 probability density distillation 기반으로 구성되는데, 이는 forward process의 diffusion 기반의 공유 평균을 가지는Gaussian distribution과 pretrained diffusion model로부터 학습된score function간의 KL divergence를 최소화하는 방향을 의미.
+
Score Distillation Sampling(SDS)방법은 미분가능한 image parameterization을 기반으로 sampling 최적화가 가능하게 함.
+
즉, NeRF와 SDS를 결합함으로써 Text prompt가 입력으로 주어진다면, DramFusion은 고품질이며 일관성있는 3D object와 scene들을 만들어낼 수 있다.
2. Diffusion Models and Score Distillation Sampling#
+
Data : \(x\)
+
Forward process : \(q\)
+
Reverse process : \(p\)
+
Perturbed latent at timestep \(t\): \(z_t\)
+
Marginal distribution of the latent variables at timestep \(t\) given an initial datapoint \(x\) :
+\(q(z_t | x ) = \mathcal{N} (\alpha_t x ,\sigma_t^2 \mathbf{I})\)
+
Generative model : \(p\)
+
starting Random Noise : \(p(z_T) = \mathcal{N} (0, \mathbf{I})\)
추가 발견 내용 : 랜덤하게 albedo color \(\rho\)를 white (1,1,1)로 교체하여 textureless 음영 처리 결과물 생성할 수 있음.
+
모델이 퇴화된 솔루션을 만드는 것을 방지하는 데 유익
+
Scene Structure
+
1) 고정된 Bounding sphere: NeRF 모델의 query를 고정된 bounding sphere 내에서만 수행하여 밀도가 카메라 근처에 채워지지 않도록 함.
+
2) 추가 환경 맵 생성: 두 번째 MLP를 사용하여 배경 색상을 계산하고, 렌더링된 색상을 배경 색상 위에 합성.
+
3) 누적된 alpha 값 활용: 누적된 alpha 값을 통해 배경과 렌더링된 광선 색상을 자연스럽게 합성.
+
Geometry regularizers
+
1)opacity에 대한 regularization penalty 추가 : Mip-NeRF 360 모델에서 빈 공간에 대한 불필요한 채움을 방지하기 위해 진행. (Zero-shot text-guided object generation with dream fields. CVPR 2022)
+
2) Ref-NeRF에서 제안된 orientation loss의 수정 버전을 사용 : Density field에서 normal vector가 camera로부터 멀어지는 문제 방지를 위해 제안.
+신경망(MLP)을 이용해 3d 물체에 대한 정보를 표현했다.
+신경망은 카메라의 위치와 방향을 입력으로 해당 지점의 density와 color를 리턴한다. 온전한 하나의 이미지를 렌더링 하기 위해서는 모든 camera ray를 따라 (이론상)적분이 필요하다.
+
+
+ray tracing이 아닌 cone tracing 방식으로, 렌더링 된 이미지의 품질을 향상시킴.
+
+
+파란 영역은 euclidean space, 노란 영역은 맵핑된 영역이다.
+이외에도 기존 방식(coarse-to-fine)과 다르게 n개의 신경망을 사용했으며 초기 신경망을 최종 결과물 출력시 사용하지 않았다.
+
+
+
+
+
+
+Instant NGP
+
+
+Block-NeRF
+
+
+NeRF in the wild
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+voxel기반의 multiresolution hash encoding을 통해 기존 sin/cos을 이용한 positional encoding 방식을 발전시킴. 이러한 encoding 방식을 채택함으로써 encoding 자체의 속도도 빨라졌으며 다중 스케일 정보를 담은 encoding을 이용함으로써 original NeRF의 신경망보다 오히려 작은 구조를 채택할 수 있었다. 또한 cuda를 활용하여 처리속도를 향상시킴으로써 real-time에 가까운 속도를 낼 수 있었다.
+
+
+대규모 장면을 모델링하기 위해 여러 NeRF를 합쳐서 하나의 큰 장면을 구성하는 방법
+
+
+in the wild dataset에서 scene 재구성을 위해 scene을
+"static 요소"와 "transient 요소"로 분리하여 모델링
+
+
+
+
+
+3D Gaussian Splatting (3DGS)
+
+
+
+point cloud 예시
+
+
+Gaussian densification 과정
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Fig. 776 Gaussian Splatting optimization
+colmap과 같은 SfM 을 이용해 3D keypoint를 찾아 해당 지점으로 3D gaussian을 초기화 한다. 이후 gaussian들을 합치거나 쪼개며 최적화를 진행한다. 렌더링 시에는 3D gaussian들을 2D projection하여 하나의 이미지를 만든다.#
각각의 3D Gaussians은 3D position(mean) \(\mu\), opacity \(\alpha\), anisotropic covariance \(\Sigma\)로 위치와 크기, 방향을 표현하며, 여기에 spherical harmonic (SH) coefficients를 추가해 view-dependent appearance(color)를 표현했다.
+
+
covariance matrix \(\Sigma\) 를 rotation matrix \(\mathbf R\) 와 scaling matrix \(\mathbf S\)로 분리가능.
Zero-1-to-3 control the camera perspective in large-scale diffusion models,
+enabling zero-shot novel view synthesis and 3D reconstruction from a single image.
+
RGB image \(x\in\Bbb R^{H\times W\times 3}\) , relative camera rotation \(R\in \Bbb R^{3\times 3}\),relative camera translation \(T\in\Bbb R^3\)
개별 3D gaussian의 위치와 형태는 center(\(\mathbf x\)), scaling factor(\(\mathbf x\)), rotation quaternion(\(\mathbf q\))으로 표현되며, opacity value(\(\alpha\)), color feature(\(\mathbf c\))를 저장하여 volumetric rendering시 사용한다.
+
\(\Theta_i=\{\mathbf x_i, \mathbf s_i,\mathbf q_i, \alpha_i, \mathbf c_i\}\), \(\mathbf x \in \Bbb R^3, \mathbf s\in \Bbb R^3, \mathbf q \in \Bbb R^4, \alpha\in \Bbb R, \mathbf c \in \Bbb R^3\)
+original gaussian splatting에서는 spherical harmonics 계수를 이용하여 색을 표현하지만
+simple diffuse color를 모델링 하기 위해 간략화 → 재질 표현이 어려울 수 있다.
+
3D Gaussians은 random position, unit scaling, no rotation으로 initialization 한 후, SDS를 이용해 최적화 한다.
\(w(t)\)는 weighting function이고, \(\epsilon_\phi(\cdot)\) 는 사전학습된 \(\phi\)를 이용해 예측된 noise를 뜻한다.
+\(\triangle p\) 는 relative camera pose, \(r\)은 reference camera이다.
+
+
추가적으로 reference view와 transparency 를 input에 align했다.
marching cube algorithm을 적용하기 위해서는 local density grid가 필요하다. gaussian splatting 알고리즘의 주요 특징은 over-sized Gaussian 들은 최적화 과정에서 split 및 pruning된다는 점이다. 이는 효과적인 rasterization을 위해 culling technique을 적용 할 수 있는 근거가 된다. 또한 이 점은 block-wise density queries를 perform 할 때도 사용할 수 있다.
+
먼저 3D space를 \((-1,1)^3\) 으로 맵핑한다. (그냥 최대, 최소값을 이용해 정규화) 그리고 이 공간을 \(16^3\)의 overlapping blocks(multiscale voxels)으로 나눈다. 그리고 각 블록의 외부에 위치한 gaussian들은 제외한다. 이를 통해 계산해야 할 gaussian의 총 개수를 효과적으로 줄일 수 있다. 그리고 각 블록의 내부에 \(8^3\) dense grid를 만들어 최종적으로는 \(128^3\)의 dense grid를 만든다. grid position \(\mathbf x\)의 각 query는 남아있는 3D gaussian들의 opacity의 weighted sum으로 local density grid를 얻는다.
\(\Sigma\)는 covariance matrix로 scaling \(\mathbf s\), rotation \(\mathbf q\)로 이루어져 있다. 이후에는 empirical threshold를 marching cube 알고리즘에 적용하여 mesh surface를 추출한다. decimation과 remeshing을 이용해 후처리하여 더욱 자연스럽고(smoother), 간결한(compact) mesh를 만들었다.
먼저 mesh의 UV coordinate를 unwrap하고 빈 texture image로 초기화 한다. 그리고 8개의 azimuth, 3개의 elevation을 균일하게 선택하고 top, bottom view까지 포함하여 corresponding RGB image를 렌더링 할 수 있게 한다. 이러한 RGB 이미지들의 각 픽셀은 UV coordinate를 기반으로 texture image로 맵핑할 수 있다.
+
이렇게 back-project된 texture image는 다음의 texture fine-tuning 단계의 초기 설정으로 사용된다.
앞선 back-projection된 coarse texture를 시작으로 texture 품질을 올리고자 했으나, SDS loss를 이용해
+UV-space를 직접 fine-tuning 하면 위의 그림과 같은 artifact가 발생하게된다. 이는 differentiable rasterization시 사용되는 mipmap texture sampling 기법때문이다. SDS와 같이 모호한 guidance를 이용하면 각 mipmap level에 따라 over-saturation된 color block으로 gradient가 전파 된다.
위와 같은 고품질 렌더링와 렌더링 속도 향상을 위해 mipmap이라는 기법을 활용한다. 본 논문에서 texture mapping, rendering시 사용한 NVdiffrast도 mipmap을 활용하고 있다.
+mipmap은 texture를 여러 레벨의 화질으로 저장하는 방식으로 mipmap level은 특정 화질의 texture version을 의미한다. 카메라로 부터 멀리 떨어진 object는 저레벨의 mipmap을 사용해 렌더링 한다. 저레벨의 mipmap은 이미 정보손실이 일어난 상태이고 이를 이용해 렌더링 되었다면 gradient가 흐르는 방향이 왜곡 될수 있다.
\(f_\phi(\cdot)\) 는 사전학습된 2D diffusion 을 통해 refined image를 얻는 multi-step denoising process를 의미한다. \(\epsilon(t_\text{start})\) 는 timestep \(t_\text{start}\)의 랜덤 노이즈를 말한다. \(c\) 는 image-to-3D를 위한 condition인 카메라 포즈 변화량 \(\Delta p\) 이고, \(e\)는 text-to-3D의 condition을 말한다. 시작 timestep \(t_\text{start}\)는 noise 강도를 제한하기 위해 신중히 선택되어야 refined image의 original content를 유지하며 detail을 향상 시킬수 있다고 한다. refined image는 이후 pixel-wise MSE loss에 texture 최적화를 위해 사용된다.
number - 5000 for image-to-3D, 1000 for text-to-3D
+
opacity - 0.1
+
color - grey
+
radius - 0.5
+
+
+
Rendering resolution - 64 to 512 for gaussian splatting, 128 to 1024 for mesh
+
Loss weights in eq(2) - RGB, transperency 가중치(\(\lambda_\text{RGB}, \lambda_A\))는 0에서 부터 각각 10000, 1000로 linearly increasing
+
Camera pose sampling - fixed radius 2 for image-to-3D / 2.5 for text-to-3D,
+y-axis FOV 49 degree,
+azimuth in \([-180,180]\) degree, elevation in \([-30,30]\).
많은 text-to-video 디퓨전 모델은 text-to-image 디퓨전 모델을 활용하여 적용한다.
-
결과를 기대할만 하지만, 여전히 텍스트-이미지 모델과 같은 성능은 나오지 않고 있다.
-
프레임 간의 시간적 일관성을 유지하는 것과 사실적인 모션을 생성하는 것이 어렵다.
-
어떤 디퓨전 기반 방법들은 스크래치부터 학습하기 때문에 값비싼 컴퓨팅 리소스, 방대학 학습 데이터셋, 오랜 학습 시간이 필요하다.
-
Turn-A-Video는 텍스트와 이미지가 조건으로 들어왔을 때 비디오 생성을 위해 사전 학습된 텍스트-이미지 디퓨전 모델을 파인튜닝한다. → 이전 방법들과 마찬가지로 텍스처 깜빡거림(textural flickering), 구조적인 불일치가 나타난다.
-
본 논문에서는 위의 문제를 해결하여 사람과 섬유의 움직임의 싱크를 맞추는 것을 목표로 한다.
-
-
-
-
2.5. Conditioning Mechanisms for Diffusion Models#
-
-
텍스트를 조건으로 하는 이미지 생성 디퓨전 모델을 널리 사용되어 왔다.
-
텍스트 컨디셔닝은 높은 수준의 디테일을 조절하는 데는 효과적이지만, 사람과 의상의 정확한 identity나 포즈에 대한 풍부하고 상세한 정보를 제공하는 것은 어렵다.
-
여러 연구에서 사전 학습된 text-to-image 스테이블 디퓨전 모델을 위한 이미지 컨디셔닝 문제를 다루고 있다.
-
-
이러한 모델에는 종종 어떤 종류의 텍스트 임베딩이 포함된다. (ex: DreamBooth: 피사체별 파인 튜닝을 수행하기 위해 고유한 텍스트 토큰을 학습)
-
기존 이미지와 동영상의 모양을 편집하기 위해 텍스트를 통합하기도 한다.
-
PIDM은 별도의 텍스처 인코더를 사용하여 이미지 텍스처를 인코딩하고 입력된 노이즈 이미지와 대상 포즈를 연결한다.
-
-
-
DreamPose는 영상 속 피사체의 외형뿐만 아니라 구조와 움직임까지 제어할 수 있다.
-
PIDM과 마찬가지로 이미지 임베딩을 UNet의 크로스 어텐션 레이어에 직접 통합하지만, 이미지 임베딩에 대해 사전 학습된 두 개의 인코더(CLIP, VAE)를 혼합하여 사용한다. → 입력 노이즈에 연결된(concatenated) 멀티 포즈 입력 표현(multi-pose input representation)을 이용해 부드럽고 시간적으로 일관된 모션을 구현할 수 있다.
이미지를 조건으로 넣기 위한 이전 연구 (ex: InstructPix2Pix)는 주로 조건으로 들어오는 이미지 신호를 디노이징 U-Net에 대한 입력 노이즈와 concat한다.
-
이는 원하는 출력 이미지와 공간적으로(spatially) 정렬된 조건 신호에 대한 조건화에 효과적이지만, DreamPose의 경우에는 네트워크가 입력 이미지와 공간적으로 정렬되지 않은 이미지를 생성하는 것을 목표로 한다.
-
따라서 해당 태스크에는 다른 방법이 필요하고, 이를 위해 맞춤형 컨디셔닝 어댑터를 구현하였다.
-
맞춤형 컨디셔닝 어댑터는 CLIP 텍스트 인코더를 사용하여 이미지 조건화를 대체하는 맞춤형 컨디셔닝 어댑터(custom conditioning adapter)를 구현하였다.
-
이 어댑터는 사전 학습된 CLIP 이미지 및 VAE 인코더에서 인코딩된 정보를 결합한다.
-
-
-
디퓨전 기반 파인튜닝
-
-
목표: 입력 신호를 원래 네트워크 학습에 사용된 신호와 최대한 유사하게 만들어 학습 기울기를 가능한 한 의미 있게 만드는 것 → 학습된 prior 값의 손실을 방지하는 데 도움이 된다.
-
이러한 이유로 대부분의 디퓨전 기반 파인튜닝 체계는 모든 원래 컨디셔닝 신호를 유지하고 새로운 컨디셔닝 신호와 상호 작용하는 네트워크 가중치를 0으로 초기화한다.
-
-
-
VAE Encoder의 필요성
-
-
스테이블 디퓨전이 텍스트 프롬프트의 CLIP 임베딩으로 컨디셔닝 되고 CLIP이 텍스트와 이미지를 공유 임베딩 스페이스(shared embedding space)로 인코딩한다는 점을 감안할 때 CLIP 컨디셔닝을 조건으로 주어진 이미지에서 파생된 임베딩으로 간단히 대체하는 것이 자연스러워 보일 수 있다.
-
하지만 실제로는 CLIP 이미지 임베딩만으로는 조건으로 주어진 이미지에서 세밀한 디테일을 캡처하기에 충분하지 않다.
-
따라서 스테이블 디퓨전의 VAE에서 인코딩된 latent 임베딩을 추가로 입력한다.
-
이를 통해 디퓨전의 출력 도메인과 일치하는 추가적인 장점을 가지게 된다.
-
-
-
어댑터 \(\mathcal{A}\)
-
-
스테이블 디퓨전 아키텍처는 기본적으로 컨디셔닝 신호로 VAE latent를 지원하지 않기 때문에 어댑터 모듈 \(\mathcal{A}\)를 추가한다.
-
해당 어댑터는 CLIP과 VAE 임베딩을 결합하여 네트워크의 일반적인 cross-attention 연산에 사용되는 하나의 임베딩을 생성한다.
-
이 어댑터는 두 신호를 함께 혼합하고 디노이징 U-Net의 cross-attention 모듈에서 예상하는 일반적인 모양으로 출력을 변환한다.
-
-
-
디퓨전 기반 파인튜닝에서 언급했 듯이 학습에서 네트워크의 충격을 완화하기 위해 처음에는 VAE 임베딩에 해당하는 가중치는 0으로 설정되어 네트워크가 CLIP 임베딩으로만 학습을 시작한다.
Noisy latent \(\tilde{z}_i\)를 타겟 포즈 표현 \(c_p\)와 concat한다.
-
실제 비디오에서 추정된 포즈의 노이즈를 고려하고 생성된 프레임에서의 시간적 일관성을 극대화하기 위해, \(c_p\)를 다섯 개의 연속된 포즈 프레임으로 구성하였다. 즉, \(c_p = \{p_{i-2}, p_{i-1}, pi, p_{i+1}, p_{i+2}\}\) → 개별 포즈로 네트워크를 학습하는 것보다 연속 포즈로 학습하면 전반적인 움직임의 부드러움과 시간적 일관성이 증가한다.
-
구조적으로 0으로 초기화된 10개의 추가 입력 채널을 받아들이도록 UNet 입력 레이어를 수정하고 noisy latent에 해당하는 원래 채널은 사전 학습된 가중치에서 수정되지 않는다.
많은 text-to-video 디퓨전 모델은 text-to-image 디퓨전 모델을 활용하여 적용한다.
+
결과를 기대할만 하지만, 여전히 텍스트-이미지 모델과 같은 성능은 나오지 않고 있다.
+
프레임 간의 시간적 일관성을 유지하는 것과 사실적인 모션을 생성하는 것이 어렵다.
+
어떤 디퓨전 기반 방법들은 스크래치부터 학습하기 때문에 값비싼 컴퓨팅 리소스, 방대학 학습 데이터셋, 오랜 학습 시간이 필요하다.
+
Turn-A-Video는 텍스트와 이미지가 조건으로 들어왔을 때 비디오 생성을 위해 사전 학습된 텍스트-이미지 디퓨전 모델을 파인튜닝한다. → 이전 방법들과 마찬가지로 텍스처 깜빡거림(textural flickering), 구조적인 불일치가 나타난다.
+
본 논문에서는 위의 문제를 해결하여 사람과 섬유의 움직임의 싱크를 맞추는 것을 목표로 한다.
+
+
+
+
2.5. Conditioning Mechanisms for Diffusion Models#
+
+
텍스트를 조건으로 하는 이미지 생성 디퓨전 모델을 널리 사용되어 왔다.
+
텍스트 컨디셔닝은 높은 수준의 디테일을 조절하는 데는 효과적이지만, 사람과 의상의 정확한 identity나 포즈에 대한 풍부하고 상세한 정보를 제공하는 것은 어렵다.
+
여러 연구에서 사전 학습된 text-to-image 스테이블 디퓨전 모델을 위한 이미지 컨디셔닝 문제를 다루고 있다.
+
+
이러한 모델에는 종종 어떤 종류의 텍스트 임베딩이 포함된다. (ex: DreamBooth: 피사체별 파인 튜닝을 수행하기 위해 고유한 텍스트 토큰을 학습)
+
기존 이미지와 동영상의 모양을 편집하기 위해 텍스트를 통합하기도 한다.
+
PIDM은 별도의 텍스처 인코더를 사용하여 이미지 텍스처를 인코딩하고 입력된 노이즈 이미지와 대상 포즈를 연결한다.
+
+
+
DreamPose는 영상 속 피사체의 외형뿐만 아니라 구조와 움직임까지 제어할 수 있다.
+
PIDM과 마찬가지로 이미지 임베딩을 UNet의 크로스 어텐션 레이어에 직접 통합하지만, 이미지 임베딩에 대해 사전 학습된 두 개의 인코더(CLIP, VAE)를 혼합하여 사용한다. → 입력 노이즈에 연결된(concatenated) 멀티 포즈 입력 표현(multi-pose input representation)을 이용해 부드럽고 시간적으로 일관된 모션을 구현할 수 있다.
이미지를 조건으로 넣기 위한 이전 연구 (ex: InstructPix2Pix)는 주로 조건으로 들어오는 이미지 신호를 디노이징 U-Net에 대한 입력 노이즈와 concat한다.
+
이는 원하는 출력 이미지와 공간적으로(spatially) 정렬된 조건 신호에 대한 조건화에 효과적이지만, DreamPose의 경우에는 네트워크가 입력 이미지와 공간적으로 정렬되지 않은 이미지를 생성하는 것을 목표로 한다.
+
따라서 해당 태스크에는 다른 방법이 필요하고, 이를 위해 맞춤형 컨디셔닝 어댑터를 구현하였다.
+
맞춤형 컨디셔닝 어댑터는 CLIP 텍스트 인코더를 사용하여 이미지 조건화를 대체하는 맞춤형 컨디셔닝 어댑터(custom conditioning adapter)를 구현하였다.
+
이 어댑터는 사전 학습된 CLIP 이미지 및 VAE 인코더에서 인코딩된 정보를 결합한다.
+
+
+
디퓨전 기반 파인튜닝
+
+
목표: 입력 신호를 원래 네트워크 학습에 사용된 신호와 최대한 유사하게 만들어 학습 기울기를 가능한 한 의미 있게 만드는 것 → 학습된 prior 값의 손실을 방지하는 데 도움이 된다.
+
이러한 이유로 대부분의 디퓨전 기반 파인튜닝 체계는 모든 원래 컨디셔닝 신호를 유지하고 새로운 컨디셔닝 신호와 상호 작용하는 네트워크 가중치를 0으로 초기화한다.
+
+
+
VAE Encoder의 필요성
+
+
스테이블 디퓨전이 텍스트 프롬프트의 CLIP 임베딩으로 컨디셔닝 되고 CLIP이 텍스트와 이미지를 공유 임베딩 스페이스(shared embedding space)로 인코딩한다는 점을 감안할 때 CLIP 컨디셔닝을 조건으로 주어진 이미지에서 파생된 임베딩으로 간단히 대체하는 것이 자연스러워 보일 수 있다.
+
하지만 실제로는 CLIP 이미지 임베딩만으로는 조건으로 주어진 이미지에서 세밀한 디테일을 캡처하기에 충분하지 않다.
+
따라서 스테이블 디퓨전의 VAE에서 인코딩된 latent 임베딩을 추가로 입력한다.
+
이를 통해 디퓨전의 출력 도메인과 일치하는 추가적인 장점을 가지게 된다.
+
+
+
어댑터 \(\mathcal{A}\)
+
+
스테이블 디퓨전 아키텍처는 기본적으로 컨디셔닝 신호로 VAE latent를 지원하지 않기 때문에 어댑터 모듈 \(\mathcal{A}\)를 추가한다.
+
해당 어댑터는 CLIP과 VAE 임베딩을 결합하여 네트워크의 일반적인 cross-attention 연산에 사용되는 하나의 임베딩을 생성한다.
+
이 어댑터는 두 신호를 함께 혼합하고 디노이징 U-Net의 cross-attention 모듈에서 예상하는 일반적인 모양으로 출력을 변환한다.
+
+
+
디퓨전 기반 파인튜닝에서 언급했 듯이 학습에서 네트워크의 충격을 완화하기 위해 처음에는 VAE 임베딩에 해당하는 가중치는 0으로 설정되어 네트워크가 CLIP 임베딩으로만 학습을 시작한다.
Noisy latent \(\tilde{z}_i\)를 타겟 포즈 표현 \(c_p\)와 concat한다.
+
실제 비디오에서 추정된 포즈의 노이즈를 고려하고 생성된 프레임에서의 시간적 일관성을 극대화하기 위해, \(c_p\)를 다섯 개의 연속된 포즈 프레임으로 구성하였다. 즉, \(c_p = \{p_{i-2}, p_{i-1}, pi, p_{i+1}, p_{i+2}\}\) → 개별 포즈로 네트워크를 학습하는 것보다 연속 포즈로 학습하면 전반적인 움직임의 부드러움과 시간적 일관성이 증가한다.
+
구조적으로 0으로 초기화된 10개의 추가 입력 채널을 받아들이도록 UNet 입력 레이어를 수정하고 noisy latent에 해당하는 원래 채널은 사전 학습된 가중치에서 수정되지 않는다.
기본적으로 학습과 생성 시 iteration이 들어가는데 iteration은 학습의 안정성을 키워주는 장점이 있지만, computation cost가 매우 증가한다는 단점이 있다.
-
-
-
반면에 GAN은
-
-
이미지 생성 시 single forward pass만 필요하므로 cost가 크지 않다는 장점이 있지만 single 혹은 multiple object의 생성에는 성능이 뛰어나지만 class가 명확히 정의되지않은 이미지 즉, open world image의 생성에는 어려움이 있다.
-
-
-
“GAN을 더 develop한다면 Diffusion 모델을 넘어설 수 있을까?”
-
gigaGAN은?
-
-
속도적 장점
-
-
0.13 s/img (512 size), 3.66s / img (4k)
-
-
-
latent space상에서의 editing 가능(style mixing, interpolation, prompt mixing like stylegan2)
단순히 convolution layer의 kernel size만 scaling up을 하면 학습이 안되는 현상
-
GAN 기반 모델이 (1)text-condition의 (2)오픈 이미지 생성에 한계를 보이는 이유는 convolution network의 구조 때문이다.
-
-
convolution 연산은 구조상 같은 레이어상에 있는 하나의 filter가 text condition 주입부터 이미지의 생성까지 모든 부분에 참여하는데 이 부분이 모델의 표현력을 떨어트릴 수 있다.
-
-
-
-
-
kernel selection method 적용
-
레이어마다 \(\{k_{i}\in R^{C_{in}\times C_{out}\times K\times K}\}\)차원의 N개의 kernel set을 두고 style vector w의 affine layer를 거친 weight를 각 kernel값에 weighted summation한 값을 최종 filter로 사용
-
-
-
-
Fig. 465 Equation of kernel selection method affine layer#
-
-
-
-
이 때 kernel weight 계산에 softmax를 사용하는데 얘는 differentiable하므로 gradient update 가능
-
또, 실제로 N개의 kernel을 모두 filter로 사용할 때보다 computation cost가 굉장히 절약된다는 장점
-
-
Interleaving attention with convolution
-
-
도입 배경
-
-
convolution filter는 receptive field 내부의 local feature 캡처에는 탁월하지만 field 외부의 부분은 학습할 수 없다.
condition \(c_{0}\)에 대해 생성된 이미지의 feature vector는 condition \(c_{0}\)의 feature 벡터와는 가깝게 (positive), 나머지 condition의 feature vector와는 멀게(negative) 학습되어야한다.
기본적으로 학습과 생성 시 iteration이 들어가는데 iteration은 학습의 안정성을 키워주는 장점이 있지만, computation cost가 매우 증가한다는 단점이 있다.
+
+
+
반면에 GAN은
+
+
이미지 생성 시 single forward pass만 필요하므로 cost가 크지 않다는 장점이 있지만 single 혹은 multiple object의 생성에는 성능이 뛰어나지만 class가 명확히 정의되지않은 이미지 즉, open world image의 생성에는 어려움이 있다.
+
+
+
“GAN을 더 develop한다면 Diffusion 모델을 넘어설 수 있을까?”
+
gigaGAN은?
+
+
속도적 장점
+
+
0.13 s/img (512 size), 3.66s / img (4k)
+
+
+
latent space상에서의 editing 가능(style mixing, interpolation, prompt mixing like stylegan2)
단순히 convolution layer의 kernel size만 scaling up을 하면 학습이 안되는 현상
+
GAN 기반 모델이 (1)text-condition의 (2)오픈 이미지 생성에 한계를 보이는 이유는 convolution network의 구조 때문이다.
+
+
convolution 연산은 구조상 같은 레이어상에 있는 하나의 filter가 text condition 주입부터 이미지의 생성까지 모든 부분에 참여하는데 이 부분이 모델의 표현력을 떨어트릴 수 있다.
+
+
+
+
+
kernel selection method 적용
+
레이어마다 \(\{k_{i}\in R^{C_{in}\times C_{out}\times K\times K}\}\)차원의 N개의 kernel set을 두고 style vector w의 affine layer를 거친 weight를 각 kernel값에 weighted summation한 값을 최종 filter로 사용
+
+
+
+
Fig. 465 Equation of kernel selection method affine layer#
+
+
+
+
이 때 kernel weight 계산에 softmax를 사용하는데 얘는 differentiable하므로 gradient update 가능
+
또, 실제로 N개의 kernel을 모두 filter로 사용할 때보다 computation cost가 굉장히 절약된다는 장점
+
+
Interleaving attention with convolution
+
+
도입 배경
+
+
convolution filter는 receptive field 내부의 local feature 캡처에는 탁월하지만 field 외부의 부분은 학습할 수 없다.
condition \(c_{0}\)에 대해 생성된 이미지의 feature vector는 condition \(c_{0}\)의 feature 벡터와는 가깝게 (positive), 나머지 condition의 feature vector와는 멀게(negative) 학습되어야한다.
Natural language로 부터 realistic한 image를 만드는 많은 방법들이 생겨나고 있다. 하지만 text prompts에 정확히 대응하는 photorealistic한 image를 생성하기에는 어려움을 겪고 있다.
-
Diffusion model이 DDPM, DDIM 논문을 통해 생성모델의 중심으로 떠오르며 unconditional한 image에 대해서는 SOTA를 찍었다고 한다. 자연스럽게 class-conditional한 image 생성에 대해서도 연구가 이루어졌는데, Diffusion models beat gans on image synthesis라는 논문에서 저자들은 noise한 image에 대해 class를 예측하는 classifier를 추가하여 sampling과정에서 label에 해당하는 이미지를 생성하도록 gradient를 control시키는 classifier guidance 방법을 소개한다. 이후, classifier없이 guidance를 줄 수 있는 classifier-free guidance 방법이 소개되었다.
-
이 논문에서는 classifier-free guidance 방법과 기존 diffusion model을 활용하여 text-conditional image synthesis를 잘 수행했다고 보여준다. 추가적으로 pretrained CLIP 모델을 활용하여 CLIP guidance라는 방법을 제시하며 classifier-free guidance와 비교를 한다. 결과적으로는 classifier-free guidance가 더 좋은 성능을 보인다고 한다.
-
text prompt를 zero-shot으로 생성하는데에 있어 좋은 성능을 보였으나, 복잡한 prompt에 대한 photorealistc한 image를 생성하는데는 어려움을 겪을 수 있다고 한다. 그래서 이 논문에서는 text-conditional image generation뿐만 아니라 기존 image를 text-prompt를 통해 편집할 수 있는 image impainting기능도 가능하도록 했다고 한다.
DDPM에서는 임의의 time step t로 부터 noise가 껴있는 image \(x_t\)의 \(\epsilon_t\)가 얼만큼인지 예측한다. 예측한 \(\epsilon_t\)를 이용하여 noise가 일부 제거된 이전 step의 mean(\(\mu_{\theta}(x_t)\))을 구할 수 있고 variance(\(\sum_{\theta}(x_t)\))는 constant한 값으로 고정시킨다. DDPM에서 제시한 forward process와 reverse process는 다음과 같다.
Score-based generative modeling through stochastic differential equations
-
-
해당 논문에서는 결국 score를 구하는 것과 epsilon을 구하는 것이 결국 같은 방향성을 띤다라고 주장한다.
-
-
-
-
Fig. 325 Proof of proportional relationship to finding score and epsilon#
-
-
-
-
Improved-DDPM
-
-
\(\sum_{\theta}\)를 constant값으로 고정시킨 이전 DDPM과 달리 해당 논문에서는 \(\sum_{\theta}\) learnable parameter로 설정하여 더 적은 diffusion step만으로 더 좋은 quality의 sample을 만들어낼 수 있다고 제시한다.
Diffusion model beat GANS on Image Synthesis(Dharwial et al.)에서는 diffusion model을 통해 class-conditional한 image생성을 제시한다. 이 논문에서의 가장 핵심적인 기술이 classifier-guidance이다. noise한 image로부터 epsilon을 예측하는 model은 그대로 유지하되, 해당 noise image가 어떤 class에 속하는지 분류하는 별도의 classifier를 설정한다. 이 classifier의 score를 통해 class-conditional한 전체 과정의 score에게 guide를 주는 방법을 제시한다.
classifier를 통해 class-conditional한 image생성을 하는 방법이 위에 소개되었는데, 이 방법은 noise한 image에 대해서 classifiy를 해야하므로 pretrained model을 사용할 수 없고 모델 규모가 너무 heavy해지는 등 몇몇 문제점을 가지고 있었다. 이 방법에 대한 개선점을 Classifier-Free Diffusion Guidance(Ho et al.)에서 Classifer-free guidance라는 기법으로 제시한다. 위의 score 식에서 약간의 변형을 통해 classifier 없이 단일 model만으로 guidance를 줄 수 있는 방법을 제시한다.
CLIP은 텍스트와 이미지 사이의 joint representation을 학습할 수 있는 모델이다. Image encoder f(x)와 Text encoder g(c)로 이루어져 있다. (x,c) 즉 이미지와 이미지 캡션 쌍으로 이루어진 대규모 데이터를 이용해 contrastive learning을 진행시킨 모델이다. 같은 의미를 가진 positive pair에 대해서는 f(x) · g(c)(유사도)가 커지도록 negative pair에 대해서는 f(x) · g(c)가 작아지도록 하는 것이다. CLIP guidance에서는 classifier guidance에서 classifier대신에 pretrained CLIP모델을 사용한다. 따라서 guidance를 주는 방식도 classifier대신 CLIP모델을 통해 구한 noise한 image x와 주어진 text간의 유사도를 이용한다.
Improved DDPM의 ADM model을 base로 text-conditioning을 추가하여 학습을 진행하였다. 주어진 noised image \(x_t\)로부터 \(x_{t-1}\)을 예측하는 \(p_{\theta}(x_{t-1}|x_t,c)\)를 수행해야한다. text를 condition으로 주기 위해서 우선 주어진 text를 K개의 token으로 encoding한 후, Transformer model에 input값으로 넣어준다. Transformer output의 마지막 embedding token과 positional encoding을 통해 나온 time step embedding token을 연산하고자 하는 크기에 맞게 linear projection하여 더한 후, residual block을 거친 image와 AdaIN기법을 통해 residual block의 output을 도출한다. Transformer output의 마지막 layer는 연산하고자 하는 크기에 맞게 linear projection하여 residual block뒤에 붙는 attention block에 이용한다.
-
학습 데이터셋은 DALL-E와 같은 데이터셋을 사용하였고 model architecture로는 기존 ADM model보다 더 scale up된 model과 1.2B paremeters를 갖는 Transformer를 사용했다고 한다. 게다가 64x64 image를 256x256 image로 upsampling하는 Upsampler model도 학습시켰다고 한다. upsampler model은 Improved DDPM에서의 ImageNet Upsampler와 거의 비슷하다고 한다.
처음 training을 진행했을때는, text를 condition으로 준 conditional image generation에 맞춰 training을 진행했다고 한다. 이 후, unconditional image generation의 성능을 위해 데이터셋의 약 20%의 text condition에 empty sequence를 주고 training을 진행했다고 한다.
이전 연구에서는, impainting을 위해 diffusion model로 학습시키는 과정을 거치지 않았다. diffusion model로 sampling을 한 후, 알려진 영역에 대해서는 \(q(x_t|x_0)\)로 대체하는 방식을 사용했기에 model이 sampling을 하는 과정에서 전체 context를 참조할 수 없다는 단점이 있었다.
-
이 논문에서는 fine-tuning과정에서 training example의 임의의 부분을 지운다음, 남은 부분은 모델에 추가적인 조건 정보로서 마스크 채널과 함께 입력되도록 설계하였다.
classifier guidance에 더 적합하게 훈련시키기 위해 clip guidance를 사용해서 classifier-free guidance와 비교했음을 위에서 언급했다. clip guidance를 사용하기 위해 저자들은 noise image에 대해 학습시킨 Noised CLIP models를 사용했음을 밝힌다. 위에서 언급했듯이 결과는 classifier-free guidance가 더 좋았다고 한다.
-
-
-
-
Fig. 331 comparison between CLIP guidance and classifier-free guidance#
논문에서는 classifier-free guidance와 CLIP guidance에 대해 Precision과 Recall, FID와 IS, CLIP score와 FID 간의 명확한 trade-off 를 관찰하고 있다고 언급한다.
-
위의 (a)와 (b)에 대해서는 classifier-free guidance가 거의 최적으로 수행되었으며, classifier-free guidance가 훨씬 강력한 방법임을 보여주고 있다. 반면, (c)에서는 CLIP guidance가 CLIP 점수를 classifier-free guidance에 비해 상당히 향상시킬 수 있는 것으로 보인다. 저자들은 CLIP guidance가 주로 CLIP 모델의 평가에 따라 이미지를 생성하는 데 중점을 둘 수 있지만, 특정 prompt 또는 caption과 일치시키는 데 뛰어나지 않을 수 있다는 가설을 제시한다. 이 가설을 확인하기 위해 저자들은 인간 평가자를 활용한 실험을 진행하였고 인간들이 CLIP 점수와 다른 의견을 가지며, classifier-free guida nce가 해당 prompt와 더 일치하는 더 높은 품질의 샘플을 생성한다고 판단했다.
Table1은 Unguided, CLIP guidance, Classifier-free guidance 기법을 각각 적용한 256x256 resolution image에 대해 human evaluation을 진행한 결과이다. Classifier-free guidance를 적용한 결과가 photorealism, caption 항목에 대해 압도적인 결과를 보임을 알 수 있다.
-
Table2는 GLIDE와 다른 text-conditional image generation model들을 비교한 표이다. MS-COCO dataset에 대해 생성된 image의 FID score를 구하였다. GLIDE model이 MS-COCO에 대해 학습한 경험이 없음에도 불구하고 Zero-shot FID 부분을 보면 상당히 좋은 result를 보임을 알 수 있다.
Natural language로 부터 realistic한 image를 만드는 많은 방법들이 생겨나고 있다. 하지만 text prompts에 정확히 대응하는 photorealistic한 image를 생성하기에는 어려움을 겪고 있다.
+
Diffusion model이 DDPM, DDIM 논문을 통해 생성모델의 중심으로 떠오르며 unconditional한 image에 대해서는 SOTA를 찍었다고 한다. 자연스럽게 class-conditional한 image 생성에 대해서도 연구가 이루어졌는데, Diffusion models beat gans on image synthesis라는 논문에서 저자들은 noise한 image에 대해 class를 예측하는 classifier를 추가하여 sampling과정에서 label에 해당하는 이미지를 생성하도록 gradient를 control시키는 classifier guidance 방법을 소개한다. 이후, classifier없이 guidance를 줄 수 있는 classifier-free guidance 방법이 소개되었다.
+
이 논문에서는 classifier-free guidance 방법과 기존 diffusion model을 활용하여 text-conditional image synthesis를 잘 수행했다고 보여준다. 추가적으로 pretrained CLIP 모델을 활용하여 CLIP guidance라는 방법을 제시하며 classifier-free guidance와 비교를 한다. 결과적으로는 classifier-free guidance가 더 좋은 성능을 보인다고 한다.
+
text prompt를 zero-shot으로 생성하는데에 있어 좋은 성능을 보였으나, 복잡한 prompt에 대한 photorealistc한 image를 생성하는데는 어려움을 겪을 수 있다고 한다. 그래서 이 논문에서는 text-conditional image generation뿐만 아니라 기존 image를 text-prompt를 통해 편집할 수 있는 image impainting기능도 가능하도록 했다고 한다.
DDPM에서는 임의의 time step t로 부터 noise가 껴있는 image \(x_t\)의 \(\epsilon_t\)가 얼만큼인지 예측한다. 예측한 \(\epsilon_t\)를 이용하여 noise가 일부 제거된 이전 step의 mean(\(\mu_{\theta}(x_t)\))을 구할 수 있고 variance(\(\sum_{\theta}(x_t)\))는 constant한 값으로 고정시킨다. DDPM에서 제시한 forward process와 reverse process는 다음과 같다.
Score-based generative modeling through stochastic differential equations
+
+
해당 논문에서는 결국 score를 구하는 것과 epsilon을 구하는 것이 결국 같은 방향성을 띤다라고 주장한다.
+
+
+
+
Fig. 325 Proof of proportional relationship to finding score and epsilon#
+
+
+
+
Improved-DDPM
+
+
\(\sum_{\theta}\)를 constant값으로 고정시킨 이전 DDPM과 달리 해당 논문에서는 \(\sum_{\theta}\) learnable parameter로 설정하여 더 적은 diffusion step만으로 더 좋은 quality의 sample을 만들어낼 수 있다고 제시한다.
Diffusion model beat GANS on Image Synthesis(Dharwial et al.)에서는 diffusion model을 통해 class-conditional한 image생성을 제시한다. 이 논문에서의 가장 핵심적인 기술이 classifier-guidance이다. noise한 image로부터 epsilon을 예측하는 model은 그대로 유지하되, 해당 noise image가 어떤 class에 속하는지 분류하는 별도의 classifier를 설정한다. 이 classifier의 score를 통해 class-conditional한 전체 과정의 score에게 guide를 주는 방법을 제시한다.
classifier를 통해 class-conditional한 image생성을 하는 방법이 위에 소개되었는데, 이 방법은 noise한 image에 대해서 classifiy를 해야하므로 pretrained model을 사용할 수 없고 모델 규모가 너무 heavy해지는 등 몇몇 문제점을 가지고 있었다. 이 방법에 대한 개선점을 Classifier-Free Diffusion Guidance(Ho et al.)에서 Classifer-free guidance라는 기법으로 제시한다. 위의 score 식에서 약간의 변형을 통해 classifier 없이 단일 model만으로 guidance를 줄 수 있는 방법을 제시한다.
CLIP은 텍스트와 이미지 사이의 joint representation을 학습할 수 있는 모델이다. Image encoder f(x)와 Text encoder g(c)로 이루어져 있다. (x,c) 즉 이미지와 이미지 캡션 쌍으로 이루어진 대규모 데이터를 이용해 contrastive learning을 진행시킨 모델이다. 같은 의미를 가진 positive pair에 대해서는 f(x) · g(c)(유사도)가 커지도록 negative pair에 대해서는 f(x) · g(c)가 작아지도록 하는 것이다. CLIP guidance에서는 classifier guidance에서 classifier대신에 pretrained CLIP모델을 사용한다. 따라서 guidance를 주는 방식도 classifier대신 CLIP모델을 통해 구한 noise한 image x와 주어진 text간의 유사도를 이용한다.
Improved DDPM의 ADM model을 base로 text-conditioning을 추가하여 학습을 진행하였다. 주어진 noised image \(x_t\)로부터 \(x_{t-1}\)을 예측하는 \(p_{\theta}(x_{t-1}|x_t,c)\)를 수행해야한다. text를 condition으로 주기 위해서 우선 주어진 text를 K개의 token으로 encoding한 후, Transformer model에 input값으로 넣어준다. Transformer output의 마지막 embedding token과 positional encoding을 통해 나온 time step embedding token을 연산하고자 하는 크기에 맞게 linear projection하여 더한 후, residual block을 거친 image와 AdaIN기법을 통해 residual block의 output을 도출한다. Transformer output의 마지막 layer는 연산하고자 하는 크기에 맞게 linear projection하여 residual block뒤에 붙는 attention block에 이용한다.
+
학습 데이터셋은 DALL-E와 같은 데이터셋을 사용하였고 model architecture로는 기존 ADM model보다 더 scale up된 model과 1.2B paremeters를 갖는 Transformer를 사용했다고 한다. 게다가 64x64 image를 256x256 image로 upsampling하는 Upsampler model도 학습시켰다고 한다. upsampler model은 Improved DDPM에서의 ImageNet Upsampler와 거의 비슷하다고 한다.
처음 training을 진행했을때는, text를 condition으로 준 conditional image generation에 맞춰 training을 진행했다고 한다. 이 후, unconditional image generation의 성능을 위해 데이터셋의 약 20%의 text condition에 empty sequence를 주고 training을 진행했다고 한다.
이전 연구에서는, impainting을 위해 diffusion model로 학습시키는 과정을 거치지 않았다. diffusion model로 sampling을 한 후, 알려진 영역에 대해서는 \(q(x_t|x_0)\)로 대체하는 방식을 사용했기에 model이 sampling을 하는 과정에서 전체 context를 참조할 수 없다는 단점이 있었다.
+
이 논문에서는 fine-tuning과정에서 training example의 임의의 부분을 지운다음, 남은 부분은 모델에 추가적인 조건 정보로서 마스크 채널과 함께 입력되도록 설계하였다.
classifier guidance에 더 적합하게 훈련시키기 위해 clip guidance를 사용해서 classifier-free guidance와 비교했음을 위에서 언급했다. clip guidance를 사용하기 위해 저자들은 noise image에 대해 학습시킨 Noised CLIP models를 사용했음을 밝힌다. 위에서 언급했듯이 결과는 classifier-free guidance가 더 좋았다고 한다.
+
+
+
+
Fig. 331 comparison between CLIP guidance and classifier-free guidance#
논문에서는 classifier-free guidance와 CLIP guidance에 대해 Precision과 Recall, FID와 IS, CLIP score와 FID 간의 명확한 trade-off 를 관찰하고 있다고 언급한다.
+
위의 (a)와 (b)에 대해서는 classifier-free guidance가 거의 최적으로 수행되었으며, classifier-free guidance가 훨씬 강력한 방법임을 보여주고 있다. 반면, (c)에서는 CLIP guidance가 CLIP 점수를 classifier-free guidance에 비해 상당히 향상시킬 수 있는 것으로 보인다. 저자들은 CLIP guidance가 주로 CLIP 모델의 평가에 따라 이미지를 생성하는 데 중점을 둘 수 있지만, 특정 prompt 또는 caption과 일치시키는 데 뛰어나지 않을 수 있다는 가설을 제시한다. 이 가설을 확인하기 위해 저자들은 인간 평가자를 활용한 실험을 진행하였고 인간들이 CLIP 점수와 다른 의견을 가지며, classifier-free guida nce가 해당 prompt와 더 일치하는 더 높은 품질의 샘플을 생성한다고 판단했다.
Table1은 Unguided, CLIP guidance, Classifier-free guidance 기법을 각각 적용한 256x256 resolution image에 대해 human evaluation을 진행한 결과이다. Classifier-free guidance를 적용한 결과가 photorealism, caption 항목에 대해 압도적인 결과를 보임을 알 수 있다.
+
Table2는 GLIDE와 다른 text-conditional image generation model들을 비교한 표이다. MS-COCO dataset에 대해 생성된 image의 FID score를 구하였다. GLIDE model이 MS-COCO에 대해 학습한 경험이 없음에도 불구하고 Zero-shot FID 부분을 보면 상당히 좋은 result를 보임을 알 수 있다.
Personalization 는 Generative AI 분야에서 떠오르고 있는 주제입니다. 이는 high-fidelity와 identity를 유지한 상태로 다양한 맥락과 스타일을 생성할 수 있도록 합니다. 본 논문은 Dreambooth 를 기반으로 진행되었기 때문에 Dreambooth 논문을 먼저 읽어 보시기를 추천드립니다.
본 논문의 Contribution은 크게 3가지로 볼 수 있습니다. Lighweight DreamBooth (LiDB), New HyperNetwork architecture 그리고 rank-relaxed finetuning 입니다. 위 3가지 방법을 활용하여 기존 DreamBooth의 핵심 능력을 유지하면서 크기를 줄이고 속도를 높일 수 있었습니다.
Text-to-image Models
-본 논문에서는 Stable Diffusion 모델을 활용하여 HyperDreamBooth를 구현했지만, 이 부분은 다른 텍스트-이미지 모델 (Imagen, DALL-E2 등) 도 적용이 가능합니다.
-
Personalization of Generative Models
-Generative Adversarial Network 기반의 기술들은 fidelity가 떨어지거나 다양한 문맥을 제공하지 못하는 문제가 있습니다. 이에 따라 HyperNetwork를 도입한 연구를 진행했습니다.
-
T2I Personalization via Finetuning
-다음으로, text-to-image personalization을 위한 Finetuning에 대한 연구가 있습니다. CustomDiffusion, SVDiff, LoRA, StyleDrop, DreamArtist 등의 예시가 있습니다. 하지만 이는 속도 측면에서 느리다는 단점을 가지고 있습니다.
-
이러한 관련 연구들을 볼 때, HyperDreamBooth는 속도와 효율성 측면에서 큰 발전을 이루었다고 볼 수 있습니다.
-
-
-
-
Fig. 295 HyperDreamBooth Training and Fast Fine-Tuning#
HyperdreamBooth 의 핵심 기술 중 하나인 Lightweight DreamBooth, 줄여서 LiDB에 대해 설명드리겠습니다. LiDB는 rank-1 LoRA residuals의 가중치 공간을 더 세분화하는 것이 핵심 아이디어입니다. 분해 과정에서 rank-1 LoRA weight-space 내에서 random orthogonal basis를 활용하여 decompose 합니다.
이 접근 방식은 LoRA의 A와 B 행렬을 각각 두 개의 행렬로 분해하는 것으로도 이해할 수 있습니다. 더 구체적으로 살펴보면, A 행렬은 \(A_{aux}\) 와 \(A_{train}\) 으로 분해되며, B 행렬은 \(B_{aux}\) 와 \(B_{train}\) 으로 분해할 수 있습니다. 여기서 \(aux\) 레이어는 행별로 직교하는 벡터로 무작위 초기화되고 freeze 되어 있으며, \(train\) 레이어는 학습되는 가중치입니다. 따라서 LiDB 선형 레이어의 weight-residual은 다음과 같이 표현할 수 있습니다.
여기서 \(aux\) 레이어는 experimentally fix 되었으며 이 과정을 통해 trainable parameter 개수는 약 30K개, 사이즈는 약 120KB로 경량화 할 수 있습니다. 이렇게 작은 크기와 변수만으로 fidelity, editability, style 그리고 diversity 등을 유지할 수 있다는 것이 포인트입니다.
다음은 Hypernetwork 입니다. 본 논문에서는 사전에 훈련된 T2I 모델을 빠르게 personalization 하기 위해 HyperNetwork를 제안합니다. 여기서 \(\tilde{\theta}\) 는 모든 LiDB residual 행렬을 나타내며, 각 T2I 모델의 cross-attention 및 self-attention 레이어에 대한 \(A_{train}\) 및 \(B_{train}\) 입니다. 이 핵심 아이디어는 주어진 이미지 x를 입력으로 받고, 이 이미지를 사용하여 LiDB의 low-rank residual인 \(\hat{\theta}\) 을 예측하는 HyperNetwork \(H_{\eta}\) 를 돌입하는 것입니다.HyperNetwork는 도메인 특화 이미지 데이터셋에서 훈련되며, 일반적인 확산 노이즈 제거 손실과 가중치 공간 손실을 가지고 있습니다.
여기서 \(x\) 는 reference image를 의미합니다. HyperDreamBooth의 목표는 주어진 참조 이미지 x를 기반으로 해당 이미지와 유사한 새로운 이미지를 생성하는 것입니다. \(\theta\) 는 \(x\) 에 대한 pre-optimized 된 가중치 paramters입니다. 이러한 가중치는 HyperDreamBooth 모델을 personalization 하기 위해 이미지 \(x\) 와 관련된 텍스트와 함께 조정됩니다. \(D_{\theta}\) 는 diffusion model을 나타냅니다. 이 모델은 이미지 \(x + \epsilon\) 및 Supervisory Text Prompt \(c\) 로 조건이 설정된 상태에서 사용됩니다. 이 모델은 이미지 생성 및 개인화에 사용됩니다. \(\alpha\) 와 \(\beta\) 는 상대적인 loss의 가중치를 제어하기 위한 hyperparameters 입니다. 이러한 hyperparameters 는 각 loss 항목의 중요성을 조절하는 데 사용됩니다.
-
Supervisory Text Prompt
-Supervisory Text Prompt는 이미지 생성을 지원하기 위한 텍스트 입력입니다. 주어진 텍스트 프롬프트는 이미지 생성에 대한 지시사항 또는 조건을 제공합니다. HyperDreamBooth에서는 “a [V] face” 와 같은 텍스트 프롬프트를 사용하여 개인화된 이미지를 생성합니다. [V] 는 드물지만 다양한 의미 수정을 삽입할 수 있는 역할을 합니다.
-
HyperNetwork Architecture
-HyperNetwork는 HyperDreamBooth에서 사용되는 모델로, 개인화된 이미지 생성을 위한 가중치를 예측하는 역할을 합니다. HyperNetwork는 보통 다른 신경망 구조로 구성되며, 주어진 이미지를 입력으로 받아서 T2I 모델의 가중치를 예측합니다. 이러한 개인화된 이미지 생성을 위한 핵심 구성 요소 중 하나입니다. 여기서 예측한 가중치를 이후 Stable Diffusion 모델의 가중치에 더하여 개인화를 실행합니다.
-
Iterative Prediction
-HyperDreamBooth에서 사용되는 HyperNetwork는 반복적 예측을 수행합니다. 이것은 HyperNetwork가 초기 예측을 한 후에도 추가 반복적인 예측 단계를 통해 결과를 개선하려고 시도하는 것을 의미합니다. 초기 HyperNetwork 예측은 방향성이 올바르고 대상과 얼굴과 유사한 semantic 특성을 생성하지만 미세만 세부 정보를 충분히 잡아내지 못할 수 있습니다. 따라서 반복적인 예측을 통해 초기 예측을 fine-tuning하고 더 나은 이미지를 생성합니다. 이 때에 image encoding은 단 한 번만 수행되며, 추출된 특징 f는 반복적인 예측 과정에서 사용됩니다.
초기 HyperNetwork를 실행하고 나면 semantic 속성과 방향성에 대해서 올바르게 생성이 되지만 세부적인 detail은 잘 잡아내지 못합니다. 이를 위해 마지막으로 fast finetuning 단계를 제안합니다. 이 단계를 통해, DreamBooth보다 훨씬 빠르지만 강한 subject fidelity, editability 그리고 style diversity를 동일하게 유지할 수 있습니다.
-먼저 HyperNetwork를 사용하여 개인화된 diffusion model 가중치를 예측합니다. 이후 diffusion model의 가중치를 초기화된 이미지 x와 함께 주어진 텍스트 지시어 c에 대한 diffusion noise loss \(L(x)\) 를 최소화하도록 조정합니다. 여기서 주요한 점은 rank-relaxed 의 개념입니다. 이것은 초기 모델의 rank(주로 1)를 완화하여 더 높은 rank로 LoRA 모델을 fine tuning 하는 것을 의미합니다. 구체적으로, HyperNetwork의 예측된 가중치 모델의 전체 가중치에 추가하고 더 높은 rank로 LoRA fine tuning을 수행합니다. 이를 통해 모델은 주체의 고주파수 세부 사항을 더 잘 근사화할 수 있으며 이로 인해 다른 낮은 rank로 제한된 업데이트보다 더 높은 주제 충실도를 달성할 수 있습니다. 이러한 rank-relaxed의 개념은 HyperDreamBooth를 다른 방식보다 더 우수하게 만드는 요인입니다. 여기서도 동일한 Supervisory Text Prompt “a [V] face” 를 사용하는데 이 프롬프트는 이미지 개인화를 지원하며 모델이 얼굴에 관련된 다양한 특성과 스타일을 캡처하는 데 도움이 됩니다. 그리고 HyperNetwork의 초기화된 가중치를 고려할 때, fast finetuning 단계를 40번의 반복으로 완료할 수 있습니다. 이는 DreamBooth 및 LoRA DreamBooth와 비교했을 때 25배 빠른 속도라는 것을 의미합니다.
본 HyperDreamBooth는 Stable Diffusion v1.5 을 활용하여 구현했습니다. 이 모델에서는 Stable Diffusion v1.5의 다양한 요소 중 하나인 diffusion UNet의 cross and self-attention 레이어에 대한 LoRA 가중치를 예측합니다. 또한 텍스트 정보를 활용하기 위해 CLIP 텍스트 인코더도 예측합니다. 이미지 생성 모델을 개인화하기 위해 시각화에 사용되는 모든 얼굴 이미지는 SFHQ(Synthetic Face Headquarters) 데이터셋을 활용했습니다. 모델을 훈련시키기 위해 CelebA-HQ 데이터셋에서 15,000개의 실제 얼굴 이미지가 활용되었습니다.
위 표는 DreamBooth와 비교하는 부분입니다. DreamBooth의 hyperparameter를 다르게 조정하여 비교했습니다. 그 결과 학습률을 증가시키고 반복 횟수(iterations)를 감소시키면 결과의 저하가 있었습니다. DreamBooth-Agg-1은 400번의 반복을 시행하고, DreamBooth-Agg-2는 일반적인 Dreambooth의 1200번 대신 40번의 반복을 사용했습니다.
위 부분은 여러 가지 구성 요소로 나누어 실험한 표입니다. 실험 중에는 하이퍼네트워크를 사용하지 않는 경우, 하이퍼네트워크 예측만 사용하고 fast-finetuning을 사용하지 않은 경우, 반복 예측 없이 전체 방법을 1번만 사용한 경우를 비교합니다. 결과적으로 전체 방법이 모든 신뢰성 지표에서 가장 우수한 결과를 달성한다는 것을 보여주고 있습니다.
얼굴 인식 메트릭 이 특정 시나리오에서 상대적으로 약하다고 합니다. 얼굴 인식 네트워크가 실제 이미지에만 훈련되어 있고 다양한 스타일에서 동일한 사람을 인식하도록 훈련되어 있지 않기 때문이라고 주장하며 이를 보완하기 위해 user study를 진행했습니다. 여기서도 HyperDreamBooth, DreamBooth, Textual Inversion을 비교하고 사용자들의 평가를 받았습니다.
하지만 여전히 follow-ups가 존재합니다. 먼저 semantic directional error 라고 하는 초기 예측에서 잘못된 시맨틱 정보가 나올 수 있는 에러입니다. 잘못된 눈 색깔이나 헤어 타입, 성별 등이 나올 수 있습니다. 다음으로 incorrect subject detail capture 라는 오류가 있습니다. 다음은 underfitting 입니다. Fast finetuning 단계에서 identity는 지켜지더라도 유사하지 않은 샘플이 생성될 수 있습니다. 다음으로 HyperNetwork와 fast-finetuning 모두 일부 스타일에 대해 낮은 editability 가 나올 수 있습니다. 이러한 문제점은 빛, 포즈 등으로 인해 OOD인 샘플에서 나타날 수 있습니다.
본 연구에서는 HyperDreamBooth라는 새로운 방법을 소개했습니다. 이 방법은 텍스트에서 이미지로 변환하는 diffusion model을 빠르고 가벼운 방식으로 개인화하는 것을 목표로 합니다. HyperDreamBooth는 HyperNetwork라는 구성 요소를 활용하여 diffusion model의 가벼운 파라미터인 LiDB(Lightweight DreamBooth)파라미터를 생성하며, 이어서 DreamBooth 및 기타 최적화 기반 개인화 작업에 비해 크기와 속도를 상당히 줄이면서 fast rank-relaxed fine tuning을 수행합니다. 이를 통해 모델의 무결성을 유지하면서 다양한 스타일과 의미적 수정이 적용된 다양한 고품질 이미지를 생성할 수 있음을 입증하였습니다.
Personalization 는 Generative AI 분야에서 떠오르고 있는 주제입니다. 이는 high-fidelity와 identity를 유지한 상태로 다양한 맥락과 스타일을 생성할 수 있도록 합니다. 본 논문은 Dreambooth 를 기반으로 진행되었기 때문에 Dreambooth 논문을 먼저 읽어 보시기를 추천드립니다.
본 논문의 Contribution은 크게 3가지로 볼 수 있습니다. Lighweight DreamBooth (LiDB), New HyperNetwork architecture 그리고 rank-relaxed finetuning 입니다. 위 3가지 방법을 활용하여 기존 DreamBooth의 핵심 능력을 유지하면서 크기를 줄이고 속도를 높일 수 있었습니다.
Text-to-image Models
+본 논문에서는 Stable Diffusion 모델을 활용하여 HyperDreamBooth를 구현했지만, 이 부분은 다른 텍스트-이미지 모델 (Imagen, DALL-E2 등) 도 적용이 가능합니다.
+
Personalization of Generative Models
+Generative Adversarial Network 기반의 기술들은 fidelity가 떨어지거나 다양한 문맥을 제공하지 못하는 문제가 있습니다. 이에 따라 HyperNetwork를 도입한 연구를 진행했습니다.
+
T2I Personalization via Finetuning
+다음으로, text-to-image personalization을 위한 Finetuning에 대한 연구가 있습니다. CustomDiffusion, SVDiff, LoRA, StyleDrop, DreamArtist 등의 예시가 있습니다. 하지만 이는 속도 측면에서 느리다는 단점을 가지고 있습니다.
+
이러한 관련 연구들을 볼 때, HyperDreamBooth는 속도와 효율성 측면에서 큰 발전을 이루었다고 볼 수 있습니다.
+
+
+
+
Fig. 295 HyperDreamBooth Training and Fast Fine-Tuning#
HyperdreamBooth 의 핵심 기술 중 하나인 Lightweight DreamBooth, 줄여서 LiDB에 대해 설명드리겠습니다. LiDB는 rank-1 LoRA residuals의 가중치 공간을 더 세분화하는 것이 핵심 아이디어입니다. 분해 과정에서 rank-1 LoRA weight-space 내에서 random orthogonal basis를 활용하여 decompose 합니다.
이 접근 방식은 LoRA의 A와 B 행렬을 각각 두 개의 행렬로 분해하는 것으로도 이해할 수 있습니다. 더 구체적으로 살펴보면, A 행렬은 \(A_{aux}\) 와 \(A_{train}\) 으로 분해되며, B 행렬은 \(B_{aux}\) 와 \(B_{train}\) 으로 분해할 수 있습니다. 여기서 \(aux\) 레이어는 행별로 직교하는 벡터로 무작위 초기화되고 freeze 되어 있으며, \(train\) 레이어는 학습되는 가중치입니다. 따라서 LiDB 선형 레이어의 weight-residual은 다음과 같이 표현할 수 있습니다.
여기서 \(aux\) 레이어는 experimentally fix 되었으며 이 과정을 통해 trainable parameter 개수는 약 30K개, 사이즈는 약 120KB로 경량화 할 수 있습니다. 이렇게 작은 크기와 변수만으로 fidelity, editability, style 그리고 diversity 등을 유지할 수 있다는 것이 포인트입니다.
다음은 Hypernetwork 입니다. 본 논문에서는 사전에 훈련된 T2I 모델을 빠르게 personalization 하기 위해 HyperNetwork를 제안합니다. 여기서 \(\tilde{\theta}\) 는 모든 LiDB residual 행렬을 나타내며, 각 T2I 모델의 cross-attention 및 self-attention 레이어에 대한 \(A_{train}\) 및 \(B_{train}\) 입니다. 이 핵심 아이디어는 주어진 이미지 x를 입력으로 받고, 이 이미지를 사용하여 LiDB의 low-rank residual인 \(\hat{\theta}\) 을 예측하는 HyperNetwork \(H_{\eta}\) 를 돌입하는 것입니다.HyperNetwork는 도메인 특화 이미지 데이터셋에서 훈련되며, 일반적인 확산 노이즈 제거 손실과 가중치 공간 손실을 가지고 있습니다.
여기서 \(x\) 는 reference image를 의미합니다. HyperDreamBooth의 목표는 주어진 참조 이미지 x를 기반으로 해당 이미지와 유사한 새로운 이미지를 생성하는 것입니다. \(\theta\) 는 \(x\) 에 대한 pre-optimized 된 가중치 paramters입니다. 이러한 가중치는 HyperDreamBooth 모델을 personalization 하기 위해 이미지 \(x\) 와 관련된 텍스트와 함께 조정됩니다. \(D_{\theta}\) 는 diffusion model을 나타냅니다. 이 모델은 이미지 \(x + \epsilon\) 및 Supervisory Text Prompt \(c\) 로 조건이 설정된 상태에서 사용됩니다. 이 모델은 이미지 생성 및 개인화에 사용됩니다. \(\alpha\) 와 \(\beta\) 는 상대적인 loss의 가중치를 제어하기 위한 hyperparameters 입니다. 이러한 hyperparameters 는 각 loss 항목의 중요성을 조절하는 데 사용됩니다.
+
Supervisory Text Prompt
+Supervisory Text Prompt는 이미지 생성을 지원하기 위한 텍스트 입력입니다. 주어진 텍스트 프롬프트는 이미지 생성에 대한 지시사항 또는 조건을 제공합니다. HyperDreamBooth에서는 “a [V] face” 와 같은 텍스트 프롬프트를 사용하여 개인화된 이미지를 생성합니다. [V] 는 드물지만 다양한 의미 수정을 삽입할 수 있는 역할을 합니다.
+
HyperNetwork Architecture
+HyperNetwork는 HyperDreamBooth에서 사용되는 모델로, 개인화된 이미지 생성을 위한 가중치를 예측하는 역할을 합니다. HyperNetwork는 보통 다른 신경망 구조로 구성되며, 주어진 이미지를 입력으로 받아서 T2I 모델의 가중치를 예측합니다. 이러한 개인화된 이미지 생성을 위한 핵심 구성 요소 중 하나입니다. 여기서 예측한 가중치를 이후 Stable Diffusion 모델의 가중치에 더하여 개인화를 실행합니다.
+
Iterative Prediction
+HyperDreamBooth에서 사용되는 HyperNetwork는 반복적 예측을 수행합니다. 이것은 HyperNetwork가 초기 예측을 한 후에도 추가 반복적인 예측 단계를 통해 결과를 개선하려고 시도하는 것을 의미합니다. 초기 HyperNetwork 예측은 방향성이 올바르고 대상과 얼굴과 유사한 semantic 특성을 생성하지만 미세만 세부 정보를 충분히 잡아내지 못할 수 있습니다. 따라서 반복적인 예측을 통해 초기 예측을 fine-tuning하고 더 나은 이미지를 생성합니다. 이 때에 image encoding은 단 한 번만 수행되며, 추출된 특징 f는 반복적인 예측 과정에서 사용됩니다.
초기 HyperNetwork를 실행하고 나면 semantic 속성과 방향성에 대해서 올바르게 생성이 되지만 세부적인 detail은 잘 잡아내지 못합니다. 이를 위해 마지막으로 fast finetuning 단계를 제안합니다. 이 단계를 통해, DreamBooth보다 훨씬 빠르지만 강한 subject fidelity, editability 그리고 style diversity를 동일하게 유지할 수 있습니다.
+먼저 HyperNetwork를 사용하여 개인화된 diffusion model 가중치를 예측합니다. 이후 diffusion model의 가중치를 초기화된 이미지 x와 함께 주어진 텍스트 지시어 c에 대한 diffusion noise loss \(L(x)\) 를 최소화하도록 조정합니다. 여기서 주요한 점은 rank-relaxed 의 개념입니다. 이것은 초기 모델의 rank(주로 1)를 완화하여 더 높은 rank로 LoRA 모델을 fine tuning 하는 것을 의미합니다. 구체적으로, HyperNetwork의 예측된 가중치 모델의 전체 가중치에 추가하고 더 높은 rank로 LoRA fine tuning을 수행합니다. 이를 통해 모델은 주체의 고주파수 세부 사항을 더 잘 근사화할 수 있으며 이로 인해 다른 낮은 rank로 제한된 업데이트보다 더 높은 주제 충실도를 달성할 수 있습니다. 이러한 rank-relaxed의 개념은 HyperDreamBooth를 다른 방식보다 더 우수하게 만드는 요인입니다. 여기서도 동일한 Supervisory Text Prompt “a [V] face” 를 사용하는데 이 프롬프트는 이미지 개인화를 지원하며 모델이 얼굴에 관련된 다양한 특성과 스타일을 캡처하는 데 도움이 됩니다. 그리고 HyperNetwork의 초기화된 가중치를 고려할 때, fast finetuning 단계를 40번의 반복으로 완료할 수 있습니다. 이는 DreamBooth 및 LoRA DreamBooth와 비교했을 때 25배 빠른 속도라는 것을 의미합니다.
본 HyperDreamBooth는 Stable Diffusion v1.5 을 활용하여 구현했습니다. 이 모델에서는 Stable Diffusion v1.5의 다양한 요소 중 하나인 diffusion UNet의 cross and self-attention 레이어에 대한 LoRA 가중치를 예측합니다. 또한 텍스트 정보를 활용하기 위해 CLIP 텍스트 인코더도 예측합니다. 이미지 생성 모델을 개인화하기 위해 시각화에 사용되는 모든 얼굴 이미지는 SFHQ(Synthetic Face Headquarters) 데이터셋을 활용했습니다. 모델을 훈련시키기 위해 CelebA-HQ 데이터셋에서 15,000개의 실제 얼굴 이미지가 활용되었습니다.
위 표는 DreamBooth와 비교하는 부분입니다. DreamBooth의 hyperparameter를 다르게 조정하여 비교했습니다. 그 결과 학습률을 증가시키고 반복 횟수(iterations)를 감소시키면 결과의 저하가 있었습니다. DreamBooth-Agg-1은 400번의 반복을 시행하고, DreamBooth-Agg-2는 일반적인 Dreambooth의 1200번 대신 40번의 반복을 사용했습니다.
위 부분은 여러 가지 구성 요소로 나누어 실험한 표입니다. 실험 중에는 하이퍼네트워크를 사용하지 않는 경우, 하이퍼네트워크 예측만 사용하고 fast-finetuning을 사용하지 않은 경우, 반복 예측 없이 전체 방법을 1번만 사용한 경우를 비교합니다. 결과적으로 전체 방법이 모든 신뢰성 지표에서 가장 우수한 결과를 달성한다는 것을 보여주고 있습니다.
얼굴 인식 메트릭 이 특정 시나리오에서 상대적으로 약하다고 합니다. 얼굴 인식 네트워크가 실제 이미지에만 훈련되어 있고 다양한 스타일에서 동일한 사람을 인식하도록 훈련되어 있지 않기 때문이라고 주장하며 이를 보완하기 위해 user study를 진행했습니다. 여기서도 HyperDreamBooth, DreamBooth, Textual Inversion을 비교하고 사용자들의 평가를 받았습니다.
하지만 여전히 follow-ups가 존재합니다. 먼저 semantic directional error 라고 하는 초기 예측에서 잘못된 시맨틱 정보가 나올 수 있는 에러입니다. 잘못된 눈 색깔이나 헤어 타입, 성별 등이 나올 수 있습니다. 다음으로 incorrect subject detail capture 라는 오류가 있습니다. 다음은 underfitting 입니다. Fast finetuning 단계에서 identity는 지켜지더라도 유사하지 않은 샘플이 생성될 수 있습니다. 다음으로 HyperNetwork와 fast-finetuning 모두 일부 스타일에 대해 낮은 editability 가 나올 수 있습니다. 이러한 문제점은 빛, 포즈 등으로 인해 OOD인 샘플에서 나타날 수 있습니다.
본 연구에서는 HyperDreamBooth라는 새로운 방법을 소개했습니다. 이 방법은 텍스트에서 이미지로 변환하는 diffusion model을 빠르고 가벼운 방식으로 개인화하는 것을 목표로 합니다. HyperDreamBooth는 HyperNetwork라는 구성 요소를 활용하여 diffusion model의 가벼운 파라미터인 LiDB(Lightweight DreamBooth)파라미터를 생성하며, 이어서 DreamBooth 및 기타 최적화 기반 개인화 작업에 비해 크기와 속도를 상당히 줄이면서 fast rank-relaxed fine tuning을 수행합니다. 이를 통해 모델의 무결성을 유지하면서 다양한 스타일과 의미적 수정이 적용된 다양한 고품질 이미지를 생성할 수 있음을 입증하였습니다.
📌 문제상황
-text-to-image diffusion model(T2I diffusion model)이 생성하는 이미지 품질은 훌륭하지만 text prompt를 통해 원하는 형태의 이미지를 생성하는 것이 어렵다. 복잡한 prompt engineering을 시도하거나, image prompt를 활용할 수도 있지만 사전학습된 모델을 fine-tuning하게 되면 많은 리소스가 필요할 뿐만 아니라 해당 방식은 범용성, 호환성도 떨어진다.
-
-📌 해결방안
-cross-attention을 text features와 image features로 decoupling한다. 기존 학습된 diffusion model은 text feature에 맞춰 학습된 상태이므로 기존 layer에 image feature를 넣게 되면 image feature와 text feature를 align을 수행하게 되므로 기존 cross-attention layer 하나를 통해 image-feature와 text-feature를 결합하는 것은 적절하지 않다.
-
-📌 논문의 강점
:image prompt의 필요성과 기존 연구에서 image prompt를 사용해 이미지를 생성하려는 시도의 종류와 장단점을 말한다.
-
복잡한 scene이나 concept을 입력할때 이미지 형태로 입력하는 것이 간편하고 효과적이다.
-image prompt + text prompt(“an image is worth a thousand words”)
-
-
-
-
Fig. 269 “내츄럴 풍으로 카페를 꾸미고 여러 식물을 두어 장식하고 싶어. 내가 좋아하는 식물은 스노우 사파이어, 호야, 자미오쿨카스등 이고, 의자와 테이블은 원목을 선호해.”#
-
-
-
DALL-E2는 처음으로 image prompt를 지원한 모델으로, T2I prior model이 image embedding을 조건으로 이미지를 생성하도록 했다. 하지만 기존 대부분의 T2I 모델은 주로 text를 조건으로 이미지를 생성하는 방식이었다. 예를 들어 stable diffusion(SD) 모델의 경우 CLIP text encoder로 부터 text embedding을 뽑아내 사용했다.
-
본 논문에서는 “image prompt를 기존 T2I 모델에서 사용할 수 있는지”, image prompt를 사용한 T2I 이미지 생성을 단순한 방식으로 가능케 한다.
SD Image Variations와 Stable UnCLIP과 같은 기존 연구에서 image prompt를 사용한 이미지 생성을 위해 text-conditioned diffusion models을 image embedding을 사용해 직접 fine-tuning하려는 시도를 했다. 하지만 많은 양의 컴퓨터 리소스 사용과 기존 T2I 생성능력 저하, 재사용성 저하라는 단점이 있었다. 또한 해당 방식은 ControlNet과 같은 기존 structural control tools과 호환되지 않았다. 이는 downstream application에 치명적이다.
-
이를 피하기 위해 diffusion model 자체를 fine-tuning하지 않고 text encoder를 image encoder로 교체하는 방식도 있었지만 text prompt를 지원할 수 없게 되고 이미지 품질이 충분하지 않다는 단점이 있었다.
-
최근에는 T2I base model을 건드리지 않고 추가적인 네트워크를 이용해 image prompt를 지원하는 연구들이 있었다. ControlNet, T2I-Adapter와 같은 연구들은 대부분 sketch, depth map, segmenation map 등의 추가적인 입력을 활용했다. 또한 T2I-Adapter나 Uni-ControlNet 같이reference image를 입력해 style 이나 concept을 전달하려는 시도도 있었다. 이런 흐름의 연구들은 CLIP image encoder에서 image embedding을 추출하여 추가 trainable network에 새로운 feature들을 mapping하여 text feature와 융합하고자 했다. 기존 text feature대신 text feature+image feature를 디퓨전 모델 내 UNet 구조에 넣어 prompt에 넣은 이미지에 적합한(faithful) 이미지를 생성하고자 했다. 이런 연구들을 통해 image prompt의 가능성을 볼수 있었지만 그 충실도가 충분하지 않았다. 또한 이미지 품질이 fine-tuning된 image prompt model보다 나빴다.
본 논문에서는 앞서 언급한 문제점의 원인을 T2I model내의 cross-attention이라고 보고 있다. 사전학습된 cross-attention에서 key, value projection weights은 text feature에 맞게 훈련되어 잇는 상태이다.
-결과적으로 image feature와 text feature를 cross-attention layer에서 합쳐지는데 이때 image-specific 특성들이 무시되어 reference image에 아주 충실한 이미지를 생성하지 못하고 coarse-grained controllable generation(e.g., image style)만 달성 가능해진다.
-
마지막으로 앞선 연구의 문제점들을 극복한 효과적인 image prompt adapter, IP-Adapter를 제안한다. 특히 IP-Adapter의 경우 decoupled cross-attention mechanism을 사용해 text feature와 image feature를 분리한다. image feature를 위해 base model내 모든 UNet cross-attention layer에 cross-attention layer 를 추가하여 훈련단계에서는 적은 수의 파라미터(22M)만 훈련한다. 본 논문에서 제안하는 IP-Adapter는 매우 가볍고 효과적이다. 또한 일반화 능력(generalization capability)가 높고 text prompt와도 잘 어울린다(compatible).
-
IP-Adapter에서 제안하는 방식
-
-
additional cross-attention layer in UNet of diffusion model
-
reusable and flexible (base + IP-Adapter + ControlNet가능)
-
multimodal compatibility (image prompt + text prompt)
large T2I model은 크게 autoregressive models, diffusion models 두 부류로 나눌 수 있다. DALLE, CogView, Make-A-Scene과 같은 초기 연구들은 autoregressive model 이었다. autoregressive model은 VQ-VAE와 같은 image tokenizer를 사용해 image들을 token화 하여 autoregressive transformer에 text token을 이용해 image token을 예측하게 하는 방식으로 학습했다. 하지만 autoregressive model은 파라미터 수가 많고 고화질 이미지를 생성하기 위해 많은 리소스가 필요했다.
-
최근에는 diffusion models(DM)이 등장하여 T2I 생성모델의 state-of-the-art를 달성했다. 이전에 GLIDE는 cascaded diffusion 구조를 통해 64x64 → 256x256 이미지를 생성했다.
-DALL-E2의 경우, text prompt로 이미지를 생성하도록 학습된 모델을 활용해 image embedding을 조건으로 이미지를 생성했다. DALL-E2는 text prompt를 통한 이미지 생성을 지원하지 않았다. text 이해도를 높이기 위해 Imagen은 거대 transformer language model인 T5를 도입했다. Re-Imagen의 경우 드물거나 학습한적없는 entity에 대한 image에 대한 충성도를 개선했다.
-SD는 latent diffusion model로 pixel space가 아닌 latent space상에서 동작하게 하여 diffusion model만 사용하여 고품질의 이미지를 생성할 수 있게 했다. text 일치도(alignment)를 높이기 위해 eDiff-I의 경우 T2I diffusion model과 유사한 디자인을 채택하여 T5 text, CLIP text embedding, CLIP image embedding등 멀티모달 조건을 활용했다. Versatile Diffusion은 unified multi-flow diffusion framework를 이용해 T2I, I2T, 등 다양한 생성방식을 하나의 모델로 가능하게 했다. controllable image 생성 면에서는 Composer가 image embedding을 활용한 joint fine-tuning을 시도했었다. RAPHAEL은 mixture of experts(MoEs) 전략을 사용해 T2I model의 이미지 품질을 향상시켰다.
-
DALL-E2는 image prompt를 통해 해당 풍의 이미지들을 생성할 수 있다는 점에서 매력적이다. 또한 image prompt를 T2I model에서 지원하고자 하는 연구들이 있다. SD Image Variants model은 변경한 SD를 fine-tuning하여 text feature를 CLIP image encoder의 image embedding으로 교체할 수 있게 했다. Stable unCLIP 또한 SD를 fine-tuning하여 time embedding에 image embedding을 추가했다. 기존 모델을 fine-tuning하는 방식은 고품질의 이미지를 생성 할 수 있다는 장점이 있지만 비교적 training cost가 높으며 기존 tools(e.g.,ControlNet)과 호환되지 않는다는 단점이 있다.
거대한 사전학습된 모델 전체를 fine-tuning하는 것은 비효율적이다. 이 대안으로 떠오르는 것이 adapter를 사용하는 것인데, 기존 모델은 freeze시켜 학습하는 파라미터 수를 줄일 수 있다. adapter는 NLP에서 오랫동안 사용되던 방식이다. 최근에는 LLM의 vision-language 이해를 위해 adapter를 사용하고 있다.
-
T2I model의 최근 인기로 인해 adapter들도 여기에 추가적인 control을 주는 방향으로 사용되고 있다. ControlNet(아래 사진 참고)의 경우 사전학습된 T2I diffusion model에 task-specific한 입력
-(e.g.,canny edge)을 추가적으로 넣기위해 adapter를 사용할 수 있다는 것을 보여주었다. 유사한 시기에 T2I-Adapter(아래 사진 참고)도 등장했는데 보다 간단하고 가벼운 형태로 색이나 구조적인 면에서
-fine-grained control을 주고자 했다. fine-tuning에 사용되는 비용을 줄이기 위해 Uni-ControlNet은 multi-scale condition injection을 사용했다.
-
structural control외에 이미지 집합을 통해 content나 style을 조절하고자 한 연구도 있다. ControlNet Shuffle의 경우 이미지들을 recompose하도록 학습하여 사용자가 제공한 이미지들을 바탕으로 이미지를 생성 할 수 있었다. 또한 ControlNet Reference-only의 경우, 학습없이 SD에 feature injection을 통해 이미지를 변형했다. T2I-Adapter의 최근 버전의 경우, CLIP image encoder로 부터 reference image의 image feature를 text feature에 더해줌으로서 style adapter로서의 역할도 가능하다. Uni-ControlNet(아래 사진 참고)의 global control adapter 또한 CLIP image encoder로 부터 추출한 image embedding을 작은 네트워크를 통해 projection하 condition embedding으로 projection하여 사용한다. SeeCoder(아래 사진 참고)는 기존 text encoder를 semantic context encoder로 교체하여 image variants를 생성하고자 했다.
\(x_0\) 는 real data, \(\mathbf c\) 는 추가조건, \(t\) 는 time step을 말하며 \([0,T]\) 내에 속한다. \(x_t=\alpha_t x_0+\sigma_t\epsilon\)은 step t에 해당하는 noisy data를 말하고, \(\alpha_t, \sigma_t\)는 diffusino process를 결정하는 predefined function이다. \(\epsilon_\theta\)가 한번 학습되고 나면 랜덤 노이즈로부터 이미지를 반복적으로 생성할 수 있다. 일반적으로 생성 속도를 높이기 위해 DDIM, PNDM, DPM-solver와 같은 fast sampler를 inference시 사용한다.
-
conditional diffusion model에서 classifier guidance를 통해 이미지 정확도(fidelity)와 다양성(sample diversity)를 밸런싱할 수 있다. 이는 따로 학습된 classifier의 gradient를 활용하는데, classifier를 따로 학습하는 번거로움을 지우기 위해 classifier-free guidance를 사용하기도 한다. 이런 접근에서 conditional, unconditional diffusion models는 학습시 랜덤하게 조건 \(c\) 를 배제하여 합동 학습(joint training)된다. sampling단계 에서는 conditional model과 unconditional model의 prediction을 모두 이용하여 noise를 계산한다.
\(\mathcal w\)은 guidance scale 혹은 guidance weight로 불리는데 condition \(c\)의 영향력을 조절하기 위한 상수값이다. T2I diffusion model의 경우 image-text 일치성을 높이는데 classifier-free guidance가 큰 역할을 한다.
-
본 논문에서는 open-source SD에 IP-Adapter를 덧붙여 실험을 진행했다. SD는 latent diffusion model로 frozen CLIP text encoder로 뽑아낸 text feature를 condition으로 사용한다. diffusion model은 Unet에 attention layer가 추가된 형태이다. Imagen과 같은 pixel-based diffusion model과 비교해 SD는 사전학습된 auto-encoder model을 활용해 latent space에서 동작하므로 효율적이다.
pretained CLIP image encoder를 사용해 image prompt에서 image feature를 뽑아냈다. CLIP은 multimodal model로 거대 image-text pair 데이터셋으로 contrastive learning시킨 모델이다. CLIP image encoder를 통해 global image embedding을 얻었다. 이는 image로 부터 풍부한 내용(content)와 스타일을 담은 image caption과 잘 조정되어(well-aligned) 있다. 학습단계에서 CLIP image encoder는 frozen되어 학습되지 않는다.
-
Decoupled Cross-Attention
-
image feature는 사전학습된 UNet에 decoupled cross-attention을 통해 결합된다. 초기 SD model에서는 CLIP text encoder를 통해 뽑아낸 text feature를 UNet의 cross-attention layer에 넣었다.
query feature는 \(Z\), text feature는 \(c_t\), cross-attention의 결과는 \(Z’\)이고, \(\mathbf{Q=ZW_q, K=c_t W_k, V=c_t W_v}\)는 attention 연산의 각각 query, key, value 행렬이다. \(\mathbf{W_q, W_k, W_v}\)는 linear projection layers의 학습가능한 weigth matrices다.
-
image feature를 이미지 생성에 반영하는 직관적인 방법은 cross-attention시 text feature+image feature로 결합(concatenate)하여 처리하는 것이다. 하지만 이 방법은 충분하지 않다는 것을 발견하여 decoupled cross-attention을 제안한다. 이는 cross-attention 에서 image feature와 text feature를 따로 처리하는 것이다. 구체적으로는 기존 cross-attention layer가 존재하던 곳에 새로운 cross-attention layer를 추가하여 image feature를 처리하도록 했다. image feature \(c_i\)가 주어질때 새로운 attention layer의 결과는 다음과 같다.
\(\mathbf{Q=ZW_q}\), \(\mathbf{K'=c_t W'_k}\) , \(\mathbf{V'=c_t W'_v}\) 는 image feature를 위한 query, key, value 행렬이다. 여기서 핵심은 text cross-attention과 image cross-attention에서 동일한 qeury를 사용했다는 점이다. 결과적으로는 각 cross-attention layer 마다 2개의 파라미터 \(\mathbf{W'_k,W'_v}\) 를 추가하게 된다. 수렴속도를 높이기 위해 \(\mathbf{W'_k,W'_v}\)는 \(\mathbf{W_k,W_v}\)로 초기화했다. 그러면 두 cross-attention layer의 결과를 더함으로써 최종 결과를 구할 수 있다. decoupled cross-attention의 최종적인 형태는 다음과 같다.
image condition이 drop되면 CLIP image embedding은 0으로 처리했다. text cross-attention과 image cross-attention을 detach되며 inference시 image condition의 가중치도 조절할 수 있다. \(\lambda\) 가 0이 되면 기존 T2I 모델이 된다.
(실험 결과를 보고 IP-Adapter를 활용해 생성한 이미지가 reference와 지나치게 유사하다는 생각이 들었습니다. 몇몇은 그냥 좌우반전을 한것처럼 느껴졌습니다. 흔히 GAN에서 말하는 Model Collapse와 같은 현상이 아닌가 싶어 다양성이 낮아보이는 결과가 의아했으나, conclusion에서 이 단점을 언급합니다.)
IP-Adapter는 CLIP image encoder로 부터 추출한 global image embedding를 사용하기 때문에 reference image의 일부 특성을 잃어버릴 수 있다. 따라서 fine-grained feature를 위한 IP-Adapter를 디자인했다. 첫번째로 CLIP image encoder에서 penultimate layer에서 grid feature를 뽑아낸다. 이후 작은 query network를 이용해 feature를 학습한다. grid feature로 부터 정보를 뽑아내기 위해 lightweight transformer를 사용해 learnable 16 token들을 정의한다. 이 token feature들을 query network의 cross-attention layer에 입력으로 넣어준다.
-
두 adapter의 생성 결과를 비교하면 finer-grained feature를 이용하면 보다 image prompt와 가까운 결과를 얻을 수 있다. finer-grained feature는 spatial structure information을 학습하여 생성된 이미지의 diversity를 낮추는 결과를 초래할 수 있으나 추가적인 조건(text prompt, structure map)을 활용하면 다양한 이미지를 만들 수 있다. 예를 들어 위의 그림과 같이 사진+pose를 통해 이미지를 생성 할 수 있다.
본 연구에서는 사전 학습된 T2I diffusion model에 image prompt capability를 달성하기 위해 IP-Adapter를 제안한다. IP-Adapter의 핵심 디자인은 decoupled cross-attention으로 image feature를 분리하여 cross-attention을 수행한다. 고작 22M parameter가 추가된 IP-Adapter는 qualitative, quantitative experimental results 모두에서 비등하거나 나은 성능을 보인다. 또한 IP-Adapter는 확장성이 좋아 한번 훈련된 뒤, 다른 custom model, structural controllable tools에 곧바로 덧붙여 사용할 수도 있다. 더욱 중요한 점은 image prompt를 text prompt와 더애 멀티모달 이미지 생성을 가능케한다는 점이다.
-
IP-Adapter는 효과적이지만 reference image와 content, style이 유사한 이미지만 생성할 수 있다는 단점이 있을 수 있다. 때문에 Textual Inversion이나 DreamBooth와 같이 특정 이미지 집합 풍의 이미지를 생성하지는 못한다. 미래에 consistency를 향상시킨 더 강력한 Image prompt adapter를 개발하는 것이 목표다.
📌 문제상황
+text-to-image diffusion model(T2I diffusion model)이 생성하는 이미지 품질은 훌륭하지만 text prompt를 통해 원하는 형태의 이미지를 생성하는 것이 어렵다. 복잡한 prompt engineering을 시도하거나, image prompt를 활용할 수도 있지만 사전학습된 모델을 fine-tuning하게 되면 많은 리소스가 필요할 뿐만 아니라 해당 방식은 범용성, 호환성도 떨어진다.
+
+📌 해결방안
+cross-attention을 text features와 image features로 decoupling한다. 기존 학습된 diffusion model은 text feature에 맞춰 학습된 상태이므로 기존 layer에 image feature를 넣게 되면 image feature와 text feature를 align을 수행하게 되므로 기존 cross-attention layer 하나를 통해 image-feature와 text-feature를 결합하는 것은 적절하지 않다.
+
+📌 논문의 강점
:image prompt의 필요성과 기존 연구에서 image prompt를 사용해 이미지를 생성하려는 시도의 종류와 장단점을 말한다.
+
복잡한 scene이나 concept을 입력할때 이미지 형태로 입력하는 것이 간편하고 효과적이다.
+image prompt + text prompt(“an image is worth a thousand words”)
+
+
+
+
Fig. 269 “내츄럴 풍으로 카페를 꾸미고 여러 식물을 두어 장식하고 싶어. 내가 좋아하는 식물은 스노우 사파이어, 호야, 자미오쿨카스등 이고, 의자와 테이블은 원목을 선호해.”#
+
+
+
DALL-E2는 처음으로 image prompt를 지원한 모델으로, T2I prior model이 image embedding을 조건으로 이미지를 생성하도록 했다. 하지만 기존 대부분의 T2I 모델은 주로 text를 조건으로 이미지를 생성하는 방식이었다. 예를 들어 stable diffusion(SD) 모델의 경우 CLIP text encoder로 부터 text embedding을 뽑아내 사용했다.
+
본 논문에서는 “image prompt를 기존 T2I 모델에서 사용할 수 있는지”, image prompt를 사용한 T2I 이미지 생성을 단순한 방식으로 가능케 한다.
SD Image Variations와 Stable UnCLIP과 같은 기존 연구에서 image prompt를 사용한 이미지 생성을 위해 text-conditioned diffusion models을 image embedding을 사용해 직접 fine-tuning하려는 시도를 했다. 하지만 많은 양의 컴퓨터 리소스 사용과 기존 T2I 생성능력 저하, 재사용성 저하라는 단점이 있었다. 또한 해당 방식은 ControlNet과 같은 기존 structural control tools과 호환되지 않았다. 이는 downstream application에 치명적이다.
+
이를 피하기 위해 diffusion model 자체를 fine-tuning하지 않고 text encoder를 image encoder로 교체하는 방식도 있었지만 text prompt를 지원할 수 없게 되고 이미지 품질이 충분하지 않다는 단점이 있었다.
+
최근에는 T2I base model을 건드리지 않고 추가적인 네트워크를 이용해 image prompt를 지원하는 연구들이 있었다. ControlNet, T2I-Adapter와 같은 연구들은 대부분 sketch, depth map, segmenation map 등의 추가적인 입력을 활용했다. 또한 T2I-Adapter나 Uni-ControlNet 같이reference image를 입력해 style 이나 concept을 전달하려는 시도도 있었다. 이런 흐름의 연구들은 CLIP image encoder에서 image embedding을 추출하여 추가 trainable network에 새로운 feature들을 mapping하여 text feature와 융합하고자 했다. 기존 text feature대신 text feature+image feature를 디퓨전 모델 내 UNet 구조에 넣어 prompt에 넣은 이미지에 적합한(faithful) 이미지를 생성하고자 했다. 이런 연구들을 통해 image prompt의 가능성을 볼수 있었지만 그 충실도가 충분하지 않았다. 또한 이미지 품질이 fine-tuning된 image prompt model보다 나빴다.
본 논문에서는 앞서 언급한 문제점의 원인을 T2I model내의 cross-attention이라고 보고 있다. 사전학습된 cross-attention에서 key, value projection weights은 text feature에 맞게 훈련되어 잇는 상태이다.
+결과적으로 image feature와 text feature를 cross-attention layer에서 합쳐지는데 이때 image-specific 특성들이 무시되어 reference image에 아주 충실한 이미지를 생성하지 못하고 coarse-grained controllable generation(e.g., image style)만 달성 가능해진다.
+
마지막으로 앞선 연구의 문제점들을 극복한 효과적인 image prompt adapter, IP-Adapter를 제안한다. 특히 IP-Adapter의 경우 decoupled cross-attention mechanism을 사용해 text feature와 image feature를 분리한다. image feature를 위해 base model내 모든 UNet cross-attention layer에 cross-attention layer 를 추가하여 훈련단계에서는 적은 수의 파라미터(22M)만 훈련한다. 본 논문에서 제안하는 IP-Adapter는 매우 가볍고 효과적이다. 또한 일반화 능력(generalization capability)가 높고 text prompt와도 잘 어울린다(compatible).
+
IP-Adapter에서 제안하는 방식
+
+
additional cross-attention layer in UNet of diffusion model
+
reusable and flexible (base + IP-Adapter + ControlNet가능)
+
multimodal compatibility (image prompt + text prompt)
large T2I model은 크게 autoregressive models, diffusion models 두 부류로 나눌 수 있다. DALLE, CogView, Make-A-Scene과 같은 초기 연구들은 autoregressive model 이었다. autoregressive model은 VQ-VAE와 같은 image tokenizer를 사용해 image들을 token화 하여 autoregressive transformer에 text token을 이용해 image token을 예측하게 하는 방식으로 학습했다. 하지만 autoregressive model은 파라미터 수가 많고 고화질 이미지를 생성하기 위해 많은 리소스가 필요했다.
+
최근에는 diffusion models(DM)이 등장하여 T2I 생성모델의 state-of-the-art를 달성했다. 이전에 GLIDE는 cascaded diffusion 구조를 통해 64x64 → 256x256 이미지를 생성했다.
+DALL-E2의 경우, text prompt로 이미지를 생성하도록 학습된 모델을 활용해 image embedding을 조건으로 이미지를 생성했다. DALL-E2는 text prompt를 통한 이미지 생성을 지원하지 않았다. text 이해도를 높이기 위해 Imagen은 거대 transformer language model인 T5를 도입했다. Re-Imagen의 경우 드물거나 학습한적없는 entity에 대한 image에 대한 충성도를 개선했다.
+SD는 latent diffusion model로 pixel space가 아닌 latent space상에서 동작하게 하여 diffusion model만 사용하여 고품질의 이미지를 생성할 수 있게 했다. text 일치도(alignment)를 높이기 위해 eDiff-I의 경우 T2I diffusion model과 유사한 디자인을 채택하여 T5 text, CLIP text embedding, CLIP image embedding등 멀티모달 조건을 활용했다. Versatile Diffusion은 unified multi-flow diffusion framework를 이용해 T2I, I2T, 등 다양한 생성방식을 하나의 모델로 가능하게 했다. controllable image 생성 면에서는 Composer가 image embedding을 활용한 joint fine-tuning을 시도했었다. RAPHAEL은 mixture of experts(MoEs) 전략을 사용해 T2I model의 이미지 품질을 향상시켰다.
+
DALL-E2는 image prompt를 통해 해당 풍의 이미지들을 생성할 수 있다는 점에서 매력적이다. 또한 image prompt를 T2I model에서 지원하고자 하는 연구들이 있다. SD Image Variants model은 변경한 SD를 fine-tuning하여 text feature를 CLIP image encoder의 image embedding으로 교체할 수 있게 했다. Stable unCLIP 또한 SD를 fine-tuning하여 time embedding에 image embedding을 추가했다. 기존 모델을 fine-tuning하는 방식은 고품질의 이미지를 생성 할 수 있다는 장점이 있지만 비교적 training cost가 높으며 기존 tools(e.g.,ControlNet)과 호환되지 않는다는 단점이 있다.
거대한 사전학습된 모델 전체를 fine-tuning하는 것은 비효율적이다. 이 대안으로 떠오르는 것이 adapter를 사용하는 것인데, 기존 모델은 freeze시켜 학습하는 파라미터 수를 줄일 수 있다. adapter는 NLP에서 오랫동안 사용되던 방식이다. 최근에는 LLM의 vision-language 이해를 위해 adapter를 사용하고 있다.
+
T2I model의 최근 인기로 인해 adapter들도 여기에 추가적인 control을 주는 방향으로 사용되고 있다. ControlNet(아래 사진 참고)의 경우 사전학습된 T2I diffusion model에 task-specific한 입력
+(e.g.,canny edge)을 추가적으로 넣기위해 adapter를 사용할 수 있다는 것을 보여주었다. 유사한 시기에 T2I-Adapter(아래 사진 참고)도 등장했는데 보다 간단하고 가벼운 형태로 색이나 구조적인 면에서
+fine-grained control을 주고자 했다. fine-tuning에 사용되는 비용을 줄이기 위해 Uni-ControlNet은 multi-scale condition injection을 사용했다.
+
structural control외에 이미지 집합을 통해 content나 style을 조절하고자 한 연구도 있다. ControlNet Shuffle의 경우 이미지들을 recompose하도록 학습하여 사용자가 제공한 이미지들을 바탕으로 이미지를 생성 할 수 있었다. 또한 ControlNet Reference-only의 경우, 학습없이 SD에 feature injection을 통해 이미지를 변형했다. T2I-Adapter의 최근 버전의 경우, CLIP image encoder로 부터 reference image의 image feature를 text feature에 더해줌으로서 style adapter로서의 역할도 가능하다. Uni-ControlNet(아래 사진 참고)의 global control adapter 또한 CLIP image encoder로 부터 추출한 image embedding을 작은 네트워크를 통해 projection하 condition embedding으로 projection하여 사용한다. SeeCoder(아래 사진 참고)는 기존 text encoder를 semantic context encoder로 교체하여 image variants를 생성하고자 했다.
\(x_0\) 는 real data, \(\mathbf c\) 는 추가조건, \(t\) 는 time step을 말하며 \([0,T]\) 내에 속한다. \(x_t=\alpha_t x_0+\sigma_t\epsilon\)은 step t에 해당하는 noisy data를 말하고, \(\alpha_t, \sigma_t\)는 diffusino process를 결정하는 predefined function이다. \(\epsilon_\theta\)가 한번 학습되고 나면 랜덤 노이즈로부터 이미지를 반복적으로 생성할 수 있다. 일반적으로 생성 속도를 높이기 위해 DDIM, PNDM, DPM-solver와 같은 fast sampler를 inference시 사용한다.
+
conditional diffusion model에서 classifier guidance를 통해 이미지 정확도(fidelity)와 다양성(sample diversity)를 밸런싱할 수 있다. 이는 따로 학습된 classifier의 gradient를 활용하는데, classifier를 따로 학습하는 번거로움을 지우기 위해 classifier-free guidance를 사용하기도 한다. 이런 접근에서 conditional, unconditional diffusion models는 학습시 랜덤하게 조건 \(c\) 를 배제하여 합동 학습(joint training)된다. sampling단계 에서는 conditional model과 unconditional model의 prediction을 모두 이용하여 noise를 계산한다.
\(\mathcal w\)은 guidance scale 혹은 guidance weight로 불리는데 condition \(c\)의 영향력을 조절하기 위한 상수값이다. T2I diffusion model의 경우 image-text 일치성을 높이는데 classifier-free guidance가 큰 역할을 한다.
+
본 논문에서는 open-source SD에 IP-Adapter를 덧붙여 실험을 진행했다. SD는 latent diffusion model로 frozen CLIP text encoder로 뽑아낸 text feature를 condition으로 사용한다. diffusion model은 Unet에 attention layer가 추가된 형태이다. Imagen과 같은 pixel-based diffusion model과 비교해 SD는 사전학습된 auto-encoder model을 활용해 latent space에서 동작하므로 효율적이다.
pretained CLIP image encoder를 사용해 image prompt에서 image feature를 뽑아냈다. CLIP은 multimodal model로 거대 image-text pair 데이터셋으로 contrastive learning시킨 모델이다. CLIP image encoder를 통해 global image embedding을 얻었다. 이는 image로 부터 풍부한 내용(content)와 스타일을 담은 image caption과 잘 조정되어(well-aligned) 있다. 학습단계에서 CLIP image encoder는 frozen되어 학습되지 않는다.
+
Decoupled Cross-Attention
+
image feature는 사전학습된 UNet에 decoupled cross-attention을 통해 결합된다. 초기 SD model에서는 CLIP text encoder를 통해 뽑아낸 text feature를 UNet의 cross-attention layer에 넣었다.
query feature는 \(Z\), text feature는 \(c_t\), cross-attention의 결과는 \(Z’\)이고, \(\mathbf{Q=ZW_q, K=c_t W_k, V=c_t W_v}\)는 attention 연산의 각각 query, key, value 행렬이다. \(\mathbf{W_q, W_k, W_v}\)는 linear projection layers의 학습가능한 weigth matrices다.
+
image feature를 이미지 생성에 반영하는 직관적인 방법은 cross-attention시 text feature+image feature로 결합(concatenate)하여 처리하는 것이다. 하지만 이 방법은 충분하지 않다는 것을 발견하여 decoupled cross-attention을 제안한다. 이는 cross-attention 에서 image feature와 text feature를 따로 처리하는 것이다. 구체적으로는 기존 cross-attention layer가 존재하던 곳에 새로운 cross-attention layer를 추가하여 image feature를 처리하도록 했다. image feature \(c_i\)가 주어질때 새로운 attention layer의 결과는 다음과 같다.
\(\mathbf{Q=ZW_q}\), \(\mathbf{K'=c_t W'_k}\) , \(\mathbf{V'=c_t W'_v}\) 는 image feature를 위한 query, key, value 행렬이다. 여기서 핵심은 text cross-attention과 image cross-attention에서 동일한 qeury를 사용했다는 점이다. 결과적으로는 각 cross-attention layer 마다 2개의 파라미터 \(\mathbf{W'_k,W'_v}\) 를 추가하게 된다. 수렴속도를 높이기 위해 \(\mathbf{W'_k,W'_v}\)는 \(\mathbf{W_k,W_v}\)로 초기화했다. 그러면 두 cross-attention layer의 결과를 더함으로써 최종 결과를 구할 수 있다. decoupled cross-attention의 최종적인 형태는 다음과 같다.
image condition이 drop되면 CLIP image embedding은 0으로 처리했다. text cross-attention과 image cross-attention을 detach되며 inference시 image condition의 가중치도 조절할 수 있다. \(\lambda\) 가 0이 되면 기존 T2I 모델이 된다.
(실험 결과를 보고 IP-Adapter를 활용해 생성한 이미지가 reference와 지나치게 유사하다는 생각이 들었습니다. 몇몇은 그냥 좌우반전을 한것처럼 느껴졌습니다. 흔히 GAN에서 말하는 Model Collapse와 같은 현상이 아닌가 싶어 다양성이 낮아보이는 결과가 의아했으나, conclusion에서 이 단점을 언급합니다.)
IP-Adapter는 CLIP image encoder로 부터 추출한 global image embedding를 사용하기 때문에 reference image의 일부 특성을 잃어버릴 수 있다. 따라서 fine-grained feature를 위한 IP-Adapter를 디자인했다. 첫번째로 CLIP image encoder에서 penultimate layer에서 grid feature를 뽑아낸다. 이후 작은 query network를 이용해 feature를 학습한다. grid feature로 부터 정보를 뽑아내기 위해 lightweight transformer를 사용해 learnable 16 token들을 정의한다. 이 token feature들을 query network의 cross-attention layer에 입력으로 넣어준다.
+
두 adapter의 생성 결과를 비교하면 finer-grained feature를 이용하면 보다 image prompt와 가까운 결과를 얻을 수 있다. finer-grained feature는 spatial structure information을 학습하여 생성된 이미지의 diversity를 낮추는 결과를 초래할 수 있으나 추가적인 조건(text prompt, structure map)을 활용하면 다양한 이미지를 만들 수 있다. 예를 들어 위의 그림과 같이 사진+pose를 통해 이미지를 생성 할 수 있다.
본 연구에서는 사전 학습된 T2I diffusion model에 image prompt capability를 달성하기 위해 IP-Adapter를 제안한다. IP-Adapter의 핵심 디자인은 decoupled cross-attention으로 image feature를 분리하여 cross-attention을 수행한다. 고작 22M parameter가 추가된 IP-Adapter는 qualitative, quantitative experimental results 모두에서 비등하거나 나은 성능을 보인다. 또한 IP-Adapter는 확장성이 좋아 한번 훈련된 뒤, 다른 custom model, structural controllable tools에 곧바로 덧붙여 사용할 수도 있다. 더욱 중요한 점은 image prompt를 text prompt와 더애 멀티모달 이미지 생성을 가능케한다는 점이다.
+
IP-Adapter는 효과적이지만 reference image와 content, style이 유사한 이미지만 생성할 수 있다는 단점이 있을 수 있다. 때문에 Textual Inversion이나 DreamBooth와 같이 특정 이미지 집합 풍의 이미지를 생성하지는 못한다. 미래에 consistency를 향상시킨 더 강력한 Image prompt adapter를 개발하는 것이 목표다.
Latent Diffusion Models(LDMs)은 image generation 분야에서 좋은 성능을 보이고 있다. 그러나 아직까지는 느린 reverse process 때문에 사용자가 직접 사용하기에는 무리가 있다.
-따라서 LDMs을 가속화(Accelerate)하기 위한 기법들이 제안되어 왔는데 크게 2가지로 나눌 수 있다:
-
-
DDIM, DPM-Solver, DPM-Solver++ 등 ODE-Solver 기반 방법론.
-
LDM을 경량화 하기 위한 Distillation 기반 방법론.
-
-
ODE-Solver 방법론은 sampling step을 줄일 수 있지만 Classifier-free Guidance(CFG) 등을 사용할 때 Computation 적으로 Overhead가 있을 수 있다.
-Distillation 방법론 또한 Distillation 시 Computation적으로 Overhead가 있어 한계가 있다.
-ex)Guided Distill : 2 stage의 distillation 방식 + high resolution image 생성 한계
이에 반해 Consistency Models(CMs)에서 영감을 받은 Latent Consistency Models(LCMs)은 매우 좋은 대안이다. backward process를 augmented Probability Flow ODE(PF-ODE) problem으로 접근하여 반복적인 step을 획기적으로 줄일 수 있었다. LCMs은 1~4 step만으로도 높은 퀄리티의 고해상도 이미지를 생성해낼 수 있으며 큰 리소스가 필요하지 않다.
-
그러나 LCMs을 기반으로 하는 방법론은 새로운 데이터셋에 대해 finetuning이 필요하거나 pretrained LDMs을 필요로 하는 한계가 존재한다.
-
따라서 본 연구는 추가 학습없이 Stable Diffusion(SD)이나 SD-LoRA 등에 plug-in 해서 사용할 수 있는 LCM-LoRA를 제안한다. LCM-LoRA는 새로운 종류의 neural network 기반 PF-ODE Solver이며, 강력한 일반화 성능을 보여준다.
CMs의 핵심은 PF-ODE의 궤적의 points가 solution에 mapping 되는 function \((f: (x_t,t) \mapsto x_\epsilon)\)을 추정하는 것이다.
-쉽게 말해 어떤 step의 noise image 던지 \(x_0\) (정확히는 \(x_\epsilon\))의 결과가 나오는 function을 추정한다. 또한 각 timestep에 관한function의 결과값은 self-consistency를 만족해야 한다.
\(c_{skip}(\epsilon)=1\), \(c_{out}(\epsilon)=0\) 이기 때문에 \(f_\theta(x,\epsilon)=x\)를 만족한다. 위 수식은 미분 가능함을 증명하기 위한 수식이다. \(F_\theta\)는 심층신경망을 의미한다.
-
CMs은 scratch부터 학습하는 방식과 Distillation 방식으로 나뉘는데 보편적으로 Distillation이 사용된다. Distillation 방식은 지수평균이동(Exponential Moving Average, EMA)를 통해 self-consistency를 학습할 수 있다:
\(\theta^-\)는 \(\theta\)에 대한 EMA를 의미하며 \(d(\cdot, \cdot)\)은 두 sample 사이의 거리를 측정하는 지표이다. \(\hat{x}^{\phi}_{t_n}\)는 \(x_{t_{n+1}}\)에 대한 \(x_{t_n}\)을 추정한 값으로 다음과 같다:
\(\Phi\)는 numerical PF-ODE를 의미한다. (보통 DDIM을 사용하는 것 같다) 즉 \(x_{t_n}\)을 PF-ODE로 예측한 값을 입력으로 하는 예측값과 \(x_{t_{n+1}}\)을 입력으로 하는 예측값이 같도록 self-consistency를 비교하는 것이 핵심이다.
LCMs는 CMs와 다르게 Classifier-free Guidance(CFG)를 포함한 Distillation도 정의되어있다.(\(\tilde{\epsilon}_\theta\))
-
LCMs는 \(t_n\)과 \(t_{n+1}\)의 차이가 너무 적어 학습의 수렴이 늦어지게 된다 가정하고 \(t_n\)과 \(t_{n+k}\)의 consistency를 비교하는 Skipping timestep 방법을 제시했다. (k는 trade-off를 가지며 최적의 값은 20으로 지정.)
-
Latent Consistency Finetuning: 새로운 데이터셋에 대해 distillation할 때 LDMs를 학습 할 필요 없이 LCMs의 Consistency Distillation만 학습하여 사용할 수 있다.
LLM이나 Stable Diffusion과 같은 대규모 모델은 새로운 task로 fine-tuning 시 매우 큰 차원의 모델 파라미터를 다시 학습하기 때문에 매우 큰 Cost가 생긴다. (시간적, 자원적) 이때 weight의 차원은 줄이면서 변화량을 기록하는 또다른 weight를 만들어 더 효율적으로 계산하는 방식은 다음과 같이 나타낼 수 있다: (파라미터 \(\Theta\)에 대해 \(\Delta\Phi=\Delta\Phi(\Theta), |\Theta|<<|\Phi_0|\))
위 그림처럼 기존에는 d x d의 매우 큰 weight를 finetuning 해야 했지만, LoRA는 r만큼 압축된 weight matrix만 finetuning 하면 되기 때문에 훨씬 효율적이고 때에 따라 Fully fine-tuning 하는 방법들보다 더 좋은 성능을 보여주기도 한다. (그림은 이곳을 참고하였습니다.)
-
원본 논문의 LoRA는 LLM을 target으로 만들어졌기 때문에 Transformer의 query, key, value에 대한 parameter로 사용하였지만 Diffusion이나 다른 모델의 finetuning시에도 간단하게 사용 가능하다.
pre-trained parameter를 \(\theta_{pre}\), fine-tuning parameter를 \(\theta_{ft}\)라고 할때 task vector \(\tau\)는 \(\theta_{ft}-\theta_{pre}\)로 정의할 수 있다.
-이를 다양하게 조합하고 특히 d)처럼 task 간 analogy를 고려하여 연산하는 경우 새로운 task에 대한 성능을 높일 수 있다.
논문의 저자는 LCMs의 Distillation은 LDMs에 관한 일종의 fine-tuning으로 보고 LoRA를 적용하는 방법을 제안하였다.
-pre-trained 된 weight matrix \(W_0\)에 대하여 기울기 업데이트는 \(W_0+\Delta W=W_0+BA, W_0\in \mathbb{R}^{d\times k}, B\in \mathbb{R}^{d\times r}, A\in \mathbb{R}^{r\times k}\) 로 표현할 수 있으며 rank \(r \leq \min{(d,k)}\) 로 작은 값을 갖는다. \(W_0\)의 weight는 고정되며 input \(x\) 에 대한 forward pass는 다음과 같다:
-
-\[h=W_0x+\Delta Wx=W_0x+BAx. \tag{1}\]
-
위와같이 LCMs에 LoRA를 적용할 경우 학습 parameter를 크게 줄일 수 있어 효율적이다.
따라서 LCM-loRA는 기존 LCMs 보다 더 큰 모델의 훈련과 실사용이 가능하다. LCMs의 경우 SD-V1.5나 SD-V2.1의 base Stable Diffusion을 사용했지만, LCM-LoRA는 SDXL과 SSD-1B(Segmind)을 확장하여 사용하였다. large Model에서도 LCD을 적용했을 때 잘 적응하는 모습을 볼 수 있었다.
-
-
-
-
Fig. 567 1024 x 1024 resolution image results with CFG scale w=7.5#
LCM-LoRA는 sampling step을 줄이는 distillation에 LoRA를 적용하였다. LoRA는 이외에도 custionized datasets에 대해 fine-tuning할 때 주로 쓰이는데 이같은 style에 대한 LoRA와 LCM-LoRA가 추가 학습없이 바로 합쳐져 사용할 수 있음을 발견했다. 저자는 이 발견이 task arithmetic에 대한 관점으로 해석할 수 있다고 주장하였다.
LCM-LoRA의 fine-tuned parameter를 \(\tau_{LCM}\)이라 할 때, \(\tau_{LCM}\)은 acceleration vector라 할수 있다. 그리고 custom dataset에서 학습한 LoRA의 fine-tuned parameter를 \(\tau'\)이라 할 때, \(\tau'\)은 style vector라 할 수 있다. LCMs를 통해 custom dataset에 대한 image를 생성할 때, 파라미터는 다음과 같이 조합된다:
Latent Diffusion Models(LDMs)은 image generation 분야에서 좋은 성능을 보이고 있다. 그러나 아직까지는 느린 reverse process 때문에 사용자가 직접 사용하기에는 무리가 있다.
+따라서 LDMs을 가속화(Accelerate)하기 위한 기법들이 제안되어 왔는데 크게 2가지로 나눌 수 있다:
+
+
DDIM, DPM-Solver, DPM-Solver++ 등 ODE-Solver 기반 방법론.
+
LDM을 경량화 하기 위한 Distillation 기반 방법론.
+
+
ODE-Solver 방법론은 sampling step을 줄일 수 있지만 Classifier-free Guidance(CFG) 등을 사용할 때 Computation 적으로 Overhead가 있을 수 있다.
+Distillation 방법론 또한 Distillation 시 Computation적으로 Overhead가 있어 한계가 있다.
+ex)Guided Distill : 2 stage의 distillation 방식 + high resolution image 생성 한계
이에 반해 Consistency Models(CMs)에서 영감을 받은 Latent Consistency Models(LCMs)은 매우 좋은 대안이다. backward process를 augmented Probability Flow ODE(PF-ODE) problem으로 접근하여 반복적인 step을 획기적으로 줄일 수 있었다. LCMs은 1~4 step만으로도 높은 퀄리티의 고해상도 이미지를 생성해낼 수 있으며 큰 리소스가 필요하지 않다.
+
그러나 LCMs을 기반으로 하는 방법론은 새로운 데이터셋에 대해 finetuning이 필요하거나 pretrained LDMs을 필요로 하는 한계가 존재한다.
+
따라서 본 연구는 추가 학습없이 Stable Diffusion(SD)이나 SD-LoRA 등에 plug-in 해서 사용할 수 있는 LCM-LoRA를 제안한다. LCM-LoRA는 새로운 종류의 neural network 기반 PF-ODE Solver이며, 강력한 일반화 성능을 보여준다.
CMs의 핵심은 PF-ODE의 궤적의 points가 solution에 mapping 되는 function \((f: (x_t,t) \mapsto x_\epsilon)\)을 추정하는 것이다.
+쉽게 말해 어떤 step의 noise image 던지 \(x_0\) (정확히는 \(x_\epsilon\))의 결과가 나오는 function을 추정한다. 또한 각 timestep에 관한function의 결과값은 self-consistency를 만족해야 한다.
\(c_{skip}(\epsilon)=1\), \(c_{out}(\epsilon)=0\) 이기 때문에 \(f_\theta(x,\epsilon)=x\)를 만족한다. 위 수식은 미분 가능함을 증명하기 위한 수식이다. \(F_\theta\)는 심층신경망을 의미한다.
+
CMs은 scratch부터 학습하는 방식과 Distillation 방식으로 나뉘는데 보편적으로 Distillation이 사용된다. Distillation 방식은 지수평균이동(Exponential Moving Average, EMA)를 통해 self-consistency를 학습할 수 있다:
\(\theta^-\)는 \(\theta\)에 대한 EMA를 의미하며 \(d(\cdot, \cdot)\)은 두 sample 사이의 거리를 측정하는 지표이다. \(\hat{x}^{\phi}_{t_n}\)는 \(x_{t_{n+1}}\)에 대한 \(x_{t_n}\)을 추정한 값으로 다음과 같다:
\(\Phi\)는 numerical PF-ODE를 의미한다. (보통 DDIM을 사용하는 것 같다) 즉 \(x_{t_n}\)을 PF-ODE로 예측한 값을 입력으로 하는 예측값과 \(x_{t_{n+1}}\)을 입력으로 하는 예측값이 같도록 self-consistency를 비교하는 것이 핵심이다.
LCMs는 CMs와 다르게 Classifier-free Guidance(CFG)를 포함한 Distillation도 정의되어있다.(\(\tilde{\epsilon}_\theta\))
+
LCMs는 \(t_n\)과 \(t_{n+1}\)의 차이가 너무 적어 학습의 수렴이 늦어지게 된다 가정하고 \(t_n\)과 \(t_{n+k}\)의 consistency를 비교하는 Skipping timestep 방법을 제시했다. (k는 trade-off를 가지며 최적의 값은 20으로 지정.)
+
Latent Consistency Finetuning: 새로운 데이터셋에 대해 distillation할 때 LDMs를 학습 할 필요 없이 LCMs의 Consistency Distillation만 학습하여 사용할 수 있다.
LLM이나 Stable Diffusion과 같은 대규모 모델은 새로운 task로 fine-tuning 시 매우 큰 차원의 모델 파라미터를 다시 학습하기 때문에 매우 큰 Cost가 생긴다. (시간적, 자원적) 이때 weight의 차원은 줄이면서 변화량을 기록하는 또다른 weight를 만들어 더 효율적으로 계산하는 방식은 다음과 같이 나타낼 수 있다: (파라미터 \(\Theta\)에 대해 \(\Delta\Phi=\Delta\Phi(\Theta), |\Theta|<<|\Phi_0|\))
위 그림처럼 기존에는 d x d의 매우 큰 weight를 finetuning 해야 했지만, LoRA는 r만큼 압축된 weight matrix만 finetuning 하면 되기 때문에 훨씬 효율적이고 때에 따라 Fully fine-tuning 하는 방법들보다 더 좋은 성능을 보여주기도 한다. (그림은 이곳을 참고하였습니다.)
+
원본 논문의 LoRA는 LLM을 target으로 만들어졌기 때문에 Transformer의 query, key, value에 대한 parameter로 사용하였지만 Diffusion이나 다른 모델의 finetuning시에도 간단하게 사용 가능하다.
pre-trained parameter를 \(\theta_{pre}\), fine-tuning parameter를 \(\theta_{ft}\)라고 할때 task vector \(\tau\)는 \(\theta_{ft}-\theta_{pre}\)로 정의할 수 있다.
+이를 다양하게 조합하고 특히 d)처럼 task 간 analogy를 고려하여 연산하는 경우 새로운 task에 대한 성능을 높일 수 있다.
논문의 저자는 LCMs의 Distillation은 LDMs에 관한 일종의 fine-tuning으로 보고 LoRA를 적용하는 방법을 제안하였다.
+pre-trained 된 weight matrix \(W_0\)에 대하여 기울기 업데이트는 \(W_0+\Delta W=W_0+BA, W_0\in \mathbb{R}^{d\times k}, B\in \mathbb{R}^{d\times r}, A\in \mathbb{R}^{r\times k}\) 로 표현할 수 있으며 rank \(r \leq \min{(d,k)}\) 로 작은 값을 갖는다. \(W_0\)의 weight는 고정되며 input \(x\) 에 대한 forward pass는 다음과 같다:
+
+\[h=W_0x+\Delta Wx=W_0x+BAx. \tag{1}\]
+
위와같이 LCMs에 LoRA를 적용할 경우 학습 parameter를 크게 줄일 수 있어 효율적이다.
따라서 LCM-loRA는 기존 LCMs 보다 더 큰 모델의 훈련과 실사용이 가능하다. LCMs의 경우 SD-V1.5나 SD-V2.1의 base Stable Diffusion을 사용했지만, LCM-LoRA는 SDXL과 SSD-1B(Segmind)을 확장하여 사용하였다. large Model에서도 LCD을 적용했을 때 잘 적응하는 모습을 볼 수 있었다.
+
+
+
+
Fig. 567 1024 x 1024 resolution image results with CFG scale w=7.5#
LCM-LoRA는 sampling step을 줄이는 distillation에 LoRA를 적용하였다. LoRA는 이외에도 custionized datasets에 대해 fine-tuning할 때 주로 쓰이는데 이같은 style에 대한 LoRA와 LCM-LoRA가 추가 학습없이 바로 합쳐져 사용할 수 있음을 발견했다. 저자는 이 발견이 task arithmetic에 대한 관점으로 해석할 수 있다고 주장하였다.
LCM-LoRA의 fine-tuned parameter를 \(\tau_{LCM}\)이라 할 때, \(\tau_{LCM}\)은 acceleration vector라 할수 있다. 그리고 custom dataset에서 학습한 LoRA의 fine-tuned parameter를 \(\tau'\)이라 할 때, \(\tau'\)은 style vector라 할 수 있다. LCMs를 통해 custom dataset에 대한 image를 생성할 때, 파라미터는 다음과 같이 조합된다:
최근의 text-to-image generation 모델을 큰 발전을 이루었다. 하지만 이러한 모델들은 여전히 numeracy와 spatial reasoning을 요구하는 복잡한 프롬프트를 잘 반영하지 못하고 이미지를 생성하는 문제들이 있다. 그래서 본 논문에서는 LLM과 레이아웃 기반 이미지 생성모델을 활용하여 Diffusion model에서 프롬프트 이해 능력을 향상시키는 방법을 제안한다.
Diffusion model의 등장과 발전에 따라 T2I(Text to Image) generation 모델은 크게 발전되어왔다. 최근의 SDXL 모델을 보면 상당한 quality의 이미지를 생성하는 것을 볼 수 있다. 그럼에도 불구하고, diffusion model은 복잡한 프롬프트를 잘 반영해서 이미지를 생성하는 것에 취약한 점을 보인다. 위의 figure를 보면 크게 Negation, Generative Numeracy, Attribute Binding, Spatial Relationships에서 큰 문제점을 보임을 알 수 있다.
-
가장 단순히 위의 문제를 해결하는 방법은 복잡한 프롬프트가 포함된 대규모의 multi-modal dataset을 가지고 모델을 훈련하는 방법이다. 하지만 이러한 방법은 시간과 리소스 측면에서 좋지못한 면이 있으며, 좋은 quality의 multi-modal dataset을 대규모로 확보하는 것 조차 쉽지 않은 일이다.
-
이러한 문제를 피하면서 위의 figure의 대표적인 문제점을 해결하기 위해 본 논문에서는 LLM 및 Layout to Image Generation 모델을 활용하여 training-free 방법으로 접근한다.
주어진 prompt에 대해서 LLM을 활용하여 표현되어야 할 foreground object에 대한 layout을 생성한다. prompt로 부터 foreground object들을 해당 attribute과 함께 parsing을 하고 reasoning을 통해 올바른 bounding box coordinate을 얻는 것이 목표인 단계이다. LLM의 In-Context Learning(7-shot)을 활용하여 LLM을 Layout Generator로써 활용한다.
-
-
Stage2
-
Stage1으로 부터 각각의 foreground object에 대한 caption과 bounding box coordinate을 기반으로 실제 해당 bounding box에 해당 caption이 생성되도록 하는 단계이다. 이 과정에서 training-free 방법을 적용하기 위해 Stable Diffusion의 inference과정에서 attention map을 manipulate 하는 방법을 통해 Layout to image generation을 가능케한다.
-
-
-
본 논문의 main contribution은 다음과 같다.
-
-
We propose a training-free two-stage generation pipeline that introduces LLMs to improve the prompt understanding ability of text-to-image diffusion models.
-
We introduce layout-grounded Stable Diffusion, a novel controller that steers an off-the-shelf diffusion model to generate images grounded on instance-level box layouts from the LLM.
-
LMD enables instruction-based scene specification and allows broader language support in the prompts.
-
We propose a benchmark to assess the prompt understanding ability of a text-to-image model and demonstrate the superior performance of LMD over recent baselines.
우선 이 단계에서의 prompt는 다음과 같이 구성되어 있다. prompt의 가장 윗단인 Instruction을 보면 LLM에게 정보를 주는 말들로 이루어져 있으며 Task specification과 supporting details로 이루어져 있음을 알 수 있다. LLM에게 직접적으로 해야할 일들과 정보를 주는 prompt라고 볼 수 있다.
Overview Prompt의 In-context Examples에 관련된 부분이다. 이 부분을 통해 input prompt로 부터 원하는 형태로 output값을 얻을 수 있다. LLM을 직접 학습시키지 않고 few shot example을 통해 LLM으로 부터 원하는 결과를 이끌어내는 방법을 취한 부분이다. Gpt 3.5같은 경우에는 7-shot을 사용했고, Gpt4 같은 경우는 1-shot만으로도 충분히 원하는 형태로 결과를 얻을 수 있었다고 한다. 결과는 Objects 부분에 나와있다. Foreground Object에 대한 caption값과 해당 bounding box의 coordinate값으로 이루어져 있음을 알 수 있다.
-
-
Layout-grounded Stable Diffusion
-
이 단계에서는 LLM이 생성한 레이아웃을 기반으로 이미지 생성을 하기 위해 컨트롤러를 도입한다. 이전의 training-free 방법을 택했던 work들의 경우, regional denoising 혹은 inference과정에서의 단순한 attention manipulation을 통해 semantic guidance를 적용하지만, 이러한 방법들은 의미 있는 영역 내 객체의 수(generative numeracy)를 제어하는 능력이 부족하다. 이는 다른 인스턴스들간의 구별이 latent space나 attention map에서 어렵기 때문에 발생하며, 이는 인스턴스 수준의 control을 힘들게 하는 요인이다. 반면, LMD(LLM-grounded Diffusion)는 각 개별 경계 상자에 대해 마스킹된 잠재 변수를 먼저 생성하고, 이러한 마스킹된 잠재 변수를 prior로 사용하여 전체 이미지 생성을 안내함으로써 인스턴스 수준의 control이 가능토록 한다. 이를통해 각 객체 인스턴스의 정확한 배치와 속성 결합을 허용한다.
-
-
-
-
Fig. 519 Overall image generation with masked latents as priors#
-
-
-
Stage2는 크게 step1,2로 나눠진다. step1의 경우에는 stage1에서 구한 각각의 box들에 대해서 box내의 object들에 대한 latent map을 구하는 과정이다. stage2는 stage1에서 구한 각 box에 대한 latent map을 compose하여 전체적인 image를 생성하는 과정이다.
-
-
step1
-
예를 들어, 위의 그림처럼 gray cat에 관한 bounding box가 stage1을 통해 구해졌다면, box안에 gray cat이 그려지도록 유도를 할 수 있을 것이다. 그러는 과정에서 저 box에 gray cat이 생성되도록 하는 마치 Ground Truth latent map을 얻을 수 있게 된다. 모든 object들에 대해 이러한 방법으로 denoising 과정에서 모든 step의 latent map을 구하는 것이다. 모든 단일 box에 대해 그 box에 해당 caption object가 생성되도록 하는 GT latent map을 구하는 게 step1의 과정이라고 생각하면 된다. 사실 상 LMD의 핵심은 step1에서 진행된다고 볼 수 있다.
-
크게 보자면, 각 foreground object에 대해서 \(Z_T\) 부터 \(Z_0\)까지 denoising을 거치면서 모든 step t에 대한 latent map을 구하면 된다. 이 때, 가장 중요한 것은 foreground object가 실제 box안에서 잘 생성되도록 하는것이 선행이 되어야 한다. 이를 유도하기 위해 저자들은 각 denoising step마다 box내부에 해당 foreground object가 생성되도록 attention manipulation을 진행한다.
-
-\[
- A_{uv}^{(i)} = Softmax(q_u^TK_v)
- \]
-
식(1)과 같이 pixel값들과 prompt내에서의 text token 간의 cross-attention map을 나타낼 수 있다. u는 이미지 내의 모든 각 pixel들을 의미하고 v는 각 text token을 의미한다.
-
구성되는 프롬프트에 대해 예시를 들어 정리하자면, 전체 프롬프트가 “A realistic photo of a gray cat and an orange dog on the grass” 였다고 하자. 그러면 각 foreground object에 대해서 프롬프트를 따로 생성한다. “[background prompt] with [box caption]” (e.g., “a realistic image of an indoor scene with a gray cat”) 형태로 각 foreground object에 대한 프롬프트를 구성한다.
Object와 Bounding box를 align하기 위해서는 위의 그림에서 보이듯이 box 내부 pixel의 object에 관한 token과의 attention은 증가되고 다른 token과의 attention은 감소되면 된다. 위의 그림을 예시로 보면 “a gray cat”이라는 token과는 box내부 pixel들이 attention이 증가하고, 다른 token과는 attention이 감소하도록 유도되면 된다. 이 방법을 유도 하기 위해 본 논문의 저자들은 energy function을 사용한다.
식(2)의 Energy function을 보면 foreground object i에 대한 token v가 정해져 있을 때, box 내부 pixel이 token v와의 attention값이 크고 box 외부 pixel이 token v와의 attention값이 작으면 Energy function값이 최소가 됨을 알 수 있다. 정리하자면 위의 Energy function값이 최대한 작아지면 box 내부의 pixel들의 object token에 대한 attention이 증가되고, box와 foreground object간의 align이 잘 이루어지게 되는 것이다.
Energy function이 최소가 되도록 하기 위해 본 논문은 식(3)과 같은 optimize과정을 거친다. 방법은 단순하다. Gradient Descent를 생각해보면 parameter로 loss function을 표현하고 loss function이 최소가 되도록 parameter들을 optimize하면서 유도한다. 이 방법 역시 같다. Energy function을 최소로 만드는 것이 목표이기에 이는 loss function과 같은 역할을 하게 된다. 그리고 Energy function의 식들은 \(z_t\)에 대해 표현이 가능하기에, Energy function을 통해 z_t를 optimize하여 Energy function이 최소화가 되도록 유도한다. Energy function 최소화는 각 denoising timestep마다 5회 반복되며, denoising 단계가 다섯 번 진행될 때마다 선형적으로 감소하여 반복 횟수가 1회로 줄어든다. 또한, 30step 후에는 guidance를 수행하지 않는다.
-
guidance가 진행되면서 denoising이 다 끝나고 나면 모든 step에 대한 latent map을 얻을 수 있게 되고, attention map을 얻을 수 있게 된다. 이 때 attention map을 SAM을 통해 segment를 진행하거나 threshold값을 설정하여 Foreground mask를 구하게 된다. 이후에 구한 모든 time step에 대한 latent map에 Foreground Mask와 pixel wise곱을 해주어서 masked latent를 구하게 된다.
-
-
step2
-
step2에서는 step1에서 구한 각 foreground object들을 compose하여 처음에 주어진 prompt에 대한 이미지를 잘 생성하는 것이 목표인 단계이다. 기존 work에 의하면 diffusion model은 denoising의 초기 단계에서 semantic한 정보들을 생성하며, 이후 단계에서부터 fine-detail한 부분을 생성한다. 이 점을 이용해서 compose를 하는 step2에서는 단순히 latent map을 compose한다음 denoising을 진행하는 것이 아니라, step의 절반 지점까지는 latent map을 compose하면서 step1과 마찬가지로 optimize를 진행하며 foreground object들이 실제로 원하는 위치에 생성되도록 유도를 하게 된다. 이후부터는 fine-detail한 부분을 생성하여 자연스러운 이미지를 만들기 위해 compose나 optimize를 하지 않고 이미지를 생성하게 된다. Compose관련 식과 optimize를 위한 step2에서의 Energy function은 아래와 같다.
Evaluation 같은 경우는 Qualitive한 결과와 Quantitive한 결과로 나누어서 보여준다. Introduction에서 소개한 기존 T2I model의 문제점 4가지를 잘 해결하고자 하는 것이 이 work의 목표이었기에 4가지 항목에 대해 평가를 진행한다. 데이터 같은 경우는 Negation, Attribute Binding, Generative Numeracy, Spatial Relationships를 각각 평가하기 위한 100개씩의 데이터를 수집해서 진행을 하였다고 한다. Evaluation metric이 존재하진 않고 Quantitive한 결과를 위해서 OWL-VIT detector를 활용하여 object들에 대한 bounding box값을 얻은 후에, 생성된 이미지가 prompt에 잘 맞게 생성되어있는지를 확인하였다고 한다. 추가적으로 Ablation study에 대한 다양한 결과들도 포함되어 있다.
기존 Stable Diffusion XL 모델과 비교하여 LMD가 얼마나 prompt에 잘 대응하는 이미지를 생성하는지를 보여주는 결과이다. Introduction에서 언급했듯이 기존 SDXL모델은 이미지의 전반적인 부분은 잘 생성하지만 numarcy, spatial relationship, attribute matching등을 잘 만족시키지 못하는 경우가 발생한다. 하지만 LMD는 이러한 문제점들을 잘 해결하고 있는 것으로 보인다.
위의 result는 기존 Stable Diffusion과 이 논문에서 제시하는 LMD 방법 그리고 기존 layout to image generation model인 GLIGEN의 adapter를 가져와서 통합한 방법인 LMD+ 세가지를 비교한다. LMD & LMD+ 모두 기존 SD에 비해 월등한 결과를 보임을 알 수 있다.
Ablation study의 결과를 보면, 앞선 결과와 마찬가지로 LMD가 훨씬 더 좋은 성능임을 알 수 있다. LMD의 Baseline model로 SDv1.5, SDv2.1을 각각 써본 결과 둘의 차이는 거의 없었다고 한다. 또한 Foreground mask를 구하기 위해 SAM을 사용했을 경우와 SAM을 사용하지 않고 Threshold를 사용해서 구한 결과도 보여주었는데 이는 LMD일때와 LMD+일때가 서로 다른 결과를 보인다. LMD에서는 attention기반의 guidance가 layout box와 관련하여 공간적으로 정확하지 않기 때문에, SAM은 객체를 커버하는 올바른 마스크를 얻는 데 도움을 준다. 따라서 SAM을 제거하면 LMD에서 약간의 성능 저하가 발생하게 된다. 반면에 LMD+에서는 기존 잘 훈련된 GLIGEN 모델을 가져와 이용하기 때문에 대부분의 경우 SAM이 필요하지 않게된다. 오히려, SAM은 때때로 배경을 포함하는 영역을 선택하여 혼란을 일으키고 성능을 저하시키게 되어 SAM을 제거하면 LMD+에서는 결과가 오히려 개선되는 효과가 있었다고 한다.
-
-
-
-
Fig. 525 Ablations on layout-to-image methods as stage 2 with LMD’s LLM layout generator as stage 1#
-
-
-
위의 결과는 Stage1과 Stage2에 어떤 방법을 가져왔느냐에 따른 전체적인 Quantative한 결과를 보여준다. 우선 Stage1 즉, object에 대한 개별 bounding box를 생성하는 부분에 대해서는 이 논문의 LMD기법을 다 사용을 하였다. 생성된 box를 기반으로 이미지를 생성하는 Stage 2에 대해서 training-free 방법 즉, guidance를 주는 방법을 사용한 경우와 기존 pretrain된 layout to image generation model, 여기에 LMD기법을 추가적으로 더한 방법인 training-based 방법을 나누어서 비교한다. 우선 training-free 방법의 경우, 다른 guidance 기법에 비해 이 논문에서 제시한 stage2의 방법이 훨씬 더 뛰어난 성능을 보임을 알 수 있다. training-based 방법의 경우, 기존 layout to image generation model인 GLIGEN을 그대로 가져온 경우, GLIGEN에 이 논문의 stage2 기법을 적용한 LMD+, LMD+ 에서 GPT3.5대신 GPT4를 사용한 경우로 나누어서 비교를 한다. 사실상 LMD+가 가장 좋은 성능을 보임을 알 수 있다. GPT 버전을 GPT4로 바꾼 경우는 Numeracy에서는 성능이 살짝 감소하지만, 다른 부분에 대해서는 성능이 좀 더 많이 증가한 모습을 확인할 수 있다.
-
-
-
-
Fig. 526 Ablations on GPT version + Compare with SD#
-
-
-
GPT같은 경우 GPT3.5-turbo를 사용한 경우와 GPT4를 사용한 경우를 나누어서 실험을 진행하였다. GPT4의 경우 1-shot으로 진행을 해도 layout을 잘 만드는 모습을 보였고, GPT3.5의 경우 7shots으로 진행을 해야 완벽하게 layout을 생성하는 결과를 보임을 알 수 있다.
-
-
-
-
Fig. 527 Ablations on different LLM and same LLM with different size#
-
-
-
서로 다른 LLM을 사용해서 진행을 해본 결과, 다른 open-source model에 비해 gpt4가 확실히 좋은 성능을 보였음을 알 수 있다. 또한 똑같은 open-source model을 다른 크기로 적용해본결과 더 큰 규모의 model이 더 좋은 성능을 보임을 알 수 있다.
LMD는 text-to-image generation diffusion model이 prompt를 더 잘 반영해서 이미지를 생성할 수 있도록 한 방법이다. 추가적인 Training을 하지 않고 prompt를 더 잘이해할 수 있도록 기존 Text to Image에서 intermediate representation인 layout을 활용한 방법이 특징이라고 할 수 있다. 두 가지 stage로 나눠 LLM-based text-grounded layout generation과 layout-grounded image generation을 통해 문제를 해결하고자 한 논문이다.
최근의 text-to-image generation 모델을 큰 발전을 이루었다. 하지만 이러한 모델들은 여전히 numeracy와 spatial reasoning을 요구하는 복잡한 프롬프트를 잘 반영하지 못하고 이미지를 생성하는 문제들이 있다. 그래서 본 논문에서는 LLM과 레이아웃 기반 이미지 생성모델을 활용하여 Diffusion model에서 프롬프트 이해 능력을 향상시키는 방법을 제안한다.
Diffusion model의 등장과 발전에 따라 T2I(Text to Image) generation 모델은 크게 발전되어왔다. 최근의 SDXL 모델을 보면 상당한 quality의 이미지를 생성하는 것을 볼 수 있다. 그럼에도 불구하고, diffusion model은 복잡한 프롬프트를 잘 반영해서 이미지를 생성하는 것에 취약한 점을 보인다. 위의 figure를 보면 크게 Negation, Generative Numeracy, Attribute Binding, Spatial Relationships에서 큰 문제점을 보임을 알 수 있다.
+
가장 단순히 위의 문제를 해결하는 방법은 복잡한 프롬프트가 포함된 대규모의 multi-modal dataset을 가지고 모델을 훈련하는 방법이다. 하지만 이러한 방법은 시간과 리소스 측면에서 좋지못한 면이 있으며, 좋은 quality의 multi-modal dataset을 대규모로 확보하는 것 조차 쉽지 않은 일이다.
+
이러한 문제를 피하면서 위의 figure의 대표적인 문제점을 해결하기 위해 본 논문에서는 LLM 및 Layout to Image Generation 모델을 활용하여 training-free 방법으로 접근한다.
주어진 prompt에 대해서 LLM을 활용하여 표현되어야 할 foreground object에 대한 layout을 생성한다. prompt로 부터 foreground object들을 해당 attribute과 함께 parsing을 하고 reasoning을 통해 올바른 bounding box coordinate을 얻는 것이 목표인 단계이다. LLM의 In-Context Learning(7-shot)을 활용하여 LLM을 Layout Generator로써 활용한다.
+
+
Stage2
+
Stage1으로 부터 각각의 foreground object에 대한 caption과 bounding box coordinate을 기반으로 실제 해당 bounding box에 해당 caption이 생성되도록 하는 단계이다. 이 과정에서 training-free 방법을 적용하기 위해 Stable Diffusion의 inference과정에서 attention map을 manipulate 하는 방법을 통해 Layout to image generation을 가능케한다.
+
+
+
본 논문의 main contribution은 다음과 같다.
+
+
We propose a training-free two-stage generation pipeline that introduces LLMs to improve the prompt understanding ability of text-to-image diffusion models.
+
We introduce layout-grounded Stable Diffusion, a novel controller that steers an off-the-shelf diffusion model to generate images grounded on instance-level box layouts from the LLM.
+
LMD enables instruction-based scene specification and allows broader language support in the prompts.
+
We propose a benchmark to assess the prompt understanding ability of a text-to-image model and demonstrate the superior performance of LMD over recent baselines.
우선 이 단계에서의 prompt는 다음과 같이 구성되어 있다. prompt의 가장 윗단인 Instruction을 보면 LLM에게 정보를 주는 말들로 이루어져 있으며 Task specification과 supporting details로 이루어져 있음을 알 수 있다. LLM에게 직접적으로 해야할 일들과 정보를 주는 prompt라고 볼 수 있다.
Overview Prompt의 In-context Examples에 관련된 부분이다. 이 부분을 통해 input prompt로 부터 원하는 형태로 output값을 얻을 수 있다. LLM을 직접 학습시키지 않고 few shot example을 통해 LLM으로 부터 원하는 결과를 이끌어내는 방법을 취한 부분이다. Gpt 3.5같은 경우에는 7-shot을 사용했고, Gpt4 같은 경우는 1-shot만으로도 충분히 원하는 형태로 결과를 얻을 수 있었다고 한다. 결과는 Objects 부분에 나와있다. Foreground Object에 대한 caption값과 해당 bounding box의 coordinate값으로 이루어져 있음을 알 수 있다.
+
+
Layout-grounded Stable Diffusion
+
이 단계에서는 LLM이 생성한 레이아웃을 기반으로 이미지 생성을 하기 위해 컨트롤러를 도입한다. 이전의 training-free 방법을 택했던 work들의 경우, regional denoising 혹은 inference과정에서의 단순한 attention manipulation을 통해 semantic guidance를 적용하지만, 이러한 방법들은 의미 있는 영역 내 객체의 수(generative numeracy)를 제어하는 능력이 부족하다. 이는 다른 인스턴스들간의 구별이 latent space나 attention map에서 어렵기 때문에 발생하며, 이는 인스턴스 수준의 control을 힘들게 하는 요인이다. 반면, LMD(LLM-grounded Diffusion)는 각 개별 경계 상자에 대해 마스킹된 잠재 변수를 먼저 생성하고, 이러한 마스킹된 잠재 변수를 prior로 사용하여 전체 이미지 생성을 안내함으로써 인스턴스 수준의 control이 가능토록 한다. 이를통해 각 객체 인스턴스의 정확한 배치와 속성 결합을 허용한다.
+
+
+
+
Fig. 519 Overall image generation with masked latents as priors#
+
+
+
Stage2는 크게 step1,2로 나눠진다. step1의 경우에는 stage1에서 구한 각각의 box들에 대해서 box내의 object들에 대한 latent map을 구하는 과정이다. stage2는 stage1에서 구한 각 box에 대한 latent map을 compose하여 전체적인 image를 생성하는 과정이다.
+
+
step1
+
예를 들어, 위의 그림처럼 gray cat에 관한 bounding box가 stage1을 통해 구해졌다면, box안에 gray cat이 그려지도록 유도를 할 수 있을 것이다. 그러는 과정에서 저 box에 gray cat이 생성되도록 하는 마치 Ground Truth latent map을 얻을 수 있게 된다. 모든 object들에 대해 이러한 방법으로 denoising 과정에서 모든 step의 latent map을 구하는 것이다. 모든 단일 box에 대해 그 box에 해당 caption object가 생성되도록 하는 GT latent map을 구하는 게 step1의 과정이라고 생각하면 된다. 사실 상 LMD의 핵심은 step1에서 진행된다고 볼 수 있다.
+
크게 보자면, 각 foreground object에 대해서 \(Z_T\) 부터 \(Z_0\)까지 denoising을 거치면서 모든 step t에 대한 latent map을 구하면 된다. 이 때, 가장 중요한 것은 foreground object가 실제 box안에서 잘 생성되도록 하는것이 선행이 되어야 한다. 이를 유도하기 위해 저자들은 각 denoising step마다 box내부에 해당 foreground object가 생성되도록 attention manipulation을 진행한다.
+
+\[
+ A_{uv}^{(i)} = Softmax(q_u^TK_v)
+ \]
+
식(1)과 같이 pixel값들과 prompt내에서의 text token 간의 cross-attention map을 나타낼 수 있다. u는 이미지 내의 모든 각 pixel들을 의미하고 v는 각 text token을 의미한다.
+
구성되는 프롬프트에 대해 예시를 들어 정리하자면, 전체 프롬프트가 “A realistic photo of a gray cat and an orange dog on the grass” 였다고 하자. 그러면 각 foreground object에 대해서 프롬프트를 따로 생성한다. “[background prompt] with [box caption]” (e.g., “a realistic image of an indoor scene with a gray cat”) 형태로 각 foreground object에 대한 프롬프트를 구성한다.
Object와 Bounding box를 align하기 위해서는 위의 그림에서 보이듯이 box 내부 pixel의 object에 관한 token과의 attention은 증가되고 다른 token과의 attention은 감소되면 된다. 위의 그림을 예시로 보면 “a gray cat”이라는 token과는 box내부 pixel들이 attention이 증가하고, 다른 token과는 attention이 감소하도록 유도되면 된다. 이 방법을 유도 하기 위해 본 논문의 저자들은 energy function을 사용한다.
식(2)의 Energy function을 보면 foreground object i에 대한 token v가 정해져 있을 때, box 내부 pixel이 token v와의 attention값이 크고 box 외부 pixel이 token v와의 attention값이 작으면 Energy function값이 최소가 됨을 알 수 있다. 정리하자면 위의 Energy function값이 최대한 작아지면 box 내부의 pixel들의 object token에 대한 attention이 증가되고, box와 foreground object간의 align이 잘 이루어지게 되는 것이다.
Energy function이 최소가 되도록 하기 위해 본 논문은 식(3)과 같은 optimize과정을 거친다. 방법은 단순하다. Gradient Descent를 생각해보면 parameter로 loss function을 표현하고 loss function이 최소가 되도록 parameter들을 optimize하면서 유도한다. 이 방법 역시 같다. Energy function을 최소로 만드는 것이 목표이기에 이는 loss function과 같은 역할을 하게 된다. 그리고 Energy function의 식들은 \(z_t\)에 대해 표현이 가능하기에, Energy function을 통해 z_t를 optimize하여 Energy function이 최소화가 되도록 유도한다. Energy function 최소화는 각 denoising timestep마다 5회 반복되며, denoising 단계가 다섯 번 진행될 때마다 선형적으로 감소하여 반복 횟수가 1회로 줄어든다. 또한, 30step 후에는 guidance를 수행하지 않는다.
+
guidance가 진행되면서 denoising이 다 끝나고 나면 모든 step에 대한 latent map을 얻을 수 있게 되고, attention map을 얻을 수 있게 된다. 이 때 attention map을 SAM을 통해 segment를 진행하거나 threshold값을 설정하여 Foreground mask를 구하게 된다. 이후에 구한 모든 time step에 대한 latent map에 Foreground Mask와 pixel wise곱을 해주어서 masked latent를 구하게 된다.
+
+
step2
+
step2에서는 step1에서 구한 각 foreground object들을 compose하여 처음에 주어진 prompt에 대한 이미지를 잘 생성하는 것이 목표인 단계이다. 기존 work에 의하면 diffusion model은 denoising의 초기 단계에서 semantic한 정보들을 생성하며, 이후 단계에서부터 fine-detail한 부분을 생성한다. 이 점을 이용해서 compose를 하는 step2에서는 단순히 latent map을 compose한다음 denoising을 진행하는 것이 아니라, step의 절반 지점까지는 latent map을 compose하면서 step1과 마찬가지로 optimize를 진행하며 foreground object들이 실제로 원하는 위치에 생성되도록 유도를 하게 된다. 이후부터는 fine-detail한 부분을 생성하여 자연스러운 이미지를 만들기 위해 compose나 optimize를 하지 않고 이미지를 생성하게 된다. Compose관련 식과 optimize를 위한 step2에서의 Energy function은 아래와 같다.
Evaluation 같은 경우는 Qualitive한 결과와 Quantitive한 결과로 나누어서 보여준다. Introduction에서 소개한 기존 T2I model의 문제점 4가지를 잘 해결하고자 하는 것이 이 work의 목표이었기에 4가지 항목에 대해 평가를 진행한다. 데이터 같은 경우는 Negation, Attribute Binding, Generative Numeracy, Spatial Relationships를 각각 평가하기 위한 100개씩의 데이터를 수집해서 진행을 하였다고 한다. Evaluation metric이 존재하진 않고 Quantitive한 결과를 위해서 OWL-VIT detector를 활용하여 object들에 대한 bounding box값을 얻은 후에, 생성된 이미지가 prompt에 잘 맞게 생성되어있는지를 확인하였다고 한다. 추가적으로 Ablation study에 대한 다양한 결과들도 포함되어 있다.
기존 Stable Diffusion XL 모델과 비교하여 LMD가 얼마나 prompt에 잘 대응하는 이미지를 생성하는지를 보여주는 결과이다. Introduction에서 언급했듯이 기존 SDXL모델은 이미지의 전반적인 부분은 잘 생성하지만 numarcy, spatial relationship, attribute matching등을 잘 만족시키지 못하는 경우가 발생한다. 하지만 LMD는 이러한 문제점들을 잘 해결하고 있는 것으로 보인다.
위의 result는 기존 Stable Diffusion과 이 논문에서 제시하는 LMD 방법 그리고 기존 layout to image generation model인 GLIGEN의 adapter를 가져와서 통합한 방법인 LMD+ 세가지를 비교한다. LMD & LMD+ 모두 기존 SD에 비해 월등한 결과를 보임을 알 수 있다.
Ablation study의 결과를 보면, 앞선 결과와 마찬가지로 LMD가 훨씬 더 좋은 성능임을 알 수 있다. LMD의 Baseline model로 SDv1.5, SDv2.1을 각각 써본 결과 둘의 차이는 거의 없었다고 한다. 또한 Foreground mask를 구하기 위해 SAM을 사용했을 경우와 SAM을 사용하지 않고 Threshold를 사용해서 구한 결과도 보여주었는데 이는 LMD일때와 LMD+일때가 서로 다른 결과를 보인다. LMD에서는 attention기반의 guidance가 layout box와 관련하여 공간적으로 정확하지 않기 때문에, SAM은 객체를 커버하는 올바른 마스크를 얻는 데 도움을 준다. 따라서 SAM을 제거하면 LMD에서 약간의 성능 저하가 발생하게 된다. 반면에 LMD+에서는 기존 잘 훈련된 GLIGEN 모델을 가져와 이용하기 때문에 대부분의 경우 SAM이 필요하지 않게된다. 오히려, SAM은 때때로 배경을 포함하는 영역을 선택하여 혼란을 일으키고 성능을 저하시키게 되어 SAM을 제거하면 LMD+에서는 결과가 오히려 개선되는 효과가 있었다고 한다.
+
+
+
+
Fig. 525 Ablations on layout-to-image methods as stage 2 with LMD’s LLM layout generator as stage 1#
+
+
+
위의 결과는 Stage1과 Stage2에 어떤 방법을 가져왔느냐에 따른 전체적인 Quantative한 결과를 보여준다. 우선 Stage1 즉, object에 대한 개별 bounding box를 생성하는 부분에 대해서는 이 논문의 LMD기법을 다 사용을 하였다. 생성된 box를 기반으로 이미지를 생성하는 Stage 2에 대해서 training-free 방법 즉, guidance를 주는 방법을 사용한 경우와 기존 pretrain된 layout to image generation model, 여기에 LMD기법을 추가적으로 더한 방법인 training-based 방법을 나누어서 비교한다. 우선 training-free 방법의 경우, 다른 guidance 기법에 비해 이 논문에서 제시한 stage2의 방법이 훨씬 더 뛰어난 성능을 보임을 알 수 있다. training-based 방법의 경우, 기존 layout to image generation model인 GLIGEN을 그대로 가져온 경우, GLIGEN에 이 논문의 stage2 기법을 적용한 LMD+, LMD+ 에서 GPT3.5대신 GPT4를 사용한 경우로 나누어서 비교를 한다. 사실상 LMD+가 가장 좋은 성능을 보임을 알 수 있다. GPT 버전을 GPT4로 바꾼 경우는 Numeracy에서는 성능이 살짝 감소하지만, 다른 부분에 대해서는 성능이 좀 더 많이 증가한 모습을 확인할 수 있다.
+
+
+
+
Fig. 526 Ablations on GPT version + Compare with SD#
+
+
+
GPT같은 경우 GPT3.5-turbo를 사용한 경우와 GPT4를 사용한 경우를 나누어서 실험을 진행하였다. GPT4의 경우 1-shot으로 진행을 해도 layout을 잘 만드는 모습을 보였고, GPT3.5의 경우 7shots으로 진행을 해야 완벽하게 layout을 생성하는 결과를 보임을 알 수 있다.
+
+
+
+
Fig. 527 Ablations on different LLM and same LLM with different size#
+
+
+
서로 다른 LLM을 사용해서 진행을 해본 결과, 다른 open-source model에 비해 gpt4가 확실히 좋은 성능을 보였음을 알 수 있다. 또한 똑같은 open-source model을 다른 크기로 적용해본결과 더 큰 규모의 model이 더 좋은 성능을 보임을 알 수 있다.
LMD는 text-to-image generation diffusion model이 prompt를 더 잘 반영해서 이미지를 생성할 수 있도록 한 방법이다. 추가적인 Training을 하지 않고 prompt를 더 잘이해할 수 있도록 기존 Text to Image에서 intermediate representation인 layout을 활용한 방법이 특징이라고 할 수 있다. 두 가지 stage로 나눠 LLM-based text-grounded layout generation과 layout-grounded image generation을 통해 문제를 해결하고자 한 논문이다.
\(x \in \mathbb{R}^{H\times W \times 3}\)이 input으로 주어졌을때 이를 encoder \(\mathcal{E}\)를 통해서 \(z=\mathcal{E}(x) \in \mathbb{R}^{h\times w\times c }\)로 인코딩 하고 \(\hat{x}=\mathcal{D}(z)\)
-로 디코딩을 한다. 이 논문에서 \(f=H/h=W/w=2^m\), \(m\in \mathbb{N}\)이 되도록 여러 \(m\)에 대해서 테스트를 진행하였다. 또한 Latent space에서 분산이 커지지 않도록 KL divergence와 vector quantization(VQ)을 활용하였다.
-이미지외 텍스트나, sematic map과 같이 추가적인 정보는 \(\tau_\theta\)를 통해서 전달을 하였고,
와 같은 loss function으로 학습을 진행시키는데 \(x_t\)를 \(z_t\)로 바꾸면서 연산의 양을 줄였다는 점이다.
-
위의 “Introduction”과 연관지으면 다음과 같이 생각 해볼 수 있다.
-
-
encoder \(\varepsilon\), decoder \(D\) 로 구성된 perceptual compression model(학습된)를 바탕으로 효율적인, 낮은 차원의 latent space(high-frequency, imperceptible detail이 제거된)를 가지게 됨
-
고차원 공간과 비교했을 때 이 latent space는 likelihood-based generative model에 더 적합함
-
-
데이터에 중요한 semantic bit에 집중할 수 있고 더 낮은 차원에서 효율적으로 학습 가능
different downsampling factor \(f \in \{1,2,4,8,16,32\}\) 에 대한 분석
-
-
latent space 차원 개수에 따른 차이 분석
-
LDM-1 : pixel-based DMs
-
-
-
computational resource : single NVIDIA A100 1대로 함
-
전체 같은 parameter 개수와 step을 기준으로 함
-
-
-
위의 표는 autoencoder 차원에 따른 hyperparameter, loss에 따른 실험 결과를 보임
-
위의 그래프는 모델이 수렴하는데 소요되는 step을 분석함
-
\(f\) 값이 너무 크면 약간의 학습 후 fidelty(학습 데이터와 실제 데이터의 유사도)가 정체된 것을 볼 수 있음
-
-
이는 아래 사진의 결과와 perceptual과 bit ratio 부분을 생각해보면 대부분의 perceptual compression은 diffusion에 있으며 encoder와 decoder 부분에서 압축이 지나치게 되어 정보 손실이 발생하여 달성할 수 있는 품질이 제한됨
-
-
-
-
-
위의 그래프는 CelebA-HQ와 ImageNet에서 학습된 모델을 DDIM sampler를 사용하여 다양한 step의 denoising에 대한 샘플링 속도 측면에서 FID 점수와 비교함
-
-
ImageNet이 CelebA-HQ 대비 더 복잡한 dataset임
-
-
-
point가 총 5개인데 오른쪽부터 왼쪽으로 step 수가 {10,20,50,100,200}을 의미함
256x256 image의 unconditional model을 CelebA-HQ, FFHQ, LSUN-Churches, Bedrooms로 학습하고 sample quality, data manifold의 coverage(FID, Precision-and-Recall) 평가
-
-
-
CelebA-HQ
-
-
제안한 모델이 최고 성능
-
-
LSGM : encoder, decoder를 UNet과 동시에 학습시킨 결과
-
-
-
-
-
LSUN-Bedrooms : ADM보다 절반의 parameter와 짧은 train 시간으로 유사한 score(?)를 얻음
-
제안한 방법인 LDM은 GAN-based methods을 지속적으로 개선해 adversarial 방식에 비해 mode-covering likelihood-based training의 이점을 Precision과 Recall을 통해 볼 수 있음. (아래 그림은 정성적 결과)
\(x \in \mathbb{R}^{H\times W \times 3}\)이 input으로 주어졌을때 이를 encoder \(\mathcal{E}\)를 통해서 \(z=\mathcal{E}(x) \in \mathbb{R}^{h\times w\times c }\)로 인코딩 하고 \(\hat{x}=\mathcal{D}(z)\)
+로 디코딩을 한다. 이 논문에서 \(f=H/h=W/w=2^m\), \(m\in \mathbb{N}\)이 되도록 여러 \(m\)에 대해서 테스트를 진행하였다. 또한 Latent space에서 분산이 커지지 않도록 KL divergence와 vector quantization(VQ)을 활용하였다.
+이미지외 텍스트나, sematic map과 같이 추가적인 정보는 \(\tau_\theta\)를 통해서 전달을 하였고,
와 같은 loss function으로 학습을 진행시키는데 \(x_t\)를 \(z_t\)로 바꾸면서 연산의 양을 줄였다는 점이다.
+
위의 “Introduction”과 연관지으면 다음과 같이 생각 해볼 수 있다.
+
+
encoder \(\varepsilon\), decoder \(D\) 로 구성된 perceptual compression model(학습된)를 바탕으로 효율적인, 낮은 차원의 latent space(high-frequency, imperceptible detail이 제거된)를 가지게 됨
+
고차원 공간과 비교했을 때 이 latent space는 likelihood-based generative model에 더 적합함
+
+
데이터에 중요한 semantic bit에 집중할 수 있고 더 낮은 차원에서 효율적으로 학습 가능
different downsampling factor \(f \in \{1,2,4,8,16,32\}\) 에 대한 분석
+
+
latent space 차원 개수에 따른 차이 분석
+
LDM-1 : pixel-based DMs
+
+
+
computational resource : single NVIDIA A100 1대로 함
+
전체 같은 parameter 개수와 step을 기준으로 함
+
+
+
위의 표는 autoencoder 차원에 따른 hyperparameter, loss에 따른 실험 결과를 보임
+
위의 그래프는 모델이 수렴하는데 소요되는 step을 분석함
+
\(f\) 값이 너무 크면 약간의 학습 후 fidelty(학습 데이터와 실제 데이터의 유사도)가 정체된 것을 볼 수 있음
+
+
이는 아래 사진의 결과와 perceptual과 bit ratio 부분을 생각해보면 대부분의 perceptual compression은 diffusion에 있으며 encoder와 decoder 부분에서 압축이 지나치게 되어 정보 손실이 발생하여 달성할 수 있는 품질이 제한됨
+
+
+
+
+
위의 그래프는 CelebA-HQ와 ImageNet에서 학습된 모델을 DDIM sampler를 사용하여 다양한 step의 denoising에 대한 샘플링 속도 측면에서 FID 점수와 비교함
+
+
ImageNet이 CelebA-HQ 대비 더 복잡한 dataset임
+
+
+
point가 총 5개인데 오른쪽부터 왼쪽으로 step 수가 {10,20,50,100,200}을 의미함
256x256 image의 unconditional model을 CelebA-HQ, FFHQ, LSUN-Churches, Bedrooms로 학습하고 sample quality, data manifold의 coverage(FID, Precision-and-Recall) 평가
+
+
+
CelebA-HQ
+
+
제안한 모델이 최고 성능
+
+
LSGM : encoder, decoder를 UNet과 동시에 학습시킨 결과
+
+
+
+
+
LSUN-Bedrooms : ADM보다 절반의 parameter와 짧은 train 시간으로 유사한 score(?)를 얻음
+
제안한 방법인 LDM은 GAN-based methods을 지속적으로 개선해 adversarial 방식에 비해 mode-covering likelihood-based training의 이점을 Precision과 Recall을 통해 볼 수 있음. (아래 그림은 정성적 결과)
LoRA는 PEFT(Parameter Effecient Fine-Tuning)의 기법 중 하나이다. Pre-trained model의 weight는 고정한 채로, 몇 개의 dense(fc) layer만 학습시켜 downstream task의 연산량을 줄일 수 있다. GPT-3을 기준으로 parameter는 10000배, GPU 메모리는 3배를 줄일 수 있다. 또한 inference 과정에서 추가적인 latency가 없음
-
-
-
PEFT: 모델의 모든 파라미터를 튜닝하는 것이 아닌 일부 파라미터만을 튜닝함으로써 모델의 성능을 적은 자원으로도 높게 유지하는 방법론
-
-
-
-
Downstream task: pre-trained model을 사용해, 어떤 문제를 해결하기 위해 fine-tuning 하는것
위 그림처럼 기존 pre-trained weight \(W\)는 고정하고 low rank decomposition된 weight \(A, B\)만 학습시켜 \(W\)에 더해줌. \(A, B\)의 크기는 \(W\)보다 작아 time, computational cost를 최대 3배까지 줄일 수 있음. 또한 task에 따라 LoRA module(\(A, B\))만 바꿔주면 되기 때문에 storage requirement, task-switching overhead를 줄일 수 있음. 이 외에도 추가적인 inference latency가 없다, 다른 기법들과 함께 적용이 가능하다는 장점이 있음.
\(P_{\Phi}\left(y \mid x\right)\): \(\Phi\)로 parameterized된 pre-trained model
-
\(\mathcal{Z} = \{(x_i, y_i)\}_{i=1,...,N}\): context-target쌍으로 된 학습 데이터셋, \(x_i, y_i\)는 token sequence
-
-
Fine-tuning 과정에서 model은 \(\Phi_0\)으로 init.되고 objective를 maximize하기 위해 \(\Phi_0 + \Delta \Phi\) 로 업데이트됨. 각 downstream task를 위해 매번 \(|\Phi_0|\)와 같은 크기의 \(|\Delta \Phi|\)를 학습해 엄청난 cost가 발생.
반면 위와 같은 LoRA 방식으로 fine-tuning할 경우 \(|\Phi_0|\) 전체가 아니라 그보다 작은 \(|\Theta|\)를 찾아내는 방식으로 바뀌기 때문에 compute-/memory-effecient해짐. \(|\Theta|\)는 최대 \(|\Phi_0|\)의 0.01%까지 작아질 수 있음.
\(B \in \mathbb{R}^{d \times r}, A \in \mathbb{R}^{r \times k}\)
-
\(r \ll min(d,k)\)
-
-
\(W_0\)는 고정하고 \(A, B\)만 학습. 이후 \(W_0\)와 \(\Delta W = BA\)는 같은 input \(x\)에 곱해진 후 output vector끼리 coordinate-wise하게 sum.
-
\(A\)는 random Gaussian init., \(B\)는 zero-init.이라 \(\Delta W\) 또한 처음에는 zero-init. \(\Delta W x\)는 \(\alpha/x\)로 scaling됨. \(\alpha\)는 learning rate처럼 tuning해서 r과 같은 값으로 설정. 실제 코드에서는 보통 \(r, \alpha\)는 (8, 16)이나 (16,32)를 사용한다고 함.
-
...
- # Actual trainable parameters
- # define A, B
- ifr>0:
- self.lora_A=nn.Parameter(self.weight.new_zeros((r,num_embeddings)))
- self.lora_B=nn.Parameter(self.weight.new_zeros((embedding_dim,r)))
- self.scaling=self.lora_alpha/self.r
- # Freezing the pre-trained weight matrix
- self.weight.requires_grad=False
- self.reset_parameters()
-
- # initialize A, B
- defreset_parameters(self):
- nn.Embedding.reset_parameters(self)
- ifhasattr(self,'lora_A'):
- # initialize A the same way as the default for nn.Linear and B to zero
- nn.init.zeros_(self.lora_A)
- nn.init.normal_(self.lora_B)
-
- deftrain(self,mode:bool=True):
- nn.Embedding.train(self,mode)
- ifmode:
- ifself.merge_weightsandself.merged:
- # Make sure that the weights are not merged
- ifself.r>0:
- self.weight.data-=(self.lora_B@self.lora_A).transpose(0,1)*self.scaling
- self.merged=False
- else:
- ifself.merge_weightsandnotself.merged:
- # Merge the weights and mark it
- ifself.r>0:
- self.weight.data+=(self.lora_B@self.lora_A).transpose(0,1)*self.scaling
- self.merged=True
-
- defforward(self,x:torch.Tensor):
- ifself.r>0andnotself.merged:
- # pre-trained weight W_0 * x
- result=nn.Embedding.forward(self,x)
- ifself.r>0:
- # BA * x
- after_A=F.embedding(
- x,self.lora_A.transpose(0,1),self.padding_idx,self.max_norm,
- self.norm_type,self.scale_grad_by_freq,self.sparse
- )
- # W_0x + BAx
- result+=(after_A@self.lora_B.transpose(0,1))*self.scaling
- returnresult
- else:
- returnnn.Embedding.forward(self,x)
-
-
본 논문에서는 trainable weight를 최소화하기 위해 LoRA를 attention weight만 적용하고 MLP module은 고정함. 이를 통해 GPT-3 175B를 기준으로 VRAM은 1.2TB에서 350GB, checkpoint size는 350GB에서 35MB로 줄임. 또한 학습 속도 또한 25% 정도 빨라짐.
뉴럴네트워크의 Inner Activation을 줄이기도하고 늘리기도하는 어댑터를 중간에 삽입하는 방법론. 기존에 공개된 LoRA보다 적은 파라미터를 사용하면서 높은 성능을 내는 것으로 알려져있으며, GPT-3를 in-context learning 했을때 보다도 성능이 좋다 라고 주장하고 있음. 학습시간도 매우 짧아 A100 GPU 하나로 30분만에 튜닝할 수 있었다고 함.
# ===== Before =====
-# layer = nn.Linear(in_features, out_features)
-
-# ===== After ======
-importloralibaslora
-# Add a pair of low-rank adaptation matrices with rank r=16
-layer=lora.Linear(in_features,out_features,r=16)
-
-
-
-
학습 전, lora parameter만 학습 가능하게 설정
-
-
importloralibaslora
-model=BigModel()
-# This sets requires_grad to False for all parameters without the string "lora_" in their names
-lora.mark_only_lora_as_trainable(model)
-# Training loop
-forbatchindataloader:
- ...
-
-
-
-
checkpoint를 저장할 때엔 state_dict가 LoRA parameter만 저장하게 함.
-
-
# ===== Before =====
-# torch.save(model.state_dict(), checkpoint_path)
-# ===== After =====
-torch.save(lora.lora_state_dict(model),checkpoint_path)
-
# Load the pretrained checkpoint first
-model.load_state_dict(torch.load('ckpt_pretrained.pt'),strict=False)
-# Then load the LoRA checkpoint
-model.load_state_dict(torch.load('ckpt_lora.pt'),strict=False)
-
LoRA는 PEFT(Parameter Effecient Fine-Tuning)의 기법 중 하나이다. Pre-trained model의 weight는 고정한 채로, 몇 개의 dense(fc) layer만 학습시켜 downstream task의 연산량을 줄일 수 있다. GPT-3을 기준으로 parameter는 10000배, GPU 메모리는 3배를 줄일 수 있다. 또한 inference 과정에서 추가적인 latency가 없음
+
+
+
PEFT: 모델의 모든 파라미터를 튜닝하는 것이 아닌 일부 파라미터만을 튜닝함으로써 모델의 성능을 적은 자원으로도 높게 유지하는 방법론
+
+
+
+
Downstream task: pre-trained model을 사용해, 어떤 문제를 해결하기 위해 fine-tuning 하는것
위 그림처럼 기존 pre-trained weight \(W\)는 고정하고 low rank decomposition된 weight \(A, B\)만 학습시켜 \(W\)에 더해줌. \(A, B\)의 크기는 \(W\)보다 작아 time, computational cost를 최대 3배까지 줄일 수 있음. 또한 task에 따라 LoRA module(\(A, B\))만 바꿔주면 되기 때문에 storage requirement, task-switching overhead를 줄일 수 있음. 이 외에도 추가적인 inference latency가 없다, 다른 기법들과 함께 적용이 가능하다는 장점이 있음.
\(P_{\Phi}\left(y \mid x\right)\): \(\Phi\)로 parameterized된 pre-trained model
+
\(\mathcal{Z} = \{(x_i, y_i)\}_{i=1,...,N}\): context-target쌍으로 된 학습 데이터셋, \(x_i, y_i\)는 token sequence
+
+
Fine-tuning 과정에서 model은 \(\Phi_0\)으로 init.되고 objective를 maximize하기 위해 \(\Phi_0 + \Delta \Phi\) 로 업데이트됨. 각 downstream task를 위해 매번 \(|\Phi_0|\)와 같은 크기의 \(|\Delta \Phi|\)를 학습해 엄청난 cost가 발생.
반면 위와 같은 LoRA 방식으로 fine-tuning할 경우 \(|\Phi_0|\) 전체가 아니라 그보다 작은 \(|\Theta|\)를 찾아내는 방식으로 바뀌기 때문에 compute-/memory-effecient해짐. \(|\Theta|\)는 최대 \(|\Phi_0|\)의 0.01%까지 작아질 수 있음.
\(B \in \mathbb{R}^{d \times r}, A \in \mathbb{R}^{r \times k}\)
+
\(r \ll min(d,k)\)
+
+
\(W_0\)는 고정하고 \(A, B\)만 학습. 이후 \(W_0\)와 \(\Delta W = BA\)는 같은 input \(x\)에 곱해진 후 output vector끼리 coordinate-wise하게 sum.
+
\(A\)는 random Gaussian init., \(B\)는 zero-init.이라 \(\Delta W\) 또한 처음에는 zero-init. \(\Delta W x\)는 \(\alpha/x\)로 scaling됨. \(\alpha\)는 learning rate처럼 tuning해서 r과 같은 값으로 설정. 실제 코드에서는 보통 \(r, \alpha\)는 (8, 16)이나 (16,32)를 사용한다고 함.
+
...
+ # Actual trainable parameters
+ # define A, B
+ ifr>0:
+ self.lora_A=nn.Parameter(self.weight.new_zeros((r,num_embeddings)))
+ self.lora_B=nn.Parameter(self.weight.new_zeros((embedding_dim,r)))
+ self.scaling=self.lora_alpha/self.r
+ # Freezing the pre-trained weight matrix
+ self.weight.requires_grad=False
+ self.reset_parameters()
+
+ # initialize A, B
+ defreset_parameters(self):
+ nn.Embedding.reset_parameters(self)
+ ifhasattr(self,'lora_A'):
+ # initialize A the same way as the default for nn.Linear and B to zero
+ nn.init.zeros_(self.lora_A)
+ nn.init.normal_(self.lora_B)
+
+ deftrain(self,mode:bool=True):
+ nn.Embedding.train(self,mode)
+ ifmode:
+ ifself.merge_weightsandself.merged:
+ # Make sure that the weights are not merged
+ ifself.r>0:
+ self.weight.data-=(self.lora_B@self.lora_A).transpose(0,1)*self.scaling
+ self.merged=False
+ else:
+ ifself.merge_weightsandnotself.merged:
+ # Merge the weights and mark it
+ ifself.r>0:
+ self.weight.data+=(self.lora_B@self.lora_A).transpose(0,1)*self.scaling
+ self.merged=True
+
+ defforward(self,x:torch.Tensor):
+ ifself.r>0andnotself.merged:
+ # pre-trained weight W_0 * x
+ result=nn.Embedding.forward(self,x)
+ ifself.r>0:
+ # BA * x
+ after_A=F.embedding(
+ x,self.lora_A.transpose(0,1),self.padding_idx,self.max_norm,
+ self.norm_type,self.scale_grad_by_freq,self.sparse
+ )
+ # W_0x + BAx
+ result+=(after_A@self.lora_B.transpose(0,1))*self.scaling
+ returnresult
+ else:
+ returnnn.Embedding.forward(self,x)
+
+
본 논문에서는 trainable weight를 최소화하기 위해 LoRA를 attention weight만 적용하고 MLP module은 고정함. 이를 통해 GPT-3 175B를 기준으로 VRAM은 1.2TB에서 350GB, checkpoint size는 350GB에서 35MB로 줄임. 또한 학습 속도 또한 25% 정도 빨라짐.
뉴럴네트워크의 Inner Activation을 줄이기도하고 늘리기도하는 어댑터를 중간에 삽입하는 방법론. 기존에 공개된 LoRA보다 적은 파라미터를 사용하면서 높은 성능을 내는 것으로 알려져있으며, GPT-3를 in-context learning 했을때 보다도 성능이 좋다 라고 주장하고 있음. 학습시간도 매우 짧아 A100 GPU 하나로 30분만에 튜닝할 수 있었다고 함.
# ===== Before =====
+# layer = nn.Linear(in_features, out_features)
+
+# ===== After ======
+importloralibaslora
+# Add a pair of low-rank adaptation matrices with rank r=16
+layer=lora.Linear(in_features,out_features,r=16)
+
+
+
+
학습 전, lora parameter만 학습 가능하게 설정
+
+
importloralibaslora
+model=BigModel()
+# This sets requires_grad to False for all parameters without the string "lora_" in their names
+lora.mark_only_lora_as_trainable(model)
+# Training loop
+forbatchindataloader:
+ ...
+
+
+
+
checkpoint를 저장할 때엔 state_dict가 LoRA parameter만 저장하게 함.
+
+
# ===== Before =====
+# torch.save(model.state_dict(), checkpoint_path)
+# ===== After =====
+torch.save(lora.lora_state_dict(model),checkpoint_path)
+
# Load the pretrained checkpoint first
+model.load_state_dict(torch.load('ckpt_pretrained.pt'),strict=False)
+# Then load the LoRA checkpoint
+model.load_state_dict(torch.load('ckpt_lora.pt'),strict=False)
+
Fully-connected layers는 특별한 수정을 할 필요 없이 시간 정보만 추가해주면 된다.
-
구성 요소 수정 결과 \(D^t\)는 64X64 사이즈의 16 RGB frame을 만들게 된다.
-
Frame interpolation network \(\uparrow_{F}\)가 생성된 16개의 프레임과 super-resolution 네트워크 \(SR^t_l\) 사이를 보간하여 프레임 속도를 증가시킨다.
-
Super-resolution 네트워크에는 hallucinating information(환각 정보)가 포함 된다. 깜박이는 잔상이 생기지 않으려면, 환각이 프레임 전체에 걸쳐 일관성을 유지해야 한다.
-
-
Hallucinating information
-
실제로 존재하지 않는 정보나 세부 사항을 생성하거나 가상으로 추가하는 것
-
-
-
-
프레임당 super resolution을 수행하는 것보다 spatiotemporal 모듈인 \(SR^t_l\)가 더 좋은 성능을 보였다.
-
하지만, \(SR_h\)를 위와 같은 모듈로 만들기엔 메모리 및 컴퓨팅 제약과 고해상도 비디오 데이터의 부족으로 \(SR_h\)를 위와 같이 시간적 차원으로 확장하는 것은 어려웠다 → \(SR_h\)는 공간적 차원에서 작동한다.( 각 프레임에 대해 동일한 노이즈 초기화를 사용하여 프레임 전반에 걸쳐 일관된 환각을 제공함)
Fig. 586 T2V Generation 결과. 맨 위: VDM, 가운데: CogVideo, 맨 아래: Make-A-Video
-→ Make-A-Video가 모션의 일관성을 유지하면서 더 풍부한 콘텐츠를 생성할 수 있다.#
-
-
-
-
-
-
Fig. 587 이미지에 mask frame interpolation 및 extrpolation network ↑F를 적용한 결과.
-가장 왼쪽에 입력 이미지가 주어지면, 이를 동영상으로 애니메이션화 함.
-사용자는 자신의 이미지를 사용하여 동영상을 생성할 수 있으며, 생성된 동영상을 개인화하고 직접 제어할 수 있음.#
-
-
-
-
-
-
Fig. 588 두 이미지 사이의 interpolation 결과. 왼쪽: FILM, 오른쪽: 본 논문의 approach
-FILM → 실제 움직이는 object에 대한 이해 없이 프레임을 부드럽게 전환하기만 함.
-본 논문의 approach → 의미론적으로 더 의미있는 interpolation을 만듬.#
Fully-connected layers는 특별한 수정을 할 필요 없이 시간 정보만 추가해주면 된다.
+
구성 요소 수정 결과 \(D^t\)는 64X64 사이즈의 16 RGB frame을 만들게 된다.
+
Frame interpolation network \(\uparrow_{F}\)가 생성된 16개의 프레임과 super-resolution 네트워크 \(SR^t_l\) 사이를 보간하여 프레임 속도를 증가시킨다.
+
Super-resolution 네트워크에는 hallucinating information(환각 정보)가 포함 된다. 깜박이는 잔상이 생기지 않으려면, 환각이 프레임 전체에 걸쳐 일관성을 유지해야 한다.
+
+
Hallucinating information
+
실제로 존재하지 않는 정보나 세부 사항을 생성하거나 가상으로 추가하는 것
+
+
+
+
프레임당 super resolution을 수행하는 것보다 spatiotemporal 모듈인 \(SR^t_l\)가 더 좋은 성능을 보였다.
+
하지만, \(SR_h\)를 위와 같은 모듈로 만들기엔 메모리 및 컴퓨팅 제약과 고해상도 비디오 데이터의 부족으로 \(SR_h\)를 위와 같이 시간적 차원으로 확장하는 것은 어려웠다 → \(SR_h\)는 공간적 차원에서 작동한다.( 각 프레임에 대해 동일한 노이즈 초기화를 사용하여 프레임 전반에 걸쳐 일관된 환각을 제공함)
Fig. 598 T2V Generation 결과. 맨 위: VDM, 가운데: CogVideo, 맨 아래: Make-A-Video
+→ Make-A-Video가 모션의 일관성을 유지하면서 더 풍부한 콘텐츠를 생성할 수 있다.#
+
+
+
+
+
+
Fig. 599 이미지에 mask frame interpolation 및 extrpolation network ↑F를 적용한 결과.
+가장 왼쪽에 입력 이미지가 주어지면, 이를 동영상으로 애니메이션화 함.
+사용자는 자신의 이미지를 사용하여 동영상을 생성할 수 있으며, 생성된 동영상을 개인화하고 직접 제어할 수 있음.#
+
+
+
+
+
+
Fig. 600 두 이미지 사이의 interpolation 결과. 왼쪽: FILM, 오른쪽: 본 논문의 approach
+FILM → 실제 움직이는 object에 대한 이해 없이 프레임을 부드럽게 전환하기만 함.
+본 논문의 approach → 의미론적으로 더 의미있는 interpolation을 만듬.#
Image editing 분야 자체가 굉장히 수많은 요구 조건과 시나리오를 만족하면서 수행되어야 했기에 기존의 방법들이 여전히 challenging 한 문제를 풀고 있음
-
기존의 방법들은 현재 source image 와 함께 해당 mask 를 input 으로 넣어주고 있음 (이건 공통)
-
-
Inpainting method
-
-
editing 이라는 task 를 “Text Prompt” 하나로만 해결하고자 했는데 이건 원하는 결과를 뽑아내기에는 적절하지 않음
-
My thoughts : 실제로 inpainting 은 refining 과 같이 자연스럽게 만들어주는 것 외에는 실무에서 잘 사용하지는 않았던 것 같음
-
-
-
Composition method
-
-
ref image 와 ref mask/box 를 이용해 이를 해결하고자 하였는데, 아무래도 “individual object” 를 insertion 하는 작업처럼 느껴 모델이 어려워 할 만 했음
-
-
shoe soles 이나 hair 와 같은 local components 나 로고나 texture 같은 local patterns
-
-
-
또한, Image 로부터 reference area 를 완벽하게 잘 추출하는 방법이 필요했음
-
Local components 들은 또 전체 image 에 잘 어우러지게 하는 것도 고려해야 했고, 학습 과정에서 같은 object 인데 frame 에 따라 모양도 조금씩 달라서 이런 다양한 문제들을 풀어야 했음
-
-
-
-
-
앞선 문제들을 해결하기 위해서, editing 을 할 수 있는 novel pipeline 인 imitative editing 을 제안
-
-
Ref image 에서 mask 는 사용하지 않고 source image 의 mask area 부분을 ref image 에서 어디에 해당하는지 자동으로 찾고 모방할 수 있도록 하였음
-
-
-
Imitative editing 을 하기 위해서 MimicBrush 라고 하는 dual diffusion U-Nets network framework 를 제안
-
-
self-supervised manner 로 학습함 → 같은 video 에서 source / ref image 를 뽑아서 학습에 활용하는 방식
-
당연히 같은 video 에서 추출했기 때문에 semantic correspondence 와 visual variations 를 가지고 있을 것
-
masked source image 는 imitative U-Net 으로 / reference image 는 reference U-Net 으로 통과 → 이후 reference U-Net 의 attention K,V 를 imitative U-Net 에 injection 시키는 방식
-
-
-
이 Image editing 방식을 이용하여 학습된 model 은 구도, 조명, 카테고리 자체가 달라도 잘 변환이 되는 결과를 보였으며, ref image 의 visual concepts 의 detail 도 잘 유지한 채로 가져오는 것을 확인하였음
-
조금 더 comprehensive 한 evaluation 을 위해서 imitative editing 의 benchmark 까지 제안
-
-
part composition : 얼마나 part 구성이 자연스럽게 잘 되었는가?
-
texture transfer : 느낌을 얼마나 잘 유지하면서 texture 가 변환됐는가?
MimicBrush 의 cross-image imitation ability (서로 다른 카테고리에서 잘 모방해오는 능력 정도로 이해하면 됨) 를 끌어올리기 위해서는 조금 더 적합한 training sample 을 모아서 학습할 수 있는 방법이 필요했음
-
Training data 를 구축하는 과정에서 두 가지의 철학을 지키려 하였음
-
-
source / reference images 들 간의 correspondence relation 이 존재해야 한다.
-
robustness 를 위해 source / reference image 사이의 large variations 을 기대할 수 있어야 한다.
-
-
-
Data selection
-
-
학습 중에는 같은 비디오로부터 frame 2개를 sampling 해서 뽑았음
-
SSIM 을 이용해 video frames 간의 similarity 를 측정했고 너무 그 값이 크거나 작으면 filtering 했음
-
-
-
Data augmentation
-
-
source & reference image 의 variation 을 증가시키기 위해서, 강력한 data augmentation 을 활용
-
-
color jitter, rotation, resizing, flipping, 심지어는 random projection transformation 으로 더욱 강한 deformation 도 수행
-
-
-
-
-
Masking strategy
-
-
가장 간단하게는 image 를 N x N grid 로 나누고 랜덤하게 masking 시키는 방법인데 저자들은 이렇게 랜덤하게 가져가면 easy cases 들이 많은 portion 을 차지한다는 것을 발견
-
-
ex. 배경 같은 큰 area 를 차지하는 것들은 계속 반복되는 content/textures 이기 때문에 도움이 안됨
-
-
-
SIFT matching 을 이용해서 source & ref image 의 matching points 를 얻고 그 matched feature points 의 grids 들을 좀 더 masking 하도록 하였음
-
video 보다 high-quality image 를 찾는 것이 더 쉬웠기 때문에 static image 한 장을 가지고 augmentation 시킨 다음, seg map 가지고 masking 시키는 방식으로도 활용 → robustness 를 증가시키는 효과를 불러일으킴
Image editing 분야 자체가 굉장히 수많은 요구 조건과 시나리오를 만족하면서 수행되어야 했기에 기존의 방법들이 여전히 challenging 한 문제를 풀고 있음
+
기존의 방법들은 현재 source image 와 함께 해당 mask 를 input 으로 넣어주고 있음 (이건 공통)
+
+
Inpainting method
+
+
editing 이라는 task 를 “Text Prompt” 하나로만 해결하고자 했는데 이건 원하는 결과를 뽑아내기에는 적절하지 않음
+
My thoughts : 실제로 inpainting 은 refining 과 같이 자연스럽게 만들어주는 것 외에는 실무에서 잘 사용하지는 않았던 것 같음
+
+
+
Composition method
+
+
ref image 와 ref mask/box 를 이용해 이를 해결하고자 하였는데, 아무래도 “individual object” 를 insertion 하는 작업처럼 느껴 모델이 어려워 할 만 했음
+
+
shoe soles 이나 hair 와 같은 local components 나 로고나 texture 같은 local patterns
+
+
+
또한, Image 로부터 reference area 를 완벽하게 잘 추출하는 방법이 필요했음
+
Local components 들은 또 전체 image 에 잘 어우러지게 하는 것도 고려해야 했고, 학습 과정에서 같은 object 인데 frame 에 따라 모양도 조금씩 달라서 이런 다양한 문제들을 풀어야 했음
+
+
+
+
+
앞선 문제들을 해결하기 위해서, editing 을 할 수 있는 novel pipeline 인 imitative editing 을 제안
+
+
Ref image 에서 mask 는 사용하지 않고 source image 의 mask area 부분을 ref image 에서 어디에 해당하는지 자동으로 찾고 모방할 수 있도록 하였음
+
+
+
Imitative editing 을 하기 위해서 MimicBrush 라고 하는 dual diffusion U-Nets network framework 를 제안
+
+
self-supervised manner 로 학습함 → 같은 video 에서 source / ref image 를 뽑아서 학습에 활용하는 방식
+
당연히 같은 video 에서 추출했기 때문에 semantic correspondence 와 visual variations 를 가지고 있을 것
+
masked source image 는 imitative U-Net 으로 / reference image 는 reference U-Net 으로 통과 → 이후 reference U-Net 의 attention K,V 를 imitative U-Net 에 injection 시키는 방식
+
+
+
이 Image editing 방식을 이용하여 학습된 model 은 구도, 조명, 카테고리 자체가 달라도 잘 변환이 되는 결과를 보였으며, ref image 의 visual concepts 의 detail 도 잘 유지한 채로 가져오는 것을 확인하였음
+
조금 더 comprehensive 한 evaluation 을 위해서 imitative editing 의 benchmark 까지 제안
+
+
part composition : 얼마나 part 구성이 자연스럽게 잘 되었는가?
+
texture transfer : 느낌을 얼마나 잘 유지하면서 texture 가 변환됐는가?
MimicBrush 의 cross-image imitation ability (서로 다른 카테고리에서 잘 모방해오는 능력 정도로 이해하면 됨) 를 끌어올리기 위해서는 조금 더 적합한 training sample 을 모아서 학습할 수 있는 방법이 필요했음
+
Training data 를 구축하는 과정에서 두 가지의 철학을 지키려 하였음
+
+
source / reference images 들 간의 correspondence relation 이 존재해야 한다.
+
robustness 를 위해 source / reference image 사이의 large variations 을 기대할 수 있어야 한다.
+
+
+
Data selection
+
+
학습 중에는 같은 비디오로부터 frame 2개를 sampling 해서 뽑았음
+
SSIM 을 이용해 video frames 간의 similarity 를 측정했고 너무 그 값이 크거나 작으면 filtering 했음
+
+
+
Data augmentation
+
+
source & reference image 의 variation 을 증가시키기 위해서, 강력한 data augmentation 을 활용
+
+
color jitter, rotation, resizing, flipping, 심지어는 random projection transformation 으로 더욱 강한 deformation 도 수행
+
+
+
+
+
Masking strategy
+
+
가장 간단하게는 image 를 N x N grid 로 나누고 랜덤하게 masking 시키는 방법인데 저자들은 이렇게 랜덤하게 가져가면 easy cases 들이 많은 portion 을 차지한다는 것을 발견
+
+
ex. 배경 같은 큰 area 를 차지하는 것들은 계속 반복되는 content/textures 이기 때문에 도움이 안됨
+
+
+
SIFT matching 을 이용해서 source & ref image 의 matching points 를 얻고 그 matched feature points 의 grids 들을 좀 더 masking 하도록 하였음
+
video 보다 high-quality image 를 찾는 것이 더 쉬웠기 때문에 static image 한 장을 가지고 augmentation 시킨 다음, seg map 가지고 masking 시키는 방식으로도 활용 → robustness 를 증가시키는 효과를 불러일으킴
Muse 와 같은 transformer 기반의 generation 모델에서는 어떻게 diversity 한 결과를 가져올 수 있나요?
-
-
아무래도 Muse 는 random latent 에서 생성하는 것이 아니라 text-to-image 모델이라, text 에 따라서 다양한 이미지 생성 결과가 나타날 수 있을 것 같습니다.
-
-
-
Muse 는 결국 GAN 모델인가요?
-
-
기준점이 어떻냐에 따라 GAN 이다, 아니다, 라고 정하기 어려울 것 같습니다. VQGAN을 사용해서 GAN이라고 생각할 수 도 있고, GAN 처럼 random latent 결과에 따라 이미지 생성이 달라질 수 있는 관점에서 생각하면 아니다라고 말할 수 있을 것 같습니다.
-
-
-
Token 은 어떤 의미를 갖나요?
-
-
VQGAN에서 input 이미지를 인코딩하고, vector-quantization 과정을 거쳐 압축 후, codebook의 값을 가져와 feature를 구성하는데요, 이때 feature에 포함되어 있는 하나의 포인트에 해당하는 것이 token이라고 생각하시면 될 것 같습니다.
-
-
-
텍스트 프롬프트를 넣었을때 실제 이미지 생성은 어떻게 이뤄지나요? Inference에서는 입력 이미지가 없는데 base transformer에 입력 이미지에 대한 masked token대신 뭐가 들어가게 되나요?
-
-
실제 inference 과정에서는 input 이미지가 없기 때문에 모두 마스크된 형태로 입력되게 됩니다. text prompt 의 condition 에 따라 각 step을 거쳐 decoding 이 수행됩니다.
-
-
-
text embedding이 어떻게 objective function 수식에 들어가나요?
-
-
base transformer 에 대해 text embedding 값이 key, value로 입력되어 cross-attention 이 수행되게 됩니다. 그렇게 예측된 feature와 GT의 feature 끼리 cross entropy loss를 통해 마스크 예측할 수 있는 base transformer 가 학습이 됩니다.
Muse 와 같은 transformer 기반의 generation 모델에서는 어떻게 diversity 한 결과를 가져올 수 있나요?
+
+
아무래도 Muse 는 random latent 에서 생성하는 것이 아니라 text-to-image 모델이라, text 에 따라서 다양한 이미지 생성 결과가 나타날 수 있을 것 같습니다.
+
+
+
Muse 는 결국 GAN 모델인가요?
+
+
기준점이 어떻냐에 따라 GAN 이다, 아니다, 라고 정하기 어려울 것 같습니다. VQGAN을 사용해서 GAN이라고 생각할 수 도 있고, GAN 처럼 random latent 결과에 따라 이미지 생성이 달라질 수 있는 관점에서 생각하면 아니다라고 말할 수 있을 것 같습니다.
+
+
+
Token 은 어떤 의미를 갖나요?
+
+
VQGAN에서 input 이미지를 인코딩하고, vector-quantization 과정을 거쳐 압축 후, codebook의 값을 가져와 feature를 구성하는데요, 이때 feature에 포함되어 있는 하나의 포인트에 해당하는 것이 token이라고 생각하시면 될 것 같습니다.
+
+
+
텍스트 프롬프트를 넣었을때 실제 이미지 생성은 어떻게 이뤄지나요? Inference에서는 입력 이미지가 없는데 base transformer에 입력 이미지에 대한 masked token대신 뭐가 들어가게 되나요?
+
+
실제 inference 과정에서는 input 이미지가 없기 때문에 모두 마스크된 형태로 입력되게 됩니다. text prompt 의 condition 에 따라 각 step을 거쳐 decoding 이 수행됩니다.
+
+
+
text embedding이 어떻게 objective function 수식에 들어가나요?
+
+
base transformer 에 대해 text embedding 값이 key, value로 입력되어 cross-attention 이 수행되게 됩니다. 그렇게 예측된 feature와 GT의 feature 끼리 cross entropy loss를 통해 마스크 예측할 수 있는 base transformer 가 학습이 됩니다.
캡처된 이미지들의 렌더링 오차를 최소화하기 위해 연속적인 \(5 \mathrm{D}\) scene 함수의 파라미터를 직접 최적화하여 View synthesis 분야의 오랜 문제를 새로운 방식으로 해결함
-
-
-
정적 장면 → 연속적인 \(5 \mathrm{D}\) 함수로 표현
-
-
FC layer = Regression Function :
-a single \(5 \mathrm{D}\) coord \((x, y, z, \theta, \phi)\) → density, view-dependent RGB color
-
-
-
Output
-
-
공간 상의 각 지점 \((x, y, z)\)에서 각 방향 \((\theta, \phi)\) 으로 방출된 색상
-
각 지점 \((x, y, z)\) 의 밀도(density) = \(\sigma\)
-
-
밀도의 누적값을 통해 얼마나 많은 빛이 \((𝑥,𝑦,𝑧)\) 를 통과하는 광선에 의해 누적되는지를 표현
-
-
-
-
-
-
-
-
특정 시점으로부터의 NeRF 렌더링
-
-
광선을 따라 이동하여 샘플링된 \(3 \mathrm{D}\) 포인트 집합을 생성
-
해당 포인트들과 이에 해당하는 \(2 \mathrm{D}\) 시점 방향을 신경망에 대한 입력으로 사용하여 색상과 밀도의 집합을 생성
-
고전적 Volume rendering 기술을 사용하여 \(2 \mathrm{D}\) image 로 합성
-
-
-
-
-
-
Optimization
-
-
미분 가능, gradient descent 를 통한 최적화
-
각 관찰된 이미지와 렌더링된 해당 views사이의 오차를 최소화
-
다양한 views 에서 오차 최소화를 통해 실제 장면의 cotents 가 포함된 위치에 높은 밀도와 정확한 색상을 할당하여 장면의 일관된 모델을 예측
-
-
-
-
-
-
NeRF 최적화의 Basic implementation의 한계 및 대안
-
-
복잡한 장면에 대해서 충분히 고해상도 표현으로 수렴되지 않음
-
-
positional encoding 으로 입력 5D 좌표를 변환
-
MLP가 더 높은 주파수의 함수를 나타낼 수 있음.
-
-
-
카메라 광선당 요구되는 샘플링 수가 비효율적
-
-
계층적 샘플링 절차를 제안
-
고주파수의 장면 표현을 적절하게 샘플링하기 위해 필요한 쿼리 수를 감소시킴
-
-
-
-
-
-
-
-
본 논문의 접근 방식은 volumetric 표현의 이점을 상속
-
-
복잡한 실세계의 기하학적 형태와 외형을 표현 가능
-
투영된 이미지를 사용한 Gradient-based 최적화에 적합
-
고해상도에서 복잡한 장면을 모델링할 때 이산화된 복셀 그리드의 엄청난 저장 비용을 극복
-
Voxel (Volume + Pixel)
-3차원 공간에서 체적의 기본 단위 (2차원의 경우에선 pixe)
-위치 정보와 함께 밀도, 색상, 투과성 등의 속성을 가질 수 있음
-
Volumne Rendering
-3차원 공간에서 정의된 데이터(체적 데이터)를 2차원 이미지로 변환하는 과정
-예시) CT, MRI
-
Volumetric Data (체적 데이터)
-3차원 공간에서 샘플링된 데이터
-
-
-
-
-
-
Technical contributions
-
-
복잡한 기하학과 소재를 가진 연속적인 장면을 5차원 NeRF 로 나타내는 접근 방법, 기본 MLP 네트워크로 매개변수화
-
고전적인 볼륨 렌더링 기법을 기반으로 한 미분 가능한 렌더링 절차를 사용하여 이러한 표현을 표준 RGB 이미지로부터 최적화하는 방법을 제안
-
hierarchical sampling strategy : MLP’s capacity 를 시각적인 장면 내용이 있는 공간으로 할당 (물체가 있을 확률이 높은 부분을 모델이 집중적으로 학습)
-
Positional encoding : 입력 5차원 좌표를 고차원 공간으로 매핑하기 위해 NeRF를 성공적으로 최적화하여 고주파의 장면 콘텐츠를 표현가능
-
-
-
최초의 continuous neural scene representation 제안
-
-
-
-
-
Fig. 649 An overview of our neural radiance field scene representation and differentiable rendering procedure \ (source: {https://arxiv.org/pdf/2003.08934v2})#
\(\delta_i=t_{i+1}-t_i\) is the distance between adjacent samples (\(dt\) 를 대체)
-
\(\left(\mathbf{c}_i, \sigma_i\right)\) 의 집합으로부터 \(\hat{C}(\mathbf{r})\) 을 계산하는 함수는 쉽게 미분 가능하며
-\(\alpha_i=1-\exp \left(-\sigma_i \delta_i\right)\) 를 사용한 전통적인 alpha compositing
-
**alpha compositing (**알파 합성)
-
-
여러 이미지 또는 픽셀을 결합하여 하나의 이미지로 만드는 기술
-
ex) 투명한 이미지(유리, 그림자)를 배경 이미지 위에 겹칠 때 알파 컴포지팅을 사용하여 자연스러운 합성 수행
scene이 캡처된 RGB 이미지, extrinsic parameter(해당 카메라 포즈), intrinsic parameter, 장면 경계로 구성된 데이터셋이 필요
-
-
extrinsic parameter, intrinsic parameter
-
-
Extrinsic Parameter
-3D 공간 내에서 카메라가 어디에 위치(3D Translation)하고 있고, 어디를 바라보고 있는지(3D Rotation)에 대한 Parameter
-
Intrinsic Parameter
-카메라 렌즈와 센서 위치에 의해서 결정되어지는 항목으로, 이미지 패널이 얼마나 이동(2D Translation)하고, 얼마나 확대하고(2D Scaling), 얼마나 기울어졌는지(2D Shear) 대한 intrinsic parameter
-
-
-
-
-
Fig. 651 intrinsic prameter and extrinsic parameter#
-
-
-
-
카메라 영상 : 3차원 공간상의 점들을 2차원 이미지 평면에 투사(perspective projection)
-
-
-
-
-
Training
-
-
각 최적화 iteration에서 데이터셋의 모든 픽셀 집합에서 카메라 광선 batch를 무작위로 샘플링
-
계층적 샘플링을 따라 coarse 네트워크의 \(N_c\) 개의 샘플과 fine 네트워크의\(N_c + N_f\)개의 샘플을 쿼리
-
volume rendering 절차를 사용하여 두샘플 집합 모두에서 광선의 색상을 렌더링
-
-
-
Loss
-coarse 렌더링과 fine 렌더링의 색상 vs 실제 픽셀 색상 간의 총 제곱 오차
Volume Bounds
-For experiments with synthetic images, we scale the scene so that it lies within a cube of
-side length 2 centered at the origin, and only query the representation within this bounding volume. we use normalized device coordinates to map the depth range of these points into [−1, 1].
-
Training Details
-adding random Gaussian noise with zero mean and unit variance to the output σ values during optimization
캡처된 이미지들의 렌더링 오차를 최소화하기 위해 연속적인 \(5 \mathrm{D}\) scene 함수의 파라미터를 직접 최적화하여 View synthesis 분야의 오랜 문제를 새로운 방식으로 해결함
+
+
+
정적 장면 → 연속적인 \(5 \mathrm{D}\) 함수로 표현
+
+
FC layer = Regression Function :
+a single \(5 \mathrm{D}\) coord \((x, y, z, \theta, \phi)\) → density, view-dependent RGB color
+
+
+
Output
+
+
공간 상의 각 지점 \((x, y, z)\)에서 각 방향 \((\theta, \phi)\) 으로 방출된 색상
+
각 지점 \((x, y, z)\) 의 밀도(density) = \(\sigma\)
+
+
밀도의 누적값을 통해 얼마나 많은 빛이 \((𝑥,𝑦,𝑧)\) 를 통과하는 광선에 의해 누적되는지를 표현
+
+
+
+
+
+
+
+
특정 시점으로부터의 NeRF 렌더링
+
+
광선을 따라 이동하여 샘플링된 \(3 \mathrm{D}\) 포인트 집합을 생성
+
해당 포인트들과 이에 해당하는 \(2 \mathrm{D}\) 시점 방향을 신경망에 대한 입력으로 사용하여 색상과 밀도의 집합을 생성
+
고전적 Volume rendering 기술을 사용하여 \(2 \mathrm{D}\) image 로 합성
+
+
+
+
+
+
Optimization
+
+
미분 가능, gradient descent 를 통한 최적화
+
각 관찰된 이미지와 렌더링된 해당 views사이의 오차를 최소화
+
다양한 views 에서 오차 최소화를 통해 실제 장면의 cotents 가 포함된 위치에 높은 밀도와 정확한 색상을 할당하여 장면의 일관된 모델을 예측
+
+
+
+
+
+
NeRF 최적화의 Basic implementation의 한계 및 대안
+
+
복잡한 장면에 대해서 충분히 고해상도 표현으로 수렴되지 않음
+
+
positional encoding 으로 입력 5D 좌표를 변환
+
MLP가 더 높은 주파수의 함수를 나타낼 수 있음.
+
+
+
카메라 광선당 요구되는 샘플링 수가 비효율적
+
+
계층적 샘플링 절차를 제안
+
고주파수의 장면 표현을 적절하게 샘플링하기 위해 필요한 쿼리 수를 감소시킴
+
+
+
+
+
+
+
+
본 논문의 접근 방식은 volumetric 표현의 이점을 상속
+
+
복잡한 실세계의 기하학적 형태와 외형을 표현 가능
+
투영된 이미지를 사용한 Gradient-based 최적화에 적합
+
고해상도에서 복잡한 장면을 모델링할 때 이산화된 복셀 그리드의 엄청난 저장 비용을 극복
+
Voxel (Volume + Pixel)
+3차원 공간에서 체적의 기본 단위 (2차원의 경우에선 pixe)
+위치 정보와 함께 밀도, 색상, 투과성 등의 속성을 가질 수 있음
+
Volumne Rendering
+3차원 공간에서 정의된 데이터(체적 데이터)를 2차원 이미지로 변환하는 과정
+예시) CT, MRI
+
Volumetric Data (체적 데이터)
+3차원 공간에서 샘플링된 데이터
+
+
+
+
+
+
Technical contributions
+
+
복잡한 기하학과 소재를 가진 연속적인 장면을 5차원 NeRF 로 나타내는 접근 방법, 기본 MLP 네트워크로 매개변수화
+
고전적인 볼륨 렌더링 기법을 기반으로 한 미분 가능한 렌더링 절차를 사용하여 이러한 표현을 표준 RGB 이미지로부터 최적화하는 방법을 제안
+
hierarchical sampling strategy : MLP’s capacity 를 시각적인 장면 내용이 있는 공간으로 할당 (물체가 있을 확률이 높은 부분을 모델이 집중적으로 학습)
+
Positional encoding : 입력 5차원 좌표를 고차원 공간으로 매핑하기 위해 NeRF를 성공적으로 최적화하여 고주파의 장면 콘텐츠를 표현가능
+
+
+
최초의 continuous neural scene representation 제안
+
+
+
+
+
Fig. 661 An overview of our neural radiance field scene representation and differentiable rendering procedure \ (source: {https://arxiv.org/pdf/2003.08934v2})#
\(\delta_i=t_{i+1}-t_i\) is the distance between adjacent samples (\(dt\) 를 대체)
+
\(\left(\mathbf{c}_i, \sigma_i\right)\) 의 집합으로부터 \(\hat{C}(\mathbf{r})\) 을 계산하는 함수는 쉽게 미분 가능하며
+\(\alpha_i=1-\exp \left(-\sigma_i \delta_i\right)\) 를 사용한 전통적인 alpha compositing
+
**alpha compositing (**알파 합성)
+
+
여러 이미지 또는 픽셀을 결합하여 하나의 이미지로 만드는 기술
+
ex) 투명한 이미지(유리, 그림자)를 배경 이미지 위에 겹칠 때 알파 컴포지팅을 사용하여 자연스러운 합성 수행
scene이 캡처된 RGB 이미지, extrinsic parameter(해당 카메라 포즈), intrinsic parameter, 장면 경계로 구성된 데이터셋이 필요
+
+
extrinsic parameter, intrinsic parameter
+
+
Extrinsic Parameter
+3D 공간 내에서 카메라가 어디에 위치(3D Translation)하고 있고, 어디를 바라보고 있는지(3D Rotation)에 대한 Parameter
+
Intrinsic Parameter
+카메라 렌즈와 센서 위치에 의해서 결정되어지는 항목으로, 이미지 패널이 얼마나 이동(2D Translation)하고, 얼마나 확대하고(2D Scaling), 얼마나 기울어졌는지(2D Shear) 대한 intrinsic parameter
+
+
+
+
+
Fig. 663 intrinsic prameter and extrinsic parameter#
+
+
+
+
카메라 영상 : 3차원 공간상의 점들을 2차원 이미지 평면에 투사(perspective projection)
+
+
+
+
+
Training
+
+
각 최적화 iteration에서 데이터셋의 모든 픽셀 집합에서 카메라 광선 batch를 무작위로 샘플링
+
계층적 샘플링을 따라 coarse 네트워크의 \(N_c\) 개의 샘플과 fine 네트워크의\(N_c + N_f\)개의 샘플을 쿼리
+
volume rendering 절차를 사용하여 두샘플 집합 모두에서 광선의 색상을 렌더링
+
+
+
Loss
+coarse 렌더링과 fine 렌더링의 색상 vs 실제 픽셀 색상 간의 총 제곱 오차
Volume Bounds
+For experiments with synthetic images, we scale the scene so that it lies within a cube of
+side length 2 centered at the origin, and only query the representation within this bounding volume. we use normalized device coordinates to map the depth range of these points into [−1, 1].
+
Training Details
+adding random Gaussian noise with zero mean and unit variance to the output σ values during optimization
포인트 클라우드의 각 포인트를 출력 차원이 D인 선형 레이어(linear layer)에 넣어 K×D 입력 텐서를 얻고 모델에 입력 컨텍스트로 사용한다. 또한 작은 MLP에 타임스텝 t를 넣어 컨텍스트 앞에 추가할 다른 D차원 벡터를 얻는다.
-
이미지를 조건으로 입력 받기 위해, 사전 학습된 ViT-L/14 CLIP 모델에 이미지를 입력하고 이 CLIP 모델의 마지막 레이어의 임베딩을 가져온다. (shape: 256xD’), 이를 선형 투사(lienarly project)하여 256xD shape의 또 다른 텐서를 얻고 이를 트랜스포머 컨텍스트 앞에 추가한다. → 이 방법이 단일 CLIP 이미지 또는 텍스트 임베딩을 사용하는 것보다 우수했다.
-
최종 입력 컨텍스트는 (K+257) x D의 shape가 된다. 길이 K의 최종 출력 시퀀스를 얻기 위해 최종 토큰 K개를 가져오고 이를 프로젝션하여 입력 포인트 K개에 대한 ε와 Σ 예측을 얻는다.
-
-
-
-
-
-
이 모델에서는 positional encoding을 사용하지 않는다. 따라서 모델 자체는 입력 포인트 클라우드에 대해 순열 분별(permutation-invariant)하다.
포인트 클라우드의 각 포인트를 출력 차원이 D인 선형 레이어(linear layer)에 넣어 K×D 입력 텐서를 얻고 모델에 입력 컨텍스트로 사용한다. 또한 작은 MLP에 타임스텝 t를 넣어 컨텍스트 앞에 추가할 다른 D차원 벡터를 얻는다.
+
이미지를 조건으로 입력 받기 위해, 사전 학습된 ViT-L/14 CLIP 모델에 이미지를 입력하고 이 CLIP 모델의 마지막 레이어의 임베딩을 가져온다. (shape: 256xD’), 이를 선형 투사(lienarly project)하여 256xD shape의 또 다른 텐서를 얻고 이를 트랜스포머 컨텍스트 앞에 추가한다. → 이 방법이 단일 CLIP 이미지 또는 텍스트 임베딩을 사용하는 것보다 우수했다.
+
최종 입력 컨텍스트는 (K+257) x D의 shape가 된다. 길이 K의 최종 출력 시퀀스를 얻기 위해 최종 토큰 K개를 가져오고 이를 프로젝션하여 입력 포인트 K개에 대한 ε와 Σ 예측을 얻는다.
+
+
+
+
+
+
이 모델에서는 positional encoding을 사용하지 않는다. 따라서 모델 자체는 입력 포인트 클라우드에 대해 순열 분별(permutation-invariant)하다.
ProlificDreamer: High-Fidelity and Diverse Text-to-3D Generation with Variational Score Distillation#
+
+
view generation이 가능한 DM의 특성을 3D rendering 모델로 전달하여 pretrained 된 DM이 생성하는 이미지 분포와 3D representaiton의 분포를 맞춰가는 것으로 Dream Fusion(SDS)과 유사하지만 개선된 아이디어(VSD)를 제안하고자한 논문이다.
고품질의 3D content를 생산하는 것은 품이 많이 드는 일이다. 이러한 어려움을 해결하기 위해 text-to-3D 방식이 발전하고 있다. texture 기술을 기반으로 3D content 생성을 자동화하는 방식은 유망하며 다양한 분야(encompassing architecture, animation, gaming, AR/VR) paradigm의 변화를 일으킬 수 있을 것이다.
+
Diffusion model의 text-to-image 생성력을 바탕으로 3D content를 생성하려는 DreamFusion과 같은 시도가 있었다. Dream Fusion은 Score Distillation Sampling(SDS) 알고리즘을 이용해 단일 3D representation을 최적화 했다. 이는 어떤 방향에서 렌더링된 이미지라도 주어진 text에 대해 높은 likelihood를 갖도록 한것으로써 diffusion model에 의해 evaluate되었다. (diffusion model을 loss에 활용) 하지만 over-satuation, over-smoothing, low-diversity 문제가 발생했다. 또한 text-to-3D의 design space에서 orthogonal 한 요소(rendering resolution - distillation time schedule)들에 대한 파악이 아직 부족하다.
+
본 논문에서는 섬세한 3D representation을 얻기 위해 이러한 모든 요소에 대해 systematic study를 진행한다. 먼저 Variational Score Distillation(VSD) 를 제안한다. 이는 주어진 textual prompt와 해당 3D scene을 하나의 random variable로 취급하며 하나의 점(single point)로 취급한 SDS와는 다르다. VSD는 3D scene의 분포를 최적화하며 이러한 분포는 모든 시점에 대해 rendered images의 분포가 서로 최대한 가까워지도록 한다. pretrained 2D diffusion model의 경우에는 KL divergence에 해당한다?! 이러한 variational formulation에서 VS는 multiple 3D scene을 하나의 prompt에 정렬할 수 있는 특성을 가질 수 있다.
+
+
원문참고
+
VSD optimizesa distribution of 3D scenes such that the distribution induced on images rendered from all views aligns as closely as possible, in terms of KL divergence, with the one defined by the pretrained 2D diffusion model (see Sec. 3.1). Under this variational formulation, VSD naturally characterizes the phenomenon that multiple 3D scenes can potentially align with one prompt.
+
+
+
해당 variational formulation을 효율적으로 풀기 위해 VSD는 particle-based variational inference를 도입하고, 3D representation을 표현하기 위해 하나의 3D parameters 집합을 particles로 표현하였다. Wasserstein gradient flow를 이용해 이러한 particles로 부터 새로운 gradient-based update rule을 이끌어 냈다. 이는 최적화 수렴 후, 해당 particles가 desired distribution으로 부터 sample된 것임을 보장한다. update 시에는 diffused rendered images의 분포의 score function이 필요한데 이는 pretrained diffusion model + low-rank adaptation(LoRA) 로 얻을 수 있었다. 최종적으로 particles과 score function을 업데이트 하는 형태가 된다.
+
Sec 3.3에서 SDS는 variational distribution에 single-point Dirac distribution을 사용하는 VSD라고 볼 수 있음을 보인다. 이를 통해 SDS가 diversity가 fidelity가 낮은 이유를 알 수 있다. single particle만으로도 VSD는 parametric score model을 학습할 수 있고 잠재적으로 SDS보다 더 나은 생성 결과를 제공할 수 있다. 또한 동일한 렌더링 함수를 이용해 2D space에서 SDS와 VSD를 비교하여 3D 요소만 분리하여 비교한 결과를 담았다. diffusion model의 고전 샘플링 방식과 같이 VSD는 CFG의 가중치 조절을 통해 보다 사실적인 sample을 생성할 수 있다. 반면 SDS는 이전 text-to-3D연구과 유사한 over-saturation, over-smoothing문제를 보이는 부족한 결과를 보였다.
Sec 4는 text-to-3D 알고리즘의 orthogonal 요소들에 대한 추가적인 systematically study와 clear design space를 담고 있다. 특히 훈련과정 중 고화질 렌더링과 시각적 품질 개선을 위한 annealed distilling time schedule을 제안한다. 또한 복잡한 scene을 표현하기 위한 scene initialization을 제안한다. 요소들에 대한 ablation study는 Sec 5에서 볼 수 있으며, 앞서 언급한 요소들은 VSD에 효과적임을 보인다. 결론적으로 high-fidelity, diverse 3D 결과를 얻을 수있으며 이를 ProlificDreamer라고 한다.
+
Sec 5에서 ProlificDreamer의 고화질(512x512) rendering 능력과 rich structure와 complex effects를 Neural Radiance Fields(NeRF)상에서 표현할 수 있음을 보인다. ProlificDreamer는 다중 물체가 포함된 복잡한 scene의 360도 전방향을 성공적으로 표현하는 것에 처음으로 성공했다. 게다가 NeRF로 초기화 한 후 ProlificDreamer로 세세하고 photorealistic한 3D texture mesh들을 생성할 수있다.
\(\omega(t)\)는 time dependent weighting function이다. 훈련이 끝나면 \(p_t\approx q_t\) 가 되며 따라서 \(p_0\approx q_0\) 으로 sample들을 그릴 수 있게 된다. 덧붙여 noise prediction network는 \(p_t, q_t\) 의 score function을 approximating하는 데에도 사용가능하다. \(\triangledown_{x_t}\text{log}q_t(x_t)\approx\triangledown_{x_t}\text{log}p_t(x_t)\approx-\epsilon_\phi(x_t,t)/\sigma_t\)
+
+
+
diffusion model이 가장 활발히 활용되고 있는 분야 중 하나는 text-to-image generation으로 text prompt \(y\)를 조건으로 noise를 예측한다. 또한 Classifier-free Guidence를 통해 샘플 품질과 다양성을 조절한다. guidance scale이 커질 수록 품질이 올라가지만 다양성이 감소하는 경향을 보인다.
Score Distillation Sampling (SDS) from DreamFusion
+
Score Jacobian Chaining (SJC) 라고도 불리며 Zero-1-to-3, Magic3d, Fantasia3d, Latent NeRF 등 다양한 연구에 활용되고 있다.
+
+
사전학습된 T2I diffusion model \(p_t(x_t|y)\)과 noise prediction network \(\epsilon_\text{pretrained}(x_t,t,y)\) 을 이용해 SDS는 single 3D representation의 parameter \(\theta \in \Theta\)를 최적화 한다. 이때 사용하는 metric은 Euclidean metric으로 \(\Theta\)는 Euclidean space이다.
+
camera parameter \(c\)가 분포 \(p(c)\)를 따르고,
+differentiable rendering mapping \(g(\cdot,c):\Theta \rightarrow \Bbb R^d\) 이 주어진다고 하자.
+\(y^c\)를 view dependent prompt라고 하면, rendering image \(g(\theta,c)\)에서 시작하는 forward diffusion process는 \(q_t^\theta(x_t|c)\)로 표현할 수 있다.
3.1 Sampling from 3D Distribution via Variational Inference#
+
3D represetation에 사용되는 parameter \(\theta\)들은 확률밀도 \(\mu(\theta|y)\)로 모델링 할 수 있다.
+\(q_0^\mu(x_0|c,y)\)는 rendered image \(x_0;=g(\theta,c)\)의 분포, \(p_0(x_0|y^c)\)는 \(t=0\) 일때 marginal distribution이다.
+
고품질의 3D representation을 얻기 위해서 distribution \(\mu\)를 최적화 하는 방법을 제안한다. 사전학습된 DM을 이용해 모든 view에 대한 rendered image sample과 distribution \(\mu\)를 정렬(align)하는 것은 아래와 같이 두 분포의 거리를 좁히는 것이라고 할 수 있다.
위의 식은 일반적인 variational inference problem으로 variational distribution \(q_0^\mu(x_0|c,y)\)을 target distribution \(p_0(x_0|y^c)\)으로 근사(distill)하는 방식을 사용한다.
+
위의 식 4의 prob을 직접 푸는것은 복잡하고 비효율적이기 때문에 diffusion model을 이용해 series of optimization problem을 통해 해결하고자 한다. \(t\)가 \(T\)를 향해 점점 커질때, 위의 최적화 문제는 diffused distribution이 gaussian distribution에 가까워 지며 점점 쉬워진다.
+
(기존 SDS 최적화 식의 parameter \(\theta\)가 distribution \(\mu\)로 바뀐 형태)
3.2 Update Rule for Variational Score Distillation#
+
식 5의 prob을 풀기위해 또 다른 생성모델을 훈련하여 풀 수 있는데 이는 resource가 많이 필요하고 최적화 과정이 복잡해진다. 앞선 particle-based variational inference 연구와 유사하게, n개의 3D particles를 유지하고 해당 particles을 위한 새로운 update rule을 제안한다. 즉, \(\{\theta\}^n_{i=1}\)을 현재 distribution \(\mu\)를 표현하기 위해 사용하는 것이다. \(\theta^{(i)}\)는 최적화 과정이 수렴되고 하면 최적 분포 \(\mu^*\)에서 샘플링된 것이 된다.
SDS는 \(\mu(\theta|y)\approx \delta(\theta-\theta^{(1)})\) 인 VSD의 special case에 해당한다. VSD는 potential mutliple particles일 뿐 아니라 parametric score function \(\epsilon_\phi\)도 학습하기 때문에 SDS와 동일하게 single particle을 사용해도 성능이 좋다. 또한 LoRA를 사용해 text prompt 로 부터 추가적으로 뽑아낸 정보를 estimation \(\epsilon_\phi(x_t,t,c,y)\)에 반영할 수 있다.
VSD는 사전학습된 diffusion model을 이용해 optimal \(\mu^*\)에서 sample \(\theta\)를 추출하고자 한다. 때문에 3D sampling에서 CFG를 tuning한 효과가 기존 2D이미지 생성시 DPM-solver에서 CFG 값을 조절하는 것과 유사하다. 그래서 CFG 값을 조절하면서 더 다양한 실험결과를 얻을 수 있게 된다. SDS도 이점은 마찬가지 이나, CFG 값이 클때만 유효한 3D content를 만들어 낼 수 있었다.
+
VSD vs. SDS in 2D experiments that isolate 3D representations
High-resolution rendering for NeRF training (in 1st stage)
+
ProlificDreamer에서는 고화질 렌더링을 위해 Instant NGP를 사용했으며 VSD를 이용해 512 resolution 까지 NeRF를 최적화 했다. VSD를 사용함으로써 high-fidelity 결과를 얻을 수 있었다.
+
+
Instant NGP
+
+
Scene initialization for NeRF training (in 1st stage)
+
NeRF의 초기 density는 \(\sigma_\text{init}(\mu)=\lambda_\sigma(1-\frac{\|\mu\|_2}{r})\)로 초기화 한다. \(\lambda\) 는 density strength, \(r\) 는 density radius, \(\mu\)는 3d coordinate이다.
+
object-centric scene에서는 Magic3D의 방식을 따랐으며(\(\lambda=10, r=0.5\)),
+복잡한 scene의 경우 \(\lambda=-10\) 로 하여 density가 거의 비어있도록 하고, \(r\)을 2.5로 하여 camera를 둘러 싸도록 했다.
+
Annealed time schedule for score distillation (in 1st stage)
+
단순한 2단계 annealing을 score distillation objective에 적용했다. 이는 SDS나 VSD 모두에 적용가능하다. 초기 몇 스텝에서는 \(t\sim \mathcal U(0.02,0.98)\)로 하고 이후에는 \(t\sim \mathcal U(0.02,0.50)\)로 설정했다.
+
여기서 핵심은 \(q_0^\mu(x_0|c,y)\)와 \(p_0(x_0|y^c)\)를 맞추는 것인데 t가 커지면 KL divergence가 학습초기에 더 적당한 최적화 방향으로 갈 수 있다. t가 작으면 더 세부적인 조정이 가능하므로 \(p_t(x^*|y^c)\)와 \(p_0(x^*|y^C)\)의 차를 더 줄일 수 있다.
+
Mesh representation and fine-tuning (in 2nd stage)
+
coordinate-based hash grid encoder의 특성을 이용해 NeRF에서 mesh를 추출했다. Fantasia3D의 방법론을 따랐는데 여기서는 geometry와 texture를 분리하여 최적화했다. 첫번째로는 normal map을 이용해 geometry를 최적화하고 두번째로 texture를 최적화하는 식이다. 실험결과에서 이단계에서는 SDS와 VSD의 품질 차이가 크지않아 효율성을 위해 SDS를 사용했다. 하지만 Fantasia3D와 비교했을때 VSD 및 앞선 방법론을 이용해 최적화한 NeRF에서 뽑아낸 mesh는 SDS를 이용한 것보다 뛰어났다.
CFG 값이 작으면 diversity 상승, CFG 값이 크면 비교적 diversity가 하락하는 실험결과를 얻음. VSD의 경우 CFG 값이 작을때에도 좋은 품질의 3D content를 생성할 수있기 때문에 충분한 diversity의 결과를 얻을 수 있지만 SDS의 경우 CFG 값이 커야만 괜찮은 3D content를 생성하기 때문에 diversity가 하락할 수밖에 없음.
SDXL은 T2I latent diffusion 모델이다. Stable Diffusion과 비교하면, SDXL은 세 배 더 큰 규모의 UNet을 포함한다. 더 많은 attention 블록과 더 큰 cross attention context 가 SDXL에서 두 번째 text encoder로 사용되면서 모델 파라미터가 증가했다. 다수의 새로운 conditioning 방법과 다양한 비율에 맞도록 SDXL을 학습할 수 있도록 설계했다. 또한 후처리 방식의 image to image 기술을 사용해 SDXL의 생성 샘플의 시각적인 fidelity를 향상시킨 refinement model을 소개한다. SDXL은 대폭 향상된 성능을 보여준다.
그림 1에서 왼쪽 그림을 보면 추가의 refinement 단계를 추가해 성능을 높인 SDXL이 기존 SD보다 성능이 우수한 것을 확인할 수 있다. 오른쪽 그림은 아키텍처를 시각화했는데, 128x128 크기의 latent를 생성한다. 그 후 고해상도 refinement 모델을 활용하고 동일한 프롬프트를 활용해 첫 번째 단계에서 생성된 latent를 SDEdit을 적용한다. SDXL과 refinement 모델은 동일한 autoencoder를 사용한다.
SD와 다르게 UNet 내의 transformer 블록의 heterogeneous 분포를 사용했다는 점이다. 테이블 1을 참고하면 highest feature level에서 transformer 블럭을 사용했고, lower level에서는 2, 10 개의 블럭을 사용했고, UNet에서 lowest level(8x downsampling)을 제거했다. text conditioning을 위한 pretrained 된 text encoder를 사용했다. 특히, CLIP Vit-L과 함께 OpenCLIP ViT-bigG를 사용했고, 채널 축에 두 번째 text encoder의 output을 concat 했다. 게다가 text input으로 모델에 condition을 주기 위해 cross attention 레이어를 사용했으며, 또 OpenCLIP로부터 pooled text embedding을 모델에 condition으로 추가했다. 이러한 변화는 UNet의 파라미터 사이즈가 2.6B로 증가했다. text encoder는 817M 파라미터를 가지고 있다.
SD 1.4/1.5 같은 경우 512 픽셀 이하 크기의 이미지는 제외하고 학습을 시키거나, 너무 작은 이미지는 upscale하여 학습을 시켰다. 이는 학습할 때의 최소 크기가 정해지는 문제점이 발생한다. 따라서 성능을 저하시키거나, 일반화를 잘 못할 수 있다.
-
그림 2를 보면 SDXL의 데이터 셋의 분포를 시각화해주는 그림이다. 제안된 size-conditiong 없이, 256x256 픽셀 크기 미만의 데이터가 39%나 달한다. upscale 하게 된다면 최종 결과물이 blur 한 결과를 가져와 좋지 않은 아티팩트가 생긴다.
-
대신, 저자들은 원래의 이미지 해상도에서 UNet 모델에 condition을 주었다. 특히 어떠한 rescaling 전의 원래의 크기인 \(c_\text{size}=(h_\text{original}, w_\text{original})\)를 제공해 추가의 condition을 줄 수 있게 했다. UNet의 denoising 할 때의 condition으로 추가된다.
-
Inference 때, 사용자가 size-conditioning을 통해 해상도를 정할 수 있다. 모델은 conditioning 크기를 해상도에 의존적인 이미지 feature과 연관시키도록 하는 방법을 학습했다.
CIN-512-only 는 512 미만의 이미지를 제외하고 학습을 시켰고(70k 장), CIN-nocond 는 모든 ImageNet 이미지를 사용했으며, CIN-size-cond 는 추가 size-condition을 사용했다. 표 2에서 보다시피 CIN-size-cond 모델이 FID, IS 모두 높은 성능을 보였다.
그림 4에서 SD 같은 경우 고양이 머리가 잘려진 결과를 얻었다. 이러한 이유는 학습할 때, random cropping으로 인해 생성되었기 때문이다.
-
이러한 문제를 해결하기 위해, 간단한 효과적인 방법을 제안한다. 데이터를 loading 할 때, 균등하게 \(c_\text{top}\)과 \(c_\text{left}\) (높이 및 너비 축을 따라 왼쪽 상단 모서리에서 잘린 픽셀의 양을 지정하는 정수)를 샘플링한다. 그 후 Fourier feature 임베딩을 통해 conditioning 파라미터로써 모델에 입력한다. 위에서 언급한 size conditioning과 비슷하다. concat 된 임베딩 \(c_\text{crop}\)은 추가의 conditioning 파라미터로 사용된다.
-
저자들은 LDM 뿐만 아니라 어떠한 DM에서도 사용될 수 있다고 강조한다. crop 및 size-conditioning은 쉽게 결합될 수 있다. 이러한 경우, crop 및 size-conditioning을 feature 임베딩을 채널 축에 concat 하고 UNet의 타임스텝 임베딩에 추가한다.
최적화 동안, 학습 배치는 동일한 버킷(같은 비율의 이미지들?)의 이미지로 구성되며, 각 훈련 스텝마다 버킷 크기를 번갈아 가며 사용했다. 추가적으로, 모델은 버킷 크기(혹은 타겟 크기)를 conditioning으로 주었으며, 위에서 언급한 size, crop conditioning과 유사하게 Fourier 공간에 임베딩되는 \(c_\text{ar}=(h_\text{tgt}, w_\text{tgt})\) 형태로 표현된다.
-
실제로, 모델이 고정된 비율및 해상도의 데이터로 pretraining이 마친 후 파인튜닝 단계에서는 다양한 비율의 데이터로 학습했고, 채널 축으로 concat 하는 2.2절에서 소개한 conditioning 기술과 함께 결합했다. 이를 아래의 그림 16에서 코드로 확인할 수 있다.
SD는 LDM 중 하나이고, autoencoder의 latent space를 학습한다. semantic composition은 LDM으로부터 표현되지만 저자들은 local, high frequency 디테일한 부분을 향상하고자 autoencoder를 향상했다. 끝으로, 원래의 SD를 사용한 autoencoder 아키텍처에서 더 큰 배치사이즈(256 vs 9)로 학습했고 추가로 exponential moving average를 사용한 가중치를 사용했다. 결과 autoencoder의 성능이 reconstruction 메트릭에 좋은 결과를 가져왔다.
학습 파라미터를 정리해주는 절입니다. diffusion time step은 1000 step을 사용했다. 우선, base model를 내부 데이터 셋으로 그림 2에 나와있는 높이-너비 분포에 맞게 학습을 시켰다. 600,000 step을 사용했으며, 256x256 사이즈로, 배치는 2048로, size & crop conditioning을 사용했다. 그 후 512x512 이미지를 추가로 200,000 최적화 step으로 학습시켰고, 마침내 offset 노이즈 [11, 25] 0.05 수준과 함께 다중 비율 학습을 활용하여 ~ 1024x1024 영역의 다양한 비율로 모델을 학습했다.
경험적으로, 그림 6처럼 특정 부분 퀄리티가 낮은 샘플의 결과를 찾았다. 왼쪽 그림이 refinement stage 적용 전, 오른쪽 그림이 refinement stage를 적용한 그림이다.
-
이를 해결하기 위해, 고품질, 고해상도 데이터에 특화된 latent space 내에서 별도의 LDM을 학습했다. 기본 모델의 샘플에 대해 SDEdit에서 도입한 노이즈 제거 과정을 사용했다. eDiff-I 방법을 따랐으며, 이를 첫 200 노이즈 스케일에 refinement 모델을 사용했다. inference에서, base SDXL에서 latent를 추출하고 바로 diffuse와 denoise를 refinement 모델에 넣었다. 이 스텝은 선택이지만 배경 및 사람 얼굴과 같은 디테일에서 향상된 결과(그림 6, 13)를 얻을 수 있었다.
SDXL은 T2I latent diffusion 모델이다. Stable Diffusion과 비교하면, SDXL은 세 배 더 큰 규모의 UNet을 포함한다. 더 많은 attention 블록과 더 큰 cross attention context 가 SDXL에서 두 번째 text encoder로 사용되면서 모델 파라미터가 증가했다. 다수의 새로운 conditioning 방법과 다양한 비율에 맞도록 SDXL을 학습할 수 있도록 설계했다. 또한 후처리 방식의 image to image 기술을 사용해 SDXL의 생성 샘플의 시각적인 fidelity를 향상시킨 refinement model을 소개한다. SDXL은 대폭 향상된 성능을 보여준다.
그림 1에서 왼쪽 그림을 보면 추가의 refinement 단계를 추가해 성능을 높인 SDXL이 기존 SD보다 성능이 우수한 것을 확인할 수 있다. 오른쪽 그림은 아키텍처를 시각화했는데, 128x128 크기의 latent를 생성한다. 그 후 고해상도 refinement 모델을 활용하고 동일한 프롬프트를 활용해 첫 번째 단계에서 생성된 latent를 SDEdit을 적용한다. SDXL과 refinement 모델은 동일한 autoencoder를 사용한다.
SD와 다르게 UNet 내의 transformer 블록의 heterogeneous 분포를 사용했다는 점이다. 테이블 1을 참고하면 highest feature level에서 transformer 블럭을 사용했고, lower level에서는 2, 10 개의 블럭을 사용했고, UNet에서 lowest level(8x downsampling)을 제거했다. text conditioning을 위한 pretrained 된 text encoder를 사용했다. 특히, CLIP Vit-L과 함께 OpenCLIP ViT-bigG를 사용했고, 채널 축에 두 번째 text encoder의 output을 concat 했다. 게다가 text input으로 모델에 condition을 주기 위해 cross attention 레이어를 사용했으며, 또 OpenCLIP로부터 pooled text embedding을 모델에 condition으로 추가했다. 이러한 변화는 UNet의 파라미터 사이즈가 2.6B로 증가했다. text encoder는 817M 파라미터를 가지고 있다.
SD 1.4/1.5 같은 경우 512 픽셀 이하 크기의 이미지는 제외하고 학습을 시키거나, 너무 작은 이미지는 upscale하여 학습을 시켰다. 이는 학습할 때의 최소 크기가 정해지는 문제점이 발생한다. 따라서 성능을 저하시키거나, 일반화를 잘 못할 수 있다.
+
그림 2를 보면 SDXL의 데이터 셋의 분포를 시각화해주는 그림이다. 제안된 size-conditiong 없이, 256x256 픽셀 크기 미만의 데이터가 39%나 달한다. upscale 하게 된다면 최종 결과물이 blur 한 결과를 가져와 좋지 않은 아티팩트가 생긴다.
+
대신, 저자들은 원래의 이미지 해상도에서 UNet 모델에 condition을 주었다. 특히 어떠한 rescaling 전의 원래의 크기인 \(c_\text{size}=(h_\text{original}, w_\text{original})\)를 제공해 추가의 condition을 줄 수 있게 했다. UNet의 denoising 할 때의 condition으로 추가된다.
+
Inference 때, 사용자가 size-conditioning을 통해 해상도를 정할 수 있다. 모델은 conditioning 크기를 해상도에 의존적인 이미지 feature과 연관시키도록 하는 방법을 학습했다.
CIN-512-only 는 512 미만의 이미지를 제외하고 학습을 시켰고(70k 장), CIN-nocond 는 모든 ImageNet 이미지를 사용했으며, CIN-size-cond 는 추가 size-condition을 사용했다. 표 2에서 보다시피 CIN-size-cond 모델이 FID, IS 모두 높은 성능을 보였다.
그림 4에서 SD 같은 경우 고양이 머리가 잘려진 결과를 얻었다. 이러한 이유는 학습할 때, random cropping으로 인해 생성되었기 때문이다.
+
이러한 문제를 해결하기 위해, 간단한 효과적인 방법을 제안한다. 데이터를 loading 할 때, 균등하게 \(c_\text{top}\)과 \(c_\text{left}\) (높이 및 너비 축을 따라 왼쪽 상단 모서리에서 잘린 픽셀의 양을 지정하는 정수)를 샘플링한다. 그 후 Fourier feature 임베딩을 통해 conditioning 파라미터로써 모델에 입력한다. 위에서 언급한 size conditioning과 비슷하다. concat 된 임베딩 \(c_\text{crop}\)은 추가의 conditioning 파라미터로 사용된다.
+
저자들은 LDM 뿐만 아니라 어떠한 DM에서도 사용될 수 있다고 강조한다. crop 및 size-conditioning은 쉽게 결합될 수 있다. 이러한 경우, crop 및 size-conditioning을 feature 임베딩을 채널 축에 concat 하고 UNet의 타임스텝 임베딩에 추가한다.
최적화 동안, 학습 배치는 동일한 버킷(같은 비율의 이미지들?)의 이미지로 구성되며, 각 훈련 스텝마다 버킷 크기를 번갈아 가며 사용했다. 추가적으로, 모델은 버킷 크기(혹은 타겟 크기)를 conditioning으로 주었으며, 위에서 언급한 size, crop conditioning과 유사하게 Fourier 공간에 임베딩되는 \(c_\text{ar}=(h_\text{tgt}, w_\text{tgt})\) 형태로 표현된다.
+
실제로, 모델이 고정된 비율및 해상도의 데이터로 pretraining이 마친 후 파인튜닝 단계에서는 다양한 비율의 데이터로 학습했고, 채널 축으로 concat 하는 2.2절에서 소개한 conditioning 기술과 함께 결합했다. 이를 아래의 그림 16에서 코드로 확인할 수 있다.
SD는 LDM 중 하나이고, autoencoder의 latent space를 학습한다. semantic composition은 LDM으로부터 표현되지만 저자들은 local, high frequency 디테일한 부분을 향상하고자 autoencoder를 향상했다. 끝으로, 원래의 SD를 사용한 autoencoder 아키텍처에서 더 큰 배치사이즈(256 vs 9)로 학습했고 추가로 exponential moving average를 사용한 가중치를 사용했다. 결과 autoencoder의 성능이 reconstruction 메트릭에 좋은 결과를 가져왔다.
학습 파라미터를 정리해주는 절입니다. diffusion time step은 1000 step을 사용했다. 우선, base model를 내부 데이터 셋으로 그림 2에 나와있는 높이-너비 분포에 맞게 학습을 시켰다. 600,000 step을 사용했으며, 256x256 사이즈로, 배치는 2048로, size & crop conditioning을 사용했다. 그 후 512x512 이미지를 추가로 200,000 최적화 step으로 학습시켰고, 마침내 offset 노이즈 [11, 25] 0.05 수준과 함께 다중 비율 학습을 활용하여 ~ 1024x1024 영역의 다양한 비율로 모델을 학습했다.
경험적으로, 그림 6처럼 특정 부분 퀄리티가 낮은 샘플의 결과를 찾았다. 왼쪽 그림이 refinement stage 적용 전, 오른쪽 그림이 refinement stage를 적용한 그림이다.
+
이를 해결하기 위해, 고품질, 고해상도 데이터에 특화된 latent space 내에서 별도의 LDM을 학습했다. 기본 모델의 샘플에 대해 SDEdit에서 도입한 노이즈 제거 과정을 사용했다. eDiff-I 방법을 따랐으며, 이를 첫 200 노이즈 스케일에 refinement 모델을 사용했다. inference에서, base SDXL에서 latent를 추출하고 바로 diffuse와 denoise를 refinement 모델에 넣었다. 이 스텝은 선택이지만 배경 및 사람 얼굴과 같은 디테일에서 향상된 결과(그림 6, 13)를 얻을 수 있었다.
📌 논문요약
-2023년 openai의 Heewoo Jun, Alex Nichol 가 발표한 논문입니다. official code는 github에서, diffusers를 활용한 코드는 huggingface에서 확인할 수 있습니다.
-목적 - 조건부 3D assets 생성
-생성방식 - encoder를 통해 implicit function의 parameter 형태로 표현한 후, 이를 diffusion model의 조건으로 사용함으로써 conditional 3D assets을 생성할 수 있도록 했다.
-차별점 - texture mesh 나 NeRF 모두 생성 가능한 implicit function의 parameters를 직접적으로 생성할 수 있다. (다른 3D 생성 모델의 경우 단일 표현만 가능한 경우가 많다고 합니다.)
implicit neural representations (INRs)는 3D assets을 인코딩하는 방식으로 많이 사용된다. 3D asset을 표현하기 위해 INRs는 주로 3D coordinate를 location specific info(density, color)로 맵핑한다. 일반적으로 INRs는 화질에 영향을 받지 않는데 이는 고정된 grid나 sequence가 아닌 arbitrary input points를 처리할 수 있기 때문이다. 덕분에 end-to-end 미분이 가능하다. INRs은 이후 다양한 downstream applications도 가능하게 한다. 본 논문에서는 2가지 타입의 INRs을 다룬다.
-
-
Neural Radiamce Field (NeRF) - 3D scene을 function mapping으로 표현.
-
-
coordinate, viewing direction \(\rightarrow\) density, colors along camera rays
-
-
-
textured 3D mesh (DMTet, GET3D)
-
-
coordinate \(\rightarrow\) colors, signed distances, vertex offsets
-
INRs는 삼각메쉬를 생성할 때 사용될 수 있다.
-
-
-
-
이미지, 비디오, 오디오, 3D assets 생성에 관한 다양한 연구가 있지만 downstream application에서 사용하기 편한 형태로 3D assets을 표현하는 방법에 대한 연구는 부족하다. 본 논문은 단일 representation으로 부터 두가지 형태로 rendering 가능하게 했다는 특징이 있다.
\(x\) 는 3D 공간 좌표, \(d\) 는 3D 시야 각도, \(c\) 는 RGB, \(\sigma\) 는 density(\(\ge 0\)) 이다. \(F_\Theta\) 는 편의를 위해 \(\sigma(x)\) 와 \(c(x,d)\) 두개의 식으로 나누어 표현했다.
-
새로운 시야에서 바라본 scene 을 렌더링하기 위해서, 아래와 같이 각 ray에 맞는 color값을 계산한다.
2.2 Signed Distance Functions and Texture Field (STF)#
-
본 논문에서 STF는 signed distances와 texture colors 두가지 모두를 생성하는 implicit function을 의미한다. 이번 섹션에서는 이러한 implicit function이 meshes를 구성하고 rendering을 만드는 방식을 설명한다.
-
-
-
-
Fig. 679 point cloud, voxel, polygon mesh의 비교
-source - 3D Vision with Transformers: A Survey#
-
-
-
**Signed Distance Functions (SDFs)**는 3D shape을 scaler field에서 표현하는 전통적인 방법중 하나다. 특히 SDF \(f\)는 coordinate \(x\)를 scaler 로 mapping한다. (\(f(\mathbf x)=d\)) 여기서 \(d\)는 특정 위치 \(x\)에서 가장 가까운 물체의 표면까지의 거리를 말한다. \(d\)가 0보다 작으면 해당 물체 외부임을 의미한다. 이러한 정의에 따라 \(f(\mathbf x)=0\) 일때는 물체의 표면을 의미한다. \(\text{sign}(d)\)는 표면에 따른 normal orientation을 의미한다.
-
-
DMTet : SDFs를 활용하여 3D shape을 생성하는 모델. coarse voxel을 입력으로 받아 synthesized shape(SDF, tetrahedral)을 만들어 낸다. DMTet의 출력은 dense spatial grid에서의 각 vertex \(v_i\)별 SDF 값 \(s_i\)와 displacement \(\vartriangle v_i\) 이다. 이후 설명 생략
-
GET3D : DMTet에 추가적인 texture 정보까지도 생성하는 모델이다. 물체의 표면의 지점 \(p\) 마다 RGB color를 예측하는 모델을 따로 학습시켜 texture를 만들었다. 이후 설명 생략
본 논문에서 활용한 diffusion model은 DDPM으로 diffusion process(noising process)를 data sample \(x_0\) 에 gaussian noise를 서서히 추가하여 완전한 노이즈가 되어가는 과정 \((x_1,x_2,…x_T)\) 으로 표현했다. 일반적으로 \(x_T\)는 gaussian noise와 구분불가능한 상태로 상정한다. 해당 과정은 sequential하게 진행되지만 활용시에는 아래의 식과 같이 특정 단계로 바로 “jump”하는 방식을 이용한다.
아래와 같이 표현할 수도 있는데 Shap-E 논문에서는 아래의 식을 활용하였다. 위는 (모델이 예측하는 노이즈, diffusion process에서 더해진 노이즈)의 차이를 줄이는 방향으로 학습한다는 의미이고, 아래는 (data sample \(x_0\), 모델이 예측한 노이즈를 제거하여 만든 이미지)의 차이를 줄이는 방향으로 학습한다는 의미이다.
\(s\) 는 guidance scale이고 \(s=0, s=1\) 일때는 regular unconditional, conditional sampling을 뜻한다. \(s\) 를 더 키우면 일관성(coherence)은 커지지만 다양성(diversity)이 떨어질 수 있다. 실험적으로 나은 결과물을 얻기 위해서는 guidance가 필요하다는 것을 알아냈다. (section 5의 figure 4 참고)
continuous latent space에서도 diffusion을 활용하여 샘플들을 생성할 수 있다. 이는 Stable Diffusion(LDM)에서 제안된 것으로, pixel space와 latent space간의 변환을 담당하는 encoder와 decoder를 추가하여 two-stage방식으로 모델을 학습시키면 된다. 앞서 봤던 노이즈를 예측을 담당하는 모델 \(\epsilon_\theta\)는 latent space에서 추가된 노이즈(latent noise)를 예측하게 되는 것이다. original LDM에서는 latent noise를 원본 이미지 보다 낮은 복잡도(lower-dimensional distribution)를 가지도록 KL penalty나 vector quantization layer를 사용했다.
-
본 논문에서도 위와 유사한 방식을 사용했으나 GAN-based objective와 perceptual loss를 사용하지 않고 단순히 \(L_1\), \(L_2\) reconstruction loss를 사용했다. 또한 KL regularization과 vector quantization은 bottleneck이 되므로 고정된 numerical range를 가지도록 하고 diffusion style의 noise를 추가 했다.
입력 representation의 세부 특성
-Point-E와 비교하였을때, post-processing 방식을 변경하여 3D Asset별 사용하는 RGB point cloud의 point 개수를 늘이고, 더 많은 view를 256x256 크기로 렌더링 하여 사용했다. 구체적으로는 다음과 같다.
-
-
Point Clouds: 기존 4K -> 16K
-
Multiview point clouds: 기존 20 views -> 60 views (20개의 view를 사용한 경우 생성된 pointcloud에 crack이 발생했다고 함)\ view 렌더링시 조명과 물체표면의 특성을 간략화했다.
-
-
-
encoder에서 얻은 parameter는 implicit function에서 asset의 representation을 의미한다. (+의미상 다양한 형태로 입력받은 3D asset의 특성을 융합하여 하나로 표현한 것, 논문의 장점으로 NeRF와 point cloud 모두를 얻을수 있다고 했으므로 상당히 의도가 느껴지는 입력으로 보인다. )
encoder에 입력된 point clouds와 views는 cross-attention과 transformer backbone에 의해 처리되어 sequence of vectors가 된다. 이후 latent bottleneck과 projection layer를 통과하여 MLP weight matrices를 만든다.
-
encoder는 NeRF rendering objective를 사용(Section 4.1.1 참고)하여 사전 학습한다. mesh-based objective를 이용한 사전학습시 보다 더 안정적인 결과물을 얻을 수 있었다고 한다. 이후에는 SDF와 texture color prediction을 위해 추가적인 output head를 넣어 Section 4.1.2와 같이 two-stage 방식으로 head들을 학습시킨다.
original NeRF의 식과 유사하지만 coarse net과 fine net이 parameter들을 공유할 수 있도록 하지는 않았다. 랜덤한 4096개의 ray를 각 학습 데이터에서 샘플링하였으며, \(L_1\) loss가 최소가 되도록 했다. (original NeRF에서는 \(L_2\) loss를 사용)
여기에 추가적으로 각 ray의 transmittance에 대한 손실함수를 추가했다. 특히, 한 ray의 density 적분값(integrated density)을 통해 얻은transmittance로 coarse rendering과 fine rendering시 \(\hat T_c(r)\) 와 \(\hat T_f(r)\)를 예측하였다. ground truth로는 gt rendering결과의 alpha channel을 사용하였다. 이 손실함수는 아래와 같이 표현할 수 있다. (+NeRF의 경우 novel view를 만드는 것이 목적이었으나 본 논문은 mesh도 생성해야 하므로 노이즈 제거가 더욱 중요하였을 것으로 생각된다.)
Fig. 683 texture, bump, displacement의 비교
-source - https:grabcad.com/tutorials/adding-textures-to-3d-models-texture-bump-and-displacement-mapping-how-to-make-photo-realistic-models#
-
-
-
NeRF 방식을 통해 사전학습한 후, MLPs에 STF output heads를 추가한다. 이러한 MLPs는 SDF와 texture color를 예측한다. triangle mesh를 생성하기 위해서는 각 vertex의 SDF를 regular \(128^3\) grid로 옮겨 미분가능한 형태의 Marching Cube를 진행해야 한다. 이후 texture color는 최종 mesh의 각 vertex texture color head를 통해 얻는다. Pytorch 3D를 활용하면 미분가능한 rendering을 통해 textured mesh를 얻을 수 있다고 한다. 렌더링 시에는 데이터셋 구축시 preprocessing에 사용한 것과 동일한 lighting 조건을 사용했다.
-
사전 실험시 랜덤 초기화된 STF output heads를 사용했을 때는 결과가 불안정 했으며, rendering based objective를 사용하여 학습하는 것이 어려웠다. 해당 문제를 완화하기 위해 SDF와 texture color를 해당 output heads를 직접 학습시키기 전에 distill 접근법을 사용했다. Point-E의 regression model을 활용하여 입력 좌표를 랜덤하게 샘플링하고, SDF distillation target을 구했다. 그리고 RGB target로는 asset RGB point cloud에서 특정위치 \(x\)와 가장 가까운(nearest neighbor) point의 색을 사용했다. distillation training 시 distillation loss와 NeRF loss를 더하여 사용했다.
STF output heads가 distillation을 통해 적절한 초기값을 갖게된 후, NeRF encoder와 STF rendering 전체를 end-to-end로 fine-tune한다. 실험적으로 STF rendering에는 \(L_1\)을 사용하는 것은 불안정했으므로 \(L_2\) 손실함수만 사용하는 것이 이러한 rendering 방식에 적절함을 알 수 있었다. STF rendering에 사용한 loss는 아래와 같다.
mesh를 렌더링한 이미지와 target 이미지의 L2 reconstruction loss의 평균
-
-
N은 이미지 개수, s는 이미지의 화질, \(\text{Mesh}_i\)는 \(\text{sample}_i\)의 constructed mesh를 말한다. \(\text{Image}_i\)는 RGBA rendering된 결과물로 alpha채널을 포함하고 있기 때문에 transmittance에 대한 loss를 따로 추가하지 않았다.
-
최종 fine-tuning 단계에서는 아래와 같이 더한 objective function을 사용한다.
Point-E의 transformer 기반 diffusion 구조를 채택했다. 하지만 point cloud를 latent vector의 sequence로 바꾸었다. latent sequences의 크기는 \(1024\times1024\) 로 이를 길이가 1024인 1024개의 token처럼 transformer의 입력으로 사용했다. 각 token은 MLP weight matrices의 각 row와 일치한다. Shap-E의 모델은 Point-E base 모델과 유사한 부분이 많다.(context length와 width가 동일) 하지만 더 고차원의 샘플(samples in higher-dimensional)을 생성하는데 이는 입출력 채널의 복잡도(dimension)가 증가하였기 때문이다.
-
Point-E의 conditioning 방식을 동일하게 사용하였다. 이미지 조건부 3d 생성시 256-token CLIP embedding sequence를 transformer context로 사용했으며, 텍스트 조건부 3d 생성시 single token을 사용했다.
-
Point-E와의 차이점으로는 diffusion model의 출력을 \(\epsilon\) prediction으로 parameterize하지 않았다는 것이다. 대신 본 논문에서는 곧바로 sample을 예측하는 방식을 사용했다. 대수적으로는 동일한 의미이나 초기 실험에서 더 일관된 결과물을 생성하여 해당 방식을 사용하였다고 함.
공정한 비교를 위해 대부분의 실험에서 Point-E와 동일한 3D assets을 사용했다. 하지만 post-processing부분에서는 차이가 있다.
-
-
point cloud 계산시, 20개가 아닌 60개의 view를 rendering했다. 20개만 사용했을때 주어진 view에서 확인할 수 없는 영역때문에 crack 발생 (+NeRF 때문으로 추정)
-
point cloud를 4K 가아닌 16K의 point로 만들었다.
-
encoder학습을 위한 view를 렌더링 할때 단순한 소재와 라이팅을 사용하였다. 특히 모든 모델은 동일한 고정된 라이팅 조건내에서 렌더링 되었다. ambient와 diffuse shading만 사용 (+반사광이 고려되지 않아 표면이 매끈한 물체는 생성하기 어려울 것으로 추정됨)
Fig. 686 Shap-E와 Point-E비교
-세모 마크가 Point-E, 원형 마크가 Shap-E이다.#
-
-
-
point-E보다 Shap-E의 CLIP score가 더 높다. 더 많은수의 parameter를 가진 point-E를 사용하여도 Shap-E의 성능이 우수함.
-
두 평가 지표 모두 OpenAI의 CLIP (Contrastive Language-Image Pretraining) 모델을 활용한 평가 지표로 CLIP score의 경우 주어진 텍스트와 생성결과의 일관성을 평가하기 위한 것이고, CLIP R precision의 경우 생성결과와 참조 이미지가 얼마나 비슷한지 평가하기 위한 것이다.
왼쪽 그림과 같이 여러가지 특성을 가진물체를 생성하는데에 어려움을 겪는 모습을 보인다. 이는 학습에 사용한 paired data가 제한적이기 때문으로 더 많은 3D dataset을 수집하면 나아질 수 있다. 또한 texture의 세부 특성을 encoder가 무시하는 경우도 있는데, 더 나은 encoder를 사용함으로써 개선될수 있다.
-
Shap-E는 다양한 3D 생성 기술들을 융합하는데에 도움을 줄 수 있다. 예를 들어 Shap-E로 생성한 NeRF와 mesh를 다른 최적화 기반 모델을 초기화 하는데 사용하는 것이다. 이를 통해 더 빠른 수렴도 가능할 것으로 생각된다.
Shap-E는 latent diffusion model을 3D implicit function공간에서 전개하여 NeRF와 textured mesh 모두를 생성 할 수 있었다. 동일한 데이터셋을 활용하여 다른 생성모델들과 비교하였을때 더 나은 성능을 보임을 확인했다. 또한 text 조건부 생성시 이미지 없이도 다양한 흥미로운 물체를 생성할 수 있음확인했다. 이는 implicit represention을 생성함에 큰 가능성을 보여준다.
📌 논문요약
+2023년 openai의 Heewoo Jun, Alex Nichol 가 발표한 논문입니다. official code는 github에서, diffusers를 활용한 코드는 huggingface에서 확인할 수 있습니다.
+목적 - 조건부 3D assets 생성
+생성방식 - encoder를 통해 implicit function의 parameter 형태로 표현한 후, 이를 diffusion model의 조건으로 사용함으로써 conditional 3D assets을 생성할 수 있도록 했다.
+차별점 - texture mesh 나 NeRF 모두 생성 가능한 implicit function의 parameters를 직접적으로 생성할 수 있다. (다른 3D 생성 모델의 경우 단일 표현만 가능한 경우가 많다고 합니다.)
implicit neural representations (INRs)는 3D assets을 인코딩하는 방식으로 많이 사용된다. 3D asset을 표현하기 위해 INRs는 주로 3D coordinate를 location specific info(density, color)로 맵핑한다. 일반적으로 INRs는 화질에 영향을 받지 않는데 이는 고정된 grid나 sequence가 아닌 arbitrary input points를 처리할 수 있기 때문이다. 덕분에 end-to-end 미분이 가능하다. INRs은 이후 다양한 downstream applications도 가능하게 한다. 본 논문에서는 2가지 타입의 INRs을 다룬다.
+
+
Neural Radiamce Field (NeRF) - 3D scene을 function mapping으로 표현.
+
+
coordinate, viewing direction \(\rightarrow\) density, colors along camera rays
+
+
+
textured 3D mesh (DMTet, GET3D)
+
+
coordinate \(\rightarrow\) colors, signed distances, vertex offsets
+
INRs는 삼각메쉬를 생성할 때 사용될 수 있다.
+
+
+
+
이미지, 비디오, 오디오, 3D assets 생성에 관한 다양한 연구가 있지만 downstream application에서 사용하기 편한 형태로 3D assets을 표현하는 방법에 대한 연구는 부족하다. 본 논문은 단일 representation으로 부터 두가지 형태로 rendering 가능하게 했다는 특징이 있다.
\(x\) 는 3D 공간 좌표, \(d\) 는 3D 시야 각도, \(c\) 는 RGB, \(\sigma\) 는 density(\(\ge 0\)) 이다. \(F_\Theta\) 는 편의를 위해 \(\sigma(x)\) 와 \(c(x,d)\) 두개의 식으로 나누어 표현했다.
+
새로운 시야에서 바라본 scene 을 렌더링하기 위해서, 아래와 같이 각 ray에 맞는 color값을 계산한다.
2.2 Signed Distance Functions and Texture Field (STF)#
+
본 논문에서 STF는 signed distances와 texture colors 두가지 모두를 생성하는 implicit function을 의미한다. 이번 섹션에서는 이러한 implicit function이 meshes를 구성하고 rendering을 만드는 방식을 설명한다.
+
+
+
+
Fig. 691 point cloud, voxel, polygon mesh의 비교
+source - 3D Vision with Transformers: A Survey#
+
+
+
**Signed Distance Functions (SDFs)**는 3D shape을 scaler field에서 표현하는 전통적인 방법중 하나다. 특히 SDF \(f\)는 coordinate \(x\)를 scaler 로 mapping한다. (\(f(\mathbf x)=d\)) 여기서 \(d\)는 특정 위치 \(x\)에서 가장 가까운 물체의 표면까지의 거리를 말한다. \(d\)가 0보다 작으면 해당 물체 외부임을 의미한다. 이러한 정의에 따라 \(f(\mathbf x)=0\) 일때는 물체의 표면을 의미한다. \(\text{sign}(d)\)는 표면에 따른 normal orientation을 의미한다.
+
+
DMTet : SDFs를 활용하여 3D shape을 생성하는 모델. coarse voxel을 입력으로 받아 synthesized shape(SDF, tetrahedral)을 만들어 낸다. DMTet의 출력은 dense spatial grid에서의 각 vertex \(v_i\)별 SDF 값 \(s_i\)와 displacement \(\vartriangle v_i\) 이다. 이후 설명 생략
+
GET3D : DMTet에 추가적인 texture 정보까지도 생성하는 모델이다. 물체의 표면의 지점 \(p\) 마다 RGB color를 예측하는 모델을 따로 학습시켜 texture를 만들었다. 이후 설명 생략
본 논문에서 활용한 diffusion model은 DDPM으로 diffusion process(noising process)를 data sample \(x_0\) 에 gaussian noise를 서서히 추가하여 완전한 노이즈가 되어가는 과정 \((x_1,x_2,…x_T)\) 으로 표현했다. 일반적으로 \(x_T\)는 gaussian noise와 구분불가능한 상태로 상정한다. 해당 과정은 sequential하게 진행되지만 활용시에는 아래의 식과 같이 특정 단계로 바로 “jump”하는 방식을 이용한다.
아래와 같이 표현할 수도 있는데 Shap-E 논문에서는 아래의 식을 활용하였다. 위는 (모델이 예측하는 노이즈, diffusion process에서 더해진 노이즈)의 차이를 줄이는 방향으로 학습한다는 의미이고, 아래는 (data sample \(x_0\), 모델이 예측한 노이즈를 제거하여 만든 이미지)의 차이를 줄이는 방향으로 학습한다는 의미이다.
\(s\) 는 guidance scale이고 \(s=0, s=1\) 일때는 regular unconditional, conditional sampling을 뜻한다. \(s\) 를 더 키우면 일관성(coherence)은 커지지만 다양성(diversity)이 떨어질 수 있다. 실험적으로 나은 결과물을 얻기 위해서는 guidance가 필요하다는 것을 알아냈다. (section 5의 figure 4 참고)
continuous latent space에서도 diffusion을 활용하여 샘플들을 생성할 수 있다. 이는 Stable Diffusion(LDM)에서 제안된 것으로, pixel space와 latent space간의 변환을 담당하는 encoder와 decoder를 추가하여 two-stage방식으로 모델을 학습시키면 된다. 앞서 봤던 노이즈를 예측을 담당하는 모델 \(\epsilon_\theta\)는 latent space에서 추가된 노이즈(latent noise)를 예측하게 되는 것이다. original LDM에서는 latent noise를 원본 이미지 보다 낮은 복잡도(lower-dimensional distribution)를 가지도록 KL penalty나 vector quantization layer를 사용했다.
+
본 논문에서도 위와 유사한 방식을 사용했으나 GAN-based objective와 perceptual loss를 사용하지 않고 단순히 \(L_1\), \(L_2\) reconstruction loss를 사용했다. 또한 KL regularization과 vector quantization은 bottleneck이 되므로 고정된 numerical range를 가지도록 하고 diffusion style의 noise를 추가 했다.
입력 representation의 세부 특성
+Point-E와 비교하였을때, post-processing 방식을 변경하여 3D Asset별 사용하는 RGB point cloud의 point 개수를 늘이고, 더 많은 view를 256x256 크기로 렌더링 하여 사용했다. 구체적으로는 다음과 같다.
+
+
Point Clouds: 기존 4K -> 16K
+
Multiview point clouds: 기존 20 views -> 60 views (20개의 view를 사용한 경우 생성된 pointcloud에 crack이 발생했다고 함)\ view 렌더링시 조명과 물체표면의 특성을 간략화했다.
+
+
+
encoder에서 얻은 parameter는 implicit function에서 asset의 representation을 의미한다. (+의미상 다양한 형태로 입력받은 3D asset의 특성을 융합하여 하나로 표현한 것, 논문의 장점으로 NeRF와 point cloud 모두를 얻을수 있다고 했으므로 상당히 의도가 느껴지는 입력으로 보인다. )
encoder에 입력된 point clouds와 views는 cross-attention과 transformer backbone에 의해 처리되어 sequence of vectors가 된다. 이후 latent bottleneck과 projection layer를 통과하여 MLP weight matrices를 만든다.
+
encoder는 NeRF rendering objective를 사용(Section 4.1.1 참고)하여 사전 학습한다. mesh-based objective를 이용한 사전학습시 보다 더 안정적인 결과물을 얻을 수 있었다고 한다. 이후에는 SDF와 texture color prediction을 위해 추가적인 output head를 넣어 Section 4.1.2와 같이 two-stage 방식으로 head들을 학습시킨다.
original NeRF의 식과 유사하지만 coarse net과 fine net이 parameter들을 공유할 수 있도록 하지는 않았다. 랜덤한 4096개의 ray를 각 학습 데이터에서 샘플링하였으며, \(L_1\) loss가 최소가 되도록 했다. (original NeRF에서는 \(L_2\) loss를 사용)
여기에 추가적으로 각 ray의 transmittance에 대한 손실함수를 추가했다. 특히, 한 ray의 density 적분값(integrated density)을 통해 얻은transmittance로 coarse rendering과 fine rendering시 \(\hat T_c(r)\) 와 \(\hat T_f(r)\)를 예측하였다. ground truth로는 gt rendering결과의 alpha channel을 사용하였다. 이 손실함수는 아래와 같이 표현할 수 있다. (+NeRF의 경우 novel view를 만드는 것이 목적이었으나 본 논문은 mesh도 생성해야 하므로 노이즈 제거가 더욱 중요하였을 것으로 생각된다.)
Fig. 695 texture, bump, displacement의 비교
+source - https:grabcad.com/tutorials/adding-textures-to-3d-models-texture-bump-and-displacement-mapping-how-to-make-photo-realistic-models#
+
+
+
NeRF 방식을 통해 사전학습한 후, MLPs에 STF output heads를 추가한다. 이러한 MLPs는 SDF와 texture color를 예측한다. triangle mesh를 생성하기 위해서는 각 vertex의 SDF를 regular \(128^3\) grid로 옮겨 미분가능한 형태의 Marching Cube를 진행해야 한다. 이후 texture color는 최종 mesh의 각 vertex texture color head를 통해 얻는다. Pytorch 3D를 활용하면 미분가능한 rendering을 통해 textured mesh를 얻을 수 있다고 한다. 렌더링 시에는 데이터셋 구축시 preprocessing에 사용한 것과 동일한 lighting 조건을 사용했다.
+
사전 실험시 랜덤 초기화된 STF output heads를 사용했을 때는 결과가 불안정 했으며, rendering based objective를 사용하여 학습하는 것이 어려웠다. 해당 문제를 완화하기 위해 SDF와 texture color를 해당 output heads를 직접 학습시키기 전에 distill 접근법을 사용했다. Point-E의 regression model을 활용하여 입력 좌표를 랜덤하게 샘플링하고, SDF distillation target을 구했다. 그리고 RGB target로는 asset RGB point cloud에서 특정위치 \(x\)와 가장 가까운(nearest neighbor) point의 색을 사용했다. distillation training 시 distillation loss와 NeRF loss를 더하여 사용했다.
STF output heads가 distillation을 통해 적절한 초기값을 갖게된 후, NeRF encoder와 STF rendering 전체를 end-to-end로 fine-tune한다. 실험적으로 STF rendering에는 \(L_1\)을 사용하는 것은 불안정했으므로 \(L_2\) 손실함수만 사용하는 것이 이러한 rendering 방식에 적절함을 알 수 있었다. STF rendering에 사용한 loss는 아래와 같다.
mesh를 렌더링한 이미지와 target 이미지의 L2 reconstruction loss의 평균
+
+
N은 이미지 개수, s는 이미지의 화질, \(\text{Mesh}_i\)는 \(\text{sample}_i\)의 constructed mesh를 말한다. \(\text{Image}_i\)는 RGBA rendering된 결과물로 alpha채널을 포함하고 있기 때문에 transmittance에 대한 loss를 따로 추가하지 않았다.
+
최종 fine-tuning 단계에서는 아래와 같이 더한 objective function을 사용한다.
Point-E의 transformer 기반 diffusion 구조를 채택했다. 하지만 point cloud를 latent vector의 sequence로 바꾸었다. latent sequences의 크기는 \(1024\times1024\) 로 이를 길이가 1024인 1024개의 token처럼 transformer의 입력으로 사용했다. 각 token은 MLP weight matrices의 각 row와 일치한다. Shap-E의 모델은 Point-E base 모델과 유사한 부분이 많다.(context length와 width가 동일) 하지만 더 고차원의 샘플(samples in higher-dimensional)을 생성하는데 이는 입출력 채널의 복잡도(dimension)가 증가하였기 때문이다.
+
Point-E의 conditioning 방식을 동일하게 사용하였다. 이미지 조건부 3d 생성시 256-token CLIP embedding sequence를 transformer context로 사용했으며, 텍스트 조건부 3d 생성시 single token을 사용했다.
+
Point-E와의 차이점으로는 diffusion model의 출력을 \(\epsilon\) prediction으로 parameterize하지 않았다는 것이다. 대신 본 논문에서는 곧바로 sample을 예측하는 방식을 사용했다. 대수적으로는 동일한 의미이나 초기 실험에서 더 일관된 결과물을 생성하여 해당 방식을 사용하였다고 함.
공정한 비교를 위해 대부분의 실험에서 Point-E와 동일한 3D assets을 사용했다. 하지만 post-processing부분에서는 차이가 있다.
+
+
point cloud 계산시, 20개가 아닌 60개의 view를 rendering했다. 20개만 사용했을때 주어진 view에서 확인할 수 없는 영역때문에 crack 발생 (+NeRF 때문으로 추정)
+
point cloud를 4K 가아닌 16K의 point로 만들었다.
+
encoder학습을 위한 view를 렌더링 할때 단순한 소재와 라이팅을 사용하였다. 특히 모든 모델은 동일한 고정된 라이팅 조건내에서 렌더링 되었다. ambient와 diffuse shading만 사용 (+반사광이 고려되지 않아 표면이 매끈한 물체는 생성하기 어려울 것으로 추정됨)
Fig. 698 Shap-E와 Point-E비교
+세모 마크가 Point-E, 원형 마크가 Shap-E이다.#
+
+
+
point-E보다 Shap-E의 CLIP score가 더 높다. 더 많은수의 parameter를 가진 point-E를 사용하여도 Shap-E의 성능이 우수함.
+
두 평가 지표 모두 OpenAI의 CLIP (Contrastive Language-Image Pretraining) 모델을 활용한 평가 지표로 CLIP score의 경우 주어진 텍스트와 생성결과의 일관성을 평가하기 위한 것이고, CLIP R precision의 경우 생성결과와 참조 이미지가 얼마나 비슷한지 평가하기 위한 것이다.
왼쪽 그림과 같이 여러가지 특성을 가진물체를 생성하는데에 어려움을 겪는 모습을 보인다. 이는 학습에 사용한 paired data가 제한적이기 때문으로 더 많은 3D dataset을 수집하면 나아질 수 있다. 또한 texture의 세부 특성을 encoder가 무시하는 경우도 있는데, 더 나은 encoder를 사용함으로써 개선될수 있다.
+
Shap-E는 다양한 3D 생성 기술들을 융합하는데에 도움을 줄 수 있다. 예를 들어 Shap-E로 생성한 NeRF와 mesh를 다른 최적화 기반 모델을 초기화 하는데 사용하는 것이다. 이를 통해 더 빠른 수렴도 가능할 것으로 생각된다.
Shap-E는 latent diffusion model을 3D implicit function공간에서 전개하여 NeRF와 textured mesh 모두를 생성 할 수 있었다. 동일한 데이터셋을 활용하여 다른 생성모델들과 비교하였을때 더 나은 성능을 보임을 확인했다. 또한 text 조건부 생성시 이미지 없이도 다양한 흥미로운 물체를 생성할 수 있음확인했다. 이는 implicit represention을 생성함에 큰 가능성을 보여준다.
오늘 알아볼 모델은 StyleGAN입니다. 기존에 다뤘던 GAN과 같이 이미지를 생성하는 모델입니다. generator 구조를 변경함으로써 성능을 올리고 feature의 control이 가능하게 했습니다. loss나 discriminator 구조 개선에 관한 논문은 아닙니다. 먼저 결과를 보도록 하죠.
이 중에서 첫 번째 contribution을 자세히 보도록 하겠습니다. 논문의 abstract에는 다음과 같은 문장이 있습니다.
-
-
The new architecture leads to an automatically learned, unsupervised separation of high-level attributes (e.g., pose and identity when trained on human faces) and stochastic variation in the generated images (e.g., freckles, hair), and it enables intuitive, scale-specific control of the synthesis.
-
-
논문에서 제안한 새로운 generator 구조가 할 수 있는 일을 설명하는 부분입니다. 여기서 보시면 high level attribute의 separation이 가능하다고 얘기하고 있습니다. 저는 개인적으로 이 부분이 StyleGAN의 가장 중요한 특징이라고 생각합니다.
-
생성 모델로 이미지를 생성하고자 할 때, 사용자는 어떠한 목적을 가지고 자신이 원하는 이미지를 만들고자 할 것입니다. 이미지의 품질이 좋더라도 모델이 사용자의 의도와 상관없는 랜덤한 이미지를 내뱉어준다면 그 모델의 실용성이 좋다고 할 수 없을 것입니다. 근래에 Text-to-Image 모델들이 인기를 얻었던 이유도 누구나 쉽게 텍스트를 통해서 생성되는 이미지를 조절할 수 있다는 점도 한몫했다고 생각합니다. StyleGAN은 그런 controllability를 어느 정도 가능하게 한 모델이라는 측면에서 의미있다고 생각합니다.
-
StyleGAN의 구조는 아래 그림과 같습니다. synthesis network는 해상도를 4x4에서 시작해서 1024x1024까지 높여줍니다. 최종적으로 1024x1024 해상도를 가지는 이미지를 갖게됩니다. 아래 구조를 보면 기존 GAN하고 비교해서 특이한 점이 세 가지 있습니다.
기존 GAN을 생각해보면 z를 input으로 받아서 generator를 거쳐서 이미지를 생성하는 구조입니다. 이 z는 보통 Gaussian distribution에서 샘플링으로 얻습니다. GAN은 학습을 통해 Gaussian distribution을 data distribution으로 보내는 방법을 배우게 될 것이고, 이 분포는 (b)처럼 생기게 될 것입니다. 그런데 데이터가 (a)처럼 주어져서 특정한 데이터가 없거나 적을 수도 있을 것입니다. 예를 들어, 데이터에 피부가 희면서 머리가 긴 샘플들이 없다고 해봅시다. 그러면 피부색과 머리 길이라는 두 feature는 서로 얽히게(entangled)되어, 하나를 바꿀 때 다른 하나도 같이 바뀌는 현상이 일어나게 됩니다. 이런 현상을 완화하기 위해 논문에서는 Gaussian에서 뽑은 z를 바로 사용하는 것이 아니라 mapping network를 통해 learnable distribution에서 뽑은 w를 사용합니다.
adaptive instance normalization (AdaIN) 은 instance normalization에 scale을 곱해주고 bias를 더해주는 형태입니다. 그런데 이 scale과 bias가 style vector의 linear transformation으로 주어지는 형태입니다. linear layer를 통해서 w는 \(\mathbf{y}=(\mathbf{y}_{s},\mathbf{y}_{b})\)로 보내지게 됩니다. AdaIN의 수식은 아래와 같습니다.
AdaIN은 각 블록마다 두 개씩 들어가서 style은 총 열여덟 번 AdaIN을 통해 generator에 들어가게 됩니다. AdaIN은 localization이라는 특징과도 연관이 있습니다. 여기서 말하는 localization이란 열여덟 개의 style 중에서 일부를 바꿈으로써 이미지의 일부 특징들을 바꿀 수 있다는 의미입니다. AdaIN은 각 convolution layer 다음에 적용이 됩니다. 이 때 feature map들은 normalization되고 style에 의해 새로운 statistics를 가지게 됩니다. style은 하나의 convolution에 적용되고, 다음 convolution에서 다시 normalization이 수행되기 때문에 이전 layer에 적용된 style과 다음 layer에 적용된 style이 분리되게 학습될 수 있습니다.
아래 그림은 source A의 style 중 일부를 source B의 style로 변경해서 만든 이미지들입니다. style은 총 18곳에서 사용되는데 처음 4곳 (\(4^2 - 8^2\))을 coarse, 그다음 4곳 (\(16^2-32^2\))을 middle, 마지막 10곳 (\(64^2-1024^2\))을 fine style로 정의하였습니다. 그림을 보시면 윗 부분에서는 포즈나 전체적인 머리 스타일같이 coarse style은 source B의 것을 유지하고, 아래로 갈수록 source A의 큰 틀을 유지하면서 세부적인 부분들을 B에서 가져왔음을 볼 수 있습니다.
한 사람의 이미지 안에는 확률적으로 바뀔 수 있는 부분이 있습니다. (주근깨, 머릿결, 피부) 이를 모델링하기 위해서 noise를 추가적인 input으로 사용하여 각 convolution layer 다음에 더해집니다. 아래 그림에서 (a)의 생성된 한 사람의 이미지 안에서도 디테일들은 (b)와 같이 달라질 수 있습니다. (c)와 같이 standard deviation을 구해봤을 때 얼굴형과 같은 attribute는 변하지않지만 noise에 의해서 머리카락과 같은 부분은 variation이 생김을 볼 수 있습니다.
아래 그림에서 (a)는 모든 layer에 noise를 준 경우, (b)는 noise를 주지 않은 경우, (c)는 fine layers (\(64^2 - 1024^2\))에만 noise를 준 경우, (d)는 coarse layers (\(4^2 - 32^2\))에만 noise를 준 경우입니다. (b)를 보면 noise가 없을 경우 머리카락같은 디테일이 제대로 살아있지 않은 것을 볼 수 있습니다. (c)와 (d)를 보면 fine layers에 들어간 noise가 머리카락의 더 세밀한 부분에 영향을 끼친다는 것을 볼 수 있습니다.
-
-
-
-
Fig. 68 Effect of noise inputs at different layers#
논문에서는 localization이 더 잘 되게하기 위해 style mixing이라는 방법을 훈련에 사용합니다. 두 개의 style vector \(\mathbf{w}_{1},\mathbf{w}_{2}\)를 사용하여 앞 쪽 layer에는 \(\mathbf{w}_{1}\)을, 뒤 쪽 layer에는 \(\mathbf{w}_{2}\)를 사용하는 방법입니다. 이는 generator가 인접한 style끼리 correlated되어있다고 학습하는 것을 막아서 localization을 더 잘 되게 하는 목적입니다.
오늘 알아볼 모델은 StyleGAN입니다. 기존에 다뤘던 GAN과 같이 이미지를 생성하는 모델입니다. generator 구조를 변경함으로써 성능을 올리고 feature의 control이 가능하게 했습니다. loss나 discriminator 구조 개선에 관한 논문은 아닙니다. 먼저 결과를 보도록 하죠.
이 중에서 첫 번째 contribution을 자세히 보도록 하겠습니다. 논문의 abstract에는 다음과 같은 문장이 있습니다.
+
+
The new architecture leads to an automatically learned, unsupervised separation of high-level attributes (e.g., pose and identity when trained on human faces) and stochastic variation in the generated images (e.g., freckles, hair), and it enables intuitive, scale-specific control of the synthesis.
+
+
논문에서 제안한 새로운 generator 구조가 할 수 있는 일을 설명하는 부분입니다. 여기서 보시면 high level attribute의 separation이 가능하다고 얘기하고 있습니다. 저는 개인적으로 이 부분이 StyleGAN의 가장 중요한 특징이라고 생각합니다.
+
생성 모델로 이미지를 생성하고자 할 때, 사용자는 어떠한 목적을 가지고 자신이 원하는 이미지를 만들고자 할 것입니다. 이미지의 품질이 좋더라도 모델이 사용자의 의도와 상관없는 랜덤한 이미지를 내뱉어준다면 그 모델의 실용성이 좋다고 할 수 없을 것입니다. 근래에 Text-to-Image 모델들이 인기를 얻었던 이유도 누구나 쉽게 텍스트를 통해서 생성되는 이미지를 조절할 수 있다는 점도 한몫했다고 생각합니다. StyleGAN은 그런 controllability를 어느 정도 가능하게 한 모델이라는 측면에서 의미있다고 생각합니다.
+
StyleGAN의 구조는 아래 그림과 같습니다. synthesis network는 해상도를 4x4에서 시작해서 1024x1024까지 높여줍니다. 최종적으로 1024x1024 해상도를 가지는 이미지를 갖게됩니다. 아래 구조를 보면 기존 GAN하고 비교해서 특이한 점이 세 가지 있습니다.
기존 GAN을 생각해보면 z를 input으로 받아서 generator를 거쳐서 이미지를 생성하는 구조입니다. 이 z는 보통 Gaussian distribution에서 샘플링으로 얻습니다. GAN은 학습을 통해 Gaussian distribution을 data distribution으로 보내는 방법을 배우게 될 것이고, 이 분포는 (b)처럼 생기게 될 것입니다. 그런데 데이터가 (a)처럼 주어져서 특정한 데이터가 없거나 적을 수도 있을 것입니다. 예를 들어, 데이터에 피부가 희면서 머리가 긴 샘플들이 없다고 해봅시다. 그러면 피부색과 머리 길이라는 두 feature는 서로 얽히게(entangled)되어, 하나를 바꿀 때 다른 하나도 같이 바뀌는 현상이 일어나게 됩니다. 이런 현상을 완화하기 위해 논문에서는 Gaussian에서 뽑은 z를 바로 사용하는 것이 아니라 mapping network를 통해 learnable distribution에서 뽑은 w를 사용합니다.
adaptive instance normalization (AdaIN) 은 instance normalization에 scale을 곱해주고 bias를 더해주는 형태입니다. 그런데 이 scale과 bias가 style vector의 linear transformation으로 주어지는 형태입니다. linear layer를 통해서 w는 \(\mathbf{y}=(\mathbf{y}_{s},\mathbf{y}_{b})\)로 보내지게 됩니다. AdaIN의 수식은 아래와 같습니다.
AdaIN은 각 블록마다 두 개씩 들어가서 style은 총 열여덟 번 AdaIN을 통해 generator에 들어가게 됩니다. AdaIN은 localization이라는 특징과도 연관이 있습니다. 여기서 말하는 localization이란 열여덟 개의 style 중에서 일부를 바꿈으로써 이미지의 일부 특징들을 바꿀 수 있다는 의미입니다. AdaIN은 각 convolution layer 다음에 적용이 됩니다. 이 때 feature map들은 normalization되고 style에 의해 새로운 statistics를 가지게 됩니다. style은 하나의 convolution에 적용되고, 다음 convolution에서 다시 normalization이 수행되기 때문에 이전 layer에 적용된 style과 다음 layer에 적용된 style이 분리되게 학습될 수 있습니다.
아래 그림은 source A의 style 중 일부를 source B의 style로 변경해서 만든 이미지들입니다. style은 총 18곳에서 사용되는데 처음 4곳 (\(4^2 - 8^2\))을 coarse, 그다음 4곳 (\(16^2-32^2\))을 middle, 마지막 10곳 (\(64^2-1024^2\))을 fine style로 정의하였습니다. 그림을 보시면 윗 부분에서는 포즈나 전체적인 머리 스타일같이 coarse style은 source B의 것을 유지하고, 아래로 갈수록 source A의 큰 틀을 유지하면서 세부적인 부분들을 B에서 가져왔음을 볼 수 있습니다.
한 사람의 이미지 안에는 확률적으로 바뀔 수 있는 부분이 있습니다. (주근깨, 머릿결, 피부) 이를 모델링하기 위해서 noise를 추가적인 input으로 사용하여 각 convolution layer 다음에 더해집니다. 아래 그림에서 (a)의 생성된 한 사람의 이미지 안에서도 디테일들은 (b)와 같이 달라질 수 있습니다. (c)와 같이 standard deviation을 구해봤을 때 얼굴형과 같은 attribute는 변하지않지만 noise에 의해서 머리카락과 같은 부분은 variation이 생김을 볼 수 있습니다.
아래 그림에서 (a)는 모든 layer에 noise를 준 경우, (b)는 noise를 주지 않은 경우, (c)는 fine layers (\(64^2 - 1024^2\))에만 noise를 준 경우, (d)는 coarse layers (\(4^2 - 32^2\))에만 noise를 준 경우입니다. (b)를 보면 noise가 없을 경우 머리카락같은 디테일이 제대로 살아있지 않은 것을 볼 수 있습니다. (c)와 (d)를 보면 fine layers에 들어간 noise가 머리카락의 더 세밀한 부분에 영향을 끼친다는 것을 볼 수 있습니다.
+
+
+
+
Fig. 68 Effect of noise inputs at different layers#
논문에서는 localization이 더 잘 되게하기 위해 style mixing이라는 방법을 훈련에 사용합니다. 두 개의 style vector \(\mathbf{w}_{1},\mathbf{w}_{2}\)를 사용하여 앞 쪽 layer에는 \(\mathbf{w}_{1}\)을, 뒤 쪽 layer에는 \(\mathbf{w}_{2}\)를 사용하는 방법입니다. 이는 generator가 인접한 style끼리 correlated되어있다고 학습하는 것을 막아서 localization을 더 잘 되게 하는 목적입니다.
생성 모델이 놀라운 속도로 발전하고 있는데요! 해당 논문에서는 생성 모델의 수준이 얼만큼 왔는지, 복잡한 이미지 데이터인 ImageNet 데이터에 대해서도 충분한 퀄리티의 데이터를 생성할 수 있는 정도가 되었는지, 그래서 이 생성된 데이터를 augment된 데이터로 사용할 수 있는 정도까지 왔는지에 대한 실험과 답을 제시합니다. 이 글의 목차는 논문 내용과 동일하게 구성하였습니다.
-
-
본 논문에서는 기술적으로 엄청 새로운 내용은 없는데요! 다만 보통 사전학습된 text-to-image diffusion 모델을 사용하던 기존 방법들과는 달리 Imagen을 ImageNet에 대해 파인튜닝 했다는 것이 새롭습니다.
Diffusion 모델의 등장으로 생성 기술이 크게 발전되었습니다. 현재 생성 기술 수준이 data augmentation으로 사용될 수 있을 만큼의 자연스러운 이미지를 생성하는 것도 가능할까?에 대한 질문이 나오는 것은 당연하고, 본 논문에서는 이에 대한 답을 찾고자 했습니다. 먼저 이 질문에 대한 답을 이야기 하면 아래와 같습니다.
-
-
결과 요약
-
-
ImageNet에 대해 fine-tuning된 Imagen이 FID, Inception Score, CAS 성능에 대해 SOTA 성능을 달성 하였다.
-
합성 데이터와 실제 데이터를 결합하여 사용하고, 합성 데이터의 양이 많고, 훈련 시간이 길수록 생성 데이터로 훈련된 모델의 성능이 더욱 향상되었다.
-
-
-
-
Fig. 313 위 그림: 합성 데이터로만 학습된 모델 분류 성능과 진짜 데이터로 학습된 모델의 분류 성능 비교 \
-아래 그림: 합성 및 진짜 데이터를 사용하였을 때의 분류 성능과 진짜 데이터로 학습된 모델의 분류 성능 비교#
-
-
-
-
-
-
-
위의 그림에서 볼 수 있듯이 합성 데이터로만 학습한 모델의 정확도와 실제 데이터로 학습한 모델의 정확도를 비교했을 때, 다른 모델들에 비해 본 논문에서 제안한 모델이 훨씬 성능 차이가 적다는 것을 알 수 있습니다. 또한, 아래 그림을 보면, 실제 데이터와 생성된 데이터를 더해서 학습했을 경우에는 ResNet 기반 모델과 Transformer 기반 모델들에서 모두 실제 데이터를 사용했을 때보다 성능 향상이 있었습니다.
하지만, 위의 논문을 포함해서 기존의 논문들은 이런 생성 모델을 이용해서 data augmentation을 하여도 ImageNet validation set에 대해서는 성능을 향상 시키지 못했습니다. 또한, 기존에 논문들은 pretrained Stable Diffusion 모델을 사용하고, fine-tuning은 하지 않았습니다. 본 논문에서는 기존 논문들과는 다르게 Imagen을 ImageNet에 잘 동작하고 fine-tuning을 하였고, 그 결과 ImageNet validation set에 대해서도 성능을 향상 시킬 수 있었습니다.
본 논문에서는 Classification Accuracy Scores(CAS)라는 성능 지표를 소개합니다. FID와 Inception Score는 생성 모델의 성능 지표로 워낙 많이 쓰여서 설명은 생략하고, CAS에 대해서는 논문에서 써져 있는 내용으로 소개하겠습니다.
-
CAS는 FID와 Inception Score와 마찬가지로 생성 모델이 만들어낸 샘플의 품질을 평가하는 방법으로 제안 된 성능 지표입니다. 이것은 ‘합성 데이터’로만 훈련된 ResNet-50 모델에 대한 ImageNet validation set에 대한 분류 성능을 의미합니다. 먼저, 생성 모델을 통해 ImageNet 데이터에 대한 합성 데이터를 만들어냅니다. 그리고 이 합성 데이터만을 이용하여 ResNet-50을 훈련 시키고, 그 훈련된 모델의 실제 ImageNet validation set에 대해 분류 성능이 CAS가 됩니다. 만약 합성 데이터가 실제 ImageNet과 비슷하다면 그 합성 데이터로 학습된 모델은 실제 ImageNet validation set에 대해 좋은 분류 성능을 보일 것이라는 가정을 이용한 성능 지표라고 이해하면 될 것 같습니다.
-
저자에 의하면 그동안 생성모델의 CAS 성능은 좋지 않았다고 합니다. 생성된 샘플로만 훈련된 모델은 실제 데이터로 훈련된 모델보다 성능이 떨어졌고 (이는 당연해보입니다), 실제 데이터에 합성 데이터를 추가하면 성능이 떨어졌다고 합니다. 이는 아마도 생성된 샘플의 품질, 다양성 등이 원인일 수 있을 것이라고 합니다.
여기서는 실제로 저자들이 어떻게 text-to-image diffusion 모델을 학습하고, 샘플링을 하였는지에 대한 설명을 합니다.
-
먼저 저자들은 text-to-image diffusion 모델로는 Imagen을 사용하였습니다. Text-to-image 모델을 어떻게 ImageNet 클래스와 alignment 할 지에 대한 고민이 필요했다고 합니다. 처음에는 CLIP에서 사용한 방법과 유사하게 짧은 텍스트를 ImageNet 클래스의 텍스트 프롬프트로 사용했다고 하였는데 이 경우에 성능이 좋지 않았다고 합니다. 이는 Imagen에서 high guidance weight를 사용하여 샘플의 다양성이 저하 되면서 생기는 현상일 수 있다고 합니다. 따라서, 저자들은 프롬프트를 한 두단어 클래스 이름으로 수정하고, 모델의 weight와 sampling parameter를 fine-tuning 했다고 합니다.
왼쪽 그림이 fine-tuning이 적용된 Imagen이 만들어낸 이미지고, 오른쪽이 fine-tuning이 적용되지 않은 Imagen입니다. 아래에서 두 번째 클래스인 Schipperke를 보면, 이것은 스키퍼키라는 개 품종을 의미하는데 fine-tuning이 적용되지 않은 Imagen의 경우는 꽃과 같은 전혀 엉뚱한 이미지를 만들고 있는 것을 볼 수 있습니다.
본 논문에서는 위의 Imagen 구조에서 빨간 원으로 표시된 부분에 대해서만 fine-tuning 했습니다. Frozen Text Encoder의 경우는 원래 Imagen에서도 학습을 하지 않는 부분이라 마찬가지로 학습을 하지 않았고, 1024x1024 Image를 출력으로 하는 마지막 Super-Resolution Diffusion Model의 경우 ImageNet에 고해상도의 데이터가 적어서 fine-tuning을 하지 않았다고 합니다.
-
64x64 모델의 경우는 210K step 정도 학습하였고, optimizer의 경우는 Imagen에서 사용하였던 Adafactor optimizer를 사용하였다고 합니다. 64x64 → 256x256 super-resolution 모델의 경우는 490K step 정도 하였고, Adam optimizer를 사용하였다고 합니다.
-
최적의 모델 선택의 기준으로는 기본 Imagen sampler와 ImageNet-1K validation set에 대해 10K개의 샘플들에 대해 FID score를 계산했을 때 가장 좋은 성능의 모델을 선택했다고 합니다.
이 부분은 본 논문에서 sampling parameter는 어떻게 정했는지를 설명하는 부분입니다. 먼저, Text-conditioned diffusion model 샘플링의 품질, 다양성, 속도는 디퓨전 스텝 수, noise condition augmentation, guidance weight for classifier-free guidance, log-variance mixing coefficient 등에 대해 큰 영향을 받는다고 합니다.
“Classifier-free guidance”는 이미지를 생성하는 데 분류기나 특정 지표 없이 외부 정보를 사용한다는 것. “Guidance weights”는 외부 정보를 모델에 어떻게 반영할지를 조절하는 가중치를 의미할 수 있으며, 이러한 가중치를 조절하여 모델이 원하는 특성이나 스타일을 가진 이미지를 더 잘 생성하도록 함 (자세한 내용은 “Classifier-free diffusion guidance”를 참고해주세요)
-
-
-
Log-variance mixing coefficient:
-
이미지 생성 모델에서 사용되는 확률 분포의 변동성을 조절하는 데 사용되는 계수를 나타냄. 이미지 생성 모델은 일반적으로 확률 분포를 사용하여 이미지를 생성하며, 이 확률 분포의 평균과 분산을 조절함으로써 생성된 이미지의 다양성과 품질을 조절할 수 있음. 로그-분산 혼합 계수는 이러한 분산을 조절하는 데 사용되며, 높은 값은 더 큰 분산을 의미하고, 작은 값은 더 작은 분산을 의미함. 이를 통해 이미지 생성의 다양성을 조절할 수 있음 (자세한 내용은 “Improved denoising diffusion probabilistic models”를 참고해주세요)
-
-
-
-
64x64 기반 모델의 샘플링 parameter 설정법에 대해 설명하겠습니다. 해당 모델의 샘플링 이미지 샘플링의 전반적인 특징과 다양성의 영향을 주게 됩니다. 1차 sweep으로 DDPM 샘플러를 이용하여 FID-50K에 대해 가장 최적의 하이퍼파라미터를 찾습니다. Sweep의 사용한 각 하이퍼파라미터의 범위는 아래와 같습니다.
-
-
Guidance weight: [1.0, 1.25, 1.5, 1.75, 2.0, 5.0]
-
Log-variance: [0.0, 0.2, 0.3, 0.4, 1.0]
-
Denoise step: [128, 500, 1000]
-
-
1차 sweep 결과 최적의 FID는 log-variance는 0이고 denoising step은 1000이었을 때라고 합니다.
-
1차 sweep이 끝난 후에는 guidance weight에 대해서만 sweep을 합니다. 이 때에는 1.2M 이미지를 사용하고, 각 guidacne weight에 대해 FID, IS, CAS를 측정했다고 합니다.
위 그래프는 guidance weight를 1.0으로 설정하고 noise condition 파라미터를 변경했을 때 FID와 CAS의 그래프를 나타낸 그래프입니다. CAS 같은 경우는 logvar coeff가 0.3일 때 전반적으로 좋은 성능을 보였으며, FID 같은 경우도 logvar coeff가 0.3일 때 전반적으로 좋은 성능을 보인 것을 알 수 있습니다.
-
-
샘플링 하이퍼파라미터의 결과를 분석해보자면, 전반적으로 FID와 CAS는 높은 상관관계가 있으며 (Figure 4 참고), guidance weight가 작을수록 CAS는 높아지지만, Inception Score에는 부정적인 영향을 주며 (Figure 3 참고), noise augmentation이 0일 때 FID가 가장 작은 것을 볼 수 있습니다. (Figure 4 참고)
-
-
이런 하이퍼파라미터 설정 방법을 기준으로 본 논문에서 최종적으로 설정한 값은 아래와 같다고 합니다.
이 부분은 실제로 데이터 합성은 어떤 프로토콜을 따랐는지에 대해 설명하는 부분입니다. 본 논문에서는 원본 데이터셋의 class balance를 유지하며 데이터를 합성했으며, 합성된 결과 총 훈련 데이터셋의 규모는 1배인 1.2M 에서 10배인 12M 규모의 데이터셋의 범위를 가지도록 데이터를 합성했다고 합니다.
위 표에서 볼 수 있듯이, 본 논문의 파인 튜닝된 Imagen이 ImageNet에 대한 데이터 생성에 대해 다른 베이스모델들 보다 FID와 IS가 뛰어난 것을 알 수 있습니다. 이는 64x64 resolution과 256x256 resolution에서 모두 해당되었습니다.
Figure 5에서 파란색 부분은 실제 학습 데이터로 학습된 모델의 분류 성능이고, 빨간색 부분은 합성된 데이터로 학습된 모델의 분류 성능입니다. 왼쪽 그림은 베이스라인 중 하나인 CDM 모델의 성능을 나타낸 그림이며, 가운데는 본 논문에서 256x256 resolution 모델의 성능, 오른쪽은 본 논문에서 제안한 1024x1024 resolution 모델의 성능을 나타낸 것입니다. 빨간색 부분이 파란색 부분보다 전반적으로 위쪽에 위치하면 모델의 성능이 좋다고 해석할 수 있습니다. 이 그림을 통해 본 논문에서 제안한 모델들이 베이스라인보다 좋은 성능을 보인다는 것을 알 수 있습니다.
-
Table 2에서도 마찬가지로 본 논문 모델이 다른 베이스 모델보다 성능이 뛰어난 것을 알 수 있습니다. 여기서 주목할 만한 점은 CAS를 평가하기 위한 ResNet50이 256x256으로 입력 데이터를 다운샘플링 함에도 1024x1024 샘플에 대한 결과가 훨씬 좋다는 것을 볼 수 있습니다. (Ours 256x256 resolution보다 Ours 1024x1024 resolution의 CAS 성능이 월등히 높음)
-
-
-
5.3. Classification Accuracy with Different Models#
-
이 부분은 합성된 데이터를 여러 종류의 모델로 학습 시켰을 때, 각 모델의 분류 성능을 확인하는 부분입니다. CAS와 비슷하지만 CAS에서는 ResNet50 모델로 분류 성능을 확인했지만 여기서는 ResNet50 이외에 모델로도 분류 성능을 본다는 차이점이 있습니다.
위 표에서 확인할 수 있듯이, 다양한 모델에 대해서 분류 정확도를 살펴본 결과 생성된 데이터로만 학습될 경우에는 실제 데이터로 학습할 때 보다 성능이 낮았지만, 실제 데이터와 생성된 데이터를 합쳐서 학습할 경우 실제 데이터만 사용했을 때보다 성능이 증가한 것을 볼 수 있습니다. 이것은 onvNet기반 모델과 transformer 기반 모델에 대해서 동일한 양상을 보였습니다.
본 논문에 결론 부분을 보자면, 이 논문에서는 Large-sclae text-to-image diffusion 모델을 파인튜닝하여 FID, Inception Score, CAS 성능 지표에 대해서 SOTA를 달성했습니다.
-
-
FID: 1.76 at 256x256
-
Inception Score: 239 at 256x256
-
CAS: 64.96 for 256x256, 69.24 for 1024x1024
-
-
또한 그렇게 생성 데이터를 이용하여 ResNet과 Transformer 기반 모델들에 대한 ImageNet classification accuracy를 향상 시켰습니다.
-
실험 결과에 대해서 생각해볼만한 거리들이 있었는데 그 중 하나는 CAS 성능 측정할 때 ResNet50이 입력을 256x256으로 다운샘플링 함에도 불구하고 256x256보다 1024x1024의 모델의 CAS가 좋은 것이 있었습니다. 이는 다운샘플링을 하더라도 다운샘플링 전 원본 데이터 resolution이 클 때 더 많은 정보를 담는다는 것을 의미하는 것일 수 있습니다. 또한, 64x64 데이터에서 합성 데이터의 양이 증가함에 따라 분류 정확도가 지속적으로 증가했지만 고해상도 데이터에서는 그렇지 않았던 것을 통해 고해상도에 이미지에 대해서는 보다 정교한 훈련 방법이 필요할 수 있음을 시사하고 있습니다.
-
-
이렇게 Synthetic Data from Diffusion Models Improves ImageNet Classification 논문의 리뷰를 마치겠습니다. 개인적으로 느낀 점은 실제 산업에서는 data shortage나 class imbalance 문제가 대부분 발생하는데 본 논문이 그 해결법 중 하나가 될 수 있을 것 같다는 생각이 들었습니다. 다만 Frozen Text Encoder는 추가적으로 파인튜닝이 되지 않기 때문에 특정 산업에서만 쓰이는 특정 텍스트가 들어왔을 때는 잘 동작할 수 있을까 하는 의문이 들었습니다. 또한 합성하고자 하는 데이터셋에 맞게 파인튜닝을 해야하는 점이 꽤나 불편할 것 같아서 파인튜닝이 모델 성능에 얼마나 큰 의미를 갖는지, 파인튜닝을 하지 않았을 때의 CAS 성능도 논문에 있었으면 좋았을 것 같다는 개인적인 생각이 들었습니다. (물론 Figure 2를 보고 어느 정도 결과를 유추해볼 순 있지만요!)
생성 모델이 놀라운 속도로 발전하고 있는데요! 해당 논문에서는 생성 모델의 수준이 얼만큼 왔는지, 복잡한 이미지 데이터인 ImageNet 데이터에 대해서도 충분한 퀄리티의 데이터를 생성할 수 있는 정도가 되었는지, 그래서 이 생성된 데이터를 augment된 데이터로 사용할 수 있는 정도까지 왔는지에 대한 실험과 답을 제시합니다. 이 글의 목차는 논문 내용과 동일하게 구성하였습니다.
+
+
본 논문에서는 기술적으로 엄청 새로운 내용은 없는데요! 다만 보통 사전학습된 text-to-image diffusion 모델을 사용하던 기존 방법들과는 달리 Imagen을 ImageNet에 대해 파인튜닝 했다는 것이 새롭습니다.
Diffusion 모델의 등장으로 생성 기술이 크게 발전되었습니다. 현재 생성 기술 수준이 data augmentation으로 사용될 수 있을 만큼의 자연스러운 이미지를 생성하는 것도 가능할까?에 대한 질문이 나오는 것은 당연하고, 본 논문에서는 이에 대한 답을 찾고자 했습니다. 먼저 이 질문에 대한 답을 이야기 하면 아래와 같습니다.
+
+
결과 요약
+
+
ImageNet에 대해 fine-tuning된 Imagen이 FID, Inception Score, CAS 성능에 대해 SOTA 성능을 달성 하였다.
+
합성 데이터와 실제 데이터를 결합하여 사용하고, 합성 데이터의 양이 많고, 훈련 시간이 길수록 생성 데이터로 훈련된 모델의 성능이 더욱 향상되었다.
+
+
+
+
Fig. 313 위 그림: 합성 데이터로만 학습된 모델 분류 성능과 진짜 데이터로 학습된 모델의 분류 성능 비교 \
+아래 그림: 합성 및 진짜 데이터를 사용하였을 때의 분류 성능과 진짜 데이터로 학습된 모델의 분류 성능 비교#
+
+
+
+
+
+
+
위의 그림에서 볼 수 있듯이 합성 데이터로만 학습한 모델의 정확도와 실제 데이터로 학습한 모델의 정확도를 비교했을 때, 다른 모델들에 비해 본 논문에서 제안한 모델이 훨씬 성능 차이가 적다는 것을 알 수 있습니다. 또한, 아래 그림을 보면, 실제 데이터와 생성된 데이터를 더해서 학습했을 경우에는 ResNet 기반 모델과 Transformer 기반 모델들에서 모두 실제 데이터를 사용했을 때보다 성능 향상이 있었습니다.
하지만, 위의 논문을 포함해서 기존의 논문들은 이런 생성 모델을 이용해서 data augmentation을 하여도 ImageNet validation set에 대해서는 성능을 향상 시키지 못했습니다. 또한, 기존에 논문들은 pretrained Stable Diffusion 모델을 사용하고, fine-tuning은 하지 않았습니다. 본 논문에서는 기존 논문들과는 다르게 Imagen을 ImageNet에 잘 동작하고 fine-tuning을 하였고, 그 결과 ImageNet validation set에 대해서도 성능을 향상 시킬 수 있었습니다.
본 논문에서는 Classification Accuracy Scores(CAS)라는 성능 지표를 소개합니다. FID와 Inception Score는 생성 모델의 성능 지표로 워낙 많이 쓰여서 설명은 생략하고, CAS에 대해서는 논문에서 써져 있는 내용으로 소개하겠습니다.
+
CAS는 FID와 Inception Score와 마찬가지로 생성 모델이 만들어낸 샘플의 품질을 평가하는 방법으로 제안 된 성능 지표입니다. 이것은 ‘합성 데이터’로만 훈련된 ResNet-50 모델에 대한 ImageNet validation set에 대한 분류 성능을 의미합니다. 먼저, 생성 모델을 통해 ImageNet 데이터에 대한 합성 데이터를 만들어냅니다. 그리고 이 합성 데이터만을 이용하여 ResNet-50을 훈련 시키고, 그 훈련된 모델의 실제 ImageNet validation set에 대해 분류 성능이 CAS가 됩니다. 만약 합성 데이터가 실제 ImageNet과 비슷하다면 그 합성 데이터로 학습된 모델은 실제 ImageNet validation set에 대해 좋은 분류 성능을 보일 것이라는 가정을 이용한 성능 지표라고 이해하면 될 것 같습니다.
+
저자에 의하면 그동안 생성모델의 CAS 성능은 좋지 않았다고 합니다. 생성된 샘플로만 훈련된 모델은 실제 데이터로 훈련된 모델보다 성능이 떨어졌고 (이는 당연해보입니다), 실제 데이터에 합성 데이터를 추가하면 성능이 떨어졌다고 합니다. 이는 아마도 생성된 샘플의 품질, 다양성 등이 원인일 수 있을 것이라고 합니다.
여기서는 실제로 저자들이 어떻게 text-to-image diffusion 모델을 학습하고, 샘플링을 하였는지에 대한 설명을 합니다.
+
먼저 저자들은 text-to-image diffusion 모델로는 Imagen을 사용하였습니다. Text-to-image 모델을 어떻게 ImageNet 클래스와 alignment 할 지에 대한 고민이 필요했다고 합니다. 처음에는 CLIP에서 사용한 방법과 유사하게 짧은 텍스트를 ImageNet 클래스의 텍스트 프롬프트로 사용했다고 하였는데 이 경우에 성능이 좋지 않았다고 합니다. 이는 Imagen에서 high guidance weight를 사용하여 샘플의 다양성이 저하 되면서 생기는 현상일 수 있다고 합니다. 따라서, 저자들은 프롬프트를 한 두단어 클래스 이름으로 수정하고, 모델의 weight와 sampling parameter를 fine-tuning 했다고 합니다.
왼쪽 그림이 fine-tuning이 적용된 Imagen이 만들어낸 이미지고, 오른쪽이 fine-tuning이 적용되지 않은 Imagen입니다. 아래에서 두 번째 클래스인 Schipperke를 보면, 이것은 스키퍼키라는 개 품종을 의미하는데 fine-tuning이 적용되지 않은 Imagen의 경우는 꽃과 같은 전혀 엉뚱한 이미지를 만들고 있는 것을 볼 수 있습니다.
본 논문에서는 위의 Imagen 구조에서 빨간 원으로 표시된 부분에 대해서만 fine-tuning 했습니다. Frozen Text Encoder의 경우는 원래 Imagen에서도 학습을 하지 않는 부분이라 마찬가지로 학습을 하지 않았고, 1024x1024 Image를 출력으로 하는 마지막 Super-Resolution Diffusion Model의 경우 ImageNet에 고해상도의 데이터가 적어서 fine-tuning을 하지 않았다고 합니다.
+
64x64 모델의 경우는 210K step 정도 학습하였고, optimizer의 경우는 Imagen에서 사용하였던 Adafactor optimizer를 사용하였다고 합니다. 64x64 → 256x256 super-resolution 모델의 경우는 490K step 정도 하였고, Adam optimizer를 사용하였다고 합니다.
+
최적의 모델 선택의 기준으로는 기본 Imagen sampler와 ImageNet-1K validation set에 대해 10K개의 샘플들에 대해 FID score를 계산했을 때 가장 좋은 성능의 모델을 선택했다고 합니다.
이 부분은 본 논문에서 sampling parameter는 어떻게 정했는지를 설명하는 부분입니다. 먼저, Text-conditioned diffusion model 샘플링의 품질, 다양성, 속도는 디퓨전 스텝 수, noise condition augmentation, guidance weight for classifier-free guidance, log-variance mixing coefficient 등에 대해 큰 영향을 받는다고 합니다.
“Classifier-free guidance”는 이미지를 생성하는 데 분류기나 특정 지표 없이 외부 정보를 사용한다는 것. “Guidance weights”는 외부 정보를 모델에 어떻게 반영할지를 조절하는 가중치를 의미할 수 있으며, 이러한 가중치를 조절하여 모델이 원하는 특성이나 스타일을 가진 이미지를 더 잘 생성하도록 함 (자세한 내용은 “Classifier-free diffusion guidance”를 참고해주세요)
+
+
+
Log-variance mixing coefficient:
+
이미지 생성 모델에서 사용되는 확률 분포의 변동성을 조절하는 데 사용되는 계수를 나타냄. 이미지 생성 모델은 일반적으로 확률 분포를 사용하여 이미지를 생성하며, 이 확률 분포의 평균과 분산을 조절함으로써 생성된 이미지의 다양성과 품질을 조절할 수 있음. 로그-분산 혼합 계수는 이러한 분산을 조절하는 데 사용되며, 높은 값은 더 큰 분산을 의미하고, 작은 값은 더 작은 분산을 의미함. 이를 통해 이미지 생성의 다양성을 조절할 수 있음 (자세한 내용은 “Improved denoising diffusion probabilistic models”를 참고해주세요)
+
+
+
+
64x64 기반 모델의 샘플링 parameter 설정법에 대해 설명하겠습니다. 해당 모델의 샘플링 이미지 샘플링의 전반적인 특징과 다양성의 영향을 주게 됩니다. 1차 sweep으로 DDPM 샘플러를 이용하여 FID-50K에 대해 가장 최적의 하이퍼파라미터를 찾습니다. Sweep의 사용한 각 하이퍼파라미터의 범위는 아래와 같습니다.
+
+
Guidance weight: [1.0, 1.25, 1.5, 1.75, 2.0, 5.0]
+
Log-variance: [0.0, 0.2, 0.3, 0.4, 1.0]
+
Denoise step: [128, 500, 1000]
+
+
1차 sweep 결과 최적의 FID는 log-variance는 0이고 denoising step은 1000이었을 때라고 합니다.
+
1차 sweep이 끝난 후에는 guidance weight에 대해서만 sweep을 합니다. 이 때에는 1.2M 이미지를 사용하고, 각 guidacne weight에 대해 FID, IS, CAS를 측정했다고 합니다.
위 그래프는 guidance weight를 1.0으로 설정하고 noise condition 파라미터를 변경했을 때 FID와 CAS의 그래프를 나타낸 그래프입니다. CAS 같은 경우는 logvar coeff가 0.3일 때 전반적으로 좋은 성능을 보였으며, FID 같은 경우도 logvar coeff가 0.3일 때 전반적으로 좋은 성능을 보인 것을 알 수 있습니다.
+
+
샘플링 하이퍼파라미터의 결과를 분석해보자면, 전반적으로 FID와 CAS는 높은 상관관계가 있으며 (Figure 4 참고), guidance weight가 작을수록 CAS는 높아지지만, Inception Score에는 부정적인 영향을 주며 (Figure 3 참고), noise augmentation이 0일 때 FID가 가장 작은 것을 볼 수 있습니다. (Figure 4 참고)
+
+
이런 하이퍼파라미터 설정 방법을 기준으로 본 논문에서 최종적으로 설정한 값은 아래와 같다고 합니다.
이 부분은 실제로 데이터 합성은 어떤 프로토콜을 따랐는지에 대해 설명하는 부분입니다. 본 논문에서는 원본 데이터셋의 class balance를 유지하며 데이터를 합성했으며, 합성된 결과 총 훈련 데이터셋의 규모는 1배인 1.2M 에서 10배인 12M 규모의 데이터셋의 범위를 가지도록 데이터를 합성했다고 합니다.
위 표에서 볼 수 있듯이, 본 논문의 파인 튜닝된 Imagen이 ImageNet에 대한 데이터 생성에 대해 다른 베이스모델들 보다 FID와 IS가 뛰어난 것을 알 수 있습니다. 이는 64x64 resolution과 256x256 resolution에서 모두 해당되었습니다.
Figure 5에서 파란색 부분은 실제 학습 데이터로 학습된 모델의 분류 성능이고, 빨간색 부분은 합성된 데이터로 학습된 모델의 분류 성능입니다. 왼쪽 그림은 베이스라인 중 하나인 CDM 모델의 성능을 나타낸 그림이며, 가운데는 본 논문에서 256x256 resolution 모델의 성능, 오른쪽은 본 논문에서 제안한 1024x1024 resolution 모델의 성능을 나타낸 것입니다. 빨간색 부분이 파란색 부분보다 전반적으로 위쪽에 위치하면 모델의 성능이 좋다고 해석할 수 있습니다. 이 그림을 통해 본 논문에서 제안한 모델들이 베이스라인보다 좋은 성능을 보인다는 것을 알 수 있습니다.
+
Table 2에서도 마찬가지로 본 논문 모델이 다른 베이스 모델보다 성능이 뛰어난 것을 알 수 있습니다. 여기서 주목할 만한 점은 CAS를 평가하기 위한 ResNet50이 256x256으로 입력 데이터를 다운샘플링 함에도 1024x1024 샘플에 대한 결과가 훨씬 좋다는 것을 볼 수 있습니다. (Ours 256x256 resolution보다 Ours 1024x1024 resolution의 CAS 성능이 월등히 높음)
+
+
+
5.3. Classification Accuracy with Different Models#
+
이 부분은 합성된 데이터를 여러 종류의 모델로 학습 시켰을 때, 각 모델의 분류 성능을 확인하는 부분입니다. CAS와 비슷하지만 CAS에서는 ResNet50 모델로 분류 성능을 확인했지만 여기서는 ResNet50 이외에 모델로도 분류 성능을 본다는 차이점이 있습니다.
위 표에서 확인할 수 있듯이, 다양한 모델에 대해서 분류 정확도를 살펴본 결과 생성된 데이터로만 학습될 경우에는 실제 데이터로 학습할 때 보다 성능이 낮았지만, 실제 데이터와 생성된 데이터를 합쳐서 학습할 경우 실제 데이터만 사용했을 때보다 성능이 증가한 것을 볼 수 있습니다. 이것은 onvNet기반 모델과 transformer 기반 모델에 대해서 동일한 양상을 보였습니다.
본 논문에 결론 부분을 보자면, 이 논문에서는 Large-sclae text-to-image diffusion 모델을 파인튜닝하여 FID, Inception Score, CAS 성능 지표에 대해서 SOTA를 달성했습니다.
+
+
FID: 1.76 at 256x256
+
Inception Score: 239 at 256x256
+
CAS: 64.96 for 256x256, 69.24 for 1024x1024
+
+
또한 그렇게 생성 데이터를 이용하여 ResNet과 Transformer 기반 모델들에 대한 ImageNet classification accuracy를 향상 시켰습니다.
+
실험 결과에 대해서 생각해볼만한 거리들이 있었는데 그 중 하나는 CAS 성능 측정할 때 ResNet50이 입력을 256x256으로 다운샘플링 함에도 불구하고 256x256보다 1024x1024의 모델의 CAS가 좋은 것이 있었습니다. 이는 다운샘플링을 하더라도 다운샘플링 전 원본 데이터 resolution이 클 때 더 많은 정보를 담는다는 것을 의미하는 것일 수 있습니다. 또한, 64x64 데이터에서 합성 데이터의 양이 증가함에 따라 분류 정확도가 지속적으로 증가했지만 고해상도 데이터에서는 그렇지 않았던 것을 통해 고해상도에 이미지에 대해서는 보다 정교한 훈련 방법이 필요할 수 있음을 시사하고 있습니다.
+
+
이렇게 Synthetic Data from Diffusion Models Improves ImageNet Classification 논문의 리뷰를 마치겠습니다. 개인적으로 느낀 점은 실제 산업에서는 data shortage나 class imbalance 문제가 대부분 발생하는데 본 논문이 그 해결법 중 하나가 될 수 있을 것 같다는 생각이 들었습니다. 다만 Frozen Text Encoder는 추가적으로 파인튜닝이 되지 않기 때문에 특정 산업에서만 쓰이는 특정 텍스트가 들어왔을 때는 잘 동작할 수 있을까 하는 의문이 들었습니다. 또한 합성하고자 하는 데이터셋에 맞게 파인튜닝을 해야하는 점이 꽤나 불편할 것 같아서 파인튜닝이 모델 성능에 얼마나 큰 의미를 갖는지, 파인튜닝을 하지 않았을 때의 CAS 성능도 논문에 있었으면 좋았을 것 같다는 개인적인 생각이 들었습니다. (물론 Figure 2를 보고 어느 정도 결과를 유추해볼 순 있지만요!)
text-to-image model은 자연어를 통한 creation에 전례없는 자유도를 주었다. 하지만, 특정한 contept를 생성하고, 그것의 생김새를 바꾸거나, 새로운 역할이 주어지거나 참신한 장면이 그려지는건 아직 불분명하다. 즉, ‘이것을 그려줘’라고 말할 때, ‘이것’에 대한 설명을 prompt로 어떻게 할 것이냐는 물음에는 아직 한계가 있는 것 같다. 이를 해결하기 위해, 저자는 image를 3-5개만으로 사물이나 스타일과 같은 concept, 즉 새로운 ‘단어’를 고정된 text-to-image model의 embedding space에서 표현하는 방법을 제안한다. 이러한 ‘단어’는 자연어 문장에 녹아들어가, 직관적인 방법으로 ‘개인화된’ 이미지 생성을 이끌어 낸다. 특히, 독자적이면서 다양한 콘셉트를 capture하기 위해서는 single word embedding이 충분하다는 것을 알게 되었다.
대규모 학습된 모델에 새로운 개념을 도입하는 일은 어려운 일이다. 각 새로운 개념에 대해 확장된 데이터 셋을 사용해 모델을 retraining하는 것은 엄청나게 비용이 많이 들고, 몇 가지 예제에 해서 fine-tuning은 보통 치명적인 망각을 초래한다. 따라서 저자들은 사전 훈련된 텍스트-이미지 모델의 텍스트 임베딩 공간에서 새로운 단어를 찾아 이러한 문제를 극복할 것을 제안.
위 figure에서, “A photo of S*”은 tokenizer를 지나면서 각각 ‘508’, ‘701’, ‘73’, ‘*’과 같은 형태의 token set으로 변환되고, 이후 각 토큰은 자체 임베딩 벡터로 변환되고 이러한 벡터는 다운스트림 모델을 통해 제공됨.
-
input image의 concept를 나타내는, 새로운 pseudo-word인 S를 이용해 새로운 embedding vector(v)를 나타낸다. 이후 이 vector는 다른 단어와 같이 처리되며 생성 모델에 대한 새로운 text query를 구성하는데 사용될 수 있음. 따라서 이 query는 generator에 들어가서 사용자가 의도한바와 일치하도록 새로운 image를 생성하도록 하는 것이 전반적인 그림이라고 볼 수 있음.
-
여기서 중요한 것은, 이 과정에서 생성모델(여기서는 LDM이 쓰임)은 untouched되어 있다는 것(즉, 따로 수정이 들어가지 않는듯함). 그렇게 함으로써 새로운 task에 대한 fine-tuning을 할 때 일반적으로 손실되는 text에 대한 이해도나 generalization을 유지할 수 있음.
-
이러한 ‘유사단어’를 찾기 위해, 이 작업을 하나로 inversion시켜 프레임화 한다. 그리고 고정된, pre-trained text-to-image model을 사용하고, 3-5개의 concept를 나타내는 small image set이 주어진다. 저자들은 ‘a photo of S*’와 같은 형태의 문장을 설정해 주어진 작은 dataset에서 이미지를 재구성 하는 것으로 이어지는 single-word embedding을 찾는 것을 목표로 함.
-
이 모델의 목표는 새로운 concept인 입력 이미지를 나타내는 S*를 표현하는 방법을 찾는 것이며, 이러한 task를 **’textual inversion’**이라고 한다고 함.
-
This embedding is found through an optimization process, which we refer to as “Textual Inversion”.
-
pre-trained CLIP model을 이용해서 personalized object의 복구 및 segmentation을 수행. PALAVRA는 특정 개체를 참조하는 CLIP의 textual embedding space에서 pseudo-word를 식별함. 그 다음 검색을 위해 이미지를 설명하거나 어떤 장면에서 특정 개체를 분할하기 위해 사용됨. figure 5에서 보듯이, 그들의 접근 방식은 새로운 장면에서 그럴듯한 재구성 또는 합성에 필요한 세부 정보를 캡처하지 못함.
의역) 목표: 유저가 의도한 것에 초첨을 맞춘, 새로운 concept를 embedding으로 잘 가이드해서 괜찮은 성과물을 내는 것.
-
-
따라서 pre-trained text-to-image model의 중간 단계의 representation으로 이러한 새로운 ‘concepts’을 인코딩하는데 초점을 맞춤. 일반적인 text-to-image model에서는 image의 representation에 대한 후보군을 text encoder의 word-embedding 단계에서 찾는다. 그러나 이러한 접근 방식은 이미지에 대한 in-depth visual understanding을 필요로 하지 않는다(생성자가 이미지에 대해서 시각적인 이해? 없이 그린다.) 따라서 여기서는 GAN inversion에서 영감을 받은 visual reconstruction objective를 제시.
입력 이미지와 유사한 결과 이미지를 얻을 수 있도록 하는 latent vector를 찾는 과정. GAN이 학습되면 random latent vector로부터 이미지를 생성해낸다. GAN inversion은 이의 역과정으로써 GAN의 latent space로 input image를 inverting시켜 latent vector를 알아가는 과정.
입력된 문자열의 각 단어, 하위 단어는 tokenizer를 통과하며, 미리 정의된 dictionary에서 index token으로 변환함. 각 토큰을 통해 찾을 수 있는 고유한 임베딩 벡터에 연결됨.
-
index에 의한 embedding vector는 일반적으로 text encoder인 C_Θ의 일부로 학습된다. 이러한 space를 inversion target으로 삼았음. 새로운 개념을 나타내기 위해 자리표시자 문자열인 S를 새롭게 지정함. 이 과정에서 PALAVRA를 사용했을 것으로 추정함. 임베딩 process에 개입해서 tokenize된 문자열과 관련된 vector를 새로운 학습된 embedding V로 대체하여 본질적으로 어휘(pseudo-word)에 개념을 주입함. 이렇게 함으로써 다른 단어와 마찬가지로 concept를 포함하는 새로운 문장을 만들 수 있었음.
새로운 embedding을 찾기 위해 작은 규모의 dataset(3-5장)을 사용해 다양한 배경 또는 포즈와 같은 여러 설정에 걸쳐 목표 concept을 묘사함. 이러한 작은 dataset에서 LDM loss를 최소화하는 과정을 통해 V를 최적화함. 생성 조건을 고정하기 위해 CLIP ImageNet 템플릿에서 파생된 중립 컨텍스트 텍스트를 무작위로 샘플링한다. 여기에는 “A photo of S*”, “A rendition of S*” 등의 형식 프롬프트가 포함된다.(아마 원본 이미지와 최대한 비슷하게 만들어서 원본과 비교하기 위한 목적이 아닐까 싶음) 최적화 목표식은 다음과 같음.
기존 모델의 결과를 보면, 위 사진에서와 같이 ‘의사’라는 단어를 사용하면, 보통 백인 남성 의사를 잘 그려냈음. 이는 기존 데이터셋에서 남성 의사 사진 데이터가 많았음을 보여준다. 보다 작은 imageset에서 새로운 embedding을 학습함으로써 이러한 bias를 줄일 수 있음을 보여준다(즉, 성별 및 인종적 다양성에 대한 인식을 높일 수 있음).
reconstruction(y축?): target concept를 얼마나 잘 복제하는지. 특정 이미지가 아닌 개념에 대한 변형을 생성하므로 의미적 CLIP 공간 거리를 고려하여 유사성을 측정.(이미지에 자체가 아닌, 이미지가 가진 ‘개념’에 대해 latent space를 생성하므로) 각 컨셉에 대해 “A photo of S*”라는 prompt를 사용해 64개의 이미지를 생성.
-
editability(x축?): text prompt를 사용해 개념을 수정하는 능력을 평가. 다양한 난이도와 다양한 설정의 prompt를 사용해 일련의 이미지를 생성.
-
-
각 prompt 별로, 50 DDIM step을 사용해 64개의 샘플을 만들고, CLIP-space embedding을 평가, textual prompt의 CLIP-space embedding에서 cosine similarity를 계산. 높은 스코어는 더 높은 editing capability와 prompt의 신뢰도를 보여줌.
많은 baseline과 우리 방법의 semantic reconstruction quality는 단순히 training set에서 임의의 이미지를 샘플링하는 것과 비슷함(== 원본 이미지와 생성된 이미지가 큰 차이가 없었다?)
-
single-word method는 비슷한 reconstruction quality를 달성하고, 모든 multi-word baseline에서 상당히 향상된 editablity을 달성. 이러한 점은 text embedding space의 인상적인 유연성을 나타내고, 단일 pseudo word만 사용하면서 높은 정확도로 새로운 개념을 캡처하는데 도움이 될 수 있음을 보여줌.
-
baseline이 distortion-editability tradeoff 곡선의 outline을 그리며 실제 단어 분포에 더 가까운 embedding이 더 쉽게 수정될 수 있음. 그러나 target의 세부 정보를 캡처하지는 못함. 반대로, 단어 분포에서 멀리 벗어나면 editability가 크게 감소하는 대신 향상된 reconstruction이 가능해짐. 특히 single embedding model은 단순히 learning rate를 변경해 이 곡선을 따라 이동할 수 있으므로 사용자에게 이 tradeoff에 대한 어느 정도의 제어를 제공함.
-
concept에 대한 human description을 사용하면 유사성을 포착하지 못하면서도, editability가 감소함.
: 새로운 설정과 장면에서 특정 concept의 이미지를 생성하기 위해 text-to-image model를 활용하는 개인화되며, language-guided generation을 소개함. 여기서 사용한 ‘text inversion’은 pretrained text-to-image 모델의 text embedding space 내에서 concept를 새로운 pseudo word로 inverse하여 작동함. 이러한 pseudo-word는 간단한 자연어 설명을 사용해 새로운 장면에 삽입할 수 있으므로 간단하고 직관적인 수정이 가능함.
-
어떤 의미에서 이 방법은 사용자가 편집하기 쉽도록 텍스트 기반 interpace를 사용하지만 자연 언어의 한계에 접근할 때 시각적 단서를 제공하는 등 multi modal 정보를 활용할 수 있도록 함.
-
이러한 접근 방식은 공개적으로 사용가능한 가장 큰 text-to-image model인 LDM을 통해 구현됨. 그러나 접근 방식에 아키텍처 세부 정보에 의존하지 않음. 따라서 textual inversion은 추가적인 대규모 text-to-image model에 쉽게 적용할 수 있다고 생각. 거기에서 text-to-image alignment, shape preseravation, image generation fidelity가 더 향상될 수 있음.
text-to-image model은 자연어를 통한 creation에 전례없는 자유도를 주었다. 하지만, 특정한 contept를 생성하고, 그것의 생김새를 바꾸거나, 새로운 역할이 주어지거나 참신한 장면이 그려지는건 아직 불분명하다. 즉, ‘이것을 그려줘’라고 말할 때, ‘이것’에 대한 설명을 prompt로 어떻게 할 것이냐는 물음에는 아직 한계가 있는 것 같다. 이를 해결하기 위해, 저자는 image를 3-5개만으로 사물이나 스타일과 같은 concept, 즉 새로운 ‘단어’를 고정된 text-to-image model의 embedding space에서 표현하는 방법을 제안한다. 이러한 ‘단어’는 자연어 문장에 녹아들어가, 직관적인 방법으로 ‘개인화된’ 이미지 생성을 이끌어 낸다. 특히, 독자적이면서 다양한 콘셉트를 capture하기 위해서는 single word embedding이 충분하다는 것을 알게 되었다.
대규모 학습된 모델에 새로운 개념을 도입하는 일은 어려운 일이다. 각 새로운 개념에 대해 확장된 데이터 셋을 사용해 모델을 retraining하는 것은 엄청나게 비용이 많이 들고, 몇 가지 예제에 해서 fine-tuning은 보통 치명적인 망각을 초래한다. 따라서 저자들은 사전 훈련된 텍스트-이미지 모델의 텍스트 임베딩 공간에서 새로운 단어를 찾아 이러한 문제를 극복할 것을 제안.
위 figure에서, “A photo of S*”은 tokenizer를 지나면서 각각 ‘508’, ‘701’, ‘73’, ‘*’과 같은 형태의 token set으로 변환되고, 이후 각 토큰은 자체 임베딩 벡터로 변환되고 이러한 벡터는 다운스트림 모델을 통해 제공됨.
+
input image의 concept를 나타내는, 새로운 pseudo-word인 S를 이용해 새로운 embedding vector(v)를 나타낸다. 이후 이 vector는 다른 단어와 같이 처리되며 생성 모델에 대한 새로운 text query를 구성하는데 사용될 수 있음. 따라서 이 query는 generator에 들어가서 사용자가 의도한바와 일치하도록 새로운 image를 생성하도록 하는 것이 전반적인 그림이라고 볼 수 있음.
+
여기서 중요한 것은, 이 과정에서 생성모델(여기서는 LDM이 쓰임)은 untouched되어 있다는 것(즉, 따로 수정이 들어가지 않는듯함). 그렇게 함으로써 새로운 task에 대한 fine-tuning을 할 때 일반적으로 손실되는 text에 대한 이해도나 generalization을 유지할 수 있음.
+
이러한 ‘유사단어’를 찾기 위해, 이 작업을 하나로 inversion시켜 프레임화 한다. 그리고 고정된, pre-trained text-to-image model을 사용하고, 3-5개의 concept를 나타내는 small image set이 주어진다. 저자들은 ‘a photo of S*’와 같은 형태의 문장을 설정해 주어진 작은 dataset에서 이미지를 재구성 하는 것으로 이어지는 single-word embedding을 찾는 것을 목표로 함.
+
이 모델의 목표는 새로운 concept인 입력 이미지를 나타내는 S*를 표현하는 방법을 찾는 것이며, 이러한 task를 **’textual inversion’**이라고 한다고 함.
+
This embedding is found through an optimization process, which we refer to as “Textual Inversion”.
+
pre-trained CLIP model을 이용해서 personalized object의 복구 및 segmentation을 수행. PALAVRA는 특정 개체를 참조하는 CLIP의 textual embedding space에서 pseudo-word를 식별함. 그 다음 검색을 위해 이미지를 설명하거나 어떤 장면에서 특정 개체를 분할하기 위해 사용됨. figure 5에서 보듯이, 그들의 접근 방식은 새로운 장면에서 그럴듯한 재구성 또는 합성에 필요한 세부 정보를 캡처하지 못함.
의역) 목표: 유저가 의도한 것에 초첨을 맞춘, 새로운 concept를 embedding으로 잘 가이드해서 괜찮은 성과물을 내는 것.
+
+
따라서 pre-trained text-to-image model의 중간 단계의 representation으로 이러한 새로운 ‘concepts’을 인코딩하는데 초점을 맞춤. 일반적인 text-to-image model에서는 image의 representation에 대한 후보군을 text encoder의 word-embedding 단계에서 찾는다. 그러나 이러한 접근 방식은 이미지에 대한 in-depth visual understanding을 필요로 하지 않는다(생성자가 이미지에 대해서 시각적인 이해? 없이 그린다.) 따라서 여기서는 GAN inversion에서 영감을 받은 visual reconstruction objective를 제시.
입력 이미지와 유사한 결과 이미지를 얻을 수 있도록 하는 latent vector를 찾는 과정. GAN이 학습되면 random latent vector로부터 이미지를 생성해낸다. GAN inversion은 이의 역과정으로써 GAN의 latent space로 input image를 inverting시켜 latent vector를 알아가는 과정.
입력된 문자열의 각 단어, 하위 단어는 tokenizer를 통과하며, 미리 정의된 dictionary에서 index token으로 변환함. 각 토큰을 통해 찾을 수 있는 고유한 임베딩 벡터에 연결됨.
+
index에 의한 embedding vector는 일반적으로 text encoder인 C_Θ의 일부로 학습된다. 이러한 space를 inversion target으로 삼았음. 새로운 개념을 나타내기 위해 자리표시자 문자열인 S를 새롭게 지정함. 이 과정에서 PALAVRA를 사용했을 것으로 추정함. 임베딩 process에 개입해서 tokenize된 문자열과 관련된 vector를 새로운 학습된 embedding V로 대체하여 본질적으로 어휘(pseudo-word)에 개념을 주입함. 이렇게 함으로써 다른 단어와 마찬가지로 concept를 포함하는 새로운 문장을 만들 수 있었음.
새로운 embedding을 찾기 위해 작은 규모의 dataset(3-5장)을 사용해 다양한 배경 또는 포즈와 같은 여러 설정에 걸쳐 목표 concept을 묘사함. 이러한 작은 dataset에서 LDM loss를 최소화하는 과정을 통해 V를 최적화함. 생성 조건을 고정하기 위해 CLIP ImageNet 템플릿에서 파생된 중립 컨텍스트 텍스트를 무작위로 샘플링한다. 여기에는 “A photo of S*”, “A rendition of S*” 등의 형식 프롬프트가 포함된다.(아마 원본 이미지와 최대한 비슷하게 만들어서 원본과 비교하기 위한 목적이 아닐까 싶음) 최적화 목표식은 다음과 같음.
기존 모델의 결과를 보면, 위 사진에서와 같이 ‘의사’라는 단어를 사용하면, 보통 백인 남성 의사를 잘 그려냈음. 이는 기존 데이터셋에서 남성 의사 사진 데이터가 많았음을 보여준다. 보다 작은 imageset에서 새로운 embedding을 학습함으로써 이러한 bias를 줄일 수 있음을 보여준다(즉, 성별 및 인종적 다양성에 대한 인식을 높일 수 있음).
reconstruction(y축?): target concept를 얼마나 잘 복제하는지. 특정 이미지가 아닌 개념에 대한 변형을 생성하므로 의미적 CLIP 공간 거리를 고려하여 유사성을 측정.(이미지에 자체가 아닌, 이미지가 가진 ‘개념’에 대해 latent space를 생성하므로) 각 컨셉에 대해 “A photo of S*”라는 prompt를 사용해 64개의 이미지를 생성.
+
editability(x축?): text prompt를 사용해 개념을 수정하는 능력을 평가. 다양한 난이도와 다양한 설정의 prompt를 사용해 일련의 이미지를 생성.
+
+
각 prompt 별로, 50 DDIM step을 사용해 64개의 샘플을 만들고, CLIP-space embedding을 평가, textual prompt의 CLIP-space embedding에서 cosine similarity를 계산. 높은 스코어는 더 높은 editing capability와 prompt의 신뢰도를 보여줌.
많은 baseline과 우리 방법의 semantic reconstruction quality는 단순히 training set에서 임의의 이미지를 샘플링하는 것과 비슷함(== 원본 이미지와 생성된 이미지가 큰 차이가 없었다?)
+
single-word method는 비슷한 reconstruction quality를 달성하고, 모든 multi-word baseline에서 상당히 향상된 editablity을 달성. 이러한 점은 text embedding space의 인상적인 유연성을 나타내고, 단일 pseudo word만 사용하면서 높은 정확도로 새로운 개념을 캡처하는데 도움이 될 수 있음을 보여줌.
+
baseline이 distortion-editability tradeoff 곡선의 outline을 그리며 실제 단어 분포에 더 가까운 embedding이 더 쉽게 수정될 수 있음. 그러나 target의 세부 정보를 캡처하지는 못함. 반대로, 단어 분포에서 멀리 벗어나면 editability가 크게 감소하는 대신 향상된 reconstruction이 가능해짐. 특히 single embedding model은 단순히 learning rate를 변경해 이 곡선을 따라 이동할 수 있으므로 사용자에게 이 tradeoff에 대한 어느 정도의 제어를 제공함.
+
concept에 대한 human description을 사용하면 유사성을 포착하지 못하면서도, editability가 감소함.
: 새로운 설정과 장면에서 특정 concept의 이미지를 생성하기 위해 text-to-image model를 활용하는 개인화되며, language-guided generation을 소개함. 여기서 사용한 ‘text inversion’은 pretrained text-to-image 모델의 text embedding space 내에서 concept를 새로운 pseudo word로 inverse하여 작동함. 이러한 pseudo-word는 간단한 자연어 설명을 사용해 새로운 장면에 삽입할 수 있으므로 간단하고 직관적인 수정이 가능함.
+
어떤 의미에서 이 방법은 사용자가 편집하기 쉽도록 텍스트 기반 interpace를 사용하지만 자연 언어의 한계에 접근할 때 시각적 단서를 제공하는 등 multi modal 정보를 활용할 수 있도록 함.
+
이러한 접근 방식은 공개적으로 사용가능한 가장 큰 text-to-image model인 LDM을 통해 구현됨. 그러나 접근 방식에 아키텍처 세부 정보에 의존하지 않음. 따라서 textual inversion은 추가적인 대규모 text-to-image model에 쉽게 적용할 수 있다고 생각. 거기에서 text-to-image alignment, shape preseravation, image generation fidelity가 더 향상될 수 있음.
예를 들어, 어떤 동물 이미지 X 를 Stable Diffusion 으로 Classification 하고 싶다면..
-1. 일단 해당 동물의 클래스를 포함하고 있을 만한 데이터셋을 구한다.
-37개의 동물 클래스가 존재하는 Pets 데이터셋을 사용한다고 치자.
-2. text prompts 로 “호랑이” 가 주어진 Stable Diffusion 으로,
-X 의 Noised Image 에서 Reverse process 를 진행한다. 그럼 Loss 를 획득할 수 있을 것이다.
-3. 37개의 모든 Pets Classes 에 대해서 이를 수행해서,
-가장 Loss 가 작은 Class 를 판별한다.
-이 Class 가 바로 이미지 X 의 클래스이다.
-
-
-
-
-
Fig. 389 Algorithm 1 : Diffusion Classifier 학습 알고리즘#
-
-
-
-
n_samples 에 지정된 수 만큼 t 와 noise 를 각각 샘플링해 벡터를 만든다.
-
클래스 판별이 필요한 이미지 X 의 t-step Noised image 인 X_t 를 구한다.
-
X_t 를 Diffusion Model 에 Input 으로 주어 Noise 를 출력한다.
-
loss 를 구한다.
-
-
-
위 과정을, 여러 번 (n_trials 만큼) 시도해서 평균낼 수도 있다.
-
-
-
loss 가 가장 낮은 Class 를 찾을 때 까지, 가능한 모든 Class 에 대해 추론한다.
-
최종 남은 Class 를 X 의 Class 라고 판정한다.
-
-
-
Zero-shot classification 도 위와 동일한 과정으로 진행된다.
-다만 추론할 Class list 가 필요하다.
-- 예를 들어서, Stable Diffusion 의 Zero-shot classification 을 수행하기 위해서는,
-(Stable Diffusion 이 학습하지는 않았지만) 37개의 클래스가 정의되어 있는
-Pets 와 같은 데이터셋으로 Classification 을 수행할 수 있다.
-
하지만, Class 마다 n_samples 수 만큼 t 를 샘플링하고,
-또 X_t 를 구하고,
-Diffusion Model 로 노이즈를 추론하고,
-loss 를 구하는 것은 Inference times 가 많이 소모됨.
-따라서 다음의 방법을 활용해 inference times 을 줄인다.
왜 이렇게까지 inference time 을 줄이려고 하지??
-- 위의 스크립트 그대로 RTX 3090 에서 돌리면,
-Pets 이미지 1장 Classification 하는데 18초 걸린다.
-- ImageNet 은 Class 1,000 개 있는데,
-512x512 이미지 1장 Classification 하려면 1,000 초 걸린다.
특정한 이미지 x 의 모든 클래스에 대해서 loss 를 추론하게 될텐데,
-모든 클래스에 대해서
-동일한 \(\epsilon\) (즉 sampled noise) 과 동일한 t (즉 sampled time steps) 를 사용해야 한다.
-이 두 변수에 따라 loss 가 크게 달라지기 때문.
-
-
-
-
-
Figure 3 & Figure 4
-
-
Figure 3
-
-
t 에 따라서, Classification 성능이 달라졌다.
-
-
-
Figure 4
-
-
Figure 3 의 결과에 따라서,
-intermediate timesteps 를 더 많이 sampling 하면 성능이 올라가는지 실험해보았다.
-
그렇지 않았다.
-timesteps 를 Uniform 하게 sampling 했을 때 성능이 가장 좋았다.
본 논문에서 제시한 Diffusion Classifier 가 Classification 능력이 나쁘지 않았다.
-
-
-
Diffusion 모델에서 knowledge 를 추출해내는 다른 방법들보다 성능이 뛰어났다.
-- Diffusion Classifier 는 Zero-shot 성능이,
-“Stable Diffusion 으로 생성된 영상을“ 학습한ResNet-50classifier 보다 뛰어났다.
-- Synthetic SD data :
-Class 마다 10,000 장의 이미지를 Stable Diffusion 2.0 으로 생성해
-데이터셋을 구축하고 (90% train / 10% validation),
-해당 데이터셋으로 ResNet-50 classifier 를 학습시켜서 classification 수행한 결과
-- Diffusion Classifier 는 Classification 성능이,
-Stable Diffusion 의 intermediate U-Net layer 를 추출해 학습시킨
-ResNet-based 모델보다 뛰어났다.
-- SD features :
-Input 이미지에 따른 Stable Diffusion 의 Intermediate U-Net features 를
-ResNet 기반의 classifier 에 전달해서 추론.
-이 때 classifier 는 모든 데이터셋을 직접 학습한다. 따라서 zero-shot 은 아니다.
ImageNet 에 존재하는 1,000 개의 클래스를 활용해
-Pretrained DiT (Diffusion Transformer) 를 활용한 Diffusion Classifier 의 성능을,
-Discriminative Classifiers (ResNet-101 and ViT-B/16) 와 비교했다.
-
ImageNet 에 대해서, 79.1% 의 top-1 accuracy 를 기록하며 ViT-L/32 을 능가했다.
-
더 적은 augmentation 기법을 사용하였고,
-regularization 은 사용하지 않았음에도 Discriminative Classifiers 의 성능을 능가했다.
ImageNet 데이터셋에서,
-ImageNet-A 와 겹치는 클래스에 대해서만 Classification 을 수행한다.
-
일반적인 discriminative classifiers 는 신뢰구간 과 함께 파란 점으로 찍혀 있다.
-
Diffusion Classifiers 는 신뢰구간 과 함께 별 모양의 점으로 찍혀 있다.
-
Diffusion Classifiers 는 In-distribution (ImageNet) 에서 획득한 Accuracy 에 따라
-기대되는 것보다,
-훨씬 Out-of-distribution (ImageNet-A) 에서의 성능이 뛰어났다.
-- 즉, OOD 에 훨씬 Robust 하다.
-
결론
-
-
Diffusion Models 에서 Diffusion Classifier 를 추출하는 방법을 제시함
-
Stable Diffusion 에서 추출한 Diffusion Classifier 가 Zero-shot 능력이 우수함을 확인
-
DiT 에서 추출한 Diffusion Classifier 가 Standard Classification 능력이 우수함을 확인
-
Diffusion Classifiers 의 Compositional Reasoning 능력이 우수함을 확인
-
Diffusion Classifiers 가 OOD 에 매우 Robust 함
-
Filtering 되지 않은 데이터도 학습시킬 수 있다면,
-Stable Diffusion 의 Diffusion Classifier 성능은 더 개선될 것임.
-
Imagen 의 경우 OpenCLIP 보다 훨씬 큰 거대 언어 모델인, T5-XXL 을 활용했음.
-Imagen 의 Classification 능력은 Stable Diffusion 보다 뛰어날 것으로 예상됨.
예를 들어, 어떤 동물 이미지 X 를 Stable Diffusion 으로 Classification 하고 싶다면..
+1. 일단 해당 동물의 클래스를 포함하고 있을 만한 데이터셋을 구한다.
+37개의 동물 클래스가 존재하는 Pets 데이터셋을 사용한다고 치자.
+2. text prompts 로 “호랑이” 가 주어진 Stable Diffusion 으로,
+X 의 Noised Image 에서 Reverse process 를 진행한다. 그럼 Loss 를 획득할 수 있을 것이다.
+3. 37개의 모든 Pets Classes 에 대해서 이를 수행해서,
+가장 Loss 가 작은 Class 를 판별한다.
+이 Class 가 바로 이미지 X 의 클래스이다.
+
+
+
+
+
Fig. 389 Algorithm 1 : Diffusion Classifier 학습 알고리즘#
+
+
+
+
n_samples 에 지정된 수 만큼 t 와 noise 를 각각 샘플링해 벡터를 만든다.
+
클래스 판별이 필요한 이미지 X 의 t-step Noised image 인 X_t 를 구한다.
+
X_t 를 Diffusion Model 에 Input 으로 주어 Noise 를 출력한다.
+
loss 를 구한다.
+
+
+
위 과정을, 여러 번 (n_trials 만큼) 시도해서 평균낼 수도 있다.
+
+
+
loss 가 가장 낮은 Class 를 찾을 때 까지, 가능한 모든 Class 에 대해 추론한다.
+
최종 남은 Class 를 X 의 Class 라고 판정한다.
+
+
+
Zero-shot classification 도 위와 동일한 과정으로 진행된다.
+다만 추론할 Class list 가 필요하다.
+- 예를 들어서, Stable Diffusion 의 Zero-shot classification 을 수행하기 위해서는,
+(Stable Diffusion 이 학습하지는 않았지만) 37개의 클래스가 정의되어 있는
+Pets 와 같은 데이터셋으로 Classification 을 수행할 수 있다.
+
하지만, Class 마다 n_samples 수 만큼 t 를 샘플링하고,
+또 X_t 를 구하고,
+Diffusion Model 로 노이즈를 추론하고,
+loss 를 구하는 것은 Inference times 가 많이 소모됨.
+따라서 다음의 방법을 활용해 inference times 을 줄인다.
왜 이렇게까지 inference time 을 줄이려고 하지??
+- 위의 스크립트 그대로 RTX 3090 에서 돌리면,
+Pets 이미지 1장 Classification 하는데 18초 걸린다.
+- ImageNet 은 Class 1,000 개 있는데,
+512x512 이미지 1장 Classification 하려면 1,000 초 걸린다.
특정한 이미지 x 의 모든 클래스에 대해서 loss 를 추론하게 될텐데,
+모든 클래스에 대해서
+동일한 \(\epsilon\) (즉 sampled noise) 과 동일한 t (즉 sampled time steps) 를 사용해야 한다.
+이 두 변수에 따라 loss 가 크게 달라지기 때문.
+
+
+
+
+
Figure 3 & Figure 4
+
+
Figure 3
+
+
t 에 따라서, Classification 성능이 달라졌다.
+
+
+
Figure 4
+
+
Figure 3 의 결과에 따라서,
+intermediate timesteps 를 더 많이 sampling 하면 성능이 올라가는지 실험해보았다.
+
그렇지 않았다.
+timesteps 를 Uniform 하게 sampling 했을 때 성능이 가장 좋았다.
본 논문에서 제시한 Diffusion Classifier 가 Classification 능력이 나쁘지 않았다.
+
+
+
Diffusion 모델에서 knowledge 를 추출해내는 다른 방법들보다 성능이 뛰어났다.
+- Diffusion Classifier 는 Zero-shot 성능이,
+“Stable Diffusion 으로 생성된 영상을“ 학습한ResNet-50classifier 보다 뛰어났다.
+- Synthetic SD data :
+Class 마다 10,000 장의 이미지를 Stable Diffusion 2.0 으로 생성해
+데이터셋을 구축하고 (90% train / 10% validation),
+해당 데이터셋으로 ResNet-50 classifier 를 학습시켜서 classification 수행한 결과
+- Diffusion Classifier 는 Classification 성능이,
+Stable Diffusion 의 intermediate U-Net layer 를 추출해 학습시킨
+ResNet-based 모델보다 뛰어났다.
+- SD features :
+Input 이미지에 따른 Stable Diffusion 의 Intermediate U-Net features 를
+ResNet 기반의 classifier 에 전달해서 추론.
+이 때 classifier 는 모든 데이터셋을 직접 학습한다. 따라서 zero-shot 은 아니다.
ImageNet 에 존재하는 1,000 개의 클래스를 활용해
+Pretrained DiT (Diffusion Transformer) 를 활용한 Diffusion Classifier 의 성능을,
+Discriminative Classifiers (ResNet-101 and ViT-B/16) 와 비교했다.
+
ImageNet 에 대해서, 79.1% 의 top-1 accuracy 를 기록하며 ViT-L/32 을 능가했다.
+
더 적은 augmentation 기법을 사용하였고,
+regularization 은 사용하지 않았음에도 Discriminative Classifiers 의 성능을 능가했다.
ImageNet 데이터셋에서,
+ImageNet-A 와 겹치는 클래스에 대해서만 Classification 을 수행한다.
+
일반적인 discriminative classifiers 는 신뢰구간 과 함께 파란 점으로 찍혀 있다.
+
Diffusion Classifiers 는 신뢰구간 과 함께 별 모양의 점으로 찍혀 있다.
+
Diffusion Classifiers 는 In-distribution (ImageNet) 에서 획득한 Accuracy 에 따라
+기대되는 것보다,
+훨씬 Out-of-distribution (ImageNet-A) 에서의 성능이 뛰어났다.
+- 즉, OOD 에 훨씬 Robust 하다.
+
결론
+
+
Diffusion Models 에서 Diffusion Classifier 를 추출하는 방법을 제시함
+
Stable Diffusion 에서 추출한 Diffusion Classifier 가 Zero-shot 능력이 우수함을 확인
+
DiT 에서 추출한 Diffusion Classifier 가 Standard Classification 능력이 우수함을 확인
+
Diffusion Classifiers 의 Compositional Reasoning 능력이 우수함을 확인
+
Diffusion Classifiers 가 OOD 에 매우 Robust 함
+
Filtering 되지 않은 데이터도 학습시킬 수 있다면,
+Stable Diffusion 의 Diffusion Classifier 성능은 더 개선될 것임.
+
Imagen 의 경우 OpenCLIP 보다 훨씬 큰 거대 언어 모델인, T5-XXL 을 활용했음.
+Imagen 의 Classification 능력은 Stable Diffusion 보다 뛰어날 것으로 예상됨.
Diffusion Models 은 image generation, audio synthesis, video generation 등의 다양한 분야에 연구가 진행되어 왔습니다. 하지만 single-step generative model 인 VAE, GAN, 그리고 normalizing flows 에 비해 추론 속도가 10-2000배 더 많은 연산작업을 요하는 치명적인 단점이 존재합니다.
위의 사진처럼 주어진 PF ODE (Probability Flow Ordinary Differential Equation) 에 대해서 동일한 trajectory 에 있는 point 들이 동일한 시작점으로 매핑되도록 모델을 학습하는 방식을 제안하고, 이러한 self-consistency 특성을 만족시킬 수 있도록 2가지 학습 방식을 소개합니다.
-
-
첫번째 방식으로는 우선적으로 numerical ODE solver 와 사전 학습된 diffusion model을 사용하여 PF ODE trajectory 에서 인접한 point 쌍을 생성합니다. 그리고 이러한 쌍에 대한 모델 출력 간의 차이를 최소화하도록 모델을 학습함으로써 diffusion model 을 consistency model 로 효과적으로 knowledge distillation 을 적용할 수 있고, 단 한번의 step 만으로도 high quality sample 을 생성할 수 있게 됩니다.
-
두번째 방식으로는 사전학습된 diffusion model 에 의존하지 않고 독립적으로 consistency model 을 학습하는 방식입니다.
-
-
CIFAR-10, ImageNet 64x64, LSUN 256x256 데이터셋에 실험한 결과, 기존 distillation 기법을 적용한 모델 (i.e., progressive distillation) 보다 성능이 개선되고, 독립적인 모델로서도 사전학습된 diffusion model 없이 GAN 을 제외한 single-step generative model 보다 성능이 좋다고 합니다. 마지막으로 다양한 zero-shot data editing (image denoising, interpolation, inpainting, colorization, super-resolution, stroke-guided image editing) task 에도 consistency model 이 좋은 성능을 보여준다는 것을 확인하였습니다.
\(\{w_t\}_{t \in [0,T]}\) := standard Brownian motion
-
-
그리고 해당 SDE 는 아래 식과 같은 PF ODE 로 표현할 수 있다는 성질을 가지고 있습니다. 이때 \(\nabla \log p_t(x_t)\) 를 score function 이라고 하고, 시점 t 에 대한 solution trajectory 가 \(p_t(x)\) 에 따라 분포합니다.
일반적으로 위의 SDE 수식에서 \(p_T(x)\) 가 Gaussian distribution \(\pi(x)\) 를 따르도록 정의하고, 해당 논문에서 Karras et al., 2022 와 동일하게 \(\mu(x,t) = 0, \sigma(t) = \sqrt{2}t\) 로 설정하였습니다. 그리고 sampling 시, score matching 을 통해 score model \(s_{\phi}(x,t) \approx \nabla \log p_t(x)\) 우선적으로 학습한 후, 위의 식에 대입하면 다음과 같은 empirical PF ODE 로 표현할 수 있습니다
다음 과정으로는 initial condition \(x_T \sim N(0, T^2I)\) 을 기반으로 Euler 나 Heun 등의 numerical ode solver 를 통해 역방향으로 풀어 solution trajectory \(\{x_t\}_{t \in [0,T]}\)\({x_t}\)\(\hat{x}_0\)\({x_t}\)\(p_{data}(x)\) 로부터 나온 샘플에 대한 근사값이라고 할 수 있습니다.
-
추가적으로 논문에서 numerical instability 를 방지하기 위해 고정된 작은 양수 \(\epsilon\) 에 대해 \(t = \epsilon\) 에서 solver 를 멈추고 \(\hat{x}_{\epsilon}\) 를 \(p_{data}(x)\) 에 대한 근사값으로 간주합니다. 그리고 Karras et al., 2022 와 동일하게 이미지 픽셀 값을 \([-1,1]\) 로 rescale 하고 \(T = 80, \epsilon = 0.002\) 로 설정합니다.
-
앞서 소개드린 방식으로 diffusion model 을 통한 sampling 시, ode solver 를 사용하는데 score model \(s_{\phi}(x_t,t)\) 의 수많은 iterative evaluation 작업이 필요합니다. 빠른 sampling 작업을 위해, 더 빠른 numerical ode solver 에 대한 연구들이 진행되었지만, 이를 활용해도 최소 10번 이상의 evaluation step 을 거쳐야만 competitive 한 성능을 보여준다고 합니다. 여러 distillation 기법들에 대한 연구들도 진행되었지만, Salimans & Ho (2022) 를 제외하고는 distillation 작업을 하기 위해서 사전에 diffusion model 로부터 대량의 데이터를 수집해야한다는 단점이 있습니다.
논문에서 single-step generation 이 가능한 consistency model 을 제안하고, 학습하는 방식으로 1) 사전학습된 diffusion model 로부터 knowledge distillation 진행하는 방식과 2) 독립적으로 학습하는 방식 을 소개합니다.
-
Definition
-
주어진 PF ODE 에 대한 trajectory \(\{x_t\}_{t \in [0,T]}\) 에 대해서 다음과 같은 consistency function\(f : (x_t, t) \mapsto x_{\epsilon}\) 을 정의하고, 함수 \(f\) 는 동일한 trajectory 에 있는 임의의 두 \(t, t' \in [\epsilon, T]\) 에 대해 \(f(x_t, t) = f(x_{t'}, t')\), 즉 self-consistency 성질을 만족합니다. 이러한 함수 \(f\) 를 예측하기 위해 데이터로부터 \(f_{\theta}\) 을 학습하는 것이 consistency model 의 objective 이며, 이는 Bilos et al., 2021 에서 정의하는 neural flow 와 유사하지만, consistency model 은 invertible property 를 부여하지는 않습니다.
앞서 정의한 부분에 의해, 모든 consistency function \(f\) 에 대해서 \(f(x_{\epsilon}, t) = x_{\epsilon}\) 를 만족해야 하는 boundary condition 이 존재하고, 이를 만족하기 위해 다음과 같이 두 가지 방식으로 parameterization 방식을 정의하였습니다.
두번째 parameterization 기법이 diffusion model 형식과 매우 유사하여 이러한 diffusion model 아키텍쳐를 leverage 하기 위해 논문에서 두번째 방식으로 parameterization 을 하는 방식을 택합니다.
-
Sampling
-
학습된 consistency model \(f_{\theta}(\cdot,\cdot)\) 와 initial distribution \(\hat{x}_T \sim N(0, T^2I)\) 를 활용하여 단일 sampling step 만으로 \(\hat{x}_{\epsilon} = f_{\theta}(\hat{x}_{T}, T)\) 를 생성할 수 있습니다. 더불어 하단 pseudo code 에 보이듯이, denoising 과 noise injection 작업을 여러 번 거치는 multistep consistency sampling 을 통해 computing cost 와 sample quality 를 trade-off 할 수 있는 유연성도 제공합니다.
Diffusion model 과 유사하게 추가적인 학습 없이 zero-shot 형태로 image editing 그리고 manipulation task 이 가능합니다. 예를 들어, consistency model 은 Gaussian noise 로부터 one-to-one mapping 을 통해 \(x_{\epsilon}\)을 생성하기 때문에 GAN, VAE, normalizing flow 와 유사하게 latent space 을 통해 sample 들간의 interpolation 이 가능합니다. 또한, multistep consistency sampling 을 통해 zero-shot 의 한계점을 보완하면서 image editing, inpainting, colorization, super-resolution, stroke-guided image editing (Meng et al., 2021) 등의 다양한 task 를 수행할 수 있습니다. 대표적으로 몇 가지 zero-shot image editing 결과 예시들을 공유합니다.
앞서 소개한 두 가지 학습 방식 중, 첫번째로 사전학습된 score model \(s_{\phi}(x,t)\) 를 consistency model 에 knowledge distillation 하는 학습하는 방식을 소개합니다.
-
논문에서 특히 continuous time interval \([\epsilon, T]\) 을 boundary \(t_1 = \epsilon < t_2 < \cdots < t_N=T\) 를 기준으로 \(N-1\) 개의 interval 로 discretize 하는 상황을 가정하고, Karras et al., 2022 의 설정과 동일하게 boundary 를 다음과 같이 정의합니다.
이때, \(N\) 이 충분히 크다면 다음과 같이 numerical ode solver 의 discretization step 을 한번 진행시켜 \(x_{t_{n+1}}\) 로부터 \(x_{t_n}\) 에 대한 정확한 예측값을 얻을 수 있다고 합니다.
-
-
-
-
Fig. 492 One Discretization Step of a Numerical ODE Solver#
-
-
-
이때, \(\Phi(\cdots; \phi)\) 은 empirical PF ODE 에 적용되는 one step ODE solver 의 update function 입니다. Euler solver 같은 경우, \(\Phi(x,t;\phi) = -ts_{\phi}(x,t)\) 를 대입하면 다음과 같이 표현할 수 있게 됩니다.
-
-
-
-
Fig. 493 One Discretization Step of a Euler ODE Solver#
-
-
-
위 수식을 활용하여 주어진 \(x \sim p_{data}\) 에 대해서 PF ODE trajectory 에 있는 인접한 두 지점 \((\hat{x}^{\phi}_{t_n}, x_{t_{n+1}})\) 을 샘플링할 수 있게 됩니다. 더 자세하게는, \(x_{t_{n+1}} \sim N(x,t^2_{n+1}I)\) 를 우선적으로 샘플링한 후, 위 수식을 기반으로 numerical ode solver 의 discretization step 을 한번 거쳐 \(\hat{x}^{\phi}_{t_n}\) 을 계산합니다. 최종적으로 \((\hat{x}^{\phi}_{t_n}, x_{t_{n+1}})\) 로부터의 모델 출력값 차이를 최소화하도록 consistency model 을 학습하게 되고, 학습 시 사용되는 consistency distillation loss 는 다음과 같이 정의합니다.
여기서 metric function \(d(\cdot,\cdot)\) 로는 L1 distance, L2 distance, 그리고 LPIPS distance 를 사용하였고, 실험적으로 확인해본 결과 \(\lambda(t_n) \equiv 1\) 를 적용했을 때 모델 성능이 가장 좋은 부분을 확인할 수 있었다고 합니다. 파라미터 \(\theta\) 는 stochastic gradient descent 그리고 \(\theta^-\) 는 exponential moving average (EMA) 로 학습하였다고 합니다.
이처럼 EMA update 와 stopgrad operator 로 학습할 시, \(\theta = \theta^{-}\) 로 설정할때보다 모델을 더 안정적으로 학습할 수 있고 성능에도 개선이 있었다고 합니다. 전체적인 학습 절차는 하단의 Algorithm 2 처럼 정리할 수 있습니다.
-
-
-
-
Fig. 496 Overview of Consistency Distillation (CD)#
-
-
-
\(\theta^{-}\) 는 과거 \(\theta\) 에 대한 running average 이므로 Algorithm 2 가 수렴할 시 이 둘은 일치하게 됩니다. 즉, target network \(f_{\theta^-}\)와 online network \(f_{\theta}\) 가 일치하게 됩니다.
Consistency Distillation 방식에서는 ground truth score function \(\nabla \log p_t(x_t)\) 을 근사하는 사전학습된 score model \(s_{\phi}(x,t)\) 에 의존했다면, 이에 의존하지 않고 다음과 같은 \(\nabla \log p_t(x_t)\) 에 대한 unbiased estimator 를 활용할 수도 있습니다. 다시 말해, \(-(x_t - x)/t^2\) 로 \(\nabla \log p_t(x_t)\) 를 근사할 수 있습니다.
Fig. 499 Schedule Functions for Consistency Training#
-
-
-
논문에서 추가적인 성능 개선을 위해 \(N\) 을 점진적으로 증가시키는 방식을 제안합니다. \(N\) 이 작을수록 (\(i.e., \Delta t\) 가 클수록) consistency training loss 가 consistency distillation loss 와 비교했을때 variance 는 감소하지만 bias 는 증가하게 되어, 초기에 더 빠른 convergence 에 이르는데 용이합니다. 반면에, \(N\) 이 클수록 (\(i.e., \Delta t\) 가 작을수록) variance 는 증가하고 bias 는 감소하게 되어, 학습의 마지막 단계에 적용하는 것이 바람직하다고 제안합니다. EMA decay rate schedule function \(\mu(\cdot)\) 도 \(N\) 에 따라 바뀌는 함수로 최종적으로 정의합니다. 전체적인 학습 절차는 하단의 Algorithm 3 처럼 정리할 수 있습니다.
논문에서 CIFAR-10, ImageNet 64x64, LSUN Bedroom 256x256, 그리고 LSUN Cat 256x256 데이터셋에 consistency distillation, consistency training 두 학습 방식을 모두 실험하였고, 모델 성능 지표는 FID, IS, Precision, 그리고 Recall 을 사용하였습니다. 모델 architecture 는 CIFAR-10 데이터셋에는 NCSN++, 그리고 그 외 데이터셋에는 ADM 모델을 사용하였습니다.
CIFAR-10 데이터셋에 다음과 같은 hyperparameter tuning 작업을 진행하였습니다. (metric function \(d(\cdot,\cdot)\), ODE solver, CD (Consistency Distillation) 에서의 number of discretization steps \(N\), 그리고 CT (Consistency Training)) 에서의 schedule functions \(N(\cdot), \mu(\cdot)\))
-
Parameter Initialization
-
모델 초기 파라미터 값은 다음과 같이 설정하였습니다.
-
-
Consistency Distillation - 사전학습된 diffusion model 파라미터 값
LPIPS 를 metric function 으로 사용했을때 모델 성능이 가장 좋았고, 이는 LPIPS metric 이 CIFAR-10 와 같은 natural image 들 간의 유사도를 측정하는데 특화되어 있기 때문이라고 합니다.
-
Euler ODE solver 보다 Heun ODE solver 를 사용했을 때, 그리고 \(N = 18\) 로 설정했을때 모델 성능이 가장 좋았습니다. 또한, 동일한 \(N\) 에 대해서 Heun’s second ode solver 를 사용했을때 Euler’s first ode solver 를 사용했을 때보다 모델 성능이 우월한 부분을 확인할 수 있었다고 합니다.
-
-
이외에도 다른 데이터셋에 hyperparameter tuning 작업을 별도로 진행하였습니다.
-
-
Consistency Training (CT)
-
-
CD 와 동일하게 LPIPS metric function 사용하였고, ODE solver 는 사용하지 않았습니다.
-
\(N\) 이 작을수록, 모델이 더 빨리 수렴하지만 생성된 이미지 퀄리티는 좋지 않은 부분을 재차 확인할 수 있습니다. (and vice versa)
-
\(N\) 을 점차적으로 증가시키면서 \(\mu\) 도 변화시켰을때 성능이 가장 좋았습니다.
CIFAR-10 데이터셋 기준으로 VAE, normalizing flow 를 비롯한 타 single-step generative model 보다 CT 가 성능이 가장 좋았습니다. 또한, distillation 기법 없이도 Progressive Distillation (PD, Salimans & Ho (2022)) 와 견줄만한 성능을 가진 부분을 확인할 수 있습니다. 마지막으로 동일한 noise 로부터 높은 structural similarity 를 가진 이미지들을 생성함으로써 self-consistency 성질도 확인할 수 있었다고 합니다.
-
-
-
-
Fig. 503 Experimental Results - Direct Generation#
Diffusion model 과 유사하게 consistency model 도 multistep sampling 알고리즘을 수정함으로써 zero shot image editing 이 가능합니다. 해당 사진은 LSUN Bedroom 데이터셋에 colorization, super-resolution, stroke-guided image editing task 를 적용한 결과입니다.
Diffusion Models 은 image generation, audio synthesis, video generation 등의 다양한 분야에 연구가 진행되어 왔습니다. 하지만 single-step generative model 인 VAE, GAN, 그리고 normalizing flows 에 비해 추론 속도가 10-2000배 더 많은 연산작업을 요하는 치명적인 단점이 존재합니다.
위의 사진처럼 주어진 PF ODE (Probability Flow Ordinary Differential Equation) 에 대해서 동일한 trajectory 에 있는 point 들이 동일한 시작점으로 매핑되도록 모델을 학습하는 방식을 제안하고, 이러한 self-consistency 특성을 만족시킬 수 있도록 2가지 학습 방식을 소개합니다.
+
+
첫번째 방식으로는 우선적으로 numerical ODE solver 와 사전 학습된 diffusion model을 사용하여 PF ODE trajectory 에서 인접한 point 쌍을 생성합니다. 그리고 이러한 쌍에 대한 모델 출력 간의 차이를 최소화하도록 모델을 학습함으로써 diffusion model 을 consistency model 로 효과적으로 knowledge distillation 을 적용할 수 있고, 단 한번의 step 만으로도 high quality sample 을 생성할 수 있게 됩니다.
+
두번째 방식으로는 사전학습된 diffusion model 에 의존하지 않고 독립적으로 consistency model 을 학습하는 방식입니다.
+
+
CIFAR-10, ImageNet 64x64, LSUN 256x256 데이터셋에 실험한 결과, 기존 distillation 기법을 적용한 모델 (i.e., progressive distillation) 보다 성능이 개선되고, 독립적인 모델로서도 사전학습된 diffusion model 없이 GAN 을 제외한 single-step generative model 보다 성능이 좋다고 합니다. 마지막으로 다양한 zero-shot data editing (image denoising, interpolation, inpainting, colorization, super-resolution, stroke-guided image editing) task 에도 consistency model 이 좋은 성능을 보여준다는 것을 확인하였습니다.
\(\{w_t\}_{t \in [0,T]}\) := standard Brownian motion
+
+
그리고 해당 SDE 는 아래 식과 같은 PF ODE 로 표현할 수 있다는 성질을 가지고 있습니다. 이때 \(\nabla \log p_t(x_t)\) 를 score function 이라고 하고, 시점 t 에 대한 solution trajectory 가 \(p_t(x)\) 에 따라 분포합니다.
일반적으로 위의 SDE 수식에서 \(p_T(x)\) 가 Gaussian distribution \(\pi(x)\) 를 따르도록 정의하고, 해당 논문에서 Karras et al., 2022 와 동일하게 \(\mu(x,t) = 0, \sigma(t) = \sqrt{2}t\) 로 설정하였습니다. 그리고 sampling 시, score matching 을 통해 score model \(s_{\phi}(x,t) \approx \nabla \log p_t(x)\) 우선적으로 학습한 후, 위의 식에 대입하면 다음과 같은 empirical PF ODE 로 표현할 수 있습니다
다음 과정으로는 initial condition \(x_T \sim N(0, T^2I)\) 을 기반으로 Euler 나 Heun 등의 numerical ode solver 를 통해 역방향으로 풀어 solution trajectory \(\{x_t\}_{t \in [0,T]}\)\({x_t}\)\(\hat{x}_0\)\({x_t}\)\(p_{data}(x)\) 로부터 나온 샘플에 대한 근사값이라고 할 수 있습니다.
+
추가적으로 논문에서 numerical instability 를 방지하기 위해 고정된 작은 양수 \(\epsilon\) 에 대해 \(t = \epsilon\) 에서 solver 를 멈추고 \(\hat{x}_{\epsilon}\) 를 \(p_{data}(x)\) 에 대한 근사값으로 간주합니다. 그리고 Karras et al., 2022 와 동일하게 이미지 픽셀 값을 \([-1,1]\) 로 rescale 하고 \(T = 80, \epsilon = 0.002\) 로 설정합니다.
+
앞서 소개드린 방식으로 diffusion model 을 통한 sampling 시, ode solver 를 사용하는데 score model \(s_{\phi}(x_t,t)\) 의 수많은 iterative evaluation 작업이 필요합니다. 빠른 sampling 작업을 위해, 더 빠른 numerical ode solver 에 대한 연구들이 진행되었지만, 이를 활용해도 최소 10번 이상의 evaluation step 을 거쳐야만 competitive 한 성능을 보여준다고 합니다. 여러 distillation 기법들에 대한 연구들도 진행되었지만, Salimans & Ho (2022) 를 제외하고는 distillation 작업을 하기 위해서 사전에 diffusion model 로부터 대량의 데이터를 수집해야한다는 단점이 있습니다.
논문에서 single-step generation 이 가능한 consistency model 을 제안하고, 학습하는 방식으로 1) 사전학습된 diffusion model 로부터 knowledge distillation 진행하는 방식과 2) 독립적으로 학습하는 방식 을 소개합니다.
+
Definition
+
주어진 PF ODE 에 대한 trajectory \(\{x_t\}_{t \in [0,T]}\) 에 대해서 다음과 같은 consistency function\(f : (x_t, t) \mapsto x_{\epsilon}\) 을 정의하고, 함수 \(f\) 는 동일한 trajectory 에 있는 임의의 두 \(t, t' \in [\epsilon, T]\) 에 대해 \(f(x_t, t) = f(x_{t'}, t')\), 즉 self-consistency 성질을 만족합니다. 이러한 함수 \(f\) 를 예측하기 위해 데이터로부터 \(f_{\theta}\) 을 학습하는 것이 consistency model 의 objective 이며, 이는 Bilos et al., 2021 에서 정의하는 neural flow 와 유사하지만, consistency model 은 invertible property 를 부여하지는 않습니다.
앞서 정의한 부분에 의해, 모든 consistency function \(f\) 에 대해서 \(f(x_{\epsilon}, t) = x_{\epsilon}\) 를 만족해야 하는 boundary condition 이 존재하고, 이를 만족하기 위해 다음과 같이 두 가지 방식으로 parameterization 방식을 정의하였습니다.
두번째 parameterization 기법이 diffusion model 형식과 매우 유사하여 이러한 diffusion model 아키텍쳐를 leverage 하기 위해 논문에서 두번째 방식으로 parameterization 을 하는 방식을 택합니다.
+
Sampling
+
학습된 consistency model \(f_{\theta}(\cdot,\cdot)\) 와 initial distribution \(\hat{x}_T \sim N(0, T^2I)\) 를 활용하여 단일 sampling step 만으로 \(\hat{x}_{\epsilon} = f_{\theta}(\hat{x}_{T}, T)\) 를 생성할 수 있습니다. 더불어 하단 pseudo code 에 보이듯이, denoising 과 noise injection 작업을 여러 번 거치는 multistep consistency sampling 을 통해 computing cost 와 sample quality 를 trade-off 할 수 있는 유연성도 제공합니다.
Diffusion model 과 유사하게 추가적인 학습 없이 zero-shot 형태로 image editing 그리고 manipulation task 이 가능합니다. 예를 들어, consistency model 은 Gaussian noise 로부터 one-to-one mapping 을 통해 \(x_{\epsilon}\)을 생성하기 때문에 GAN, VAE, normalizing flow 와 유사하게 latent space 을 통해 sample 들간의 interpolation 이 가능합니다. 또한, multistep consistency sampling 을 통해 zero-shot 의 한계점을 보완하면서 image editing, inpainting, colorization, super-resolution, stroke-guided image editing (Meng et al., 2021) 등의 다양한 task 를 수행할 수 있습니다. 대표적으로 몇 가지 zero-shot image editing 결과 예시들을 공유합니다.
앞서 소개한 두 가지 학습 방식 중, 첫번째로 사전학습된 score model \(s_{\phi}(x,t)\) 를 consistency model 에 knowledge distillation 하는 학습하는 방식을 소개합니다.
+
논문에서 특히 continuous time interval \([\epsilon, T]\) 을 boundary \(t_1 = \epsilon < t_2 < \cdots < t_N=T\) 를 기준으로 \(N-1\) 개의 interval 로 discretize 하는 상황을 가정하고, Karras et al., 2022 의 설정과 동일하게 boundary 를 다음과 같이 정의합니다.
이때, \(N\) 이 충분히 크다면 다음과 같이 numerical ode solver 의 discretization step 을 한번 진행시켜 \(x_{t_{n+1}}\) 로부터 \(x_{t_n}\) 에 대한 정확한 예측값을 얻을 수 있다고 합니다.
+
+
+
+
Fig. 492 One Discretization Step of a Numerical ODE Solver#
+
+
+
이때, \(\Phi(\cdots; \phi)\) 은 empirical PF ODE 에 적용되는 one step ODE solver 의 update function 입니다. Euler solver 같은 경우, \(\Phi(x,t;\phi) = -ts_{\phi}(x,t)\) 를 대입하면 다음과 같이 표현할 수 있게 됩니다.
+
+
+
+
Fig. 493 One Discretization Step of a Euler ODE Solver#
+
+
+
위 수식을 활용하여 주어진 \(x \sim p_{data}\) 에 대해서 PF ODE trajectory 에 있는 인접한 두 지점 \((\hat{x}^{\phi}_{t_n}, x_{t_{n+1}})\) 을 샘플링할 수 있게 됩니다. 더 자세하게는, \(x_{t_{n+1}} \sim N(x,t^2_{n+1}I)\) 를 우선적으로 샘플링한 후, 위 수식을 기반으로 numerical ode solver 의 discretization step 을 한번 거쳐 \(\hat{x}^{\phi}_{t_n}\) 을 계산합니다. 최종적으로 \((\hat{x}^{\phi}_{t_n}, x_{t_{n+1}})\) 로부터의 모델 출력값 차이를 최소화하도록 consistency model 을 학습하게 되고, 학습 시 사용되는 consistency distillation loss 는 다음과 같이 정의합니다.
여기서 metric function \(d(\cdot,\cdot)\) 로는 L1 distance, L2 distance, 그리고 LPIPS distance 를 사용하였고, 실험적으로 확인해본 결과 \(\lambda(t_n) \equiv 1\) 를 적용했을 때 모델 성능이 가장 좋은 부분을 확인할 수 있었다고 합니다. 파라미터 \(\theta\) 는 stochastic gradient descent 그리고 \(\theta^-\) 는 exponential moving average (EMA) 로 학습하였다고 합니다.
이처럼 EMA update 와 stopgrad operator 로 학습할 시, \(\theta = \theta^{-}\) 로 설정할때보다 모델을 더 안정적으로 학습할 수 있고 성능에도 개선이 있었다고 합니다. 전체적인 학습 절차는 하단의 Algorithm 2 처럼 정리할 수 있습니다.
+
+
+
+
Fig. 496 Overview of Consistency Distillation (CD)#
+
+
+
\(\theta^{-}\) 는 과거 \(\theta\) 에 대한 running average 이므로 Algorithm 2 가 수렴할 시 이 둘은 일치하게 됩니다. 즉, target network \(f_{\theta^-}\)와 online network \(f_{\theta}\) 가 일치하게 됩니다.
Consistency Distillation 방식에서는 ground truth score function \(\nabla \log p_t(x_t)\) 을 근사하는 사전학습된 score model \(s_{\phi}(x,t)\) 에 의존했다면, 이에 의존하지 않고 다음과 같은 \(\nabla \log p_t(x_t)\) 에 대한 unbiased estimator 를 활용할 수도 있습니다. 다시 말해, \(-(x_t - x)/t^2\) 로 \(\nabla \log p_t(x_t)\) 를 근사할 수 있습니다.
Fig. 499 Schedule Functions for Consistency Training#
+
+
+
논문에서 추가적인 성능 개선을 위해 \(N\) 을 점진적으로 증가시키는 방식을 제안합니다. \(N\) 이 작을수록 (\(i.e., \Delta t\) 가 클수록) consistency training loss 가 consistency distillation loss 와 비교했을때 variance 는 감소하지만 bias 는 증가하게 되어, 초기에 더 빠른 convergence 에 이르는데 용이합니다. 반면에, \(N\) 이 클수록 (\(i.e., \Delta t\) 가 작을수록) variance 는 증가하고 bias 는 감소하게 되어, 학습의 마지막 단계에 적용하는 것이 바람직하다고 제안합니다. EMA decay rate schedule function \(\mu(\cdot)\) 도 \(N\) 에 따라 바뀌는 함수로 최종적으로 정의합니다. 전체적인 학습 절차는 하단의 Algorithm 3 처럼 정리할 수 있습니다.
논문에서 CIFAR-10, ImageNet 64x64, LSUN Bedroom 256x256, 그리고 LSUN Cat 256x256 데이터셋에 consistency distillation, consistency training 두 학습 방식을 모두 실험하였고, 모델 성능 지표는 FID, IS, Precision, 그리고 Recall 을 사용하였습니다. 모델 architecture 는 CIFAR-10 데이터셋에는 NCSN++, 그리고 그 외 데이터셋에는 ADM 모델을 사용하였습니다.
CIFAR-10 데이터셋에 다음과 같은 hyperparameter tuning 작업을 진행하였습니다. (metric function \(d(\cdot,\cdot)\), ODE solver, CD (Consistency Distillation) 에서의 number of discretization steps \(N\), 그리고 CT (Consistency Training)) 에서의 schedule functions \(N(\cdot), \mu(\cdot)\))
+
Parameter Initialization
+
모델 초기 파라미터 값은 다음과 같이 설정하였습니다.
+
+
Consistency Distillation - 사전학습된 diffusion model 파라미터 값
LPIPS 를 metric function 으로 사용했을때 모델 성능이 가장 좋았고, 이는 LPIPS metric 이 CIFAR-10 와 같은 natural image 들 간의 유사도를 측정하는데 특화되어 있기 때문이라고 합니다.
+
Euler ODE solver 보다 Heun ODE solver 를 사용했을 때, 그리고 \(N = 18\) 로 설정했을때 모델 성능이 가장 좋았습니다. 또한, 동일한 \(N\) 에 대해서 Heun’s second ode solver 를 사용했을때 Euler’s first ode solver 를 사용했을 때보다 모델 성능이 우월한 부분을 확인할 수 있었다고 합니다.
+
+
이외에도 다른 데이터셋에 hyperparameter tuning 작업을 별도로 진행하였습니다.
+
+
Consistency Training (CT)
+
+
CD 와 동일하게 LPIPS metric function 사용하였고, ODE solver 는 사용하지 않았습니다.
+
\(N\) 이 작을수록, 모델이 더 빨리 수렴하지만 생성된 이미지 퀄리티는 좋지 않은 부분을 재차 확인할 수 있습니다. (and vice versa)
+
\(N\) 을 점차적으로 증가시키면서 \(\mu\) 도 변화시켰을때 성능이 가장 좋았습니다.
CIFAR-10 데이터셋 기준으로 VAE, normalizing flow 를 비롯한 타 single-step generative model 보다 CT 가 성능이 가장 좋았습니다. 또한, distillation 기법 없이도 Progressive Distillation (PD, Salimans & Ho (2022)) 와 견줄만한 성능을 가진 부분을 확인할 수 있습니다. 마지막으로 동일한 noise 로부터 높은 structural similarity 를 가진 이미지들을 생성함으로써 self-consistency 성질도 확인할 수 있었다고 합니다.
+
+
+
+
Fig. 503 Experimental Results - Direct Generation#
Diffusion model 과 유사하게 consistency model 도 multistep sampling 알고리즘을 수정함으로써 zero shot image editing 이 가능합니다. 해당 사진은 LSUN Bedroom 데이터셋에 colorization, super-resolution, stroke-guided image editing task 를 적용한 결과입니다.
Image-to-image translation 은 한 이미지 도메인을 다른 이미지 도메인으로 변환시키는 computer vision 의 한 task 입니다.
-
Image-to-image translation 은 보통 input과 output이 짝이 지어진 상태에서 학습하지만 짝이 지어진 학습 데이터를 얻는 것이 어렵습니다. 따라서 CycleGAN 논문에서는 짝지어진 예시 없이 \(X\) 라는 domain 으로부터 얻은 이미지를 target domain \(Y\) 로 바꾸는 방법을 제안합니다. 이 연구는 Adversarial loss 를 활용해, \(G(x)\) 로부터 생성된 이미지 데이터의 분포와 \(Y\) 로부터의 이미지 데이터의 분포가 구분이 불가능하도록 함수 \(G: X -> Y\) 를 학습시키는 것을 목표로 합니다. 더불어, \(X -> Y\) 로의 mapping 에 제약을 가해서 원하는 이미지를 강제하기 위해 \(F: Y -> X\) 와 같은 역방향 매핑을 함께 진행합니다. 즉, \(F(G(x))\) 가 \(X\) 와 유사해지도록 강제하는 cycle consistency loss 를 도입했습니다.
-
결과적으로 collection style transfer, object transfiguration, season transfer, photo enhancement 등의 task 에서 이미지 pair 가 존재하지 않는 상태에서 우수한 결과를 보여줬다고 합니다.
Image-to-Image Translation : 특정 image 를 input 로 넣으면 그에 맞는 image 가 output 로 나오는 방법입니다. pix2pix 같은 방법이 있으며 상세한 설명은 아래의 Background section 을 참조하면 됩니다.
-
Unpaired Image-to-Image Translation : 위의 Image-to-Image Translation 에서 pair 가 아닌 데이터로 학습해서 Image-to-Image Translation 과 같은 input, output 결과가 나오도록 만드는 방법입니다.
-
Cycle Consistency : 한 이미지를 다른 도메인으로 변환하고 다시 원래 도메인으로 변환할 때 처음의 원본으로 되도록 하여 일종의 순환(사이클)을 만드는 방법으로 학습 프로세스가 더 안정적이게 되고, 이미지 간의 일관성을 보다 잘 유지할 수 있도록 만듭니다. (ex) \(X\) 를 모델 \(A\) 에 거쳐 \(Y\) 로 만든 뒤 다시 모델 \(B\) 를 거쳐 \(X\) 로 복구)
-
Neural Style Transfer : pre-trained 된 deep features 의 Gram matrix statistics 일치를 기반으로 이미지 content 를 다른 image 의 스타일과 결합하여 새로운 이미지를 합성하는 방법입니다.
Image-to-image translation 은 input image 를 다른 스타일, 속성, 구조 등을 가진 output image 로 변환하는 task 입니다. 예를 들어 사진을 그림으로 변환한다거나, 낮에 찍은 사진을 밤에 찍은 것 처럼 변환하는 것을 말합니다. 흔히 translation 은 input 과 output 로 짝이 지어진 데이터를 바탕으로 학습이 이루어져 있었는데요. 짝이 지어진 사진 데이터를 얻는 것은 어렵고 값이 비싼 일이 됩니다.
이 논문에서는 input image와 output image가 일대일로 짝지어지지 않은 상태에서 하나의 image 모음의 특성을 캡쳐하고, 이러한 특성을 다른 image 모음으로 변환할 수 있는 방법을 제시합니다.
-GAN은 domain \(X\) 에 이미지 한 세트, domain \(Y\) 에 이미지 한 세트가 제공되고, model 의 output 과 \(Y\) 가 discriminator 에 의해 구별할 수 없도록 모델 \(G: X -> Y\) 를 학습합니다. 하지만, 이것이 개별 입력 \(x\) 와 출력 \(y\) 가 무조건 유의미하게 쌍을 이룬다는 것을 뜻하지는 않습니다. \(G\) 가 생성할 수 있는 image 에는 무한한 경우의 수가 있기 때문에 종종 mode collapse 현상이 일어나기도 합니다.
어떤 input image 든 모두 같은 output image 로 매핑하면서 최적화에 실패하는 현상입니다. 이 현상은 generator 입장에서, discriminator 가 이 사진이 진짜 \(Y\)인지 가짜인 \(\hat{Y}\)인지 구별하는 것을 ‘속이기만’ 하면 되기 때문에 우리의 목적과 전혀 상관이 없는 데이터를 generator 가 만들더라도 문제가 생기지 않아서 발생합니다.
이러한 이슈로 인해 추가 objective function 이 필요해졌습니다. 따라서 translation task 는 영어 -> 프랑스어 -> 영어로 번역했을 때 원래 문장에 다시 도달하는 것처럼, \(X --> Y --> X'\) 로 돌아가는 과정에서 \(X\) 와 \(X'\) 이 최대한 같아야 한다는 의미의 cycle consistency 이라는 속성을 이용합니다. 필요한 목적식을 간단하게 정리하면 다음과 같습니다.
이는 GAN 에서 쓰이는 loss function 를 사용하지만, 차이점이 있다면 \(X -> Y\) 로 갈 때와 \(Y -> X\) 로 갈 때 총 두 개의 수식이 나옵니다. 다시 말해, \(F: Y -> X\) 와 \(D_X\) 에 대해서도 \(F\), \(D_X\) 를 넣은 동일한 수식을 사용합니다.
(원래 Discriminator 는 이보다 더 고차원이지만) 간략히 2차원을 표방하면 결정경계를 위와 같이 나타낼 수 있습니다. 윗 쪽이 가짜 영역, 아래 쪽이 진짜 영역입니다 이 때, 아래에 보면 진짜 데이터 샘플과 거리가 먼 가짜 데이터 샘플이 존재합니다. 즉, NLL Loss 를 사용한다면, Generator 의 입장에서는 이미 Discriminator 를 잘 속이고 있기 때문에 학습할 필요가 없게 됩니다. 즉, Vanishing Gradient 현상이 일어나기 때문에, Discriminator 를 잘 속인다는 이유만으로, 안 좋은 샘플을 생성하는 것에 대해 패널티를 줄 수가 없게 됩니다. 이 때, LSGAN 을 사용한다면 실제 데이터 분포와 가짜 데이터 샘플이 거리가 먼 것에 대해서도 패널티를 주게 됩니다.
그리고 모든 실험에 대해서 \(\lambda\) 를 10 으로 설정하고, batch size = 1, 그리고 Adam solver 를 사용했습니다. 첫 100 epoch 동안에는 learning rate 를 0.0002 로 설정했고, 다음 100 epoch 마다 0 으로 조금식 수렴하게 scheduling 하였습니다.
모델 성능 평가를 위해 아래와 같은 세 개의 지표를 기반으로 기존의 CoGAN, SimGAN, pix2pix baseline 모델과 비교했습니다. 그 외 loss function 에 대한 ablation study 도 수행했습니다.
-
-
AMT perceptual studies: 참가자들은 실제 사진이미지 vs 가짜 이미지, 또는 지도 이미지 vs 가짜이미지에 노출된 후 진짜라고 생각되는 이미지를 선택하게 합니다.
-
FCN Score: 1번 study 가 테스트에 있어 매우 좋은 기준임에도 불구하고, 이번에는 사람을 대상으로 한 실험이 아닌 양적인 기준을 사용합니다. 우선적으로 FCN 모델을 통해 생성된 사진에 대한 레이블 맵을 예측합니다. 이 레이블 맵은 아래에서 설명하는 standard semantic segmentation metric 을 사용하여 input ground truth label 과 비교할 수 있습니다. “도로 상의 자동차”라는 label 에서 사진 이미지를 생성하면, 생성된 이미지에 적용된 FCN 이 “도로 상의 자동차”를 감지하면 성공한 것입니다.
-
Semantic segmentation metric: pixel 당 정확도, class 당 정확도, 그리고 IoU(Intersection-Over-Union) 를 포함하는 cityscapes benchmark 의 표준 metric 를 사용합니다.
Table 1 은 AMT perceptual realism task 에 대한 성능을 나타냅니다. CycleGAN 의 지도에서 항공 사진, 그리고 항공 사진에서 지도 translation 결과에서 약 1/4의 참가자를 속일 수 있었던 반면에 그 외 모든 baseline 모델은 참가자를 거의 속일 수 없었습니다.
GAN 과 cycle consistency loss 의 중요성을 보여주는 ablation study 입니다. GAN loss 그리고 cycle consistency loss 를 각각 제거하면 성능이 크게 저하되는 부분을 확인할 수 있습니다. 또한 한쪽 방향에 대해서만 GAN + forward cycle 만 돌렸을 때와 GAN + backward cycle 만 돌렸을 때 학습의 불안정성을 보이고, mode collapse 를 유발하는 것을 확인할 수 있었다고 합니다.
Figure 8 은 CMP Facade Database 의 건축 레이블 <-> 사진, 그리고 UT Zapoos50K dataset 의 edge <-> 신발 을 비롯하여 pix2pix 에 사용된 paired dataset 에 대한 몇 가지 예시 결과를 보여줍니다. CycleGAN 이 생성한 이미지 품질이 fully supervised 된 pix2pix 에 대응하는 성능을 보여주는 것을 확인할 수 있습니다.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- : shallow depth of field: 얕은 초점. 초점이 맞은 대상과 배경이 흐릿하게 보이는 효과. 인물 사진 / 작품 사진에 활용. 구목하고자 하는 대상을 강조하기 위해 활용. -->
- 따라서 source domain은 스마트폰의 **작은 조리개로 깊은 초점** \--> target은 **조리개가 커서 얕은 초점**.-->
-
-
-
-
-
-
이 방법은 많은 경우에 흥미로운 결과를 얻을 수 있지만, 결과가 균일하게 좋은 것은 아니었습니다.
-
-
개 <-> 고양이 translation task 와 같은 경우는 input image 에서 최소한의 변화만 주어, 사람이 보았을 때 실제로 변화가 안되는 경우도 있었고, 형체가 애매해진 경우도 있었습니다. 이를 보았을 때, geometry 가 반영되는 눈, 코, 입 등의 세부적인 구조에 대한 정확히 구현하는데 한계가 있어 보입니다.
-
말 <–> 얼룩말 translation 예제의 경우, 말은 사람이 타는 모습이 많았는데 얼룩말의 경우는 사람이 타는 사진이 없다보니, 사람 뿐만 아니라 배경도 얼룩 그림을 그리거나 단순히 얼룩말에서 노랗게 칠한 경우가 존재합니다.
-
때때로 photo -> image translation task 에서 나무와 건물의 label 을 바꾸는 경우도 있었습니다.
-이러한 모호성을 해결하려면 weak semantic supervision 이 필요할 수도 있을 것 같습니다.
-
-
그럼에도 불구하고 해당 논문은 완전히 paired 되지 않은 “unsupervised” setting 에서도 image translation task 의 한계를 늘리는데 기여합니다.
Image-to-image translation 은 한 이미지 도메인을 다른 이미지 도메인으로 변환시키는 computer vision 의 한 task 입니다.
+
Image-to-image translation 은 보통 input과 output이 짝이 지어진 상태에서 학습하지만 짝이 지어진 학습 데이터를 얻는 것이 어렵습니다. 따라서 CycleGAN 논문에서는 짝지어진 예시 없이 \(X\) 라는 domain 으로부터 얻은 이미지를 target domain \(Y\) 로 바꾸는 방법을 제안합니다. 이 연구는 Adversarial loss 를 활용해, \(G(x)\) 로부터 생성된 이미지 데이터의 분포와 \(Y\) 로부터의 이미지 데이터의 분포가 구분이 불가능하도록 함수 \(G: X -> Y\) 를 학습시키는 것을 목표로 합니다. 더불어, \(X -> Y\) 로의 mapping 에 제약을 가해서 원하는 이미지를 강제하기 위해 \(F: Y -> X\) 와 같은 역방향 매핑을 함께 진행합니다. 즉, \(F(G(x))\) 가 \(X\) 와 유사해지도록 강제하는 cycle consistency loss 를 도입했습니다.
+
결과적으로 collection style transfer, object transfiguration, season transfer, photo enhancement 등의 task 에서 이미지 pair 가 존재하지 않는 상태에서 우수한 결과를 보여줬다고 합니다.
Image-to-Image Translation : 특정 image 를 input 로 넣으면 그에 맞는 image 가 output 로 나오는 방법입니다. pix2pix 같은 방법이 있으며 상세한 설명은 아래의 Background section 을 참조하면 됩니다.
+
Unpaired Image-to-Image Translation : 위의 Image-to-Image Translation 에서 pair 가 아닌 데이터로 학습해서 Image-to-Image Translation 과 같은 input, output 결과가 나오도록 만드는 방법입니다.
+
Cycle Consistency : 한 이미지를 다른 도메인으로 변환하고 다시 원래 도메인으로 변환할 때 처음의 원본으로 되도록 하여 일종의 순환(사이클)을 만드는 방법으로 학습 프로세스가 더 안정적이게 되고, 이미지 간의 일관성을 보다 잘 유지할 수 있도록 만듭니다. (ex) \(X\) 를 모델 \(A\) 에 거쳐 \(Y\) 로 만든 뒤 다시 모델 \(B\) 를 거쳐 \(X\) 로 복구)
+
Neural Style Transfer : pre-trained 된 deep features 의 Gram matrix statistics 일치를 기반으로 이미지 content 를 다른 image 의 스타일과 결합하여 새로운 이미지를 합성하는 방법입니다.
Image-to-image translation 은 input image 를 다른 스타일, 속성, 구조 등을 가진 output image 로 변환하는 task 입니다. 예를 들어 사진을 그림으로 변환한다거나, 낮에 찍은 사진을 밤에 찍은 것 처럼 변환하는 것을 말합니다. 흔히 translation 은 input 과 output 로 짝이 지어진 데이터를 바탕으로 학습이 이루어져 있었는데요. 짝이 지어진 사진 데이터를 얻는 것은 어렵고 값이 비싼 일이 됩니다.
이 논문에서는 input image와 output image가 일대일로 짝지어지지 않은 상태에서 하나의 image 모음의 특성을 캡쳐하고, 이러한 특성을 다른 image 모음으로 변환할 수 있는 방법을 제시합니다.
+GAN은 domain \(X\) 에 이미지 한 세트, domain \(Y\) 에 이미지 한 세트가 제공되고, model 의 output 과 \(Y\) 가 discriminator 에 의해 구별할 수 없도록 모델 \(G: X -> Y\) 를 학습합니다. 하지만, 이것이 개별 입력 \(x\) 와 출력 \(y\) 가 무조건 유의미하게 쌍을 이룬다는 것을 뜻하지는 않습니다. \(G\) 가 생성할 수 있는 image 에는 무한한 경우의 수가 있기 때문에 종종 mode collapse 현상이 일어나기도 합니다.
어떤 input image 든 모두 같은 output image 로 매핑하면서 최적화에 실패하는 현상입니다. 이 현상은 generator 입장에서, discriminator 가 이 사진이 진짜 \(Y\)인지 가짜인 \(\hat{Y}\)인지 구별하는 것을 ‘속이기만’ 하면 되기 때문에 우리의 목적과 전혀 상관이 없는 데이터를 generator 가 만들더라도 문제가 생기지 않아서 발생합니다.
이러한 이슈로 인해 추가 objective function 이 필요해졌습니다. 따라서 translation task 는 영어 -> 프랑스어 -> 영어로 번역했을 때 원래 문장에 다시 도달하는 것처럼, \(X --> Y --> X'\) 로 돌아가는 과정에서 \(X\) 와 \(X'\) 이 최대한 같아야 한다는 의미의 cycle consistency 이라는 속성을 이용합니다. 필요한 목적식을 간단하게 정리하면 다음과 같습니다.
이는 GAN 에서 쓰이는 loss function 를 사용하지만, 차이점이 있다면 \(X -> Y\) 로 갈 때와 \(Y -> X\) 로 갈 때 총 두 개의 수식이 나옵니다. 다시 말해, \(F: Y -> X\) 와 \(D_X\) 에 대해서도 \(F\), \(D_X\) 를 넣은 동일한 수식을 사용합니다.
(원래 Discriminator 는 이보다 더 고차원이지만) 간략히 2차원을 표방하면 결정경계를 위와 같이 나타낼 수 있습니다. 윗 쪽이 가짜 영역, 아래 쪽이 진짜 영역입니다 이 때, 아래에 보면 진짜 데이터 샘플과 거리가 먼 가짜 데이터 샘플이 존재합니다. 즉, NLL Loss 를 사용한다면, Generator 의 입장에서는 이미 Discriminator 를 잘 속이고 있기 때문에 학습할 필요가 없게 됩니다. 즉, Vanishing Gradient 현상이 일어나기 때문에, Discriminator 를 잘 속인다는 이유만으로, 안 좋은 샘플을 생성하는 것에 대해 패널티를 줄 수가 없게 됩니다. 이 때, LSGAN 을 사용한다면 실제 데이터 분포와 가짜 데이터 샘플이 거리가 먼 것에 대해서도 패널티를 주게 됩니다.
그리고 모든 실험에 대해서 \(\lambda\) 를 10 으로 설정하고, batch size = 1, 그리고 Adam solver 를 사용했습니다. 첫 100 epoch 동안에는 learning rate 를 0.0002 로 설정했고, 다음 100 epoch 마다 0 으로 조금식 수렴하게 scheduling 하였습니다.
모델 성능 평가를 위해 아래와 같은 세 개의 지표를 기반으로 기존의 CoGAN, SimGAN, pix2pix baseline 모델과 비교했습니다. 그 외 loss function 에 대한 ablation study 도 수행했습니다.
+
+
AMT perceptual studies: 참가자들은 실제 사진이미지 vs 가짜 이미지, 또는 지도 이미지 vs 가짜이미지에 노출된 후 진짜라고 생각되는 이미지를 선택하게 합니다.
+
FCN Score: 1번 study 가 테스트에 있어 매우 좋은 기준임에도 불구하고, 이번에는 사람을 대상으로 한 실험이 아닌 양적인 기준을 사용합니다. 우선적으로 FCN 모델을 통해 생성된 사진에 대한 레이블 맵을 예측합니다. 이 레이블 맵은 아래에서 설명하는 standard semantic segmentation metric 을 사용하여 input ground truth label 과 비교할 수 있습니다. “도로 상의 자동차”라는 label 에서 사진 이미지를 생성하면, 생성된 이미지에 적용된 FCN 이 “도로 상의 자동차”를 감지하면 성공한 것입니다.
+
Semantic segmentation metric: pixel 당 정확도, class 당 정확도, 그리고 IoU(Intersection-Over-Union) 를 포함하는 cityscapes benchmark 의 표준 metric 를 사용합니다.
Table 1 은 AMT perceptual realism task 에 대한 성능을 나타냅니다. CycleGAN 의 지도에서 항공 사진, 그리고 항공 사진에서 지도 translation 결과에서 약 1/4의 참가자를 속일 수 있었던 반면에 그 외 모든 baseline 모델은 참가자를 거의 속일 수 없었습니다.
GAN 과 cycle consistency loss 의 중요성을 보여주는 ablation study 입니다. GAN loss 그리고 cycle consistency loss 를 각각 제거하면 성능이 크게 저하되는 부분을 확인할 수 있습니다. 또한 한쪽 방향에 대해서만 GAN + forward cycle 만 돌렸을 때와 GAN + backward cycle 만 돌렸을 때 학습의 불안정성을 보이고, mode collapse 를 유발하는 것을 확인할 수 있었다고 합니다.
Figure 8 은 CMP Facade Database 의 건축 레이블 <-> 사진, 그리고 UT Zapoos50K dataset 의 edge <-> 신발 을 비롯하여 pix2pix 에 사용된 paired dataset 에 대한 몇 가지 예시 결과를 보여줍니다. CycleGAN 이 생성한 이미지 품질이 fully supervised 된 pix2pix 에 대응하는 성능을 보여주는 것을 확인할 수 있습니다.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ : shallow depth of field: 얕은 초점. 초점이 맞은 대상과 배경이 흐릿하게 보이는 효과. 인물 사진 / 작품 사진에 활용. 구목하고자 하는 대상을 강조하기 위해 활용. -->
+ 따라서 source domain은 스마트폰의 **작은 조리개로 깊은 초점** \--> target은 **조리개가 커서 얕은 초점**.-->
+
+
+
+
+
+
이 방법은 많은 경우에 흥미로운 결과를 얻을 수 있지만, 결과가 균일하게 좋은 것은 아니었습니다.
+
+
개 <-> 고양이 translation task 와 같은 경우는 input image 에서 최소한의 변화만 주어, 사람이 보았을 때 실제로 변화가 안되는 경우도 있었고, 형체가 애매해진 경우도 있었습니다. 이를 보았을 때, geometry 가 반영되는 눈, 코, 입 등의 세부적인 구조에 대한 정확히 구현하는데 한계가 있어 보입니다.
+
말 <–> 얼룩말 translation 예제의 경우, 말은 사람이 타는 모습이 많았는데 얼룩말의 경우는 사람이 타는 사진이 없다보니, 사람 뿐만 아니라 배경도 얼룩 그림을 그리거나 단순히 얼룩말에서 노랗게 칠한 경우가 존재합니다.
+
때때로 photo -> image translation task 에서 나무와 건물의 label 을 바꾸는 경우도 있었습니다.
+이러한 모호성을 해결하려면 weak semantic supervision 이 필요할 수도 있을 것 같습니다.
+
+
그럼에도 불구하고 해당 논문은 완전히 paired 되지 않은 “unsupervised” setting 에서도 image translation task 의 한계를 늘리는데 기여합니다.
Autoregressive Language Model며 few-shot learning을 통해 fine-tuning 없이 높은 성능을 냄 *(fine-tuning 을 할 수는 있지만 본 논문에서는 task-agnostic performance 에 중점을 맞춰 Few shot을 함)
-
GPT-3 는 transformer에서 decoder 부분만 사용 (GPT-2 와 유사한 구조를 가지고 있음 )
Autoregressive Language Model며 few-shot learning을 통해 fine-tuning 없이 높은 성능을 냄 *(fine-tuning 을 할 수는 있지만 본 논문에서는 task-agnostic performance 에 중점을 맞춰 Few shot을 함)
+
GPT-3 는 transformer에서 decoder 부분만 사용 (GPT-2 와 유사한 구조를 가지고 있음 )
\(log_\phi p(y|x_t)\)가 \(\Sigma^-1\) 에 비해 곡률이 낮으며, 이 가정을 따라, diffusion step이 무한으로 갈 시, \(||\Sigma^ || \rightarrow0\) 이므로,\(log_\phi p(y|x_t)\)가 테일러 급수를 활용하여 식을 \(x_t = \mu\) 로 재전개 할 수 있다.
\(log_\phi p(y|x_t)\)가 \(\Sigma^-1\) 에 비해 곡률이 낮으며, 이 가정을 따라, diffusion step이 무한으로 갈 시, \(||\Sigma^ || \rightarrow0\) 이므로,\(log_\phi p(y|x_t)\)가 테일러 급수를 활용하여 식을 \(x_t = \mu\) 로 재전개 할 수 있다.
최근에 DALL-E2, Imagen, Stable Diffusion 등 다양한 text-to-image generation 모델들이 등장하였지만, 어떠한 동일한 subject 에 대해서 다른 context 에 적용하는 부분에서 부족한 면들을 보여주고 있습니다. DreamBooth 논문은 이러한 문제점을 개선하기 위해 text-to-image 모델을 fine-tuning 하는 기법으로 소개되었고, 단 3-5장의 이미지를 학습하면 되며 이를 NVIDIA A100 으로 학습하는데 5분 정도밖에 소요되지 않는다고 합니다.
사전학습된 text-to-image diffusion model \(\hat{x}_{\theta}\) 는 input 으로 원본 이미지 \(x\), 그리고 text prompt \(P\) 와 text-encoder \(\Gamma\) 로부터 나오는 conditioning vector \(c = \Gamma(P)\) 를 입력받아서 이미지 \(x_{gen} = \hat{x}_{\theta}(\epsilon, c)\) 를 생성하게 됩니다. 학습 시, mean squared loss 를 사용하고 이를 수식적으로 표현하면 다음과 같습니다.
-
-\[
-\mathbb{E}_{x,c,\epsilon,t}[w_t || \hat{x}_{\theta}(\alpha_tx + \sigma_{t}\epsilon, c) - x ||_{2}^{2}]
-\]
-
이때, DreamBooth 에서는 text encoder 를 CLIP text embedding 과 사전학습된 T5-XXL 모델 중 T5-XXL 모델을 사용했다고 합니다. 그리고 DreamBooth 로 fine-tuning 할때, diffusion process 에서 사용되는 U-net (때로는 text encoder 도 포함) 은 learnable 한 parameter 로 설정하고 생성된 latent vector 로부터 새로운 이미지를 생성하는 Decoder 의 파라미터 값은 고정시킨다고 합니다.
-
앞써 설명드렸던 내용들을 해당 implementation code 에서 확인할 수 있습니다.
# https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py
-forepochinrange(first_epoch,args.num_train_epochs):
- unet.train()
- ifargs.train_text_encoder:
- text_encoder.train()
- forstep,batchinenumerate(train_dataloader):
- # Skip steps until we reach the resumed step
- ifargs.resume_from_checkpointandepoch==first_epochandstep<resume_step:
- ifstep%args.gradient_accumulation_steps==0:
- progress_bar.update(1)
- continue
-
- withaccelerator.accumulate(unet):
- # Convert images to latent space
- latents=vae.encode(batch["pixel_values"].to(dtype=weight_dtype)).latent_dist.sample()
- latents=latents*vae.config.scaling_factor
-
- # Sample noise that we'll add to the latents
- ifargs.offset_noise:
- noise=torch.randn_like(latents)+0.1*torch.randn(
- latents.shape[0],latents.shape[1],1,1,device=latents.device
- )
- else:
- noise=torch.randn_like(latents)
- bsz=latents.shape[0]
- # Sample a random timestep for each image
- timesteps=torch.randint(0,noise_scheduler.config.num_train_timesteps,(bsz,),device=latents.device)
- timesteps=timesteps.long()
-
- # Add noise to the latents according to the noise magnitude at each timestep
- # (this is the forward diffusion process)
- noisy_latents=noise_scheduler.add_noise(latents,noise,timesteps)
-
- # Get the text embedding for conditioning
- encoder_hidden_states=text_encoder(batch["input_ids"])[0]
-
- # Predict the noise residual
- model_pred=unet(noisy_latents,timesteps,encoder_hidden_states).sample
-
- # Get the target for loss depending on the prediction type
- ifnoise_scheduler.config.prediction_type=="epsilon":
- target=noise
- elifnoise_scheduler.config.prediction_type=="v_prediction":
- target=noise_scheduler.get_velocity(latents,noise,timesteps)
- else:
- raiseValueError(f"Unknown prediction type {noise_scheduler.config.prediction_type}")
-
- ifargs.with_prior_preservation:
- # Chunk the noise and model_pred into two parts and compute the loss on each part separately.
- model_pred,model_pred_prior=torch.chunk(model_pred,2,dim=0)
- target,target_prior=torch.chunk(target,2,dim=0)
-
- # Compute instance loss
- loss=F.mse_loss(model_pred.float(),target.float(),reduction="mean")
-
- # Compute prior loss
- prior_loss=F.mse_loss(model_pred_prior.float(),target_prior.float(),reduction="mean")
-
- # Add the prior loss to the instance loss.
- loss=loss+args.prior_loss_weight*prior_loss
- else:
- loss=F.mse_loss(model_pred.float(),target.float(),reduction="mean")
-
- accelerator.backward(loss)
- ifaccelerator.sync_gradients:
- params_to_clip=(
- itertools.chain(unet.parameters(),text_encoder.parameters())
- ifargs.train_text_encoder
- elseunet.parameters()
- )
- accelerator.clip_grad_norm_(params_to_clip,args.max_grad_norm)
- optimizer.step()
- lr_scheduler.step()
- optimizer.zero_grad(set_to_none=args.set_grads_to_none)
-
DreamBooth 에서 pre-trained 된 text-to-image generation 모델을 fine-tuning 할 때 “a [unique identifier] [class noun]” 그리고 “a [class noun]” 형태의 두 가지 text prompt 를 사용합니다. 이때, unique identifier 에 유지하고자 하는 대상에 대한 정보를 담는 것을 목표로 하기 때문에 사전 정보가 없는 rare token 을 사용하는 것이 중요하다고 합니다. 논문에서는 3개 이하의 Unicode character 혹은 T5-XXL tokenizer 를 랜덤하게 샘플링해서 token 을 생성하고 이를 기반으로 unique identifier 를 정의합니다.
-
또한, 논문에서 Language Drift 그리고 Reduced Output Diversity 두 가지 문제점을 해결하기 위해 Class-specific Prior Preservation Loss 를 소개합니다. 이를 활용하여 모델을 fine-tuning 하는 방법은 다음과 같습니다.
우선, Gaussian 노이즈 이미지와 “A V [class noun]” 형태의 text prompt 를 사전학습된 text-to-image diffusion 모델에 입력하여 이미지를 생성한 후, 원본 이미지와의 Reconstruction Loss 를 계산합니다. 그리고 비슷한 과정으로 Gaussian 노이즈 이미지와 “A [class noun]” 형태의 text prompt 를 학습하고자 하는 모델, 그리고 freeze 시킨 또 다른 pre-trained diffusion 모델에 각각 입력하여 이미지를 생성한 후 Class-Specific Prior Preservation Loss 를 계산합니다. 이에 대한 training objective 를 수식적으로 표현하면 다음과 같습니다.
DreamBooth 논문에서 세 가지의 모델 평가 metric 을 소개합니다. 첫번째로는 subject fidelity 를 측정하는 CLIP-I, DINO 그리고 prompt fidelity 를 측정하는 CLIP-T metric 을 사용합니다. 이때, DINO metric 이 동일한 class 를 가진 subject 에 대해서 다른 embedding 이 생성되기 때문에 CLIP-I 보다 더 선호된다고 합니다. 더 자세하게는 각 metric 은 다음과 같이 계산됩니다.
-
-
CLIP-I := 생성된 이미지와 실제 이미지의 CLIP embedding 의 평균 pairwise cosine similarity
-
DINO := 생성된 이미지와 실제 이미지의 ViT-S/16 DINO embedding 의 평균 pairwise cosine similarity
-
CLIP-T := 입력 prompt 와 생성된 이미지의 CLIP embedding 의 평균 pairwise cosine similarity
-
-
Textual Inversion 과 비교했을때, 세 개의 metric 에서 모두 DreamBooth 가 더 좋은 성능을 보여주는 것을 확인할 수 있습니다.
Prior Preservation Loss (PPL) 과 Class-Prior 에 대한 Ablation Studies 결과도 논문에서 공유합니다. PPL 가 적용됨으로써 앞써 소개드렸던 Language Drift 그리고 Reduced Output Diversity 문제점을 PRES 그리고 DIV metric 을 통해 해결되는 것을 보여줍니다. 또한, Class-Prior Ablation 에서 다음과 같은 세 가지 prompt 를 사용하여 fine-tuning 했을 때, 해당 subject 에 맞는 class noun 을 prompt 에 입력했을때가 가장 좋은 성능을 보여준다고 설명합니다.
-
-
“no class noun”
-
“a randomly sampled incorrect class noun” (e.g., “can” for a backpack)
마지막으로, 논문 본문에 소개되고 있지는 않지만 Appendix 부문에서도 흥미로운 결과들을 확인할 수 있습니다. Figure 20 은 fine tuning 하는 이미지 개수에 따른 DreamBooth 학습결과를 보여주는데, 단 한 장만으로도 identity 의 전반적인 특징을 잘 담는 것을 확인할 수 있습니다. Figure 18 은 만화 캐릭터의 identity 를 유지한 상태로 다양한 만화 사진들을 모델이 생성하는 사례들을 보여줍니다.
최근에 DALL-E2, Imagen, Stable Diffusion 등 다양한 text-to-image generation 모델들이 등장하였지만, 어떠한 동일한 subject 에 대해서 다른 context 에 적용하는 부분에서 부족한 면들을 보여주고 있습니다. DreamBooth 논문은 이러한 문제점을 개선하기 위해 text-to-image 모델을 fine-tuning 하는 기법으로 소개되었고, 단 3-5장의 이미지를 학습하면 되며 이를 NVIDIA A100 으로 학습하는데 5분 정도밖에 소요되지 않는다고 합니다.
사전학습된 text-to-image diffusion model \(\hat{x}_{\theta}\) 는 input 으로 원본 이미지 \(x\), 그리고 text prompt \(P\) 와 text-encoder \(\Gamma\) 로부터 나오는 conditioning vector \(c = \Gamma(P)\) 를 입력받아서 이미지 \(x_{gen} = \hat{x}_{\theta}(\epsilon, c)\) 를 생성하게 됩니다. 학습 시, mean squared loss 를 사용하고 이를 수식적으로 표현하면 다음과 같습니다.
+
+\[
+\mathbb{E}_{x,c,\epsilon,t}[w_t || \hat{x}_{\theta}(\alpha_tx + \sigma_{t}\epsilon, c) - x ||_{2}^{2}]
+\]
+
이때, DreamBooth 에서는 text encoder 를 CLIP text embedding 과 사전학습된 T5-XXL 모델 중 T5-XXL 모델을 사용했다고 합니다. 그리고 DreamBooth 로 fine-tuning 할때, diffusion process 에서 사용되는 U-net (때로는 text encoder 도 포함) 은 learnable 한 parameter 로 설정하고 생성된 latent vector 로부터 새로운 이미지를 생성하는 Decoder 의 파라미터 값은 고정시킨다고 합니다.
+
앞써 설명드렸던 내용들을 해당 implementation code 에서 확인할 수 있습니다.
# https://github.com/huggingface/diffusers/blob/main/examples/dreambooth/train_dreambooth.py
+forepochinrange(first_epoch,args.num_train_epochs):
+ unet.train()
+ ifargs.train_text_encoder:
+ text_encoder.train()
+ forstep,batchinenumerate(train_dataloader):
+ # Skip steps until we reach the resumed step
+ ifargs.resume_from_checkpointandepoch==first_epochandstep<resume_step:
+ ifstep%args.gradient_accumulation_steps==0:
+ progress_bar.update(1)
+ continue
+
+ withaccelerator.accumulate(unet):
+ # Convert images to latent space
+ latents=vae.encode(batch["pixel_values"].to(dtype=weight_dtype)).latent_dist.sample()
+ latents=latents*vae.config.scaling_factor
+
+ # Sample noise that we'll add to the latents
+ ifargs.offset_noise:
+ noise=torch.randn_like(latents)+0.1*torch.randn(
+ latents.shape[0],latents.shape[1],1,1,device=latents.device
+ )
+ else:
+ noise=torch.randn_like(latents)
+ bsz=latents.shape[0]
+ # Sample a random timestep for each image
+ timesteps=torch.randint(0,noise_scheduler.config.num_train_timesteps,(bsz,),device=latents.device)
+ timesteps=timesteps.long()
+
+ # Add noise to the latents according to the noise magnitude at each timestep
+ # (this is the forward diffusion process)
+ noisy_latents=noise_scheduler.add_noise(latents,noise,timesteps)
+
+ # Get the text embedding for conditioning
+ encoder_hidden_states=text_encoder(batch["input_ids"])[0]
+
+ # Predict the noise residual
+ model_pred=unet(noisy_latents,timesteps,encoder_hidden_states).sample
+
+ # Get the target for loss depending on the prediction type
+ ifnoise_scheduler.config.prediction_type=="epsilon":
+ target=noise
+ elifnoise_scheduler.config.prediction_type=="v_prediction":
+ target=noise_scheduler.get_velocity(latents,noise,timesteps)
+ else:
+ raiseValueError(f"Unknown prediction type {noise_scheduler.config.prediction_type}")
+
+ ifargs.with_prior_preservation:
+ # Chunk the noise and model_pred into two parts and compute the loss on each part separately.
+ model_pred,model_pred_prior=torch.chunk(model_pred,2,dim=0)
+ target,target_prior=torch.chunk(target,2,dim=0)
+
+ # Compute instance loss
+ loss=F.mse_loss(model_pred.float(),target.float(),reduction="mean")
+
+ # Compute prior loss
+ prior_loss=F.mse_loss(model_pred_prior.float(),target_prior.float(),reduction="mean")
+
+ # Add the prior loss to the instance loss.
+ loss=loss+args.prior_loss_weight*prior_loss
+ else:
+ loss=F.mse_loss(model_pred.float(),target.float(),reduction="mean")
+
+ accelerator.backward(loss)
+ ifaccelerator.sync_gradients:
+ params_to_clip=(
+ itertools.chain(unet.parameters(),text_encoder.parameters())
+ ifargs.train_text_encoder
+ elseunet.parameters()
+ )
+ accelerator.clip_grad_norm_(params_to_clip,args.max_grad_norm)
+ optimizer.step()
+ lr_scheduler.step()
+ optimizer.zero_grad(set_to_none=args.set_grads_to_none)
+
DreamBooth 에서 pre-trained 된 text-to-image generation 모델을 fine-tuning 할 때 “a [unique identifier] [class noun]” 그리고 “a [class noun]” 형태의 두 가지 text prompt 를 사용합니다. 이때, unique identifier 에 유지하고자 하는 대상에 대한 정보를 담는 것을 목표로 하기 때문에 사전 정보가 없는 rare token 을 사용하는 것이 중요하다고 합니다. 논문에서는 3개 이하의 Unicode character 혹은 T5-XXL tokenizer 를 랜덤하게 샘플링해서 token 을 생성하고 이를 기반으로 unique identifier 를 정의합니다.
+
또한, 논문에서 Language Drift 그리고 Reduced Output Diversity 두 가지 문제점을 해결하기 위해 Class-specific Prior Preservation Loss 를 소개합니다. 이를 활용하여 모델을 fine-tuning 하는 방법은 다음과 같습니다.
우선, Gaussian 노이즈 이미지와 “A V [class noun]” 형태의 text prompt 를 사전학습된 text-to-image diffusion 모델에 입력하여 이미지를 생성한 후, 원본 이미지와의 Reconstruction Loss 를 계산합니다. 그리고 비슷한 과정으로 Gaussian 노이즈 이미지와 “A [class noun]” 형태의 text prompt 를 학습하고자 하는 모델, 그리고 freeze 시킨 또 다른 pre-trained diffusion 모델에 각각 입력하여 이미지를 생성한 후 Class-Specific Prior Preservation Loss 를 계산합니다. 이에 대한 training objective 를 수식적으로 표현하면 다음과 같습니다.
DreamBooth 논문에서 세 가지의 모델 평가 metric 을 소개합니다. 첫번째로는 subject fidelity 를 측정하는 CLIP-I, DINO 그리고 prompt fidelity 를 측정하는 CLIP-T metric 을 사용합니다. 이때, DINO metric 이 동일한 class 를 가진 subject 에 대해서 다른 embedding 이 생성되기 때문에 CLIP-I 보다 더 선호된다고 합니다. 더 자세하게는 각 metric 은 다음과 같이 계산됩니다.
+
+
CLIP-I := 생성된 이미지와 실제 이미지의 CLIP embedding 의 평균 pairwise cosine similarity
+
DINO := 생성된 이미지와 실제 이미지의 ViT-S/16 DINO embedding 의 평균 pairwise cosine similarity
+
CLIP-T := 입력 prompt 와 생성된 이미지의 CLIP embedding 의 평균 pairwise cosine similarity
+
+
Textual Inversion 과 비교했을때, 세 개의 metric 에서 모두 DreamBooth 가 더 좋은 성능을 보여주는 것을 확인할 수 있습니다.
Prior Preservation Loss (PPL) 과 Class-Prior 에 대한 Ablation Studies 결과도 논문에서 공유합니다. PPL 가 적용됨으로써 앞써 소개드렸던 Language Drift 그리고 Reduced Output Diversity 문제점을 PRES 그리고 DIV metric 을 통해 해결되는 것을 보여줍니다. 또한, Class-Prior Ablation 에서 다음과 같은 세 가지 prompt 를 사용하여 fine-tuning 했을 때, 해당 subject 에 맞는 class noun 을 prompt 에 입력했을때가 가장 좋은 성능을 보여준다고 설명합니다.
+
+
“no class noun”
+
“a randomly sampled incorrect class noun” (e.g., “can” for a backpack)
마지막으로, 논문 본문에 소개되고 있지는 않지만 Appendix 부문에서도 흥미로운 결과들을 확인할 수 있습니다. Figure 20 은 fine tuning 하는 이미지 개수에 따른 DreamBooth 학습결과를 보여주는데, 단 한 장만으로도 identity 의 전반적인 특징을 잘 담는 것을 확인할 수 있습니다. Figure 18 은 만화 캐릭터의 identity 를 유지한 상태로 다양한 만화 사진들을 모델이 생성하는 사례들을 보여줍니다.
생성형 모델은 크게 생성하고자 하는 데이터의 explicit density 와 implicit density 를 계산하는 방식으로 나뉩니다. Explicit density 를 계산한다는 것은 데이터 분포를 명확하게 사전에 정의하고 모델을 학습하는 것을 의미합니다. 이때, 데이터의 분포를 직접적인 계산이 가능한 tractable density 로 추정하는 방법과 근사화시켜 approximate density 로 추정하는 방법으로 나뉩니다.
-
-
Tractable density: AutoRegressive 하게 구하는 방식이 있습니다. AutoRegressive 모델을 사용하여 이전 단계의 데이터를 활용하여 모델을 학습하고, 대표적인 모델로는 PixelCNN, PixelRNN 등이 있습니다.
-
Approximate density: 대표적으로 score-based model, Boltzmann Machine 등이 있습니다.
-
-
Score-based model - 모델 파라미터의 gradient 가 아닌 데이터의 gradient 활용하여 모델을 학습하는 방식으로, energy-based model 에서 MLE 에 사용하는 확률분포를 정규화하는 term 을 따로 계산하지 않아도 되는 장점이 있습니다.
-
Boltzmann Machine : 완전그래프 구조로 학습하는 생성형 모델입니다. 모델을 학습하는 과정에서 확률 분포의 학습이 어려워(계산량이 많아서 어려움) Markov chain 을 활용하여 학습합니다. 또한, 완전그래프이기 때문에 노드가 늘어날수록 간선, 파라미터 등이 급증하는 문제가 있어 Restricted Boltzmann Machine(RBM) 이 제안되기도 했습니다.
-
-
-
-
반면에 데이터의 분포를 명확히 정의하지 않고 implicit 하게 모델을 학습하는 방식도 존재합니다. 대표적으로는 Ian Goodfellow 가 2014년에 발표한 GAN 모델이 있습니다. GAN 은 최근에 Diffusion Model 이 소개되기 전까지 몇 년 동안 이미지 생성 분야에서 대표적인 모델로 자리잡았었습니다. GAN 은 VAE 와 달리 marginal likelihood \(p_{\theta}(x)\) 를 직접 구하지 않고, Adversarial Process 를 통해 implicit 하게 샘플링을 해서 분포를 구하게 됩니다.
아래 그림과 같이 GAN 은 크게 잠재변수 \(z\) 로부터 가짜 데이터를 생성하는 Generator 와 그로부터 생성된 데이터와 실제 training 데이터를 구분하는 Discriminator 로 구성이 되어 있습니다. 다시 말해서 Discriminator 는 실제 데이터가 들어오면 1, 그리고 가짜로 생성된 데이터가 들어오면 0 을 출력하는 binary classification task 를 진행합니다.
이렇게 Discriminator 와 Generator 는 각각 \(V(D,G)\) 가 최대화하고 최소화하는 방향으로 stochastic gradient descent 를 진행하게 됩니다. 하지만 아래 그림처럼 실제로 Generator를 학습할 때, 초반에 \(D(G(z)) \approx 0\) 일 경우 학습하지 못하는 상황이 발생합니다. 이 때, \(\log(1-D(G(z))\) 를 최소화하지 않고 \(\log(D(G(z))\) 를 최대화하는 방향으로 Generator 를 학습하는 기법도 있습니다.
-
-
-
-
Fig. 11 Alternative to Vanishing Gradient when Training the Generator#
-
-
-
이렇게 학습함으로써 최적화된 solution 에서는 Generator 가 training 데이터 분포를 완벽히 복원하고 Discriminator 는 binary classification 확률을 언제나 1/2 로 내뱉게 됩니다.
논문에서 MNIST, the Toronto Face Database(TFD), 그리고 CIFAR-10 dataset 로 모델 실험 및 성능 평가했습니다. 평가시에는 \(p_g\) 로부터 Parzen density estimation을 거쳐 계산한 log likelihood estimate 로 모델 성능 평가를 진행했습니다. 아래 표를 보면 실험 방법 중 GAN이 제일 결과가 좋은 것을 볼 수 있습니다.
VAE는 새로운 데이터를 잘 생성하지만 생성된 이미지가 흐릿하다는 단점을 지니고 있습니다. 반면에 GAN 은 high quality image 를 잘 생성하지만 unstable 한 convergence 를 가지고 있습니다. 그래서 실제로 VAE 는 Encoder 를 활용한 차원축소로 많이 활용되고 이미지 데이터를 생성하는데는 GAN 이 많이 활용되었다고 합니다.
생성형 모델은 크게 생성하고자 하는 데이터의 explicit density 와 implicit density 를 계산하는 방식으로 나뉩니다. Explicit density 를 계산한다는 것은 데이터 분포를 명확하게 사전에 정의하고 모델을 학습하는 것을 의미합니다. 이때, 데이터의 분포를 직접적인 계산이 가능한 tractable density 로 추정하는 방법과 근사화시켜 approximate density 로 추정하는 방법으로 나뉩니다.
+
+
Tractable density: AutoRegressive 하게 구하는 방식이 있습니다. AutoRegressive 모델을 사용하여 이전 단계의 데이터를 활용하여 모델을 학습하고, 대표적인 모델로는 PixelCNN, PixelRNN 등이 있습니다.
+
Approximate density: 대표적으로 score-based model, Boltzmann Machine 등이 있습니다.
+
+
Score-based model - 모델 파라미터의 gradient 가 아닌 데이터의 gradient 활용하여 모델을 학습하는 방식으로, energy-based model 에서 MLE 에 사용하는 확률분포를 정규화하는 term 을 따로 계산하지 않아도 되는 장점이 있습니다.
+
Boltzmann Machine : 완전그래프 구조로 학습하는 생성형 모델입니다. 모델을 학습하는 과정에서 확률 분포의 학습이 어려워(계산량이 많아서 어려움) Markov chain 을 활용하여 학습합니다. 또한, 완전그래프이기 때문에 노드가 늘어날수록 간선, 파라미터 등이 급증하는 문제가 있어 Restricted Boltzmann Machine(RBM) 이 제안되기도 했습니다.
+
+
+
+
반면에 데이터의 분포를 명확히 정의하지 않고 implicit 하게 모델을 학습하는 방식도 존재합니다. 대표적으로는 Ian Goodfellow 가 2014년에 발표한 GAN 모델이 있습니다. GAN 은 최근에 Diffusion Model 이 소개되기 전까지 몇 년 동안 이미지 생성 분야에서 대표적인 모델로 자리잡았었습니다. GAN 은 VAE 와 달리 marginal likelihood \(p_{\theta}(x)\) 를 직접 구하지 않고, Adversarial Process 를 통해 implicit 하게 샘플링을 해서 분포를 구하게 됩니다.
아래 그림과 같이 GAN 은 크게 잠재변수 \(z\) 로부터 가짜 데이터를 생성하는 Generator 와 그로부터 생성된 데이터와 실제 training 데이터를 구분하는 Discriminator 로 구성이 되어 있습니다. 다시 말해서 Discriminator 는 실제 데이터가 들어오면 1, 그리고 가짜로 생성된 데이터가 들어오면 0 을 출력하는 binary classification task 를 진행합니다.
이렇게 Discriminator 와 Generator 는 각각 \(V(D,G)\) 가 최대화하고 최소화하는 방향으로 stochastic gradient descent 를 진행하게 됩니다. 하지만 아래 그림처럼 실제로 Generator를 학습할 때, 초반에 \(D(G(z)) \approx 0\) 일 경우 학습하지 못하는 상황이 발생합니다. 이 때, \(\log(1-D(G(z))\) 를 최소화하지 않고 \(\log(D(G(z))\) 를 최대화하는 방향으로 Generator 를 학습하는 기법도 있습니다.
+
+
+
+
Fig. 11 Alternative to Vanishing Gradient when Training the Generator#
+
+
+
이렇게 학습함으로써 최적화된 solution 에서는 Generator 가 training 데이터 분포를 완벽히 복원하고 Discriminator 는 binary classification 확률을 언제나 1/2 로 내뱉게 됩니다.
논문에서 MNIST, the Toronto Face Database(TFD), 그리고 CIFAR-10 dataset 로 모델 실험 및 성능 평가했습니다. 평가시에는 \(p_g\) 로부터 Parzen density estimation을 거쳐 계산한 log likelihood estimate 로 모델 성능 평가를 진행했습니다. 아래 표를 보면 실험 방법 중 GAN이 제일 결과가 좋은 것을 볼 수 있습니다.
VAE는 새로운 데이터를 잘 생성하지만 생성된 이미지가 흐릿하다는 단점을 지니고 있습니다. 반면에 GAN 은 high quality image 를 잘 생성하지만 unstable 한 convergence 를 가지고 있습니다. 그래서 실제로 VAE 는 Encoder 를 활용한 차원축소로 많이 활용되고 이미지 데이터를 생성하는데는 GAN 이 많이 활용되었다고 합니다.
Pretrained Frozen text encoder (T5-XXL) 이 text-to-image generation task 에 매우 좋은 성능을 보여줌.
-
Pretrained Text Encoder 사이즈를 fine-tuning하는 것이 diffusion model size fine tuning 하는 것보다 더 중요하다는 것을 실험적으로 증명함
-
Dynamic Thresholding 이라는 새로운 diffusion sampling technique (thresholding diffusion sampler) 을 제시하여 high guidance weight을 leverage 할 수 있게 만들어 더욱 “현실적인” 이미지 생성을 할 수 있음
-
Efficient U-Net이라는 기존 Palette 나 DDIM에서 사용하는 U-Net 구조보다 computational, memory efficient 한 U-Net 구조를 제시함
-
COCO FID 점수 7.27 SOTA 점수를 달성함
-
DrawBench라는 새로운 text-to-image generation evaluation용 benchmark dataset을 제시함
Imagen 저자들이 제시한 새로운 벤치마크 데이터셋. 본 데이터셋은 text prompt 와 category label 로 이루어졌다
-
깃허브에서 다운 받을 수 있으며, 예시는 아래 그림과 갗다
-11 categories, 200 text prompts
-Human evaluation 으로 진행 (25명의 평가자)
-Model A에서 생성한 이미지 set vs Model B에서 생성한 이미지 set
-
-
평가자는 2가지 질문을 주며 2가지 기준점으로 평가함
-Q1. Which set of images is of higher quality?
-Q2. Which set of images better represents the text caption: {text caption}?
Frozen large pretrained language model shows better performance over text-image paired multimodal encoders such as CLIP in text-to-image generation task
-
Efficient U-Net significantly improves performance time
-
Dynamic thresholding allows usage of much higher guidance weights with better fidelity of generated images
Pretrained Frozen text encoder (T5-XXL) 이 text-to-image generation task 에 매우 좋은 성능을 보여줌.
+
Pretrained Text Encoder 사이즈를 fine-tuning하는 것이 diffusion model size fine tuning 하는 것보다 더 중요하다는 것을 실험적으로 증명함
+
Dynamic Thresholding 이라는 새로운 diffusion sampling technique (thresholding diffusion sampler) 을 제시하여 high guidance weight을 leverage 할 수 있게 만들어 더욱 “현실적인” 이미지 생성을 할 수 있음
+
Efficient U-Net이라는 기존 Palette 나 DDIM에서 사용하는 U-Net 구조보다 computational, memory efficient 한 U-Net 구조를 제시함
+
COCO FID 점수 7.27 SOTA 점수를 달성함
+
DrawBench라는 새로운 text-to-image generation evaluation용 benchmark dataset을 제시함
Imagen 저자들이 제시한 새로운 벤치마크 데이터셋. 본 데이터셋은 text prompt 와 category label 로 이루어졌다
+
깃허브에서 다운 받을 수 있으며, 예시는 아래 그림과 갗다
+11 categories, 200 text prompts
+Human evaluation 으로 진행 (25명의 평가자)
+Model A에서 생성한 이미지 set vs Model B에서 생성한 이미지 set
+
+
평가자는 2가지 질문을 주며 2가지 기준점으로 평가함
+Q1. Which set of images is of higher quality?
+Q2. Which set of images better represents the text caption: {text caption}?
Frozen large pretrained language model shows better performance over text-image paired multimodal encoders such as CLIP in text-to-image generation task
+
Efficient U-Net significantly improves performance time
+
Dynamic thresholding allows usage of much higher guidance weights with better fidelity of generated images
이번 시간에는 Google Research 에서 소개하는 Imagen 모델 기반의 text-guided image inpainting 모델 Imagen Editor 와 text-guided impainting 의 평가기법 EditBench 에 대해 알아볼 예정입니다.
-
Text-guided image inpainting 에서 기존에는 mask 영역을 random 하게 지정하여 학습을 진행했습니다. 이는 입력된 text prompt 와 무관한 영역을 masking 하게 됨으로써 모델이 prompt 를 참조하지 않고 오로지 image content 만으로 학습하게 되는 현상이 발생합니다. Imagen Editor 는 이를 해결하기 위해 Object Masking 기법을 소개합니다. Prompt 에 해당하는 객체 전체를 masking 함으로써 모델이 text prompt 를 더 참조할 수 있도록 유도하는 것이 목표입니다. SSD MobileNet v2 모델을 Object Detector 로 사용함으로써 모델 성능이 크게 개선되는 부분을 확인할 수 있었다고 합니다.
Imagen Editor 에서 또 다른 특징은 Imagen 모델 기반의 cascaded diffusion model architecture 를 지니고 있다는 점입니다. 이때, SR3, Palette, GLIDE 와 유사하게 이미지와 mask 가 Encoder 를 거친 후, diffusion latent 와 concatenate 하면서 conditioning input 으로 들어가게 되며, 모두 1024x1024 해상도를 가진다고 합니다. 따라서, base diffusion 64x64 모델 그리고 64x64 → 256x256 super resolution 모델에 입력 시, downsampling 작업 후 모델 input 으로 입력합니다. 또한, conditioning 이미지와 mask 없을 시 Imagen 모델을 사용하는 것과 동일한 효과를 내기 위해, 새로 추가되는 input channel weights 는 0으로 초기화해서 학습을 진행했다고 소개합니다.
Imagen 에서 소개되었던 Classifier-Free Guidance 를 동일하게 사용하고, 이때 guidance weight 를 1부터 30 까지 범위 내에서 변화시키는 oscillating guidance 기법을 적용함으로써 생성된 이미지 퀄리티 및 text-image alignment 가 상승되는 효과를 볼 수 있었다고 합니다.
-
논문에서는 Imagen Editor 와 같은 text-guided image inpainting 모델들을 평가할 수 있는 새로운 benchmark EditBench 를 제시합니다. 240개의 (image, mask) 쌍으로 데이터셋이 구축되어있고, 각 쌍마다 3가지의 prompt 로 생성된 이미지로 사람이 모델 성능을 측정하게 됩니다. Automatic Evaluation Metric 으로는 CLIPScore, 그리고 CLIP-R-Prec 를 사용했습니다.
-
EditBench 이미지 데이터셋의 절반은 open source 로 공개된 computer vision 데이터셋으로부터 수집되었고, 나머지 절반은 text-to-image 모델로 생성해서 구축했습니다. 이때, attribute-object-scene 의 요소들을 모두 갖추도록 이미지들을 수집 및 생성했습니다.
-
-
Attributes (material, color, shape, size, count)
-
Objects (common, rare, text rendering)
-
Scenes (indoor, outdoor, realistic, paintings)
-
-
예를 들어서, ‘a=metal|o=cat|s=outdoor’ 요소들을 포함하는 문구를 ‘a metal cat standing in the middle of a farm field’ 처럼 생성하는 것입니다. 앞써 언급한 3가지 prompt 는 해당사진처럼 Mask-Simple, Mask-Rich, 그리고 Full 로 정의합니다.
데이터셋 구축시, mask 크기도 다양하게 설정하여 mask 크기에 따른 모델 성능도 확인할 수 있었습니다. 성능을 측정해본 결과, Object masking 으로 학습한 모델이 random masking 으로 학습한 모델보다 small/medium masks 에서 성능적으로 월등히 좋다는 것을 확인할 수 있습니다.
이번 시간에는 Google Research 에서 소개하는 Imagen 모델 기반의 text-guided image inpainting 모델 Imagen Editor 와 text-guided impainting 의 평가기법 EditBench 에 대해 알아볼 예정입니다.
+
Text-guided image inpainting 에서 기존에는 mask 영역을 random 하게 지정하여 학습을 진행했습니다. 이는 입력된 text prompt 와 무관한 영역을 masking 하게 됨으로써 모델이 prompt 를 참조하지 않고 오로지 image content 만으로 학습하게 되는 현상이 발생합니다. Imagen Editor 는 이를 해결하기 위해 Object Masking 기법을 소개합니다. Prompt 에 해당하는 객체 전체를 masking 함으로써 모델이 text prompt 를 더 참조할 수 있도록 유도하는 것이 목표입니다. SSD MobileNet v2 모델을 Object Detector 로 사용함으로써 모델 성능이 크게 개선되는 부분을 확인할 수 있었다고 합니다.
Imagen Editor 에서 또 다른 특징은 Imagen 모델 기반의 cascaded diffusion model architecture 를 지니고 있다는 점입니다. 이때, SR3, Palette, GLIDE 와 유사하게 이미지와 mask 가 Encoder 를 거친 후, diffusion latent 와 concatenate 하면서 conditioning input 으로 들어가게 되며, 모두 1024x1024 해상도를 가진다고 합니다. 따라서, base diffusion 64x64 모델 그리고 64x64 → 256x256 super resolution 모델에 입력 시, downsampling 작업 후 모델 input 으로 입력합니다. 또한, conditioning 이미지와 mask 없을 시 Imagen 모델을 사용하는 것과 동일한 효과를 내기 위해, 새로 추가되는 input channel weights 는 0으로 초기화해서 학습을 진행했다고 소개합니다.
Imagen 에서 소개되었던 Classifier-Free Guidance 를 동일하게 사용하고, 이때 guidance weight 를 1부터 30 까지 범위 내에서 변화시키는 oscillating guidance 기법을 적용함으로써 생성된 이미지 퀄리티 및 text-image alignment 가 상승되는 효과를 볼 수 있었다고 합니다.
+
논문에서는 Imagen Editor 와 같은 text-guided image inpainting 모델들을 평가할 수 있는 새로운 benchmark EditBench 를 제시합니다. 240개의 (image, mask) 쌍으로 데이터셋이 구축되어있고, 각 쌍마다 3가지의 prompt 로 생성된 이미지로 사람이 모델 성능을 측정하게 됩니다. Automatic Evaluation Metric 으로는 CLIPScore, 그리고 CLIP-R-Prec 를 사용했습니다.
+
EditBench 이미지 데이터셋의 절반은 open source 로 공개된 computer vision 데이터셋으로부터 수집되었고, 나머지 절반은 text-to-image 모델로 생성해서 구축했습니다. 이때, attribute-object-scene 의 요소들을 모두 갖추도록 이미지들을 수집 및 생성했습니다.
+
+
Attributes (material, color, shape, size, count)
+
Objects (common, rare, text rendering)
+
Scenes (indoor, outdoor, realistic, paintings)
+
+
예를 들어서, ‘a=metal|o=cat|s=outdoor’ 요소들을 포함하는 문구를 ‘a metal cat standing in the middle of a farm field’ 처럼 생성하는 것입니다. 앞써 언급한 3가지 prompt 는 해당사진처럼 Mask-Simple, Mask-Rich, 그리고 Full 로 정의합니다.
데이터셋 구축시, mask 크기도 다양하게 설정하여 mask 크기에 따른 모델 성능도 확인할 수 있었습니다. 성능을 측정해본 결과, Object masking 으로 학습한 모델이 random masking 으로 학습한 모델보다 small/medium masks 에서 성능적으로 월등히 좋다는 것을 확인할 수 있습니다.
이중 특히 Consistency Models은 ODE-trajectory에 대한 일관성을 갖도록 하는 모델로서, single step만으로도 이미지를 생성할 수 있기 때문에 반복적인 계산이 필요하지 않다. 그러나 이 모델 또한 2가지의 단점을 가지고 있다:
-
-
-
Pixel space의 Flow-based Model이기 때문에 high-resolution 이미지 생성에 적합하지 않음.
-
Conditional(Classifer-free Guidance)한 이미지 생성을 고려하지 않아 text2img에 적합하지 않음.
-
-
-
본 논문의 제안점은 다음 3가지다:
-
-
-
빠르고 high-resolution 이미지를 생성하기 위한 Latent Consistency Models(LCMs)를 제안한다. LCMs은 영상의 latent space에 Consistency Models 개념을 적용해 매우 적은 step 만으로도 고품질의 이미지를 생성할 수 있다.
-
guided consistency distillation을 통해 Stable Diffusion을 매우 적은 step(1~4)으로 sampling 할 수 있는 방법을 제공한다. Skipping-Step이라는 테크닉을 통해 학습을 가속화 한다. 2, 4 step Model의 경우 학습에 A100 GPU 32시간 밖에 걸리지 않으며 LAION-5B-Aesthetics dataset에서 SOTA의 성능을 달성했다.
-
LCMs에 대한 새로운 fine-tuning 방식인 Latent Consistency Fine-tuning을 통해 빠른 추론 속도를 유지하면서도 Custom Dataset에 효율적으로 적용할 수 있다.
Consistenct Model(CM)은 몇 step 혹은 한번의 step 만으로 데이터를 생성할 수 있는 모델이다. CM의 핵심은 PF-ODE의 궤적에 어떤 point와 PF-ODE의 solution에 대해 mapping되는 function (\(f:(x_t, t) \mapsto x_\epsilon\))을 추정하는 것이다.
\(c_{skip}(t)\)와 \(c_{out}(t)\)는 미분 가능한 함수이며 \(c_{skip}=1, c_{out}=0\)이기 때문에 \(f_\theta(x, \epsilon)=x\)를 만족한다. \(\theta\)는 학습 가능한 파라미터로 \(F_\theta\)는 심층 신경망을 의미한다.
-
-
CM은 pre-trained 모델에 대한 Distillation 방식과 scratch부터 학습하는 방식이 있는데 주로 Distillation 방식을 사용한다. Distillation 방식은 parameter \(\theta^-\)가 \(\theta\)를 통해 학습하며 모델에 대한 self-consistency를 위해 다음과 같이 손실함수를 구성한다:
이 때 \(\theta^-\)는 \(\theta\)에 대한 지수평균이동(Exponential Moving Average, EMA)이며 \(\theta^- \leftarrow \mu\theta^-+(1-\mu)\theta\)이다. \(d(\cdot, \cdot)\)은 두 sample 사이의 거리를 측정하는 지표이다. \(\hat{x}^{\phi}_{t_n}\)은 \(x_{t_{n+1}}\)에 대한 \(x_{t_n}\)을 추정한 값으로 다음과 같다:
\(\Phi\)는 PF-ODE에 사용되는 ODE Solver로 Euler나 Heun Method등의 수치적인 ODE solver를 사용할 수 있다. 즉 Consistency Distillation은 ODE Solver로 예측한 \(\hat{x}^{\phi}_{t_n}\)과 \(x_{t_{n+1}}\)을 입력으로 \(f_{\theta^-}\)와 \(f_\theta\)로 예측한 값의 Consistency를 비교하는 방식으로 Distillation을 수행한다.
본 논문에서는 pre-trained 된 Stable Diffusion에 Consistency Distillation을 적용한 Latent Consistency Distillation (LCD)을 제안한다. LCMs는 LDM(SD)을 기반으로 설계되었기 때문에 \(z=\varepsilon(x)\)를 통해 \(x\)를 latent vector로 임베딩하고 \(\hat{x}=\mathcal{D}(z)\)를 통해 원본 영상으로 복원한다. latent space 상에서 연산이 이뤄지기 때문에 Computation Cost를 크게 줄일 수 있어 high-resolution 영상을 laptop GPU에서 생성할 수도 있다.
-
condition을 추가한 PF-ODE의 reverse process는 다음과 같이 정의된다:
\(z_t\)는 t step의 image latents, \(\epsilon_\theta(z_t,c,t)\)는 noise 예측 모델, c는 text와 같은 conditional prompt를 의미한다. PF-ODE상에서 모든 t step에 대해 consistency function \(f_\theta :(z_t,c,t) \mapsto z_0\)이기 때문에 이를 수식으로 정리하자면 다음과 같이 나타낼 수 있다 (\(\hat{\epsilon}_\theta\)는 noise prediction model.):
수식을 살펴보면 ddpm 등의 reparameterization trick인 \(x_t := \sqrt{\bar{\alpha}_t}x_0 + \sqrt{1-\bar{\alpha}_t}\epsilon\)을 변형하여 식에 대입한 것을 알 수 있음. (\(x\)→\(z\)로 치환)
CM과 마찬가지로 \(c_{skip}(0)=1, c_{out}(0)=0\)이고 \(\hat{\epsilon}_{\theta}(z,c,t)\)는 teacher diffusion model과 유사한 noise 예측 모델 parameter이다. \(f_\theta\)는 \(\epsilon-Prediction\) 외에도 \(x-Prediction\)이나 \(v-Prediction\)을 사용할 수도 있다. (\(x-Prediction\)은 DDPM, \(v-prediction\)은 PD에서 나온 개념)
\(\psi(z_t,t,x,c)\)는 ODE solver이며 특정한 time step \(t \sim s\) 사이에 대한 Eq. 8의 우항을 근사한 값이다. ODE Solver이기 때문에 DDIM, DPM-Solver, DPM-Solver++ 등을 사용할 수 있다. 또한 \(\psi\)는 학습 및 Distillation시에만 사용한다. 이때 \(t_n\)은 EDM을 토대로 CM에서 나오는 값이다. 기존 timestep \([t, T]\)에 대한 하위 간격으로 \(t_1=\epsilon<t_2<\cdots<t_N=T\)인 어떠한간격을 의미한다. \(t_i\)는 다음과 같이 나타낼 수 있다:
3.2 One-Stage Guided Distillation by solving augmented PF-ODE#
-
Clasifier-free Guidance(CFG)는 high-quality의 conditional 이미지 생성을 가능하게 했다. 다만 CFG는 2개의 Diffusion Model을 훈련해야하기 때문에 효율적이지 못하며, LCMs와 같은 few-step sampling method에 사용하기 힘들다. 따라서 이를 해결하기 위해 본 논문에서는 CFG를 Distillation 과정에서 통합하였다.
-
Guided-Distill의 경우 two-stage Distillation을 통해 few-step sampling에 CFG를 통합하였으나 학습시간이 길고 2단계를 거치며 손실이 누적되기 때문에 최적의 성능을 내기 힘들다.
CFG는 conditional noise 예측값과 unconditional noise 예측값을 선형 결합하여 사용한다. 즉 noise 값이 \(\omega\)에 따라 변형되므로 augmented PF-ODE라고 한다. augmented PF-ODE는 다음과 같이 나타낼 수 있다:
\(\omega\)와 \(n\)는 각각 \([\omega_{min}, \omega_{max}]\), \(\{1,…,N-1\}\)에서 sampling된다. \(\hat{z}^{\psi, \omega}_{t_n}\)는 이전과 마찬가지로 CFG가 추가된 ODE-Solver를 사용하여 근사한 값을 의미한다. 이때 사용되는 새로운 noise 예측모델 \(\tilde{\epsilon}_\theta(z_t,\omega,c,t)\)는 Eq. 11처럼 \(t_{n+1} \sim t_n\)까지 t에 대해 적분 했을 때 다음과 같이 나타낼 수 있다:
마찬가지로 PF-ODE Solver \(\psi(\cdot,\cdot,\cdot,\cdot)\)에는 DDIM, DPM-Solver, DPM-Solver++ 등을 사용할 수 있다.
-
-
-
3.3 Accelerating Distillation with Skipping Time Steps#
-
Stable Diffusion 등 보통의 Diffusion Model들은 매우 큰 step을 전체 time step으로 잡고 학습한다. 그러나 이같이 촘촘한 time step은 각 \(t_n\)과 \(t_{n+1}\)의 변화량을 감소시키기 때문에 자연스럽게 Consistency Distillation Loss도 작아지게 된다. Loss가 작아지면 학습의 수렴속도도 느려지게 된다. 따라서 LCMs는 학습 수렴의 속도를 높이기 위해 time step을 수천에서 수십으로 크기 단축시키는 SKIPPING-STEP 방법을 제안하였다.
-
기존 CMs 모델의 경우 time scheduler로 EDM을 사용하고 ODE-Solver로 Euler 방법이나 Heun 방법을 사용한다. 그러나 LCMs는 Eq. 8을 통해 DDIM, DPM-Solver, DPM-Solver++와 같은 효율적인 solver도 효과적으로 데이터를 생성할 수 있다는 것을 증명했다. 따라서 SKIPPING-STEP 방법은 \(t_{n+1} → t_n\) 사이의 Consistency를 비교하는것이 아니라 특정 k-step만큼 거리가 있는 time step에 대한 Consistency를 비교한다. (\(t_{n+k}→t_n\))
-
이때 \(k\)값의 크기는 trade-off 관계를 가진다. 너무작으면 (\(k=1\)) 기존과 같이 느린 수렴속도를 갖게되며, 너무 큰 값일 때는 ODE solver 를 통해 근사할 때 오차가 매우 커질수 있다. 논문의 저자는 \(k=20\)을 사용해 time step을 수천에서 수십으로 대폭 줄여 학습을 Accelerating 할 수 있었다. Eq. 14에 k값을 추가해 SKIPPING-STEP을 표현할 수 있다.
3.4 Latent Consistency Fine-tuning for customized dataset#
-
Stable Diffusion과 같은 Foundation 생성 모델은 거의 대부분의 text-to-image Generation task에서 잘 되지만 가끔 downstream task를 위해 Cunstom dataset에 대한 fine-tuning이 필요할 때가 있다. Latent Consistency Fine-tuning(LCF)는 Custom Dataset도 teacher model에 대한 종속없이 few-step inference를 성공적으로 할수 있도록 한다. 따라서 LCM은 기존의 Diffusion model에 대한 추가적인 fine tuning 방법론 없이도 Custom Dataset을 바로바로 학습하여 사용할수 있다.
-
따로 추가적인 fine-tuning 방법이 있는것은 아니고 Consisteny Distillation 시 pre-trained 된 LDM을 사용하여 EMA를 통해 Distillation을 하기 때문에 Dataset을 Custom Dataset으로 사용하기만하면 된다. 즉 pre-trained Diffuson model → Custom Dataset fine-tuning → few step inference를 위한 Consistency Distillation을 할 필요 없이 바로학습이 가능하다는 의미이다.
3가지 데이터셋에 대한 평가를 진행했다. (LAION-5B, LAION-Aesthetics-6+(12M), LAION-Aesthetics-6.5+(650k)) 앞서말한것처럼 하나의 Resolution이 아닌 512x512, 768x768의 high resolution을 생성했다. 512 size는 \(\epsilon\)-prediction, 768 size는 \(v\)-prediction을 사용했고 ODE-Solver로는 DDIM을 사용했다. 앞서말한것처럼 SKIPPING-STEP은 20의 값을 가진다.
-
-
-
-
Fig. 509 Quantitative results at 512 x 512 & 768 x 768 resolution.#
-
-
-
-
-
-
Fig. 510 Qualitative results on LAION-Aesthetic-6.5+ Dataset. (2,4 steps)#
-
-
-
DDIM, DPM-Solver, DPM-Solver++, Guided-Distill 4가지 모델에 대해 LCM과 성능비교를 했는데 이때 Guided-Distill은 오픈소스 코드가 없기 때문에 논문의 내용과 동일하게 Implementation 해서 성능을 비교하였다. LCM은 같은 메모리 Cost 대비 더 빠르게 수렴하고 더 좋은 품질의 영상을 생성하였다. 특히 Guided-Distill은 2 stage Distillation이지만 LCM은 1 Stage만 사용해도 이같은 성능을 보여줬다.
augmented PF-ODE를 푸는 solver들(DDIM, DPM, DPM++)을 LCM에 사용할 때 성능 비교와 SKIPPING-STEP schedule의 \(k\)값에 따른 성능 변화를 비교하였다. 모든 모델은 2,000 iteration에서의 4-step inference로 고정해서 비교했다.
-
-
-
-
Fig. 511 Different ODE solvers and skipping step k.#
-
-
-
Skipping step의 경우 \(k\) 값을 올렸을 때 훨씬더 빠르게 수렴하며 때때로 더 좋은 FID 값을 보여주었다. 또한 DPM과 DPM++은 \(k\)가 50일 때 DDIM보다 더 좋은 성능을 보였다. 이는 \(k\) 값이 클수록 더 큰 ODE approximation error를 가지는 DDIM에 비해 오차가 적기 때문이다.
LCM은 Consistency Distillation을 Latent 상에 적용하여 고화질의 영상을 매우 적은 time step으로 inference 할 수 있도록 한 모델이다. 즉 성능 좋고 고해상도의 영상을 few-step으로 가능하게 만들었다. 특히 Custom Dataset에도 Distillation을 적용했을 때 적은 time step으로도 어느정도의 style을 간단하게 학습하는 결과를 보여주었다.
이중 특히 Consistency Models은 ODE-trajectory에 대한 일관성을 갖도록 하는 모델로서, single step만으로도 이미지를 생성할 수 있기 때문에 반복적인 계산이 필요하지 않다. 그러나 이 모델 또한 2가지의 단점을 가지고 있다:
+
+
+
Pixel space의 Flow-based Model이기 때문에 high-resolution 이미지 생성에 적합하지 않음.
+
Conditional(Classifer-free Guidance)한 이미지 생성을 고려하지 않아 text2img에 적합하지 않음.
+
+
+
본 논문의 제안점은 다음 3가지다:
+
+
+
빠르고 high-resolution 이미지를 생성하기 위한 Latent Consistency Models(LCMs)를 제안한다. LCMs은 영상의 latent space에 Consistency Models 개념을 적용해 매우 적은 step 만으로도 고품질의 이미지를 생성할 수 있다.
+
guided consistency distillation을 통해 Stable Diffusion을 매우 적은 step(1~4)으로 sampling 할 수 있는 방법을 제공한다. Skipping-Step이라는 테크닉을 통해 학습을 가속화 한다. 2, 4 step Model의 경우 학습에 A100 GPU 32시간 밖에 걸리지 않으며 LAION-5B-Aesthetics dataset에서 SOTA의 성능을 달성했다.
+
LCMs에 대한 새로운 fine-tuning 방식인 Latent Consistency Fine-tuning을 통해 빠른 추론 속도를 유지하면서도 Custom Dataset에 효율적으로 적용할 수 있다.
Consistenct Model(CM)은 몇 step 혹은 한번의 step 만으로 데이터를 생성할 수 있는 모델이다. CM의 핵심은 PF-ODE의 궤적에 어떤 point와 PF-ODE의 solution에 대해 mapping되는 function (\(f:(x_t, t) \mapsto x_\epsilon\))을 추정하는 것이다.
\(c_{skip}(t)\)와 \(c_{out}(t)\)는 미분 가능한 함수이며 \(c_{skip}=1, c_{out}=0\)이기 때문에 \(f_\theta(x, \epsilon)=x\)를 만족한다. \(\theta\)는 학습 가능한 파라미터로 \(F_\theta\)는 심층 신경망을 의미한다.
+
+
CM은 pre-trained 모델에 대한 Distillation 방식과 scratch부터 학습하는 방식이 있는데 주로 Distillation 방식을 사용한다. Distillation 방식은 parameter \(\theta^-\)가 \(\theta\)를 통해 학습하며 모델에 대한 self-consistency를 위해 다음과 같이 손실함수를 구성한다:
이 때 \(\theta^-\)는 \(\theta\)에 대한 지수평균이동(Exponential Moving Average, EMA)이며 \(\theta^- \leftarrow \mu\theta^-+(1-\mu)\theta\)이다. \(d(\cdot, \cdot)\)은 두 sample 사이의 거리를 측정하는 지표이다. \(\hat{x}^{\phi}_{t_n}\)은 \(x_{t_{n+1}}\)에 대한 \(x_{t_n}\)을 추정한 값으로 다음과 같다:
\(\Phi\)는 PF-ODE에 사용되는 ODE Solver로 Euler나 Heun Method등의 수치적인 ODE solver를 사용할 수 있다. 즉 Consistency Distillation은 ODE Solver로 예측한 \(\hat{x}^{\phi}_{t_n}\)과 \(x_{t_{n+1}}\)을 입력으로 \(f_{\theta^-}\)와 \(f_\theta\)로 예측한 값의 Consistency를 비교하는 방식으로 Distillation을 수행한다.
본 논문에서는 pre-trained 된 Stable Diffusion에 Consistency Distillation을 적용한 Latent Consistency Distillation (LCD)을 제안한다. LCMs는 LDM(SD)을 기반으로 설계되었기 때문에 \(z=\varepsilon(x)\)를 통해 \(x\)를 latent vector로 임베딩하고 \(\hat{x}=\mathcal{D}(z)\)를 통해 원본 영상으로 복원한다. latent space 상에서 연산이 이뤄지기 때문에 Computation Cost를 크게 줄일 수 있어 high-resolution 영상을 laptop GPU에서 생성할 수도 있다.
+
condition을 추가한 PF-ODE의 reverse process는 다음과 같이 정의된다:
\(z_t\)는 t step의 image latents, \(\epsilon_\theta(z_t,c,t)\)는 noise 예측 모델, c는 text와 같은 conditional prompt를 의미한다. PF-ODE상에서 모든 t step에 대해 consistency function \(f_\theta :(z_t,c,t) \mapsto z_0\)이기 때문에 이를 수식으로 정리하자면 다음과 같이 나타낼 수 있다 (\(\hat{\epsilon}_\theta\)는 noise prediction model.):
수식을 살펴보면 ddpm 등의 reparameterization trick인 \(x_t := \sqrt{\bar{\alpha}_t}x_0 + \sqrt{1-\bar{\alpha}_t}\epsilon\)을 변형하여 식에 대입한 것을 알 수 있음. (\(x\)→\(z\)로 치환)
CM과 마찬가지로 \(c_{skip}(0)=1, c_{out}(0)=0\)이고 \(\hat{\epsilon}_{\theta}(z,c,t)\)는 teacher diffusion model과 유사한 noise 예측 모델 parameter이다. \(f_\theta\)는 \(\epsilon-Prediction\) 외에도 \(x-Prediction\)이나 \(v-Prediction\)을 사용할 수도 있다. (\(x-Prediction\)은 DDPM, \(v-prediction\)은 PD에서 나온 개념)
\(\psi(z_t,t,x,c)\)는 ODE solver이며 특정한 time step \(t \sim s\) 사이에 대한 Eq. 8의 우항을 근사한 값이다. ODE Solver이기 때문에 DDIM, DPM-Solver, DPM-Solver++ 등을 사용할 수 있다. 또한 \(\psi\)는 학습 및 Distillation시에만 사용한다. 이때 \(t_n\)은 EDM을 토대로 CM에서 나오는 값이다. 기존 timestep \([t, T]\)에 대한 하위 간격으로 \(t_1=\epsilon<t_2<\cdots<t_N=T\)인 어떠한간격을 의미한다. \(t_i\)는 다음과 같이 나타낼 수 있다:
3.2 One-Stage Guided Distillation by solving augmented PF-ODE#
+
Clasifier-free Guidance(CFG)는 high-quality의 conditional 이미지 생성을 가능하게 했다. 다만 CFG는 2개의 Diffusion Model을 훈련해야하기 때문에 효율적이지 못하며, LCMs와 같은 few-step sampling method에 사용하기 힘들다. 따라서 이를 해결하기 위해 본 논문에서는 CFG를 Distillation 과정에서 통합하였다.
+
Guided-Distill의 경우 two-stage Distillation을 통해 few-step sampling에 CFG를 통합하였으나 학습시간이 길고 2단계를 거치며 손실이 누적되기 때문에 최적의 성능을 내기 힘들다.
CFG는 conditional noise 예측값과 unconditional noise 예측값을 선형 결합하여 사용한다. 즉 noise 값이 \(\omega\)에 따라 변형되므로 augmented PF-ODE라고 한다. augmented PF-ODE는 다음과 같이 나타낼 수 있다:
\(\omega\)와 \(n\)는 각각 \([\omega_{min}, \omega_{max}]\), \(\{1,…,N-1\}\)에서 sampling된다. \(\hat{z}^{\psi, \omega}_{t_n}\)는 이전과 마찬가지로 CFG가 추가된 ODE-Solver를 사용하여 근사한 값을 의미한다. 이때 사용되는 새로운 noise 예측모델 \(\tilde{\epsilon}_\theta(z_t,\omega,c,t)\)는 Eq. 11처럼 \(t_{n+1} \sim t_n\)까지 t에 대해 적분 했을 때 다음과 같이 나타낼 수 있다:
마찬가지로 PF-ODE Solver \(\psi(\cdot,\cdot,\cdot,\cdot)\)에는 DDIM, DPM-Solver, DPM-Solver++ 등을 사용할 수 있다.
+
+
+
3.3 Accelerating Distillation with Skipping Time Steps#
+
Stable Diffusion 등 보통의 Diffusion Model들은 매우 큰 step을 전체 time step으로 잡고 학습한다. 그러나 이같이 촘촘한 time step은 각 \(t_n\)과 \(t_{n+1}\)의 변화량을 감소시키기 때문에 자연스럽게 Consistency Distillation Loss도 작아지게 된다. Loss가 작아지면 학습의 수렴속도도 느려지게 된다. 따라서 LCMs는 학습 수렴의 속도를 높이기 위해 time step을 수천에서 수십으로 크기 단축시키는 SKIPPING-STEP 방법을 제안하였다.
+
기존 CMs 모델의 경우 time scheduler로 EDM을 사용하고 ODE-Solver로 Euler 방법이나 Heun 방법을 사용한다. 그러나 LCMs는 Eq. 8을 통해 DDIM, DPM-Solver, DPM-Solver++와 같은 효율적인 solver도 효과적으로 데이터를 생성할 수 있다는 것을 증명했다. 따라서 SKIPPING-STEP 방법은 \(t_{n+1} → t_n\) 사이의 Consistency를 비교하는것이 아니라 특정 k-step만큼 거리가 있는 time step에 대한 Consistency를 비교한다. (\(t_{n+k}→t_n\))
+
이때 \(k\)값의 크기는 trade-off 관계를 가진다. 너무작으면 (\(k=1\)) 기존과 같이 느린 수렴속도를 갖게되며, 너무 큰 값일 때는 ODE solver 를 통해 근사할 때 오차가 매우 커질수 있다. 논문의 저자는 \(k=20\)을 사용해 time step을 수천에서 수십으로 대폭 줄여 학습을 Accelerating 할 수 있었다. Eq. 14에 k값을 추가해 SKIPPING-STEP을 표현할 수 있다.
3.4 Latent Consistency Fine-tuning for customized dataset#
+
Stable Diffusion과 같은 Foundation 생성 모델은 거의 대부분의 text-to-image Generation task에서 잘 되지만 가끔 downstream task를 위해 Cunstom dataset에 대한 fine-tuning이 필요할 때가 있다. Latent Consistency Fine-tuning(LCF)는 Custom Dataset도 teacher model에 대한 종속없이 few-step inference를 성공적으로 할수 있도록 한다. 따라서 LCM은 기존의 Diffusion model에 대한 추가적인 fine tuning 방법론 없이도 Custom Dataset을 바로바로 학습하여 사용할수 있다.
+
따로 추가적인 fine-tuning 방법이 있는것은 아니고 Consisteny Distillation 시 pre-trained 된 LDM을 사용하여 EMA를 통해 Distillation을 하기 때문에 Dataset을 Custom Dataset으로 사용하기만하면 된다. 즉 pre-trained Diffuson model → Custom Dataset fine-tuning → few step inference를 위한 Consistency Distillation을 할 필요 없이 바로학습이 가능하다는 의미이다.
3가지 데이터셋에 대한 평가를 진행했다. (LAION-5B, LAION-Aesthetics-6+(12M), LAION-Aesthetics-6.5+(650k)) 앞서말한것처럼 하나의 Resolution이 아닌 512x512, 768x768의 high resolution을 생성했다. 512 size는 \(\epsilon\)-prediction, 768 size는 \(v\)-prediction을 사용했고 ODE-Solver로는 DDIM을 사용했다. 앞서말한것처럼 SKIPPING-STEP은 20의 값을 가진다.
+
+
+
+
Fig. 509 Quantitative results at 512 x 512 & 768 x 768 resolution.#
+
+
+
+
+
+
Fig. 510 Qualitative results on LAION-Aesthetic-6.5+ Dataset. (2,4 steps)#
+
+
+
DDIM, DPM-Solver, DPM-Solver++, Guided-Distill 4가지 모델에 대해 LCM과 성능비교를 했는데 이때 Guided-Distill은 오픈소스 코드가 없기 때문에 논문의 내용과 동일하게 Implementation 해서 성능을 비교하였다. LCM은 같은 메모리 Cost 대비 더 빠르게 수렴하고 더 좋은 품질의 영상을 생성하였다. 특히 Guided-Distill은 2 stage Distillation이지만 LCM은 1 Stage만 사용해도 이같은 성능을 보여줬다.
augmented PF-ODE를 푸는 solver들(DDIM, DPM, DPM++)을 LCM에 사용할 때 성능 비교와 SKIPPING-STEP schedule의 \(k\)값에 따른 성능 변화를 비교하였다. 모든 모델은 2,000 iteration에서의 4-step inference로 고정해서 비교했다.
+
+
+
+
Fig. 511 Different ODE solvers and skipping step k.#
+
+
+
Skipping step의 경우 \(k\) 값을 올렸을 때 훨씬더 빠르게 수렴하며 때때로 더 좋은 FID 값을 보여주었다. 또한 DPM과 DPM++은 \(k\)가 50일 때 DDIM보다 더 좋은 성능을 보였다. 이는 \(k\) 값이 클수록 더 큰 ODE approximation error를 가지는 DDIM에 비해 오차가 적기 때문이다.
LCM은 Consistency Distillation을 Latent 상에 적용하여 고화질의 영상을 매우 적은 time step으로 inference 할 수 있도록 한 모델이다. 즉 성능 좋고 고해상도의 영상을 few-step으로 가능하게 만들었다. 특히 Custom Dataset에도 Distillation을 적용했을 때 적은 time step으로도 어느정도의 style을 간단하게 학습하는 결과를 보여주었다.
Pre-trained 된 text-to-image diffusion model 을 활용하여 NeRF 를 optimize 하는 DreamFusion 모델의 두 가지 단점을 명시합니다.
-
-
Extremely slow optimization of NeRF
-
Low-resolution image (64x64) space supervision on NeRF, leading to low-quality 3D models with a long processing time (1.5 hours per prompt on average using TPUv4)
-
-
따라서, 논문에서는 이러한 단점을 해결하기 위해 two-stage optimization framework 제시합니다. 첫번째 단계로 DreamFusion 과 동일하게 coarse 한 NeRF representation 을 optimize 하는데, hash grid 를 활용하여 memory 그리고 computationally efficient 하게 최적화합니다. 두번째 단계로 high resolution diffusion prior 를 기반으로 mesh representation 를 최적화합니다. 3D mesh 로 rasterizing 함으로써 graphics software 에 유동적으로 전환하여 사용할 수 있다는 장점이 있습니다.
-
정리하자면, Magic3D 는 다음과 같은 contribution 을 제공합니다.
-
-
Synthesizes 3D content with an 8× higher resolution supervision, is also
-2× faster than DreamFusion
DreamFusion 을 크게 두 가지 component 로 구성되어있다고 할 수 있습니다.
-
-
Neural scene representation
-
Volumetric renderer \(g\) 와 3D volume 을 나타내는 parameter \(\theta\) 를 입력받아 rendered image 를 생성하는 scene model \(x=g(\theta)\) 를 정의합니다. DreamFusion 에서는 scene model 로 Mip-NeRF 360 에서 shading model 를 추가하여 사용합니다.
-
-
Pre-trained text-to-image diffusion-based generative model \(\phi\)
-
DreamFusion 에서 diffusion model 로 Imagen 모델을 사용합니다.
-
-
-
이를 기반으로, 다음과 같은 Score Distillation Sampling (SDS) 을 통해 parameter \(\theta\) 를 update 합니다.
64x64 rendered image 에 대한 rendered loss 를 계산하기 위해 Imagen 과 유사한 eDiff-I 를 base diffusion 모델로 사용합니다.
-
512x512 high resolution rendered image 를 기반으로 backpropagation 할 수 있도록 Stable Diffusion model 을 LDM 으로 사용합니다. 다음과 같이 SDS 를 계산하는 과정에서 \(\partial{x}/\partial{\theta}\) 와 \(\partial{z}/\partial{x}\) 를 계산하는데 시간이 다소 소요된다고 합니다.
기존에 DreamFusion 에서 scene model 로 사용하였던 Mip-NeRF 360 모델이 3D geometry 에 대한 정보를 scratch 로부터 담아내는데 유용하다는 것을 보였지만, MLP 네트워크를 통해 dense 하게 sampling 하여 rendering 하는 과정이 computation cost 가 높다고 말합니다.
-
이를 해결하기 위한 방법으로 InstantNGP 에서 소개하는 hash grid encoding 을 사용한다고 합니다. Hash grid 를 활용하여 두 개의 single layer neural network 를 학습하는데, 하나는 albedo 와 density 그리고 나머지 하나는 normal 을 예측합니다. 또한, density-based voxel pruning (empty space 에 대한 처리) 과 octree-based ray sampling/rendering 기법을 활용하여 computation cost 를 줄였다고 합니다.
-
Textured meshes as fine scene models
-
Fine stage 에서도 high resolution image 를 기반으로 동일한 scene model (neural field) 을 학습하는 방식도 있지만, 아래 예시처럼 메모리와 연산적인 제한이 있어 좋은 성능을 내기가 어렵다고 합니다.
-
따라서, Magic3D 에서는 textured 3D mesh 를 scene representation 으로 사용합니다. 더 자세하게는, 다음과 같은 tetrahedral grid \((V_T,T)\) 형태로 3D mesh 를 표현합니다. 이때, \(V_T\) 는 grid \(T\) 에 존재하는 vertices 를 의미하고, 각 vertex \(v_i \in V_T \subset \mathbb{R}^3\) 는 signed distance field (SDF) \(s_i \in \mathbb{R}^3\) 그리고 deformation \(\Delta v_i \in \mathbb{R}^3\) 값을 가집니다.
-
이로부터 differentiable 한 marching tetrahedra 알고리즘을 통해 SDF 로부터 surface mesh 를 생성할 수 있으며, texture 에 대한 정보는 neural color field 로 정의할 수 있다고 합니다.
Instant NGP 와 동일하게 \(256^3\) resolution 의 occupancy grid 로 initialize 하고, 10 iterations 마다 grid 를 업데이트하며 empty space skipping 을 위한 octree 를 생성합니다. 매 업데이트마다 Instant NGP 와 동일한 파라미터 값을 설정하였다고 합니다.
-
또한, DreamFusion 과 동일하게 background 를 표현하는 environment map MLP 를 사용하는데, 이때 Mip-NeRF 360 에서 사용하는 scene representation 을 사용할 수 없어, 모델이 background 로부터 object 에 대한 정보를 학습할 수 있어 이를 방지하기 위해 MLP 사이즈를 작게 하고 learning rate 를 10배 증가시켰다고 합니다.
-
Mesh optimization
-
Mesh 에 대한 optimization 을 진행하기 위해, 앞서 최적화한 coarse neural field 를 non-zero constant 를 차감함으로써 SDF 로 전환하고, texture field 는 coarse stage 에서 최적화된 color field 로 초기값을 설정합니다.
-
최적화 단계를 진행할때, differentiable rasterizer 를 사용하여 surface mesh 를 rendering 하는 작업을 진행합니다. 각 vertex \(v_i\) 에 대해 앞서 정의한 high resolution 에서의 SDS gradient 를 통해 \(s_i\) 와 \(\Delta v_i\) 를 최적화하게 됩니다. 이때, rendering 하는 과정에서 각 pixel 에 해당하는 3D coordinate 를 추적하여 texture field 도 동시에 최적화합니다.
NeRF 를 scratch 로부터 single-step 으로 최적화하는 것은 어렵지만, fine stage 에서 scene model 을 NeRF 로 변경하는 것은 가능합니다. 위 그림의 하단 4개 그림 중 좌측, 우측 사진이 각각 coarse stage 그리고 fine stage 에서 NeRF 를 학습한 결과입니다.
-
Coarse models vs. fine models
-
동일한 coarse model 에 대해서 NeRF 와 Mesh 모델을 모두 fine-tuning 한 결과, 모두 좋은 성능을 보이고 fine-tuned 된 mesh 모델이 특히 3D 객체 퀄리티를 실사적으로 잘 표현하는 것을 확인할 수 있습니다.
사전에 diffusion model (eDiff-I, LDM) 을 DreamBooth 을 통해 학습하고, unique identifier \([V]\) 와 함께 3D scene model 을 학습합니다. 아래 사진과 같이, subject 에 대한 정보를 유지한 채 3D model 을 잘 생성하는 부분을 확인할 수 있습니다.
정리하자면, 논문에서 Magic3D 의 coarse-to-fine optimization 방식을 소개하고, mesh 형태의 scene model 과 고해상도 이미지에 대한 diffusion prior 를 활용함으로써 high resolution 에 대해서도 좋은 성능을 보여줄 수 있었습니다. 추가적으로, 주어진 text prompt 에 대해 3D mesh model 을 40분 만에 생성이 가능하고, 그래픽 소프트웨어와 호환이 바로 가능하다는 장점이 있습니다.
Pre-trained 된 text-to-image diffusion model 을 활용하여 NeRF 를 optimize 하는 DreamFusion 모델의 두 가지 단점을 명시합니다.
+
+
Extremely slow optimization of NeRF
+
Low-resolution image (64x64) space supervision on NeRF, leading to low-quality 3D models with a long processing time (1.5 hours per prompt on average using TPUv4)
+
+
따라서, 논문에서는 이러한 단점을 해결하기 위해 two-stage optimization framework 제시합니다. 첫번째 단계로 DreamFusion 과 동일하게 coarse 한 NeRF representation 을 optimize 하는데, hash grid 를 활용하여 memory 그리고 computationally efficient 하게 최적화합니다. 두번째 단계로 high resolution diffusion prior 를 기반으로 mesh representation 를 최적화합니다. 3D mesh 로 rasterizing 함으로써 graphics software 에 유동적으로 전환하여 사용할 수 있다는 장점이 있습니다.
+
정리하자면, Magic3D 는 다음과 같은 contribution 을 제공합니다.
+
+
Synthesizes 3D content with an 8× higher resolution supervision, is also
+2× faster than DreamFusion
DreamFusion 을 크게 두 가지 component 로 구성되어있다고 할 수 있습니다.
+
+
Neural scene representation
+
Volumetric renderer \(g\) 와 3D volume 을 나타내는 parameter \(\theta\) 를 입력받아 rendered image 를 생성하는 scene model \(x=g(\theta)\) 를 정의합니다. DreamFusion 에서는 scene model 로 Mip-NeRF 360 에서 shading model 를 추가하여 사용합니다.
+
+
Pre-trained text-to-image diffusion-based generative model \(\phi\)
+
DreamFusion 에서 diffusion model 로 Imagen 모델을 사용합니다.
+
+
+
이를 기반으로, 다음과 같은 Score Distillation Sampling (SDS) 을 통해 parameter \(\theta\) 를 update 합니다.
64x64 rendered image 에 대한 rendered loss 를 계산하기 위해 Imagen 과 유사한 eDiff-I 를 base diffusion 모델로 사용합니다.
+
512x512 high resolution rendered image 를 기반으로 backpropagation 할 수 있도록 Stable Diffusion model 을 LDM 으로 사용합니다. 다음과 같이 SDS 를 계산하는 과정에서 \(\partial{x}/\partial{\theta}\) 와 \(\partial{z}/\partial{x}\) 를 계산하는데 시간이 다소 소요된다고 합니다.
기존에 DreamFusion 에서 scene model 로 사용하였던 Mip-NeRF 360 모델이 3D geometry 에 대한 정보를 scratch 로부터 담아내는데 유용하다는 것을 보였지만, MLP 네트워크를 통해 dense 하게 sampling 하여 rendering 하는 과정이 computation cost 가 높다고 말합니다.
+
이를 해결하기 위한 방법으로 InstantNGP 에서 소개하는 hash grid encoding 을 사용한다고 합니다. Hash grid 를 활용하여 두 개의 single layer neural network 를 학습하는데, 하나는 albedo 와 density 그리고 나머지 하나는 normal 을 예측합니다. 또한, density-based voxel pruning (empty space 에 대한 처리) 과 octree-based ray sampling/rendering 기법을 활용하여 computation cost 를 줄였다고 합니다.
+
Textured meshes as fine scene models
+
Fine stage 에서도 high resolution image 를 기반으로 동일한 scene model (neural field) 을 학습하는 방식도 있지만, 아래 예시처럼 메모리와 연산적인 제한이 있어 좋은 성능을 내기가 어렵다고 합니다.
+
따라서, Magic3D 에서는 textured 3D mesh 를 scene representation 으로 사용합니다. 더 자세하게는, 다음과 같은 tetrahedral grid \((V_T,T)\) 형태로 3D mesh 를 표현합니다. 이때, \(V_T\) 는 grid \(T\) 에 존재하는 vertices 를 의미하고, 각 vertex \(v_i \in V_T \subset \mathbb{R}^3\) 는 signed distance field (SDF) \(s_i \in \mathbb{R}^3\) 그리고 deformation \(\Delta v_i \in \mathbb{R}^3\) 값을 가집니다.
+
이로부터 differentiable 한 marching tetrahedra 알고리즘을 통해 SDF 로부터 surface mesh 를 생성할 수 있으며, texture 에 대한 정보는 neural color field 로 정의할 수 있다고 합니다.
Instant NGP 와 동일하게 \(256^3\) resolution 의 occupancy grid 로 initialize 하고, 10 iterations 마다 grid 를 업데이트하며 empty space skipping 을 위한 octree 를 생성합니다. 매 업데이트마다 Instant NGP 와 동일한 파라미터 값을 설정하였다고 합니다.
+
또한, DreamFusion 과 동일하게 background 를 표현하는 environment map MLP 를 사용하는데, 이때 Mip-NeRF 360 에서 사용하는 scene representation 을 사용할 수 없어, 모델이 background 로부터 object 에 대한 정보를 학습할 수 있어 이를 방지하기 위해 MLP 사이즈를 작게 하고 learning rate 를 10배 증가시켰다고 합니다.
+
Mesh optimization
+
Mesh 에 대한 optimization 을 진행하기 위해, 앞서 최적화한 coarse neural field 를 non-zero constant 를 차감함으로써 SDF 로 전환하고, texture field 는 coarse stage 에서 최적화된 color field 로 초기값을 설정합니다.
+
최적화 단계를 진행할때, differentiable rasterizer 를 사용하여 surface mesh 를 rendering 하는 작업을 진행합니다. 각 vertex \(v_i\) 에 대해 앞서 정의한 high resolution 에서의 SDS gradient 를 통해 \(s_i\) 와 \(\Delta v_i\) 를 최적화하게 됩니다. 이때, rendering 하는 과정에서 각 pixel 에 해당하는 3D coordinate 를 추적하여 texture field 도 동시에 최적화합니다.
NeRF 를 scratch 로부터 single-step 으로 최적화하는 것은 어렵지만, fine stage 에서 scene model 을 NeRF 로 변경하는 것은 가능합니다. 위 그림의 하단 4개 그림 중 좌측, 우측 사진이 각각 coarse stage 그리고 fine stage 에서 NeRF 를 학습한 결과입니다.
+
Coarse models vs. fine models
+
동일한 coarse model 에 대해서 NeRF 와 Mesh 모델을 모두 fine-tuning 한 결과, 모두 좋은 성능을 보이고 fine-tuned 된 mesh 모델이 특히 3D 객체 퀄리티를 실사적으로 잘 표현하는 것을 확인할 수 있습니다.
사전에 diffusion model (eDiff-I, LDM) 을 DreamBooth 을 통해 학습하고, unique identifier \([V]\) 와 함께 3D scene model 을 학습합니다. 아래 사진과 같이, subject 에 대한 정보를 유지한 채 3D model 을 잘 생성하는 부분을 확인할 수 있습니다.
정리하자면, 논문에서 Magic3D 의 coarse-to-fine optimization 방식을 소개하고, mesh 형태의 scene model 과 고해상도 이미지에 대한 diffusion prior 를 활용함으로써 high resolution 에 대해서도 좋은 성능을 보여줄 수 있었습니다. 추가적으로, 주어진 text prompt 에 대해 3D mesh model 을 40분 만에 생성이 가능하고, 그래픽 소프트웨어와 호환이 바로 가능하다는 장점이 있습니다.
논문에서 기존의 conditional diffusion model 에 대해 다음과 같이 1) slow inference time, 2) paired data 에 대한 의존성 두 가지 한계점을 명시합니다. 이를 보완하기 위해, paired setting 과 unpaired setting 에서 모두 적용 가능한 학습 아키텍쳐를 제시합니다.
-
기존에 adapter 를 추가하는 방식은 one-step diffusion model 에 적합하지 않다고 설명하고, 또한 SD-Turbo 모델의 Encoder-UNet-Decoder 형태의 multi-stage pipeline 에서 이미지의 많은 시각적 디테일이 손실된다고 주장합니다. 그리고 이러한 정보 손실은 입력 이미지가 실제 이미지일 때 특히 더 치명적이라고 합니다.
-
이를 보완하기 위해, 논문에서는 첫번째로 input image 를 직접 noise encoder 에 입력함으로써 noise map 과 input control 의 충돌을 방지합니다. 두번째로, Encoder-Unet-Decoder 를 하나의 end-to-end 로 학습 가능한 아키텍처를 정의하고, 이를 위해 여러 LoRA adapter 를 정의합니다. 마지막으로, high-frequency detail 을 담아내기 위해 encoder 와 decoder 간의 skip connection 을 추가합니다.
또한, 해당 논문에서 제시하는 아케텍쳐는 CycleGAN, pix2pix 등의 GAN 기반의 모델에 plug-and-play 형태로도 적용 가능하며, CycleGAN-Turbo, pix2pix-Turbo 모델이 기존의 GAN 기반 그리고 diffusion model 기반 모델의 image translation 성능보다 우수하다고 합니다.
기존에 paired dataset 에서의 image-to-image translation 모델들은 대표적으로 reconstruction loss 와 adversarial loss 를 기반으로 학습되었습니다. 최근에는 GLIGEN, T2I-Adapter, ControlNet 와 같이 adapter 를 통한 input conditioning 하는 방식도 소개되었습니다. 그리고 unpaired dataset 에서 diffusion 모델을 활용하여 image translation 하는 사례들도 있지만, 이들은 새로 보이는 domain 마다 scratch 로부터 모델을 학습해야 하는 치명적인 단점이 있습니다.
-
SDEdit 와 Prompt-to-Prompt 모델과 같이 zero-shot 으로 이미지를 editing 하는 연구 사례들도 있지만, 이들은 multi-object 와 complex scene setting 에서 약점을 보인다고 합니다.
-
이와 동시에 diffusion model 의 inference time 을 단축하기 위해서 ODE solver 혹은 knowledge distillation 을 활용한 연구 사례들도 있었습니다.
SD-Turbo 와 같이 pretrained 된 one-step text-to-image 모델을 기반으로 input image 에 대한 conditioning 을 하는 방법을 다음과 같이 처음에 제안합니다. 아래 사진과 같이, 사전학습된 stable diffusion encoder 의 가중치 혹은 랜덤한 가중치를 가진 adapter 를 새로 정의하여 input image 에 대한 feature map 을 추출합니다.
하지만 multi-step diffusion model 과 다르게 single-step 만으로도 noise map 이 생성되는 이미지의 전체적인 layout 을 결정하기 때문에, condition encoder 를 거쳐서 나온 feature map 와의 충돌이 생겨 학습에 어려움이 생기는 현상을 보여준다고 합니다.
-
따라서, adapter 를 추가적으로 정의하는 방식이 아닌 conditioning input 을 network 에 직접 적용하는 방식을 논문에서 제안합니다.
Latent Diffusion Model (LDM) 이 image 를 encoding 하는 과정에서 차원을 8 배 축소하기 때문에 정보에 대한 손실이 크고, 따라서 이러한 방식은 fine detail 에 민감한 image translation task 에 적합하지 않을 수 있다고 주장합니다. 아래 사진을 보시면, 기존 아키텍쳐에서 skip connection 을 추가하기 전후로 원본 이미지에 대한 detail preservation 정도 차이를 확인할 수 있습니다.
더 자세하게는, skip connection 을 encoder 내의 각 downsampling layer 를 거쳐 4개의 activation 을 추출하고 이를 1 x 1 zero-convolution layer 를 통과시켜 decoder 에 대응되는 upsampling block 에 입력시킵니다.
논문에서는 SD-Turbo (v2.1) 를 base network 로 사용하고, 변형된 CycleGAN objective 를 적용하여 unpaired translation 을 진행하였습니다. 이때, cycle-consistency loss 와 adversarial loss 를 다음과 같이 정의합니다.
여기서 \(X \subset \mathbb{R}^{H \times W \times 3}\), \(Y \subset \mathbb{R}^{H \times W \times 3}\) 는 각각 source domain, target domain, 그리고 \(G(x, c_Y): X → Y\), \(G(y, c_X):
-Y → X\) 는 translation 함수입니다. 두 translation 모두 동일한 generator \(G\) 를 사용하며, caption \(c_X,c_Y\) 만 task 에 따라 변형하게 됩니다. (i.e., day → night translation task 에서 \(c_X\) 는 “Driving in the day” 그리고 \(c_Y\) 는 “Driving in the night”)
-
대부분의 layer 는 고정시킨 상태에서 U-Net 의 첫번째 convolutional layer 와 LoRA adapter 를 학습시켰다고 합니다.
또한, 새롭게 소개되는 \(L_{rec}\) 손실함수는 \(L_1\) 과 \(LPIPS\) 의 조합으로 구성되어있습니다. 그리고 adversarial loss 에서 사용되는 discriminator \(D_X(x),D_Y(y)\) 는 CLIP 모델을 backbone 으로 사용하였습니다.
-
마지막으로, identity regularization loss 도 \(L_{idt} = E_y [L_{rec}(G(y, c_Y ), y)] + E_x [L_{rec}(G(x, c_X), x)]\) 와 같이 정의하고, 최종 objective 를 이들의 가중치 합으로 정의합니다.
해당 논문에서 unpaired training setting 뿐만 아니라 paired training 그리고 stochastic output generation 에 대해서도 실험을 진행하였습니다.
-
Paired Training
-
Paired setting 에서는 single translation function \(G(x,c): X \rightarrow Y\) 를 학습하고, objective 는 (1) perceptual loss 와 pixel-space reconstruction loss 로 구성된 reconstruction loss (2) unpaired setting 에서 target domain 에 대해서만 정의된 GAN loss, 그리고 (3) CLIP text-image alignment loss \(L_{CLIP}\) 의 가중치 합으로 정의합니다.
-
Generating Diverse Outputs
-
One-step model 로 diverse 한 output 을 생성하는 것은 어려운 일입니다. 논문에서는 해당 task 를 수행하기 위해 input image \(x\), noise map \(z\), 그리고 interpolation coefficient \(\gamma\) 를 입력받는 \(G(x,z,\gamma)\) 를 정의합니다.
-
\(G(x,z,\gamma)\) 는 우선 noise \(z\) 와 encoder output \(G_{enc}(x)\) 를 다음과 같이 interpolation 합니다: \(\gamma G_{enc}(x) + (1 − \gamma) z\). 그리고 LoRA adapter 가중치와 skip connection 출력값을 \(\theta = \theta_0 + \gamma \cdot \Delta \theta\) 와 같이 조정합니다. 여기서 \(\theta_0\) 는 원래 가중치이고, \(\Delta \theta\) 는 새로 추가된 가중치입니다.
-
-
-
-
Fig. 547 Reconstruction loss with interpolation coefficient#
-
-
-
해당 objective 로 interpolation coefficient \(\gamma\) 를 변화시키면서 모델을 fine-tuning 함으로써 다양한 output 을 생성할 수 있었다고 합니다.
Unpaired datasets 에서 자주 사용되는 Horse \(\leftrightarrow\) Zebra, Yosemite Summer \(\leftrightarrow\) Winter, 그리고 고차원 이미지의 주행 데이터셋 BDD100k 의 day \(\leftrightarrow\) night, clear \(\leftrightarrow\) foggy 데이터셋으로 실험하였습니다.
-
Evaluation Protocol
-
Image translation task 에서 다음과 같은 2가지 요소를 만족시켜야 한다고 합니다.
-
(1) target domain 의 데이터셋 분포와의 일치: FID 로 측정
-
(2) input image 의 구조적인 정보 유지: DINO-Struct-Dist 로 측정
기존에 GAN-based 그리고 Diffusion-based 모델들이 output realism 그리고 structure preservation 에 모두 좋은 성능을 내지는 못하는 것을 확인할 수 있습니다.
-
-
-
-
Fig. 548 Comparison to baselines on 256 × 256 datasets.#
-
-
-
-
-
-
Fig. 549 Comparison to baselines on driving datasets (512 × 512).#
-
-
-
아래 예시 사진들과 table 에서 보이듯이, CycleGAN-Turbo 모델이 CycleGAN 과 CUT 모델보다 더 낮은 FID, DINO Structure score 를 보여주는 것을 확인할 수 있습니다.
-
또한, diffusion 기반의 zero-shot image translation 모델: SDEdit, Plug-and Play, pix2pix-zero, CycleDiffusion, 그리고 DDIB 들이 realistic 한 이미지는 잘 생성하지만 원본 이미지의 structure 를 훼손시키는 경우가 있음을 확인할 수 있습니다. 이러한 현상은 multiple object 가 존재하는 주행 데이터셋에서 더 빈번하게 발생하고, 이는 Instructpix2pix 모델을 제외하고는 noise map 으로 inverting 하는 과정에서 원본 이미지에 대한 손실이 일어나기 때문이라고 주장합니다.
-
-
Comparison to GAN-based methods
-
-
-
-
Fig. 550 Comparison to GAN-based methods on 256 × 256 datasets.#
-
-
-
-
-
-
Fig. 551 Comparison to GAN-based methods on driving datasets (512 × 512).#
-
-
-
-
Comparison to Diffusion-based editing methods
-
-
-
-
Fig. 552 Comparison to Diffusion-based editing methods on driving datasets (512 × 512).#
-
-
-
-
-
-
Fig. 553 Comparison to Diffusion-based editing methods on driving datasets (512 × 512).#
-
-
-
-
-
-
-
-
Fig. 554 Evaluation on standard CycleGAN datasets (256 × 256).#
-
-
-
-
-
-
Fig. 555 Comparison on 512 × 512 driving datasets.#
Pix2pix-Turbo 와 LCM-ControlNet, SD-Turbo ControlNet, 그리고 SD ControlNet 모델과 정성적인 평가를 진행하였습니다. Classifier-free guidance, negative prompt 없이 단일 step 만으로도 좋은 성능을 보여줌을 확인할 수 있습니다.
-
-
-
-
Fig. 558 Comparison on paired edge-to-image task (512 × 512).#
해당 논문은 multi-step diffusion training 에 의존하지 않고, single-step 만으로 다양한 GAN 기반의 objective 와 융합해서 downstream task 에 적용할 수 있는 방식을 제안합니다. 하지만, 다음과 같은 3가지 한계점을 제시합니다: (1) SD-Turbo 는 classifier-free guidance 를 사용하지 않아, guidance control 에 대한 설정할 수 없습니다. (2) 해당 방식은 negative prompt 를 지원하지 않습니다. 그리고 마지막으로 (3) high capacity generator 기반의 cycle consistency loss 로 학습하는데 메모리에 대한 부담이 큽니다.
논문에서 기존의 conditional diffusion model 에 대해 다음과 같이 1) slow inference time, 2) paired data 에 대한 의존성 두 가지 한계점을 명시합니다. 이를 보완하기 위해, paired setting 과 unpaired setting 에서 모두 적용 가능한 학습 아키텍쳐를 제시합니다.
+
기존에 adapter 를 추가하는 방식은 one-step diffusion model 에 적합하지 않다고 설명하고, 또한 SD-Turbo 모델의 Encoder-UNet-Decoder 형태의 multi-stage pipeline 에서 이미지의 많은 시각적 디테일이 손실된다고 주장합니다. 그리고 이러한 정보 손실은 입력 이미지가 실제 이미지일 때 특히 더 치명적이라고 합니다.
+
이를 보완하기 위해, 논문에서는 첫번째로 input image 를 직접 noise encoder 에 입력함으로써 noise map 과 input control 의 충돌을 방지합니다. 두번째로, Encoder-Unet-Decoder 를 하나의 end-to-end 로 학습 가능한 아키텍처를 정의하고, 이를 위해 여러 LoRA adapter 를 정의합니다. 마지막으로, high-frequency detail 을 담아내기 위해 encoder 와 decoder 간의 skip connection 을 추가합니다.
또한, 해당 논문에서 제시하는 아케텍쳐는 CycleGAN, pix2pix 등의 GAN 기반의 모델에 plug-and-play 형태로도 적용 가능하며, CycleGAN-Turbo, pix2pix-Turbo 모델이 기존의 GAN 기반 그리고 diffusion model 기반 모델의 image translation 성능보다 우수하다고 합니다.
기존에 paired dataset 에서의 image-to-image translation 모델들은 대표적으로 reconstruction loss 와 adversarial loss 를 기반으로 학습되었습니다. 최근에는 GLIGEN, T2I-Adapter, ControlNet 와 같이 adapter 를 통한 input conditioning 하는 방식도 소개되었습니다. 그리고 unpaired dataset 에서 diffusion 모델을 활용하여 image translation 하는 사례들도 있지만, 이들은 새로 보이는 domain 마다 scratch 로부터 모델을 학습해야 하는 치명적인 단점이 있습니다.
+
SDEdit 와 Prompt-to-Prompt 모델과 같이 zero-shot 으로 이미지를 editing 하는 연구 사례들도 있지만, 이들은 multi-object 와 complex scene setting 에서 약점을 보인다고 합니다.
+
이와 동시에 diffusion model 의 inference time 을 단축하기 위해서 ODE solver 혹은 knowledge distillation 을 활용한 연구 사례들도 있었습니다.
SD-Turbo 와 같이 pretrained 된 one-step text-to-image 모델을 기반으로 input image 에 대한 conditioning 을 하는 방법을 다음과 같이 처음에 제안합니다. 아래 사진과 같이, 사전학습된 stable diffusion encoder 의 가중치 혹은 랜덤한 가중치를 가진 adapter 를 새로 정의하여 input image 에 대한 feature map 을 추출합니다.
하지만 multi-step diffusion model 과 다르게 single-step 만으로도 noise map 이 생성되는 이미지의 전체적인 layout 을 결정하기 때문에, condition encoder 를 거쳐서 나온 feature map 와의 충돌이 생겨 학습에 어려움이 생기는 현상을 보여준다고 합니다.
+
따라서, adapter 를 추가적으로 정의하는 방식이 아닌 conditioning input 을 network 에 직접 적용하는 방식을 논문에서 제안합니다.
Latent Diffusion Model (LDM) 이 image 를 encoding 하는 과정에서 차원을 8 배 축소하기 때문에 정보에 대한 손실이 크고, 따라서 이러한 방식은 fine detail 에 민감한 image translation task 에 적합하지 않을 수 있다고 주장합니다. 아래 사진을 보시면, 기존 아키텍쳐에서 skip connection 을 추가하기 전후로 원본 이미지에 대한 detail preservation 정도 차이를 확인할 수 있습니다.
더 자세하게는, skip connection 을 encoder 내의 각 downsampling layer 를 거쳐 4개의 activation 을 추출하고 이를 1 x 1 zero-convolution layer 를 통과시켜 decoder 에 대응되는 upsampling block 에 입력시킵니다.
논문에서는 SD-Turbo (v2.1) 를 base network 로 사용하고, 변형된 CycleGAN objective 를 적용하여 unpaired translation 을 진행하였습니다. 이때, cycle-consistency loss 와 adversarial loss 를 다음과 같이 정의합니다.
여기서 \(X \subset \mathbb{R}^{H \times W \times 3}\), \(Y \subset \mathbb{R}^{H \times W \times 3}\) 는 각각 source domain, target domain, 그리고 \(G(x, c_Y): X → Y\), \(G(y, c_X):
+Y → X\) 는 translation 함수입니다. 두 translation 모두 동일한 generator \(G\) 를 사용하며, caption \(c_X,c_Y\) 만 task 에 따라 변형하게 됩니다. (i.e., day → night translation task 에서 \(c_X\) 는 “Driving in the day” 그리고 \(c_Y\) 는 “Driving in the night”)
+
대부분의 layer 는 고정시킨 상태에서 U-Net 의 첫번째 convolutional layer 와 LoRA adapter 를 학습시켰다고 합니다.
또한, 새롭게 소개되는 \(L_{rec}\) 손실함수는 \(L_1\) 과 \(LPIPS\) 의 조합으로 구성되어있습니다. 그리고 adversarial loss 에서 사용되는 discriminator \(D_X(x),D_Y(y)\) 는 CLIP 모델을 backbone 으로 사용하였습니다.
+
마지막으로, identity regularization loss 도 \(L_{idt} = E_y [L_{rec}(G(y, c_Y ), y)] + E_x [L_{rec}(G(x, c_X), x)]\) 와 같이 정의하고, 최종 objective 를 이들의 가중치 합으로 정의합니다.
해당 논문에서 unpaired training setting 뿐만 아니라 paired training 그리고 stochastic output generation 에 대해서도 실험을 진행하였습니다.
+
Paired Training
+
Paired setting 에서는 single translation function \(G(x,c): X \rightarrow Y\) 를 학습하고, objective 는 (1) perceptual loss 와 pixel-space reconstruction loss 로 구성된 reconstruction loss (2) unpaired setting 에서 target domain 에 대해서만 정의된 GAN loss, 그리고 (3) CLIP text-image alignment loss \(L_{CLIP}\) 의 가중치 합으로 정의합니다.
+
Generating Diverse Outputs
+
One-step model 로 diverse 한 output 을 생성하는 것은 어려운 일입니다. 논문에서는 해당 task 를 수행하기 위해 input image \(x\), noise map \(z\), 그리고 interpolation coefficient \(\gamma\) 를 입력받는 \(G(x,z,\gamma)\) 를 정의합니다.
+
\(G(x,z,\gamma)\) 는 우선 noise \(z\) 와 encoder output \(G_{enc}(x)\) 를 다음과 같이 interpolation 합니다: \(\gamma G_{enc}(x) + (1 − \gamma) z\). 그리고 LoRA adapter 가중치와 skip connection 출력값을 \(\theta = \theta_0 + \gamma \cdot \Delta \theta\) 와 같이 조정합니다. 여기서 \(\theta_0\) 는 원래 가중치이고, \(\Delta \theta\) 는 새로 추가된 가중치입니다.
+
+
+
+
Fig. 547 Reconstruction loss with interpolation coefficient#
+
+
+
해당 objective 로 interpolation coefficient \(\gamma\) 를 변화시키면서 모델을 fine-tuning 함으로써 다양한 output 을 생성할 수 있었다고 합니다.
Unpaired datasets 에서 자주 사용되는 Horse \(\leftrightarrow\) Zebra, Yosemite Summer \(\leftrightarrow\) Winter, 그리고 고차원 이미지의 주행 데이터셋 BDD100k 의 day \(\leftrightarrow\) night, clear \(\leftrightarrow\) foggy 데이터셋으로 실험하였습니다.
+
Evaluation Protocol
+
Image translation task 에서 다음과 같은 2가지 요소를 만족시켜야 한다고 합니다.
+
(1) target domain 의 데이터셋 분포와의 일치: FID 로 측정
+
(2) input image 의 구조적인 정보 유지: DINO-Struct-Dist 로 측정
기존에 GAN-based 그리고 Diffusion-based 모델들이 output realism 그리고 structure preservation 에 모두 좋은 성능을 내지는 못하는 것을 확인할 수 있습니다.
+
+
+
+
Fig. 548 Comparison to baselines on 256 × 256 datasets.#
+
+
+
+
+
+
Fig. 549 Comparison to baselines on driving datasets (512 × 512).#
+
+
+
아래 예시 사진들과 table 에서 보이듯이, CycleGAN-Turbo 모델이 CycleGAN 과 CUT 모델보다 더 낮은 FID, DINO Structure score 를 보여주는 것을 확인할 수 있습니다.
+
또한, diffusion 기반의 zero-shot image translation 모델: SDEdit, Plug-and Play, pix2pix-zero, CycleDiffusion, 그리고 DDIB 들이 realistic 한 이미지는 잘 생성하지만 원본 이미지의 structure 를 훼손시키는 경우가 있음을 확인할 수 있습니다. 이러한 현상은 multiple object 가 존재하는 주행 데이터셋에서 더 빈번하게 발생하고, 이는 Instructpix2pix 모델을 제외하고는 noise map 으로 inverting 하는 과정에서 원본 이미지에 대한 손실이 일어나기 때문이라고 주장합니다.
+
+
Comparison to GAN-based methods
+
+
+
+
Fig. 550 Comparison to GAN-based methods on 256 × 256 datasets.#
+
+
+
+
+
+
Fig. 551 Comparison to GAN-based methods on driving datasets (512 × 512).#
+
+
+
+
Comparison to Diffusion-based editing methods
+
+
+
+
Fig. 552 Comparison to Diffusion-based editing methods on driving datasets (512 × 512).#
+
+
+
+
+
+
Fig. 553 Comparison to Diffusion-based editing methods on driving datasets (512 × 512).#
+
+
+
+
+
+
+
+
Fig. 554 Evaluation on standard CycleGAN datasets (256 × 256).#
+
+
+
+
+
+
Fig. 555 Comparison on 512 × 512 driving datasets.#
Pix2pix-Turbo 와 LCM-ControlNet, SD-Turbo ControlNet, 그리고 SD ControlNet 모델과 정성적인 평가를 진행하였습니다. Classifier-free guidance, negative prompt 없이 단일 step 만으로도 좋은 성능을 보여줌을 확인할 수 있습니다.
+
+
+
+
Fig. 558 Comparison on paired edge-to-image task (512 × 512).#
해당 논문은 multi-step diffusion training 에 의존하지 않고, single-step 만으로 다양한 GAN 기반의 objective 와 융합해서 downstream task 에 적용할 수 있는 방식을 제안합니다. 하지만, 다음과 같은 3가지 한계점을 제시합니다: (1) SD-Turbo 는 classifier-free guidance 를 사용하지 않아, guidance control 에 대한 설정할 수 없습니다. (2) 해당 방식은 negative prompt 를 지원하지 않습니다. 그리고 마지막으로 (3) high capacity generator 기반의 cycle consistency loss 로 학습하는데 메모리에 대한 부담이 큽니다.
Diffusion model has revolutionized image generation, 하지만 느린 sampling speed 가 느린 문제점이 있음
+
Accelerating sampling speed 를 목적으로 하는 많은 연구가 이루어져 왔음
+
+
ODE solving: diffusion model 의 큰 틀은 유지한 채 sampling step 의 수를 줄이면서 유사한 수준의 sample 생성 (DDIM, InstaFlow, CFM)
+
하지만 여전히 50 ~ 100 step 이하로 step 을 줄이게 되면 sample quality 가 크게 감소하여 diffusion distillation 을 통한 one-step generation 방법이 연구되어지고 있음
+
Single step distillation: Diffusion model 을 teacher 삼아 one-step generation model 학습
+
직관적으로 생각해보면, diffusion model 을 학습 시킨후 학습된 모델을 통해 다수의 (noise, image) pair 얻은 후 one-step VAE 를 학습시키는 것을 생각 해 볼 수 있음.
+
그러나, 학습된 multi step 으로 학습 된 diffusion model 을 one-step generation model 에 distillation 을 하는 것은 어려움이 있음
+
+
Noise level 을 점진적으로 증가 시키며, one-step generation 을 학습시키는 방법
+
+
+
+
+
GAN 에서 영감을 받아, (noise, image) 의 대응을 강제하는 대신 (such as autoencoder), student model 이 생성하는 이미지를 teacher model (original diffusion model) 이 생성하는 이미지와 indistinguishable 하게 학습시키는 distribution matching 전략을 생각해 볼 수 있음
+
Diffusion model 의 score (\(\newcommand{\laplacianx}{\Delta x}\)\(\nabla_{\mathbf{x}} \log p(\mathbf{x})\)) 을 사용해서 student model (\(p(x)\)) 을 학습시킬 수 있음 (real image score 가 증가하는 방향으로 pattern 을 업데이트 하는 것이 desired 방향 + fake image 를 생성하는 diffusion model 의 score 을 감소시키는 방향으로 parameter update)
+
+
Diffusion model and score base model
+
엄밀하게 본다면, 이 논문은 diffusion model (DDPM style) 보다는 score matching 의 철학과 논리전개를 바탕으로 두고 있음. 그러나, diffusion model 과 score based model 은 궁극적으로 같은 objective 를 다른 방식으로 학습하고 있을 뿐이고, 그 score 과 diffusion model 이 예측하는 one-step denoised 분포 (\(\mu_{base}\)) 는 쉽게 변환 가능함.
학습된 diffusion model (real data score function) 이 주어진 상황에서 one-step generator (\(G_{\theta}\)) 를 학습시키기 위해, 두개의 loss 1) distribution matching gradient (엄밀하게는 loss 보다는 parameter update gradient) 2) regression loss 를 사용
+
Adversarial AutoEncoder 가 연상되는 architecture 를 가지고 있음
AAE 는 VAE 가 생성하는 이미지에 대한 1) regression loss 와 2) implicit distribution matching loss 를 가지고 있는데, 여기서 implicit distribution matching 을 teacher diffusion model 의 distribution matching gradient 로 대체한 형태
+
+
+
+
총 네 부분으로 나뉘어져 있음
+
+
Paired dataset construction
+
Pretrained base model (= real data score function, freezed)
+
One-step generator (main objective)
+
Fake data generator (= fake data score function, on-line training)
우선, 생성모델의 training objective를 생각해보면, \(p_\text{fake}\) (one-step generator이 생성하는 분포) \(p_\text{real}\) (실제 데이터의 분포) 를 matching 시키도록 학습을 시켜야하는 것이 one-step generator의 학습 objective이고 아래와 같이 씌여질 수 있음:
지만, \(p_\text{real}(x)\) 를 바로 구하는 것이 어려움 (이것이 곧 생성모델의 objective). 그러나, 모델을 학습시키기 위해서는 \(D_{KL}\) 을 직접 구할 필요는 없고, \(D_{KL}\) 을 minimize 하는 (fake 과 real 의 분포사이의 거리를 최소화 시키는 방향으로) parameter update 를 하기 위한 미분값만 알면 충분함. 위 식을 one-step generator 의 learnable paramter (\(\theta\)) 에 대해 미분 해주면,
이 유도되는데, 여기서 score \(s_{\text{real}}(x)\) 와 \(s_{\text{fake}}(x)\) 를 정확히 알 수 있다면, one-step generator 을 학습시킬 수 있음. 단, score 이 \(x\) 가 존재하는 전체 space 에 대해서 잘 작동하는 score 이여야함 (= Score-SDE).
+
이제, 그러면 우리의 objective 는 real score 와 fake score 을 어떻게 구할지가 되는데, \(s_{\text{real}}(x)\) 은 pretrained diffusion model 에서:
와 같이 유도됨. \(s_{\text{fake}}(x)\) 의 경우가 복잡해지는데, \(s_{\text{fake}}(x)\) 는 one-step generator 가 생성하는 이미지의 score function 라서 one-step generator 로 생성 된 이미지가 있어야 해당 이미지를 생성하는 diffusion 모델을 학습시켜서 구할 수 있음.
+
+
+
+
Fig. 580 Distribution matching gradient computation#
+
+
+
여기서 저자들은 fake data score function (initialized to real data score function) 을 동시에 학습시키는 방법으로 해결
정리하자면, real score 은 real distribution (data distribution) 방향으로 parameter update를 하면서 fake distribution (one-step generation 의 output) 을 real distribution 에 가깝게 일치시키는 역할을 하며, fake score 의 반대방향으로 parameter update 를 하는 것은 fake data generator (one-step generator) 의 반대방향으로 distribution 을 밀어내서 most probable 한 한개의 점으로 모든 fake image 가 collapse 하는것을 방지하는 regularizer 역할을 한다.
그런데, score 만을 사용하여 one-step generator 을 학습시키는 것은 충분하지 않음. 두가지 측면에서 생각 해 볼 수 있는데 1) Practically, 매우 작은 noise level 에서는 score 이 reliable 하지 않아짐 2) Theoretically, \(\nabla_x \log p_(x)\) 는 \(p(x)\) 의 scale 에 영향을 받지 않아, 데이터의 높고 낮음에 대한 정보를 줄 수 없음.
+
따라서, real + fake score 로 학습이 진행된다면, 낮은 real score 을 보이는 영역은 커버하지 못하는 부분으로 one-step generation 모델이 수렴하게 될 것 이고, high dimension 에서는 generated image 의 pixel level accuracy 에 문제가 생길 수 있음.
+
여기서 저자들은 pixel-wise MSE (regression loss) 를 사용하여 간단히 이 문제를 해결함.
Fig. 582 The effect of real and fake scores and regression loss#
+
+
+
+
그렇다면, Regression loss 하나만으로는 학습이 왜 불가능한가? (개인적 생각)
+
이론상 regression loss 만을 사용해도 충분히 one-step generator 을 학습시킬 수 있어 보인다. 그러나, regression 의 근본적 문제점은 distribution to distribution matching 이 아니라는 점이다. e.g.
+
+
+
Regression loss 를 얻기 위해서는 (noise, real image) pair 가 필요하게 되는데, 저자들은 학습된 diffusion model 에서부터 ODE solver 을 사용하여 gaussian noise와 real image 사이에 쌍을 얻어서 데이터셋을 학습 이전에 구축, 해당 pair들을 바탕으로 regression loss 를 구함 (Learned Perceptual Image Patch Similarity).
Diffusion model 이 ImageNet generation task 에서 기존 BigGAN-deep 그리고 VQ-VAE-2 모델보다 FID/CAS score 기준으로 더 좋은 성능을 보여주며 많은 각광을 받고 있습니다. 그러나 sampling 속도가 느리다는 치명적인 단점을 가지고 있습니다.
-
이를 해결하기 위해, 논문에서는 Progressive Distillation 기법을 소개하게 됩니다. 간략히 설명하자면 사전학습된 \(N\)-step DDIM 모델을 \(N/2\)-step student 모델에 distillation 하는 과정을 반복하여 최종적으로 4 steps 만으로도 state-of-the-art 모델을 수천번의 sampling steps 를 거쳐 생성한 이미지들과 유사한 모델 성능을 보여준다고 합니다.
-
-
-
2. Background - Diffusion model in continuous time#
Continuous 한 time domain 에서의 diffusion model 을 다음과 같은 요소들로 정의합니다.
-
-
Training data \(x \sim p(x)\)
-
Latent variables \(z = \{z_t | t \in [0,1]\}\)
-
-
여기서 \(z_t\) 는 differentiable 한 noise schedule functions \(\alpha_t, \sigma_t\) 로 값이 정의되고, 이 함수들은 log signal-to-noise-ratio\(\lambda_t = \log[\alpha_t^2/\sigma_t^2]\) 가 monotonically decreasing 하도록 설정됩니다. 그리고 이들을 기반으로 다음과 같은 Markovian forward process 를 정의합니다.
Diffusion model 의 objective 는 \(\hat{x}_{\theta}(z_t)\) 모델에서 \(z_t \sim q(z_t | x)\) 와 \(\lambda_t\) 를 입력받아 다음과 같이 Mean Squared Error Loss 를 최소화하는 방향으로 원본 이미지 \(x\) 를 예측하는 것입니다. 이때, \(w(\lambda_t)\) 를 weighting function 이라 부릅니다.
다시 말해 \(z_1 \sim N(0,I)\) 로부터 이미지 \(x\) 를 생성하는 task 를 위와 같이 ODE solver 문제로 해석할 수 있고, Euler rule 이나 Runge-Kutta method 등의 전통적인 ODE integrator 보다 DDIM sampler 를 적용했을때 성능이 가장 좋다고 논문에서 제시합니다. 아래 사진은 다양한 Probabiltity Flow ODE solver 들의 128x128 ImageNet 데이터셋 FID 성능을 비교한 결과입니다.
-
-
-
-
Fig. 405 FID scores on 128 × 128 ImageNet for various probability flow ODE integrators#
-
-
-
참고로 DDIM sampler 를 ODE solver 문제로 해석하면 다음과 같이 표현할 수 있고, 이 수식은 앞으로 자주 보게 될 예정입니다.
Standard diffusion training 기법으로 Teacher Diffusion Model 학습
-
Student Model 정의 - Teacher Model 로부터 모델 구조 및 parameter 복사
-
Student Model 학습
-
-
이때, original data \(x\) 대신에 \(\tilde{x}\) 를 target 로 student model 을 학습합니다. \(\tilde{x}\) 에 대한 공식은 아래 pseudocode 에 소개되는데, 이는 one-step student sample \(\tilde{z}_{t''}\) 과 two-step teacher sample \(z_{t''}\) 를 일치시키기 위해 나온 공식입니다.
-
2 DDIM steps of teacher model 결과와 1 DDIM step of student model 결과를 일치시키는 것이 핵심입니다. 여기서 \(z_t\) 에서 \(z_{t-1/N}\) 로 넘어가는 과정을 1 DDIM step 라 정의하고, \(N\) 은 총 진행되는 student sampling steps 입니다.
-
기존 denoising model 학습 시, \(x\) 가 \(z_t\) 에 대해 deterministic 하지 않기 때문에 (다른 \(x\) 값들에 대해 동일한 \(z_t\) 생성 가능) 모델은 사실상 \(x\) 가 아닌 weighted average of possible \(x\) values 를 예측하는 모델이라고 합니다. 따라서, \(z_t\)에 대해 deterministic 한 \(\tilde{x}(z_t)\) 를 예측하도록 학습한 student model 은 teacher model 보다 더 sharp 한 prediction 을 할 수 있다고 주장합니다.
-
-
-
Student Model 이 새로운 Teacher Model 이 되고 sampling steps \(N\) → \(N/2\) 로 줄어드는 이 과정을 계속 반복
-
-
이에 대한 pseudocode 도 확인해보겠습니다.
-
-
PseudoCode
-
-
-
-
Fig. 408 Pseudocode for Progresssive Distillation#
-
-
-
-
-
-
-
4. Diffusion Model Parameterization and Training Loss#
-
이제 denoising model \(\hat{x}_{\theta}\) 와 reconstruction loss weight \(w(\lambda_t)\) 에 대한 설정값에 대해 자세히 알아보겠습니다. 우선, 논문에서는 일반성을 잃지 않고 (without loss of generalization) variance-preserving diffusion process (i.e., \(\alpha_t^2 + \sigma_t^2 = 1\) ) 라는 가정을 하게 됩니다. 더 자세하게는 cosine schedule \(\alpha_t = cos(0.5\pi t)\) 를 사용합니다.
-
DDPM 을 비롯한 대다수의 논문에서 이미지 \(x\) 가 아닌 noise \(\epsilon\) 를 예측하는 denoising model \(\hat{\epsilon}_{\theta}(z_t)\) 를 정의합니다. \(\epsilon\)-space 에 정의된 손실함수에 \(\hat{x_{\theta}}(z_t) = \frac{1}{\alpha_t}(z_t - \sigma_t \hat{\epsilon}_{\theta}(z_t))\) 식을 대입해보겠습니다.
-
-
-
-
Fig. 409 Training loss on \(\epsilon\)-space and \(x\)-space#
-
-
-
따라서, 이는 이미지 \(x\) domain 에서 weighted reconstruction loss 를 적용하는 것과 동일하며 이때 weighting function \(w(\lambda_t) = exp(\lambda_t), \lambda_t = \log[\alpha_t^2/\sigma_t^2]\) 로 정의할 수 있습니다. 그러나 이러한 standard training procedure 는 progressive distillation 에 적합하지 않다고 주장합니다.
-
Standard diffusion training 기법에서는 다양한 범위 내에서의 signal-to-noise ratio \(\alpha_t^2/\sigma_t^2\) 에서 모델이 학습되지만, distillation 이 진행될수록 이 signal-to-noise ratio 가 감소한다는 단점을 확인하게 됩니다. 더 자세히 설명하자면, \(t\) 가 증가할수록 signal-to-noise-ratio \(\alpha_t^2/\sigma_t^2\) 는 0 에 가까워지게 되고, \(\hat{x_{\theta}}(z_t) = \frac{1}{\alpha_t}(z_t - \sigma_t \hat{\epsilon}_{\theta}(z_t))\) 에서 \(\alpha_t \rightarrow 0\) 이므로 \(\hat{\epsilon}_{\theta}(z_t)\) 에 대한 \(x\)-prediction 변화량이 점차적으로 커지게 됩니다. 이는 여러번의 training step 을 거칠 때 상관없지만, sampling steps 가 줄어들수록 치명적이게 됩니다. 최종적으로 sampling steps=1 일 때까지 progressively distillation 을 적용하면 모델의 입력으로는 단순한 pure noise \(\epsilon\) (i.e., \(\alpha_t = 0, \sigma_t = 1\) ) 이 들어가게 되고, \(\epsilon\)-prediction 과 \(x\)-prediction 의 상관관계가 완전히 사라지게 됩니다. 이는 위 loss function 에서 weighting function \(w(\lambda_t) = 0\) 인 부분에서 확인할 수 있습니다.
-
그래서 논문에서는 다음과 같은 세가지 방법으로 stable 한 \(\hat{x}_{\theta}(z_t)\) prediction 을 구할 수 있는 방법들을 제시합니다.
논문에서 32x32 부터 128x128 까지 다양한 resolution 에서 모델 성능을 확인했습니다. 또한, cosine schedule \(\alpha_t = cos(0.5 \pi t)\) 그리고 DDPM 에서 소개한 U-Net 아키텍쳐를 사용했으며 부가적으로 Nichol & Dhariwal (2021), Song et al. (2021c) 에서 사용된 BigGAN-style up/downsampling 기법을 활용했습니다.
아래 지표는 unconditional CIFAR-10 데이터셋에 앞써 소개드린 \(\epsilon\)-prediction 외에 다른 세 가지 parametrization 기법들로 original diffusion model 의 FID 와 Inception Score 성능을 확인해본 결과입니다.
-
-
-
-
Fig. 413 Ablation Study on Parameterizations and Loss Weightings#
-
-
-
성능을 비교해본 결과 \(v\)-prediction/\(x\)-prediction 과 Truncated SNR loss function 을 사용했을때 성능이 가장 좋은 부분을 확인할 수 있습니다. 또한, \(\epsilon\)-prediction 과 Truncated SNR loss function 의 조합을 사용하여 학습 시, unstable 한 convergence 를 보이는 현상도 볼 수 있습니다.
-
위 실험결과를 바탕으로 progressive distillation 진행시 CIFAR-10 데이터셋에는 \(x\)-prediction, 그 외 데이터셋에서는 \((x,\epsilon)\)-prediction 을 사용했다고 합니다. 더 자세한 hyperparameter setting 은 Appendix E 참조하시면 됩니다.
논문에서 CIFAR-10, 64x64 downsampled ImageNet, 128 × 128 LSUN bedrooms, 그리고 128 × 128 LSUN Church-Outdoor 데이터셋에 progressive distillation 을 적용하여 모델 성능을 측정합니다. CIFAR-10 데이터셋 기준으로 teacher model 로부터 progressive distillation 진행 시 8192 steps 부터 시작하였고 batch size=128 로 설정하였습니다. 그 외 resolution 이 큰 데이터셋에 대해서는 1024 steps 부터 시작하고 batch size=2048 로 실험을 진행했습니다. 또한, 매 iteration 마다 \(10^{-4}\) 에서 \(0\) 으로 learning rate 를 linearly anneal 했다고 합니다.
-
FID 성능을 확인해본 결과, 실험을 진행한 모든 4개의 데이터셋에 대해 progressive distillation 을 통해 4-8 sampling steps 만 진행해도 undistilled DDIM 그리고 stochastic sampler 에 준하는 성능을 보여주는 것을 확인할 수 있습니다. 4 sampling steps 까지 progressive distillation 진행하면서 발생하는 computational cost 가 baseline 모델 학습하는 것과 비슷한 부분을 생각했을때 엄청난 장점이라고 생각합니다.
-
-
-
-
Fig. 414 Comparison between Distilled, DDIM, and Stochastic Sampler#
-
-
-
추가적으로 CIFAR-10 데이터셋에서 타 fast sampling method 들과 FID 성능을 비교해본 결과입니다.
그리고 64x64 ImageNet 데이터셋에 distilled 모델로 생성한 예시 이미지들입니다. 동일한 seed 에 대해서 input noise 로부터 output image 까지 mapping 이 잘되는 부분을 확인할 수 있습니다.
-
-
-
-
Fig. 416 Random samples from distilled 64 × 64 ImageNet models#
-
-
-
마지막으로 distillation scheduling 에 대한 ablation study 도 논문에서 진행했습니다. 첫번째 ablation study 로는 매 distillation iteration 마다 parameter update 횟수를 \(50k\) 에서 \(25k, 10k, 5k\) 로 점차 줄이면서 FID 성능을 비교해보고, 두번째 ablation study 로는 매 distillation iteration 마다 sampling step 을 2배 대신에 4배씩 줄여가면서 student model 을 학습하여 성능을 비교합니다. 그 결과 parameter update 횟수를 현저히 줄임에도 불구하고 FID 성능이 크게 줄지 않는 반면, 각 iteration 마다 sampling step 을 4배씩 줄이는 학습방식으로는 모델 성능이 좋지 못한 부분을 확인할 수 있습니다.
-
-
-
-
Fig. 417 Ablation study on fast sampling schedule#
-
-
-
동일하게 CIFAR-10 외 ImageNet 그리고 LSUN 데이터셋에서 fast sampling schedule 을 적용한 성능 결과도 공유합니다.
-
-
-
-
Fig. 418 50k updates vs 10k updates on ImageNet/LSUN datasets#
Diffusion model 이 ImageNet generation task 에서 기존 BigGAN-deep 그리고 VQ-VAE-2 모델보다 FID/CAS score 기준으로 더 좋은 성능을 보여주며 많은 각광을 받고 있습니다. 그러나 sampling 속도가 느리다는 치명적인 단점을 가지고 있습니다.
+
이를 해결하기 위해, 논문에서는 Progressive Distillation 기법을 소개하게 됩니다. 간략히 설명하자면 사전학습된 \(N\)-step DDIM 모델을 \(N/2\)-step student 모델에 distillation 하는 과정을 반복하여 최종적으로 4 steps 만으로도 state-of-the-art 모델을 수천번의 sampling steps 를 거쳐 생성한 이미지들과 유사한 모델 성능을 보여준다고 합니다.
+
+
+
2. Background - Diffusion model in continuous time#
Continuous 한 time domain 에서의 diffusion model 을 다음과 같은 요소들로 정의합니다.
+
+
Training data \(x \sim p(x)\)
+
Latent variables \(z = \{z_t | t \in [0,1]\}\)
+
+
여기서 \(z_t\) 는 differentiable 한 noise schedule functions \(\alpha_t, \sigma_t\) 로 값이 정의되고, 이 함수들은 log signal-to-noise-ratio\(\lambda_t = \log[\alpha_t^2/\sigma_t^2]\) 가 monotonically decreasing 하도록 설정됩니다. 그리고 이들을 기반으로 다음과 같은 Markovian forward process 를 정의합니다.
Diffusion model 의 objective 는 \(\hat{x}_{\theta}(z_t)\) 모델에서 \(z_t \sim q(z_t | x)\) 와 \(\lambda_t\) 를 입력받아 다음과 같이 Mean Squared Error Loss 를 최소화하는 방향으로 원본 이미지 \(x\) 를 예측하는 것입니다. 이때, \(w(\lambda_t)\) 를 weighting function 이라 부릅니다.
다시 말해 \(z_1 \sim N(0,I)\) 로부터 이미지 \(x\) 를 생성하는 task 를 위와 같이 ODE solver 문제로 해석할 수 있고, Euler rule 이나 Runge-Kutta method 등의 전통적인 ODE integrator 보다 DDIM sampler 를 적용했을때 성능이 가장 좋다고 논문에서 제시합니다. 아래 사진은 다양한 Probabiltity Flow ODE solver 들의 128x128 ImageNet 데이터셋 FID 성능을 비교한 결과입니다.
+
+
+
+
Fig. 405 FID scores on 128 × 128 ImageNet for various probability flow ODE integrators#
+
+
+
참고로 DDIM sampler 를 ODE solver 문제로 해석하면 다음과 같이 표현할 수 있고, 이 수식은 앞으로 자주 보게 될 예정입니다.
Standard diffusion training 기법으로 Teacher Diffusion Model 학습
+
Student Model 정의 - Teacher Model 로부터 모델 구조 및 parameter 복사
+
Student Model 학습
+
+
이때, original data \(x\) 대신에 \(\tilde{x}\) 를 target 로 student model 을 학습합니다. \(\tilde{x}\) 에 대한 공식은 아래 pseudocode 에 소개되는데, 이는 one-step student sample \(\tilde{z}_{t''}\) 과 two-step teacher sample \(z_{t''}\) 를 일치시키기 위해 나온 공식입니다.
+
2 DDIM steps of teacher model 결과와 1 DDIM step of student model 결과를 일치시키는 것이 핵심입니다. 여기서 \(z_t\) 에서 \(z_{t-1/N}\) 로 넘어가는 과정을 1 DDIM step 라 정의하고, \(N\) 은 총 진행되는 student sampling steps 입니다.
+
기존 denoising model 학습 시, \(x\) 가 \(z_t\) 에 대해 deterministic 하지 않기 때문에 (다른 \(x\) 값들에 대해 동일한 \(z_t\) 생성 가능) 모델은 사실상 \(x\) 가 아닌 weighted average of possible \(x\) values 를 예측하는 모델이라고 합니다. 따라서, \(z_t\)에 대해 deterministic 한 \(\tilde{x}(z_t)\) 를 예측하도록 학습한 student model 은 teacher model 보다 더 sharp 한 prediction 을 할 수 있다고 주장합니다.
+
+
+
Student Model 이 새로운 Teacher Model 이 되고 sampling steps \(N\) → \(N/2\) 로 줄어드는 이 과정을 계속 반복
+
+
이에 대한 pseudocode 도 확인해보겠습니다.
+
+
PseudoCode
+
+
+
+
Fig. 408 Pseudocode for Progresssive Distillation#
+
+
+
+
+
+
+
4. Diffusion Model Parameterization and Training Loss#
+
이제 denoising model \(\hat{x}_{\theta}\) 와 reconstruction loss weight \(w(\lambda_t)\) 에 대한 설정값에 대해 자세히 알아보겠습니다. 우선, 논문에서는 일반성을 잃지 않고 (without loss of generalization) variance-preserving diffusion process (i.e., \(\alpha_t^2 + \sigma_t^2 = 1\) ) 라는 가정을 하게 됩니다. 더 자세하게는 cosine schedule \(\alpha_t = cos(0.5\pi t)\) 를 사용합니다.
+
DDPM 을 비롯한 대다수의 논문에서 이미지 \(x\) 가 아닌 noise \(\epsilon\) 를 예측하는 denoising model \(\hat{\epsilon}_{\theta}(z_t)\) 를 정의합니다. \(\epsilon\)-space 에 정의된 손실함수에 \(\hat{x_{\theta}}(z_t) = \frac{1}{\alpha_t}(z_t - \sigma_t \hat{\epsilon}_{\theta}(z_t))\) 식을 대입해보겠습니다.
+
+
+
+
Fig. 409 Training loss on \(\epsilon\)-space and \(x\)-space#
+
+
+
따라서, 이는 이미지 \(x\) domain 에서 weighted reconstruction loss 를 적용하는 것과 동일하며 이때 weighting function \(w(\lambda_t) = exp(\lambda_t), \lambda_t = \log[\alpha_t^2/\sigma_t^2]\) 로 정의할 수 있습니다. 그러나 이러한 standard training procedure 는 progressive distillation 에 적합하지 않다고 주장합니다.
+
Standard diffusion training 기법에서는 다양한 범위 내에서의 signal-to-noise ratio \(\alpha_t^2/\sigma_t^2\) 에서 모델이 학습되지만, distillation 이 진행될수록 이 signal-to-noise ratio 가 감소한다는 단점을 확인하게 됩니다. 더 자세히 설명하자면, \(t\) 가 증가할수록 signal-to-noise-ratio \(\alpha_t^2/\sigma_t^2\) 는 0 에 가까워지게 되고, \(\hat{x_{\theta}}(z_t) = \frac{1}{\alpha_t}(z_t - \sigma_t \hat{\epsilon}_{\theta}(z_t))\) 에서 \(\alpha_t \rightarrow 0\) 이므로 \(\hat{\epsilon}_{\theta}(z_t)\) 에 대한 \(x\)-prediction 변화량이 점차적으로 커지게 됩니다. 이는 여러번의 training step 을 거칠 때 상관없지만, sampling steps 가 줄어들수록 치명적이게 됩니다. 최종적으로 sampling steps=1 일 때까지 progressively distillation 을 적용하면 모델의 입력으로는 단순한 pure noise \(\epsilon\) (i.e., \(\alpha_t = 0, \sigma_t = 1\) ) 이 들어가게 되고, \(\epsilon\)-prediction 과 \(x\)-prediction 의 상관관계가 완전히 사라지게 됩니다. 이는 위 loss function 에서 weighting function \(w(\lambda_t) = 0\) 인 부분에서 확인할 수 있습니다.
+
그래서 논문에서는 다음과 같은 세가지 방법으로 stable 한 \(\hat{x}_{\theta}(z_t)\) prediction 을 구할 수 있는 방법들을 제시합니다.
논문에서 32x32 부터 128x128 까지 다양한 resolution 에서 모델 성능을 확인했습니다. 또한, cosine schedule \(\alpha_t = cos(0.5 \pi t)\) 그리고 DDPM 에서 소개한 U-Net 아키텍쳐를 사용했으며 부가적으로 Nichol & Dhariwal (2021), Song et al. (2021c) 에서 사용된 BigGAN-style up/downsampling 기법을 활용했습니다.
아래 지표는 unconditional CIFAR-10 데이터셋에 앞써 소개드린 \(\epsilon\)-prediction 외에 다른 세 가지 parametrization 기법들로 original diffusion model 의 FID 와 Inception Score 성능을 확인해본 결과입니다.
+
+
+
+
Fig. 413 Ablation Study on Parameterizations and Loss Weightings#
+
+
+
성능을 비교해본 결과 \(v\)-prediction/\(x\)-prediction 과 Truncated SNR loss function 을 사용했을때 성능이 가장 좋은 부분을 확인할 수 있습니다. 또한, \(\epsilon\)-prediction 과 Truncated SNR loss function 의 조합을 사용하여 학습 시, unstable 한 convergence 를 보이는 현상도 볼 수 있습니다.
+
위 실험결과를 바탕으로 progressive distillation 진행시 CIFAR-10 데이터셋에는 \(x\)-prediction, 그 외 데이터셋에서는 \((x,\epsilon)\)-prediction 을 사용했다고 합니다. 더 자세한 hyperparameter setting 은 Appendix E 참조하시면 됩니다.
논문에서 CIFAR-10, 64x64 downsampled ImageNet, 128 × 128 LSUN bedrooms, 그리고 128 × 128 LSUN Church-Outdoor 데이터셋에 progressive distillation 을 적용하여 모델 성능을 측정합니다. CIFAR-10 데이터셋 기준으로 teacher model 로부터 progressive distillation 진행 시 8192 steps 부터 시작하였고 batch size=128 로 설정하였습니다. 그 외 resolution 이 큰 데이터셋에 대해서는 1024 steps 부터 시작하고 batch size=2048 로 실험을 진행했습니다. 또한, 매 iteration 마다 \(10^{-4}\) 에서 \(0\) 으로 learning rate 를 linearly anneal 했다고 합니다.
+
FID 성능을 확인해본 결과, 실험을 진행한 모든 4개의 데이터셋에 대해 progressive distillation 을 통해 4-8 sampling steps 만 진행해도 undistilled DDIM 그리고 stochastic sampler 에 준하는 성능을 보여주는 것을 확인할 수 있습니다. 4 sampling steps 까지 progressive distillation 진행하면서 발생하는 computational cost 가 baseline 모델 학습하는 것과 비슷한 부분을 생각했을때 엄청난 장점이라고 생각합니다.
+
+
+
+
Fig. 414 Comparison between Distilled, DDIM, and Stochastic Sampler#
+
+
+
추가적으로 CIFAR-10 데이터셋에서 타 fast sampling method 들과 FID 성능을 비교해본 결과입니다.
그리고 64x64 ImageNet 데이터셋에 distilled 모델로 생성한 예시 이미지들입니다. 동일한 seed 에 대해서 input noise 로부터 output image 까지 mapping 이 잘되는 부분을 확인할 수 있습니다.
+
+
+
+
Fig. 416 Random samples from distilled 64 × 64 ImageNet models#
+
+
+
마지막으로 distillation scheduling 에 대한 ablation study 도 논문에서 진행했습니다. 첫번째 ablation study 로는 매 distillation iteration 마다 parameter update 횟수를 \(50k\) 에서 \(25k, 10k, 5k\) 로 점차 줄이면서 FID 성능을 비교해보고, 두번째 ablation study 로는 매 distillation iteration 마다 sampling step 을 2배 대신에 4배씩 줄여가면서 student model 을 학습하여 성능을 비교합니다. 그 결과 parameter update 횟수를 현저히 줄임에도 불구하고 FID 성능이 크게 줄지 않는 반면, 각 iteration 마다 sampling step 을 4배씩 줄이는 학습방식으로는 모델 성능이 좋지 못한 부분을 확인할 수 있습니다.
+
+
+
+
Fig. 417 Ablation study on fast sampling schedule#
+
+
+
동일하게 CIFAR-10 외 ImageNet 그리고 LSUN 데이터셋에서 fast sampling schedule 을 적용한 성능 결과도 공유합니다.
+
+
+
+
Fig. 418 50k updates vs 10k updates on ImageNet/LSUN datasets#
이번 시간에는 Tencent ARC Lab 에서 소개하는 T2I-Adapter 모델에 대해 알아볼 예정입니다.
-
Stable Diffusion 을 비롯한 기존의 T2I 모델들이 난해한 prompt (e.g., “A car with flying wings” & “Iron Man with bunny ears”) 을 입력받을 시, 생성되는 이미지 퀄리티가 저하되는 부분을 확인할 수 있는데요. 논문에서는 T2I 모델이 low level (e.g., textures), middle level (e.g., edges), 그리고 high level (e.g., semantics) 에 대한 정보들을 implicit 하게 가지고 있지만, 이를 표현하기 위해서는 text prompt 만으로는 한계가 있고 보다 세밀한 controlling (e.g., color, structure) 이 필요하다고 서술합니다. 즉, T2I 모델의 internal knowledge 와 external guidance 의 alignment 에 대한 추가적인 학습이 필요하다고 주장합니다.
ControlNet 같은 경우에 reverse diffusion process 에서 ControlNet 과 Unet 모두 연산작업이 실행됩니다. 이때 ControlNet 은 Unet Encoder 의 구조를 그대로 가져오기 때문에 parameter size 및 storage 용량이 크고, 이는 이미지 생성하는데 큰 bottleneck 이 됩니다.
-
-
-
Flexible : 다양한 adapter (e.g., color, structure) 학습 가능
-
Composable : Multiple adapter 적용 가능
-
Generalizable : 동일한 구조를 가진 다른 T2I 모델에 동일한 adapter 적용 가능
T2I-Adapter 의 기반이 되는 T2I 모델 Stable Diffusion 모델은 기본적으로 two-stage model 이고, autoencoder 와 Unet denoiser 로 구성되어 있습니다. Autoencoder 를 통해 이미지를 latent space 로 바꾸고 다시 복원하는 역할을 하고, Unet denoiser 는 diffusion process 를 통해 다음과 같은 손실함수를 최소화하는 방향으로 학습하게 됩니다.
\(Z_t = \sqrt{\bar{\alpha}_t}Z_0 + \sqrt{1-\bar{\alpha}_t}\epsilon, \epsilon \sim N(0,I)\) := noised feature map at step t
-
\(C\) := conditional information
-
\(\epsilon_{\theta}\) := UNet denoiser
-
-
Inference 시에는 random Gaussian distribution 을 따르는 \(Z_T\), 그리고 text prompt 를 CLIP text encoder 에 입력함으로써 생성한 token \(y\) 를 cross attention 을 통해 Unet denoiser \(\epsilon_{\theta}\) 에 입력합니다. 최종적으로, diffusion process 로부터 생성된 denoise 된 latent feature 를 decoder 를 통해 최종 이미지를 생성하게 됩니다. 자세한 cross attention 하는 방식은 다음과 같습니다.
Conditional input 은 512x512 의 크기를 가지며, 이는 pixel unshuffle downsampling 을 통해 64x64 이미지로 변환이 되어 1개의 convolution layer 와 2개의 residual block 으로 구성된 scale 을 4번 통과하게 됩니다. 이때, 각 scale 을 거치고 나온 condition feature 를 \(F_c^k\) 라 정의합니다.
-
최종적으로 multi-scale condition feature \(F_c = \{F_c^1, F_c^2, F_c^3, F_c^4\}\) 가 생성되고, 이는 Unet encoder 에서의 intermediate feature \(F_{enc} = \{F_{enc}^1, F_{enc}^2, F_{enc}^3, F_{enc}^4\}\) 와 더해지게 됩니다. 이때, dimension 크기는 동일하도록 설정했기 때문에 덧셈 연산하는데 문제 없습니다.
Adapter 종류로는 크게 structure 에 대한 conditioning 과 color 에 대한 conditioning 으로 분류할 수 있습니다. Structure controlling 으로는 대표적으로 sketch, depth map, semantic segmentation map, keypose 등이 있습니다. Color map 은 이미지를 우선적으로 high bicubic downsampling 을 통해 semantic 및 structural 한 정보를 제외시키고, nearest upsampling 기법으로 다시 원본 이미지 크기로 복원하는 작업을 통해 생성합니다.
-
앞써 설명한 부분처럼 추가 학습 없이 여러 adapter 로 conditioning 할 수도 있습니다. Multi-adapter 로 controlling 할 시, 다음과 같이 각 adapter 로부터 나온 condition feature 에 weight \(w_k\) 를 부여해 최종 condition feature 를 정의하게 됩니다.
Diffusion 모델 학습 시와 동일하게, time embedding 을 adapter 에 input 으로 넣으면서 성능 개선 효과가 있는 것을 확인했지만 매 time step \(t\) 마다 \(F_c\) 를 conditioning 하는 것은 computationally expensive 합니다.
-
따라서, 논문에서는 DDIM inference sampling 을 크게 3가지 stage (i.e., beginning, middle, late stage) 로 분류하는 방법을 소개합니다. 실험해본 결과, middle 그리고 late stage 에 적용하는 것보다 beginning stage 에서 guidance 를 주는 효과가 더 크다고 합니다.
해당 예시들은 다양한 single adapter controlling 에 대한 결과들을 보여줍니다. 특히 인상적인 부분은 sketch 로 controlling 시, sketch 가 정확하지 않아도 이미지 생성에 robust 한 성능을 보여주는 것을 확인할 수 있습니다.
-
-
-
-
Fig. 262 Visualization of Single-Adapter Controlling#
-
-
-
또한, image editing 도 가능합니다. SD inpainting mode 로 특정 지역을 masking 한 후, T2I-Adapter 를 통해 image editing 을 한 예시 사진입니다. Adapter 없이, SD inpainting 만으로는 성능이 좋지 못하다고 합니다.
논문에서는 guidance mode, 그리고 complexity 에 대한 ablation study 를 진행했습니다.
-
SD 모델은 encoder 그리고 decoder 에 각각 4개의 scale (i.e., 64×64, 32×32, 16×16, 8×8) 을 가지고 있는데, 하단 table 처럼 각각 다른 scale 에 adapter guidance 를 적용하면서 FID 성능을 비교했습니다. Scale Number 가 4보다 작을 경우, large scale 에 순차적으로 guidance 를 적용했습니다. 그 결과, Unet encoder 에만 4 scales 모두 guidance 를 적용하는 것이 성능이 제일 좋다고 합니다.
또한, condition map 는 비교적 sparse 하기 때문에 더 경량화된 adapter 를 사용해도 성능이 좋은 부분을 하단 예시처럼 확인할 수 있었다고 합니다. 더 자세하게는, adapter block 의 intermediate channel 숫자를 바꿔가며 adapter-small, adapter-tiny 모델을 각각 x4, x8 compression 작업을 진행했습니다.
이번 시간에는 Tencent ARC Lab 에서 소개하는 T2I-Adapter 모델에 대해 알아볼 예정입니다.
+
Stable Diffusion 을 비롯한 기존의 T2I 모델들이 난해한 prompt (e.g., “A car with flying wings” & “Iron Man with bunny ears”) 을 입력받을 시, 생성되는 이미지 퀄리티가 저하되는 부분을 확인할 수 있는데요. 논문에서는 T2I 모델이 low level (e.g., textures), middle level (e.g., edges), 그리고 high level (e.g., semantics) 에 대한 정보들을 implicit 하게 가지고 있지만, 이를 표현하기 위해서는 text prompt 만으로는 한계가 있고 보다 세밀한 controlling (e.g., color, structure) 이 필요하다고 서술합니다. 즉, T2I 모델의 internal knowledge 와 external guidance 의 alignment 에 대한 추가적인 학습이 필요하다고 주장합니다.
ControlNet 같은 경우에 reverse diffusion process 에서 ControlNet 과 Unet 모두 연산작업이 실행됩니다. 이때 ControlNet 은 Unet Encoder 의 구조를 그대로 가져오기 때문에 parameter size 및 storage 용량이 크고, 이는 이미지 생성하는데 큰 bottleneck 이 됩니다.
+
+
+
Flexible : 다양한 adapter (e.g., color, structure) 학습 가능
+
Composable : Multiple adapter 적용 가능
+
Generalizable : 동일한 구조를 가진 다른 T2I 모델에 동일한 adapter 적용 가능
T2I-Adapter 의 기반이 되는 T2I 모델 Stable Diffusion 모델은 기본적으로 two-stage model 이고, autoencoder 와 Unet denoiser 로 구성되어 있습니다. Autoencoder 를 통해 이미지를 latent space 로 바꾸고 다시 복원하는 역할을 하고, Unet denoiser 는 diffusion process 를 통해 다음과 같은 손실함수를 최소화하는 방향으로 학습하게 됩니다.
\(Z_t = \sqrt{\bar{\alpha}_t}Z_0 + \sqrt{1-\bar{\alpha}_t}\epsilon, \epsilon \sim N(0,I)\) := noised feature map at step t
+
\(C\) := conditional information
+
\(\epsilon_{\theta}\) := UNet denoiser
+
+
Inference 시에는 random Gaussian distribution 을 따르는 \(Z_T\), 그리고 text prompt 를 CLIP text encoder 에 입력함으로써 생성한 token \(y\) 를 cross attention 을 통해 Unet denoiser \(\epsilon_{\theta}\) 에 입력합니다. 최종적으로, diffusion process 로부터 생성된 denoise 된 latent feature 를 decoder 를 통해 최종 이미지를 생성하게 됩니다. 자세한 cross attention 하는 방식은 다음과 같습니다.
Conditional input 은 512x512 의 크기를 가지며, 이는 pixel unshuffle downsampling 을 통해 64x64 이미지로 변환이 되어 1개의 convolution layer 와 2개의 residual block 으로 구성된 scale 을 4번 통과하게 됩니다. 이때, 각 scale 을 거치고 나온 condition feature 를 \(F_c^k\) 라 정의합니다.
+
최종적으로 multi-scale condition feature \(F_c = \{F_c^1, F_c^2, F_c^3, F_c^4\}\) 가 생성되고, 이는 Unet encoder 에서의 intermediate feature \(F_{enc} = \{F_{enc}^1, F_{enc}^2, F_{enc}^3, F_{enc}^4\}\) 와 더해지게 됩니다. 이때, dimension 크기는 동일하도록 설정했기 때문에 덧셈 연산하는데 문제 없습니다.
Adapter 종류로는 크게 structure 에 대한 conditioning 과 color 에 대한 conditioning 으로 분류할 수 있습니다. Structure controlling 으로는 대표적으로 sketch, depth map, semantic segmentation map, keypose 등이 있습니다. Color map 은 이미지를 우선적으로 high bicubic downsampling 을 통해 semantic 및 structural 한 정보를 제외시키고, nearest upsampling 기법으로 다시 원본 이미지 크기로 복원하는 작업을 통해 생성합니다.
+
앞써 설명한 부분처럼 추가 학습 없이 여러 adapter 로 conditioning 할 수도 있습니다. Multi-adapter 로 controlling 할 시, 다음과 같이 각 adapter 로부터 나온 condition feature 에 weight \(w_k\) 를 부여해 최종 condition feature 를 정의하게 됩니다.
Diffusion 모델 학습 시와 동일하게, time embedding 을 adapter 에 input 으로 넣으면서 성능 개선 효과가 있는 것을 확인했지만 매 time step \(t\) 마다 \(F_c\) 를 conditioning 하는 것은 computationally expensive 합니다.
+
따라서, 논문에서는 DDIM inference sampling 을 크게 3가지 stage (i.e., beginning, middle, late stage) 로 분류하는 방법을 소개합니다. 실험해본 결과, middle 그리고 late stage 에 적용하는 것보다 beginning stage 에서 guidance 를 주는 효과가 더 크다고 합니다.
해당 예시들은 다양한 single adapter controlling 에 대한 결과들을 보여줍니다. 특히 인상적인 부분은 sketch 로 controlling 시, sketch 가 정확하지 않아도 이미지 생성에 robust 한 성능을 보여주는 것을 확인할 수 있습니다.
+
+
+
+
Fig. 262 Visualization of Single-Adapter Controlling#
+
+
+
또한, image editing 도 가능합니다. SD inpainting mode 로 특정 지역을 masking 한 후, T2I-Adapter 를 통해 image editing 을 한 예시 사진입니다. Adapter 없이, SD inpainting 만으로는 성능이 좋지 못하다고 합니다.
논문에서는 guidance mode, 그리고 complexity 에 대한 ablation study 를 진행했습니다.
+
SD 모델은 encoder 그리고 decoder 에 각각 4개의 scale (i.e., 64×64, 32×32, 16×16, 8×8) 을 가지고 있는데, 하단 table 처럼 각각 다른 scale 에 adapter guidance 를 적용하면서 FID 성능을 비교했습니다. Scale Number 가 4보다 작을 경우, large scale 에 순차적으로 guidance 를 적용했습니다. 그 결과, Unet encoder 에만 4 scales 모두 guidance 를 적용하는 것이 성능이 제일 좋다고 합니다.
또한, condition map 는 비교적 sparse 하기 때문에 더 경량화된 adapter 를 사용해도 성능이 좋은 부분을 하단 예시처럼 확인할 수 있었다고 합니다. 더 자세하게는, adapter block 의 intermediate channel 숫자를 바꿔가며 adapter-small, adapter-tiny 모델을 각각 x4, x8 compression 작업을 진행했습니다.
“Variational Bayesian (VB) approach involves the optimization of an approximation to the intractable posterior”
-
-
이처럼 Variational Autoencoder 는 논문에서 제시하는 Auto-Encoding Variational Bayes(AEVB) 알고리즘 중 하나로, intractable 한 posterior 분포를 다루기 쉬운 뉴럴 네트워크로 근사함으로써 Variational Inference 를 하게 됩니다.
Variational Autoencoder(VAE) 는 크게 Encoder 와 Decoder 부분으로 이루어져 있습니다. 더 자세하게는, Encoder는 입력 데이터 \(x\) 를 받아서 잠재변수(Latent Variable) \(z\) 를 만들어내고, Decoder 는 잠재변수 \(z\) 를 활용해서 다시 \(x\) 를 복원하게 됩니다.
Variational Autoencoder (VAE) 는 AutoEncoder 와 달리 확률 분포를 이용해 어떤 새로운 데이터를 생성하는 Decoder 부분에 초점을 둡니다. 이때 논문에서 다음과 같은 assumption 들을 내립니다. 첫번째로 \(p_{\theta}(z)\) 와 \(p_{\theta}(x|z)\) 는 parametric 한 distribution 을 가지고 있고, 이는 \(\theta\) 와 \(z\) 에 대해 differentiable 하다는 가정을 내립니다. 이 때, 대표적으로 \(p_{\theta}(z)\) 는 Gaussian distribution 을 따르고 \(p_{\theta}(x|z)\) 는 생성하고자 하는 데이터 성질에 따라 Bernoulli 혹은 Gaussian distribution 을 따르도록 정의합니다. 그리고 \(p_{\theta}(x|z)\) 의 파라미터 \(p\) 혹은 \((\mu, \sigma)\) 는 아래 그림과 같이 뉴럴 네트워크로 구성된 Decoder 로부터 계산이 됩니다.
-
-
-
-
Fig. 2 Overview of Bernoulli(left) and Gaussian(right) Decoder#
-
-
-
이를 기반으로 우리는 ML/MAP estimation 을 통해 marginal likelihood \(p_{\theta}(x)\) 를 최대화시키는 파라미터 \(\theta\) 를 구하는 것이 목적입니다. 하지만, \(p_{\theta}(x) = \int p_{\theta}(z)p_{\theta}(x|z) \ dz\) 는 intractable 하기 때문에 \(p_{\theta}(z|x)\) 를 계산하기 위한 Encoder 가 등장하게 됩니다.
여기서 \(p_{\theta}(z|x)\) 역시 intractable 하기 때문에 이를 잘 근사화하는 뉴럴 네트워크 \(q_{\phi}(z|x)\) 를 정의하게 되고, 이러한 과정을 변분추론(Variational Inference) 라고 합니다. 아래는 Encoder 와 Decoder 를 함께 도식화한 그림입니다. 정리하자면, MLP Encoder 를 통해 계산된 \(\mu\) 와 \(\sigma\) 로 잠재변수 \(z\) 를 생성하게 되고, 이를 기반으로 Decoder 는 원본 이미지와 유사한 데이터를 생성하게 됩니다.
이로써 우리는 marginal likelihood \(p_{\theta}(x)\) 를 최대화시키는 파라미터 \((\theta, \phi)\) 를 찾으면 되고, 이에 대한 lower bound 를 수식적으로 표현하면 손실함수(loss function) 를 다음과 같이 Reconstruction Error 와 Regularization term 로 분할할 수 있습니다.
Reconstruction Error 는 Decoder 에서 생성하는 데이터가 최대한 원본 데이터와 유사하도록 하는 term 이고, Regularization 은 Encoder 에서 만드는 잠재변수의 분포가 저희가 부여한 prior distribution 이랑 가깝도록 설정하는 term 입니다. 이때, Reconstruction Error 는 다음과 같은 Monte Carlo Estimator \(\tilde{\mathcal{L}}^{B}\) 로 근사값을 구할 수 있고, 하나의 sample 을 계산하는 것도 연산량이 많으므로 논문에서는 sample size \(L\) 을 1 로 설정합니다.
Lower bound 에 대한 수식을 변환하여 수식 전체에 대한 Monte Carlo Estimator \(\tilde{\mathcal{L}}^{A}\) 로도 근사값을 구할 수 있는데 이는 평균적으로 \(\tilde{\mathcal{L}}^{B}\) 에 비해 variance 가 높다고 합니다.
논문에서는 모델 학습 시 backpropagation 을 원활히 사용할 수 있도록 reparameterization trick 을 소개합니다. 잠재변수 \(z\) 를 Encoder 에서 나온 \(\mu\) 와 \(\sigma\) 로 직접 샘플링하지 않고, backpropagation 이 가능하도록 Gaussian noise 를 우선적으로 샘플링하고 해당 \(\mu\) 와 \(\sigma\) 를 각각 더하고 곱하게 됩니다. 이는 \(q_{\phi}(z|x)\) 이 Gaussian distribution 을 따른다고 설정했을 때이고, \(q_{\phi}(z|x)\) 에 대해 다른 분포를 가정하여 그에 따른 다른 reparameterization trick 을 시도할 수 있다고 논문에 명시되어 있습니다.
-
하단에는 Gaussian 분포에 대한 reparameterization trick 를 도식화한 그림입니다. 왼쪽에는 reparameterization trick이 적용되지 않은 경우로 \(\mu\) 나 \(\sigma\) 값이 고정되어 있어도 \(\mathcal{N}(\mu,\sigma^2)\) 에서 샘플링하므로 \(z\) 는 랜덤한 값이 되고 loss function 을 \(\mu\) 나 \(\sigma\) 에 대해 미분할 수 없어 backpropagation 을 적용하기가 어렵습니다. 반면에, 오른쪽처럼 reparameterization trick 을 적용하면, \(z\) 가 deterministic 한 형태로 정의되고 \(\mu\) 나 \(\sigma\) 에 대한 변수로도 미분이 가능해지기 때문에 backpropagation 을 활용하여 모델을 학습시킬 수 있습니다.
논문에서는 MNIST 와 Frey Face 데이터셋에 대해 AEVB(Auto-Encoder variational Bayesian)와 wake-sleep 알고리즘를 적용해서 비교합니다. 여기서 Frey Face 데이터셋은 continuous 하므로 Gaussian Decoder 를 사용합니다. 실험결과는 아래 그림과 같습니다.
또한, latent variable \(z\) 의 차원이 작으면 marginal likelihood 를 직접 Monte Carlo EM 을 할용하여 구할 수 있는데, 이에 대한 결과도 논문에서 보여줍니다. Monte Carlo EM 의 경우 학습 데이터가 많으면 수렴이 되지 않는 부분을 확인할 수 있습니다.
AutoEncoder 는 latent space 에 하나의 값으로 지정해줬다면, VAE 는 평균 그리고 분산 파라미터들과 Gaussian 분포를 가진 샘플을 통해 잠재변수를 생성합니다. 그리고 VAE 를 실제로 사용해보면 생성된 데이터 image quality 가 낮다는 단점을 가지고 있다고 합니다.
“Variational Bayesian (VB) approach involves the optimization of an approximation to the intractable posterior”
+
+
이처럼 Variational Autoencoder 는 논문에서 제시하는 Auto-Encoding Variational Bayes(AEVB) 알고리즘 중 하나로, intractable 한 posterior 분포를 다루기 쉬운 뉴럴 네트워크로 근사함으로써 Variational Inference 를 하게 됩니다.
Variational Autoencoder(VAE) 는 크게 Encoder 와 Decoder 부분으로 이루어져 있습니다. 더 자세하게는, Encoder는 입력 데이터 \(x\) 를 받아서 잠재변수(Latent Variable) \(z\) 를 만들어내고, Decoder 는 잠재변수 \(z\) 를 활용해서 다시 \(x\) 를 복원하게 됩니다.
Variational Autoencoder (VAE) 는 AutoEncoder 와 달리 확률 분포를 이용해 어떤 새로운 데이터를 생성하는 Decoder 부분에 초점을 둡니다. 이때 논문에서 다음과 같은 assumption 들을 내립니다. 첫번째로 \(p_{\theta}(z)\) 와 \(p_{\theta}(x|z)\) 는 parametric 한 distribution 을 가지고 있고, 이는 \(\theta\) 와 \(z\) 에 대해 differentiable 하다는 가정을 내립니다. 이 때, 대표적으로 \(p_{\theta}(z)\) 는 Gaussian distribution 을 따르고 \(p_{\theta}(x|z)\) 는 생성하고자 하는 데이터 성질에 따라 Bernoulli 혹은 Gaussian distribution 을 따르도록 정의합니다. 그리고 \(p_{\theta}(x|z)\) 의 파라미터 \(p\) 혹은 \((\mu, \sigma)\) 는 아래 그림과 같이 뉴럴 네트워크로 구성된 Decoder 로부터 계산이 됩니다.
+
+
+
+
Fig. 2 Overview of Bernoulli(left) and Gaussian(right) Decoder#
+
+
+
이를 기반으로 우리는 ML/MAP estimation 을 통해 marginal likelihood \(p_{\theta}(x)\) 를 최대화시키는 파라미터 \(\theta\) 를 구하는 것이 목적입니다. 하지만, \(p_{\theta}(x) = \int p_{\theta}(z)p_{\theta}(x|z) \ dz\) 는 intractable 하기 때문에 \(p_{\theta}(z|x)\) 를 계산하기 위한 Encoder 가 등장하게 됩니다.
여기서 \(p_{\theta}(z|x)\) 역시 intractable 하기 때문에 이를 잘 근사화하는 뉴럴 네트워크 \(q_{\phi}(z|x)\) 를 정의하게 되고, 이러한 과정을 변분추론(Variational Inference) 라고 합니다. 아래는 Encoder 와 Decoder 를 함께 도식화한 그림입니다. 정리하자면, MLP Encoder 를 통해 계산된 \(\mu\) 와 \(\sigma\) 로 잠재변수 \(z\) 를 생성하게 되고, 이를 기반으로 Decoder 는 원본 이미지와 유사한 데이터를 생성하게 됩니다.
이로써 우리는 marginal likelihood \(p_{\theta}(x)\) 를 최대화시키는 파라미터 \((\theta, \phi)\) 를 찾으면 되고, 이에 대한 lower bound 를 수식적으로 표현하면 손실함수(loss function) 를 다음과 같이 Reconstruction Error 와 Regularization term 로 분할할 수 있습니다.
Reconstruction Error 는 Decoder 에서 생성하는 데이터가 최대한 원본 데이터와 유사하도록 하는 term 이고, Regularization 은 Encoder 에서 만드는 잠재변수의 분포가 저희가 부여한 prior distribution 이랑 가깝도록 설정하는 term 입니다. 이때, Reconstruction Error 는 다음과 같은 Monte Carlo Estimator \(\tilde{\mathcal{L}}^{B}\) 로 근사값을 구할 수 있고, 하나의 sample 을 계산하는 것도 연산량이 많으므로 논문에서는 sample size \(L\) 을 1 로 설정합니다.
Lower bound 에 대한 수식을 변환하여 수식 전체에 대한 Monte Carlo Estimator \(\tilde{\mathcal{L}}^{A}\) 로도 근사값을 구할 수 있는데 이는 평균적으로 \(\tilde{\mathcal{L}}^{B}\) 에 비해 variance 가 높다고 합니다.
논문에서는 모델 학습 시 backpropagation 을 원활히 사용할 수 있도록 reparameterization trick 을 소개합니다. 잠재변수 \(z\) 를 Encoder 에서 나온 \(\mu\) 와 \(\sigma\) 로 직접 샘플링하지 않고, backpropagation 이 가능하도록 Gaussian noise 를 우선적으로 샘플링하고 해당 \(\mu\) 와 \(\sigma\) 를 각각 더하고 곱하게 됩니다. 이는 \(q_{\phi}(z|x)\) 이 Gaussian distribution 을 따른다고 설정했을 때이고, \(q_{\phi}(z|x)\) 에 대해 다른 분포를 가정하여 그에 따른 다른 reparameterization trick 을 시도할 수 있다고 논문에 명시되어 있습니다.
+
하단에는 Gaussian 분포에 대한 reparameterization trick 를 도식화한 그림입니다. 왼쪽에는 reparameterization trick이 적용되지 않은 경우로 \(\mu\) 나 \(\sigma\) 값이 고정되어 있어도 \(\mathcal{N}(\mu,\sigma^2)\) 에서 샘플링하므로 \(z\) 는 랜덤한 값이 되고 loss function 을 \(\mu\) 나 \(\sigma\) 에 대해 미분할 수 없어 backpropagation 을 적용하기가 어렵습니다. 반면에, 오른쪽처럼 reparameterization trick 을 적용하면, \(z\) 가 deterministic 한 형태로 정의되고 \(\mu\) 나 \(\sigma\) 에 대한 변수로도 미분이 가능해지기 때문에 backpropagation 을 활용하여 모델을 학습시킬 수 있습니다.
논문에서는 MNIST 와 Frey Face 데이터셋에 대해 AEVB(Auto-Encoder variational Bayesian)와 wake-sleep 알고리즘를 적용해서 비교합니다. 여기서 Frey Face 데이터셋은 continuous 하므로 Gaussian Decoder 를 사용합니다. 실험결과는 아래 그림과 같습니다.
또한, latent variable \(z\) 의 차원이 작으면 marginal likelihood 를 직접 Monte Carlo EM 을 할용하여 구할 수 있는데, 이에 대한 결과도 논문에서 보여줍니다. Monte Carlo EM 의 경우 학습 데이터가 많으면 수렴이 되지 않는 부분을 확인할 수 있습니다.
AutoEncoder 는 latent space 에 하나의 값으로 지정해줬다면, VAE 는 평균 그리고 분산 파라미터들과 Gaussian 분포를 가진 샘플을 통해 잠재변수를 생성합니다. 그리고 VAE 를 실제로 사용해보면 생성된 데이터 image quality 가 낮다는 단점을 가지고 있다고 합니다.
Fig. 742 High-quality, consistent multi-view 3D images from Zero123++#
+
+
+
Zero-1-to-3(Zero123) 논문이 zero-shot 형태로 single-image-to-3D conversion 을 하는 기법을 처음으로 소개하였습니다. 하지만 해당 방식으로는 주어진 view 에 대해서 독립적으로 객체를 생성하게 됨으로써 multi-view consistency 에서 부족한 부분을 보여주게 된다고 설명합니다. Zero123++ 논문에서 이를 해결하기 위해 여섯개의 view 로부터 하나의 이미지를 생성하여 multi-view 에 대한 joint distirbution 을 학습할 수 있도록 설정합니다.
+
또한, Zero-1-to-3 논문에서 다음과 같은 한계점이 있다고 제시합니다.
+
a) 첫번째로 global 및 local conditioning mechanism 을 비롯한 Stable Diffusion model prior 를 효율적으로 사용하지 않았고,
+
b) 두번째로 Zero-1-to-3 논문에서 512x512 이미지 해상도로 학습 시 불안정하게 수렴하게 되어 256x256 해상도로 줄인 부분에 대해 논문 저자는 원인을 분석하며 새로운 scheduling 기법을 소개합니다.
Zero-1-to-3 모델은 단일 이미지를 독립적으로 생성하며 multi-view 이미지에 대한 상관관계를 학습 혹은 생성 시에 고려하지 않습니다. 따라서, Zero123++에서는 3×2 layout 의 6개 이미지를 단일 프레임으로 tiling 하여 multiple image 에 대한 joint distribution 을 학습하게 됩니다.
+
Objaverse 데이터셋은 기본적으로 gravity axis 은 동일하지만 객체들이 일관된 canonical pose 를 가지고 있지 않습니다. 따라서 절대적인 camera pose 를 기반으로 해당 데이터셋을 학습하게 되면 객체의 orientation 을 학습하는데 어려움이 있다고 주장합니다.
+
반면에 Zero-1-to-3 는 input view 에 대한 상대적인 camera pose(elevation/azimuth angle) 을 입력받아 학습하였습니다. 그러나 해당 방식을 활용한다면 novel view 에 대한 relative pose 를 구하기 위해서는 input view 에 대한 elevation angle 을 사전에 알아야 한다는 단점이 있습니다. 후속적으로 One-2-3-45 그리고 DreamGaussian 논문에서 elevation angle 을 추가적으로 예측하는 모듈을 정의하고, 이에 따라 오차율도 증가하게 됩니다.
Stable Diffusion 모델에서 사용되었던 scaled-linear schedule 은 local detail 을 학습하는데 초점을 두고 Signal-to-Noise Ratio (SNR) 가 낮은 timestep 이 극히 드뭅니다. SNR 이 낮은 구간에서 global low frequency 정보들을 학습하게 되며 해당 단계에서 step 수가 적으면 구조적인 변형이 클 수가 있습니다. 따라서, 이러한 scheduling 은 단일 이미지를 생성하는데는 유용하지만 multi-view consistent 한 이미지를 생성하는데 한계가 있다고 주장합니다.
또한, 동일한 noise 가 주입되었을때 고해상도 이미지가 저해상도 이미지에 비해 noise level 이 적기 때문에, Zero-1-to-3 모델에서 고해상도 이미지를 학습하였을 때 불안정한 모습을 보여주었던 것도 동일한 원인 때문이라고 설명합니다.
+
Zero123++ 에서는 scaled-linear schedule 대신에 linear schedule 를 사용하게 되고, 변화된 schedule 에 따라 \(x\)-prediction, \(\epsilon\)-prediction 모델보다 \(v\)-prediction 모델이 더 안정적으로 학습되었다고 합니다. 따라서, Stable Diffusion 2 \(v\)-prediction 모델로 fine-tuning 을 진행하였다고 합니다.
기존에 Zero-1-to-3 논문에서 noisy input 과 conditioned image(single-view input) 가 feature-wise concatenate 하는데 해당 방식으로는 pixel-wise spatial correspondence 가 정확하지 않다고 합니다.
+
Zero123++ 에서는 이 부분을 보완하여 Reference Attention 이라는 기법을 소개합니다. Reference Attention 이란, 아래 그림과 같이 noisy latent 와 conditioned latent 간에 self-attention 모듈에서의 key, value 값을 추가하여 연산 작업을 진행합니다. 이때, noisy input 에 주입된 noise 를 동일하게 conditioned image 에 적용하였다고 합니다.
Reference Attention 기법을 적용한 결과, fine-tuning 작업을 진행하지 않아도 reference image 에서의 semantic content 와 texture 가 잘 반영되었습니다. 또한, fine-tuning 을 하였을때 reference latent 을 5x scaling 하였을때 reference image 와의 일관성을 가장 잘 보여주었다고 합니다.
Zero123++ 논문에서 추가적으로 FlexDiffuse 에서 소개한 linear guidance mechanism 을 활용하여 fine-tuning 범위를 최소화하는 선에서 global image conditioning 하였습니다.
+
더 자세하게는, \(L \times D\) 차원의 prompt embedding \(T\) 와 \(D\) 차원의 CLIP global image embedding \(I\) 에 global weight \(w_i\) 를 곱한 값을 더하여 모델에 입력합니다. 이때, \(L\) 은 token length 이고 \(D\) 는 token embedding 의 차원 크기입니다. 이때, \(w_i = \frac{i}{L}\) 로 초기 가중치 값을 설정하였습니다. Text condition 이 없을 경우에는 empty prompt 를 encoding 하여 \(T\) 를 얻게 됩니다.
정리하자면 해당 논문은 Stable Diffusion 2 \(v\)-model 을 사용하였고, Objaverse 데이터를 random HDRI environment lighting 를 적용하여 렌더링한 데이터에 학습하였습니다. 그리고 Stable Diffusion Image Variations model 의 학습 방식을 도입하여 two-stage 로 학습을 진행하였습니다.
+
첫번째 phase 에서는 self-attention layer 와 cross-attention layer 의 KV 행렬만 fine-tuning 을 하였고, AdamW optimizer 와 cosine annealing schedule 을 사용하였습니다. 두번째 phase 에서는 UNet 모델 전체를 학습하고 \(5 \times 10^{-6}\) 값의 constant learning rate 를 사용하였습니다. 그리고 학습 과정을 더 효율적으로 하기 위해 Min-SNR weighting 기법도 활용하였습니다.
Text 를 입력받아 우선적으로 SDXL 모델을 통해 단일 이미지를 생성한 후, Zero123++ 모델을 적용한 결과입니다. MVDream 과 Zero-1-to-3 XL 모델과 비교하였을 때, Zero123++ 모델이 가장 realistic 하고 multi-view consistent 한 이미지를 생성하는 부분을 확인할 수 있습니다.
+
+
+
+
Fig. 752 Qualitative comparison on text to multi-view task#
Our aim is to review papers and code related to computer vision generation models, approach them theoretically, and conduct various experiments by fine-tuning diffusion based models.
DiffInject: Revisiting Debias via Synthetic Data Generation using Diffusion-based Style Injection
-Donggeun Ko*, Sangwoo Jo*, Dongjun Lee, Namjun Park, Jaekwang KIM
-CVPR 2024 Workshop
-PDF
Our aim is to review papers and code related to computer vision generation models, approach them theoretically, and conduct various experiments by fine-tuning diffusion based models.
DiffInject: Revisiting Debias via Synthetic Data Generation using Diffusion-based Style Injection
+Donggeun Ko*, Sangwoo Jo*, Dongjun Lee, Namjun Park, Jaekwang KIM
+CVPR 2024 Workshop
+PDF