Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
gx 7e3fe3fdd0 | 11 months ago | |
---|---|---|
pic | 11 months ago | |
README.md | 11 months ago | |
amp.py | 1 year ago | |
ddpm.py | 11 months ago | |
ema.py | 1 year ago | |
inference.py | 11 months ago | |
pip-requirements.txt | 1 year ago | |
pretrain.py | 11 months ago | |
train.py | 11 months ago | |
upload.py | 1 year ago |
本次选用 DDPM(Denoising Diffusion Probabilistic Models)模型,模型通过不断对原始图片添加高斯噪声,得到该时间步以及对应的加噪图片,由此产生用于训练的数据,即为前向“扩散过程”;主要通过训练UNet 网络,来预测噪声添加步骤对应的噪声,然后从和原始图片同尺寸的高斯噪声中减去 UNet 预测的噪声,即可生成对应时间步的去噪图片,称为“去噪(逆向)过程”。
平台
模型采用 MindSpore AI 计算框架,依靠 Openi 智算网络在 NPU 上完成训练和推理任务。
数据集
整理了梵高经典画作数据集,风格为山野田园类油画(如下图),数据集命名为“vangogh-landscape-big.zip”,共包含 100 张图片。
训练过程
训练调用接口 ddpm.Trainer().train(),输入图片大小统一调整为 200×200,影响训练过程的主要参数为时间步 steps,会均分到一个batch中的所有图片,即每张图片的实际时间步为 int(steps/batch_size),时间步采用位置编码保存时序信息。从原始图片开始,逐步添加高斯噪声,最后形成多个(时间步,受噪图片)数据集,然后,从最后的时间步开始,UNet网络预测对应时间步添加的高斯噪声,以实际噪声和预测噪声的 KL 散度作为损失函数,进行训练。
推理过程
推理调用接口 ddpm.Trainer().inference(),输入为指定的时间步和高斯随机噪声(和图片同维度),从时间步为0开始,不断从高斯噪声中消除对应时间步的噪声,得到指定时间步的推理图片,即为输出。
模型
模型大小约为 1.2 G
生成 200 张 200×200 图片,推理时间预计 1h20min
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》