zoubohao / DenoisingDiffusionProbabilityModel-ddpm-

This may be the simplest implement of DDPM. You can directly run Main.py to train the UNet on CIFAR-10 dataset and see the amazing process of denoising.
MIT License
1.48k stars 156 forks source link

the issue of noise generation and sample #25

Open wjd23333 opened 1 year ago

wjd23333 commented 1 year ago

why ues this to generate a noise (saveNoisy = torch.clamp(noisyImage 0.5 + 0.5, 0, 1)) is this 0.5 necessray? and also in this function(sampledImgs = sampledImgs 0.5 + 0.5 # [0 ~ 1])

Dystopians commented 1 year ago

This is a normalization step that allows a tensor that would otherwise lie between -1 and 1 to be situated between 0 and 1.