KidsWithTokens / MedSegDiff

Medical Image Segmentation with Diffusion Model
MIT License
979 stars 147 forks source link

推理时间问题 #90

Closed Miranda-h closed 1 year ago

Miranda-h commented 1 year ago

推理的batch size为什么只能设置成1呢?也不能多卡推理?用2060跑一张图片5个sample需要一个小时

WuJunde commented 1 year ago

5 sample about 3 min at most, check your code again

Miranda-h commented 1 year ago

谢谢你的回复,我换在3090上重新测了一下,git clone后的代码丝毫没改,在ISIC数据集上一个sample需要66s,请问这是正常的吗?

knavecoder commented 1 year ago

我的模型在sample的时候又出现了跟v1一样的情况,cuda的内存没办法被释放,一直在叠加,我的pytorch已经是1.8.1的了,请问您的pytorch版本是多少

heikeyuhuajia commented 1 year ago

谢谢你的回复,我换在3090上重新测了一下,git clone后的代码丝毫没改,在ISIC数据集上一个sample需要66s,请问这是正常的吗?

您好,请问您现在推理一张图片大概用时多少呢?我设置no-dpmsolver并且steps=1000,其他的保持默认,推理时间也很长, 25061682488988_ pic

YLiu-creator commented 1 year ago

同问。我的图像尺寸是4320320,no-dpmsolver并且steps=1000生成1 sample需要 117 624s(30min~),如果食用DDIM加速,效果是成比例的, DDIM设置500steps, 生成1 sample需要58879s

xupinggl commented 1 year ago

@heikeyuhuajia 您好。我和您的设置是一样的,--diffusion_steps 1000,no-dpmsolver,在ISIC数据集上, time for 1 sample 84025.2890625 no dpm-solver time for 1 sample 78441.1328125 no dpm-solver time for 1 sample 78463.75 no dpm-solver time for 1 sample 82097.5078125 no dpm-solver time for 1 sample 78207.359375

如果用 --diffusion_steps 50 --dpm_solver True 就比较快, time for 1 sample 11437.5283203125 time for 1 sample 4107.109375 time for 1 sample 3979.4931640625 time for 1 sample 5192.29931640625 time for 1 sample 5733.0546875

但是我又一个新问题,我用的作者给的ISIC数据集,其他的默认设置全部和作者一样,跑了10w step,但是sample的output基本是全黑的,或者是有一些随机噪声。有没有可能是我在train的时候将“--diffusion_steps 1000”改为了“--diffusion_steps 50 --dpm_solver True”,dpm_solver是只能在sampling的时候用吗?在train的时候用是不是不能用?

WuJunde commented 1 year ago

dpm_solver is for sampling and it will compromise the performance