My App

DreamBooth: Fine Tuning Text-to-Image Diffusion Models for Subject-Driven Generation

任务直接看图片就行, 模仿给定参考集中的主体外观, 并在不同情境下合成新的表现形式. 讲方法: 语义先验嵌入, autogenous class-specific priorpreservation loss. 讲效果: 生成在参考图像中未出现的各种场景, 姿势, 视角和光照条件下的主体. 在多个任务上测试, 均保持主体一致性, 为新的任务Subject-Driven generation提供新的数据集和评估指标.

DreamBooth-intro

介绍

疑问句介绍了一些应用场景.

先讲了一下text to image任务的进步, 通过建立image和text的一个对应关系来训练, 但是由于语言表述本身的局限性, 不能很好的保持输入参考图对象的外表.

本文的思路是扩展模型的语言-视觉词典, 使其将新词汇与用户想要生成的特定对象绑定.

提出方法: autogenous, class-specific prior preservation loss.

后面讲的评估指标和数据集.

方法

DreamBooth-overview

Text-to-Image Diffusion Models

讲了一下原理

Ex,c,ϵ,t[wtx^θ(αtx+σtϵ,c)x22]\mathbb{E}_{\mathbf{x}, \mathbf{c}, \boldsymbol{\epsilon}, t} \left[ w_t \left\| \hat{\mathbf{x}}_\theta \bigl(\alpha_t \mathbf{x} + \sigma_t \boldsymbol{\epsilon}, \mathbf{c}\bigr) - \mathbf{x} \right\|_2^2 \right]

Personalization of Text-to-Image Models

首先想到的是用一小批自己的数据后训练, 但是存在过拟合和mode collapse的风险(GAN), 他们发现使用diffusion可以规避掉这个问题.

在text提示词上做文章, "a [identifier] [class noun]"这种格式, [identifier]和subject绑定, [class noun]为"cat, dog, watch"等等, 可以通过一个分类器或者用户提供.

[identifier]需要是rare-token, 像"unique", "special"只能带来次优解, 像"xxy5syt00"这样的乱码会被拆分成多个token, 最后它们选择直接从字典中找.

Class-specific Prior Preservation loss

根据经验需要微调所有层达到最好的效果, 但是这会带来一些问题: 1) language drift. 在大型文本语料库上预训练并在之后为特定任务进行微调的模型会逐渐失去对该语言的句法和语义知识, 它们在diffusion模型中发现了同样的现象. 2) 减少输出的多样性. 在训练时间过长时经常发生.

为了缓解这两种现象, 他们就提出了新的训练损失, 其实就是加了个无条件损失, xpr=x^(zt1,cpr)x_{pr} = \hat{x}(z_{t_1}, c_{pr}), cpr:=Γ(f("a[class noun]"))\mathbf{c}_{\mathrm{pr}} := \Gamma \big( f("a\,[\text{class noun}]") \big)

Ex,c,ϵ,ϵ,t[wtx^θ(αtx+σtϵ,c)x22+λwtx^θ(αtxpr+σtϵ,cpr)xpr22]\begin{equation} \mathbb{E}_{\mathbf{x}, \mathbf{c}, \epsilon, \epsilon', t} \Big[ w_t \big\| \hat{\mathbf{x}}_\theta(\alpha_t \mathbf{x} + \sigma_t \epsilon, \mathbf{c}) - \mathbf{x} \big\|_2^2 + \lambda w_{t'} \big\| \hat{\mathbf{x}}_\theta(\alpha_{t'} \mathbf{x}_{\mathrm{pr}} + \sigma_{t'} \epsilon', \mathbf{c}_{\mathrm{pr}}) - \mathbf{x}_{\mathrm{pr}} \big\|_2^2 \Big] \end{equation}

实验

30个subject, 从Unsplash手机, 25个提示词, 每个提示词生成4张图片, 一共3000张, 评估指标是subject保真度和提示词保真度.

感受

车轱辘话很多, 有信息的内容就方法里的两段, 1) 利用字典中很少使用的token与特定的subject联系起来, 2) 设计了一个loss用于训练.

它最大的问题在于需要先使用input image训练, 让参考图中的subject与特定的token绑定(有个专有名词叫啥...free忘记了).

On this page