Conditional Generation from Unconditional Diffusion Models using Denoiser Representations
Denoising diffusion models have gained popularity as a generative modeling technique for producing high-quality and diverse images. Applying these models to downstream tasks requires conditioning, which can take the form of text, class labels, or other forms of guidance. However, providing conditioning information to these models can be challenging, particularly when annotations are scarce or imprecise. In this work, we propose adapting pre-trained unconditional diffusion models to new conditions using the learned internal representations of the denoiser network. We demonstrate the effectiveness of our approach on various conditional generation tasks, including attributeconditioned generation and mask-conditioned generation. Additionally, we show that augmenting the Tiny ImageNet training set with synthetic images generated by our approach improves the classification accuracy of ResNet baselines by up to 8%. Our approach provides a powerful and flexible way to adapt diffusion models to new conditions and generate high-quality augmented data for various conditional generation tasks.
Problem:: 기존 Diffusion Model로 특정 조건(예: '웃는 얼굴')의 이미지를 만들려면 라벨 데이터가 많이 필요함 / 라벨이 적으면 조건을 알려주기 어렵고, 모델을 새로 학습하거나 크게 고쳐야 함 / 특히 픽셀 단위의 세밀한 조건(예: 특정 영역 마스크)은 더 어려움
Solution:: Classifier Guidance를 위한 분류기 학습에서 라벨, 노이즈 쌍을 이용한 학습이 라벨, 클린 이미지 쌍을 이용한 학습으로 근사 / 실제로는 노이즈 제거 중간 단계 이미지에서 추출한 Denoiser의 특징(Feature) 을 조건 만족 여부를 판단하는 분류기(Guidance Classifier)에 입력하여 학습 / 데이터가 조금 더 있다면, 모델을 약간 수정(Fine-tuning)하고, 추가로 원본 Unconditional Denoiser의 내부 정보로 '잘못 만들어진 이미지'를 골라내는 분류기(Rejection Classifier) 를 만들어 결과 필터링
Novelty:: Denoiser의 내부 정보를 직접 사용하여 적은 데이터만으로도 원하는 조건의 이미지를 만들도록 유도
Note:: 단순하게 Classifier Guidance의 Classifier 학습에 노이즈 이미지 대신 Unet Feature를 사용하는 방식
Summary
Motivation
- Diffusion Model은 이미지, 오디오, 분자 합성 등 다양한 생성 작업에서 인상적인 결과를 보여주며 주목받고 있음
- Diffusion Model에 Conditional 정보를 제공하면 샘플 품질이 향상되고 더 다양하고 대표성 있는 샘플을 생성하는 데 효과적임
- 그러나 conditional 정보 제공에는 여러 한계가 존재:
- 텍스트 기반 Conditional Generation이 널리 사용되지만, 모든 작업에 최적이지 않음
- 샘플링 가이던스의 적용 규모는 작업마다 다를 수 있음 (예: 픽셀 단위 조건이 필요한 경우)
- Diffusion Model을 학습하는 데 사용되는 대규모 데이터에 대해 세밀한 이미지 레벨이나 픽셀 레벨의 주석을 제공하는 것이 비현실적임
- 따라서 사전 학습된 Unconditional Diffusion Model을 새로운 조건에 효과적으로 적응시키는 방법이 필요함
- 기존 방법들의 한계:
- 노이즈가 있는 중간 단계에서 대규모 가이던스 분류기를 학습해야 함
- 제한된 예제로부터 학습하는 효율성이 낮음
Method
Learning the Guidance Signal Using Denoiser Representations
- 조건부 생성은 일반적으로 Log-Likelihood
의 Gradient 를 이용하여 Denoising Step을 조절함 - 기존 연구들은
를 학습하기 위해 별도의 Classifier를 Noisy Sample 로 학습시켰음 - 본 논문은 이러한 방식이 불필요하다고 주장하며, 대신 Denoiser Network의 Intermediate Representation과 각 Step에서의
추정치 를 활용하는 방법을 제안함 와 예측된 Noise 로부터 를 추정함: 를 에 대한 Likelihood 로 근사함 - 이를 통해 Guidance Network (
)를 Clean Sample ( ) 만으로 학습할 수 있어 Post-hoc Adaptation 과정의 복잡도를 줄임
- 문제점: Denoising 초기 단계에서
추정치는 부정확할 수 있으며, 이로 인해 Guidance Network가 잘못된 방향으로 유도할 수 있음 - 해결책:
- Unconditional Denoiser Network를 Feature Extractor로 사용함
- Denoiser는 다양한 Noise Level의 입력으로 학습되었기 때문에 Noisy Input에 Robust한 Feature를 추출하며, 다른 Scale의 Feature를 다른 Timestep에서 학습함
- Denoiser U-Net의 Intermediate Feature는 Downstream Task에 유용한 정보를 포함하고 있음이 알려져 있음
- 따라서 Denoiser Feature를 사용하면 초기
의 부정확성에 Robust한 Guidance를 제공할 수 있을 뿐만 아니라, 적은 수의 Labeled Sample만으로도 빠르게 Guidance Network를 학습할 수 있음
Combining Adaptation with Denoiser Representations
- 더 많은 데이터가 주어졌지만, Conditional Diffusion Model을 처음부터 학습하기에는 부족한 경우, Model Adaptation (Fine-tuning)과 Unconditional Denoiser Representation을 결합하여 더 높은 품질의 이미지를 생성할 수 있음
- 과정:
- 주어진 Labeled Example로 Unconditional Diffusion Model을 Fine-tuning 함 (단, Labeled Example이 전체 데이터셋을 커버하지 않는다고 가정)
- Fine-tuning된 Conditional Model만으로는 현실적인 이미지를 생성하기 어려울 수 있음
- Unconditional Denoiser Representation을 사용하여 Rejection Classifier를 학습함
- Fine-tuning된 모델로 Sample을 생성한 후, Rejection Classifier를 사용하여 낮은 확률 값을 갖는 저품질 Sample을 제거 (Rejection Sampling) 함
- 이 방식은 Guidance Weight (
)를 직접 조절하는 것보다 선호됨. Guidance Weight는 Quality와 Diversity 간의 Trade-off를 조절하기 어렵기 때문임
Method 검증
Few-shot Guidance for Face Attributes
- 실험: CelebA-64 데이터셋에서 50개 Positive/Negative 예시만 사용하여 특정 Attribute (Male, Blond 등)를 조건으로 얼굴 이미지 생성. Denoiser Feature로 Classifier를 학습하고 Guidance로 사용.
- 결과: Latent Representation 기반 모델(DiffAE, D2C)과 유사한 FID 점수를 Rejection Sampling 없이 달성. Denoiser Feature를 사용하지 않고 Clean Image로만 학습한 Classifier(DDIM-I)보다 우수.
- 통찰: 제안 방식은 Few-shot 환경에서 효과적인 Guidance를 제공하며, Denoiser Feature의 Robustness를 보여줌.
Few-shot Guidance for Semantic Segmentations
Mask-conditional Generation on Faces
- 실험: FFHQ-256 모델을 사용하여 20개의 Image-Mask Pair만으로 주어진 Segmentation Mask에 맞는 얼굴 이미지 생성. Denoiser Feature로 Per-pixel Classifier를 학습하여 Guidance로 사용.
- 결과: 기존 방식(DDIM-I, DiffAE) 대비 mIoU(Semantic Correctness) 및 FID(Quality) 모두 우수. Low-data 환경에서 Fine-tuning 기반 ControlNet은 실패.
- 통찰: 제안 방식은 Semantic 정보와 이미지 품질 모두를 유지하며, Low-data 환경에서 강점을 보임.
Mask-conditional Generation with Large Diffusion Models
- 실험: Stable Diffusion 모델에 30개의 LSUN-Cat Mask 예시만 사용하여 Mask 조건부 생성 시도. Denoiser Feature에서 Segmentation으로의 Mapping을 학습하여 Guidance로 사용.
- 결과: 성공적으로 Mask에 맞는 고양이 이미지 생성.
- 통찰: 제안 방식이 대규모 모델에도 확장 가능함을 보여줌.
Synthetic Data Augmentation
- 실험: Tiny ImageNet 분류 성능 향상을 위해 제안 방식을 사용한 데이터 증강 효과 검증. Unconditional DDPM을 Fine-tuning하고, Unconditional Denoiser Feature로 학습한 Rejection Classifier를 사용하여 생성된 이미지 필터링.
- 결과 1 (CAS): Rejection Classifier를 사용한 방식으로 생성된 데이터로 학습한 모델이 다른 방식(Rejection 미사용)보다 월등히 높은 Classification Accuracy Score(CAS) 달성 (45.09%).
- 결과 2 (Real + Synthetic): 실제 데이터에 생성된 데이터를 추가할수록 ResNet 계열 모델의 정확도가 크게 향상 (최대 8%p).
- 결과 3 (vs Image Augmentation): Mixup/Cutmix와 같은 기존 Augmentation과 함께 사용 시 추가적인 성능 향상.
- 통찰: Rejection Sampling은 생성 데이터 품질 향상에 중요하며, 제안 방식으로 생성된 데이터는 실제 데이터 증강에 매우 효과적이고 기존 Augmentation과 상호 보완적임.