ML-GSAI / EGSDE

Official implementation for "EGSDE: Unpaired Image-to-Image Translation via Energy-Guided Stochastic Differential Equations" (NIPS 2022)
195 stars 11 forks source link

How to use a conditional DDPM #5

Closed xyf9474 closed 1 year ago

xyf9474 commented 1 year ago

Thanks for your outstanding work and I have a question:If I want to use a pretrained conditional DDPM in cat2dog translation work, how can I modify the code to use it instead of a DDPM for dog for example: maybe dog is class 2 when I train the conditional DDPM and in guided-diffusion I can modify the file:image_sample.py to choose which class I want to generate.But how to modify the code here to be equal to a DDPM for dog. Looking forward to your reply at your earliest convenience.

xyf9474 commented 1 year ago

Another question: if I hope to train both cat2dog and dag2cat translation , if I need to train two classifier for cat2dog and dag2cat using run_train_dse.py respectively?

gracezhao1997 commented 1 year ago

Hi, For Q1: If you want to use a pretrained conditional DDPM, you can modify the output of noise prediction network (functions.denoising.egsde_sample, line 42-46). Here, you can change the model_output to the output of conditional DDPM. For Q2: if you hope to train both cat2dog and dag2cat translation , one classifier is enough. In addition, we also perform multi-domain translation. For example, if you want to perform multi-domain image translation in cat, dog and wild, you just need to train a conditional ddpm on 3 classes and a 3-class classifier using run_train_dse.py. Based on that, if you want to perform cat-to-wild, you just need to given the wild class label in conditional ddpm and use the pretrained 3-class classifier.

xyf9474 commented 1 year ago

Thanks so much for your reply! and I will try it😃