IDKiro / sdxs

Official repo of our paper "SDXS: Real-Time One-Step Latent Diffusion Models with Image Conditions"
Apache License 2.0
599 stars 21 forks source link

SSIM parameter #14

Closed bomcon123456 closed 5 months ago

bomcon123456 commented 5 months ago

Hi, very interesting work indeed. I was wondering, how did you pick the parameter for the SSIM loss since you're using it in the latent space, specifically the data_range and the window_size. Looking forward to your answer, thank you!!

IDKiro commented 5 months ago

Instead of setting the window size, we directly calculate the full feature maps' mean, variance and covariance. You can use DISTS loss directly, and in our experiments the difference between the two is not significant, especially since we turn down the weights for feature matching later in the training.

bomcon123456 commented 5 months ago

Thank you for the rapid response, much appreciated! I see, so in case of SSIM, the data range (which is used to calculate $C_1,C_2$ is calculated dynamically base on each input? I've tried DISTS loss beforehand and it works quite well, however your application of SSIM is quite interesting too so I would like to test it out💪💪

IDKiro commented 5 months ago

Yes, we are using the original SSIM formula directly: $$\text{SSIM}(\mathbf{x},\mathbf{y})=\frac{(2\mu_x\mu_y+C1)(2\sigma{xy}+C_2)}{(\mu_x^2+\mu_y^2+C_1)(\sigma_x^2+\sigma_y^2+C_2)}$$

bomcon123456 commented 5 months ago

I see, thanks again 💪