JuliaWolleb / Diffusion-based-Segmentation

This is the official Pytorch implementation of the paper "Diffusion Models for Implicit Image Segmentation Ensembles".
MIT License
272 stars 35 forks source link

sample question #13

Closed xuecheng990531 closed 1 year ago

xuecheng990531 commented 1 year ago

In running the segment_sample file, I found that the speed is very slow and my image size is 512*512. How can I solve the problem of slow speed?

JuliaWolleb commented 1 year ago

Well, going through the 1000 steps iteratively just takes a while. You can try to speed it up using a different timestep spacing. However, this comes at a cost of image quality

xuecheng990531 commented 1 year ago

It's like this, either reduce the timestep or reduce the size of the image. I want to continue deep learning on the generated image obtained by sampling, but I found that the generation is really slow.

guanzhenghua commented 1 year ago

@xuecheng990531 can you tell me about you result in you dataset? beacuse i use the Brast2020 dataset and do the same preprocessing as the paper did. But the result is not just a mask as in the paper. The result is a mixture of the mask and the original image.for example. image so i wonder what about your dataset. If it is convenient, can you add my email or wechat. thanks a lot email: guanzhenghua2022@email.szu.edu.cn wechat: g479251920

xuecheng990531 commented 1 year ago

@xuecheng990531 你能告诉我你在数据集中的结果吗? 因为我使用 Brast2020 数据集并进行与论文相同的预处理。但结果并不像论文中那样只是一个面具。结果是蒙版和原始图像的混合。例如。 所以我想知道你的数据集怎么样。 方便的话可以加我邮箱或者微信。非常感谢 邮箱:guanzhenghua2022@email.szu.edu.cn 微信:g479251920 图像

我的也是这样,在最后采样的时候会生成多个mask,里面有一些mask的结果跟你这种是一样的,可以选择在训练的时候多迭代,也可以选择更加密集的timestep进行采样,效果会好很多,但是时间会更长。我觉得diffusion用在分割领域还是有些困难

guanzhenghua commented 1 year ago

@xuecheng990531 最后采样生成多个mask是因为作者加了for循环,这无所谓。不是很理解你说的效果会好很多是什么意思,更多次的迭代和更大的T效果好很多是指图像更清晰吗,但我想表达的是我用brast2020训练的分割结果不仅包含了分割的掩模,还包含原始mri的轮廓,我并不想生成原始的mri的轮廓,但作者的文章里只生成了掩模,所以我想是不是我哪里出了问题。看你在自己的数据集上训练了,所以想问下,你的结果是只有掩模还是说掩模和原图的混合。 非常期待你的回复。

xuecheng990531 commented 1 year ago

@xuecheng990531 最后采样生成多个mask是因为作者加了for循环,这无所谓。不是很理解你说的效果会好很多是什么意思,更多次的迭代和更大的T效果好很多是指图像更清晰吗,但我想表达的是我用brast2020训练的分割结果不仅包含了分割的掩模,还包含原始mri的轮廓,我并不想生成原始的mri的轮廓,但作者的文章里只生成了掩模,所以我想是不是我哪里出了问题。看你在自己的数据集上训练了,所以想问下,你的结果是只有掩模还是说掩模和原图的混合。 非常期待你的回复。

就是训练迭代还不够,而且即使训练迭代次数够了,在最后生成分割结果的时候其边缘结果很差而且仍然包含一定的噪音

JuliaWolleb commented 1 year ago

Hi Yes, in the BRATSdataset you have always 4 MR sequences (T1, T1ce, T2 and FLAIR) as well as the segmentation mask. You will need both for training of the diffusion model, as shown in Figure 2 of the paper. How the data should be stored can be found in the mini-example in the folder /data.

guanzhenghua commented 1 year ago

@JuliaWolleb i wonder why my result contain the profile of the mri, not just the mask as the paper show. it's mine, not clear maybe don't have enough training, i don't care it, but i can't stand the profile in the result. image it can be see in you paper, the result is very clear , image for most, it don't have any profile of the mri. I wonder if the result is raw, or the result is processed so don't have the profile. if the result is raw, maybe my result contain the profile has something wrong with it, can you tips why my result contains the profile. [look forward to your reply](javascript.

JuliaWolleb commented 1 year ago

Hi So the profile does look a bit weird, but I would not worry about it too much. The final output should be thresholded by using Otsu or thresholding at 0.5. Then you get the clear binary segmentation, just as you have it in my figure. I think in your result, this thresholding is missing