MedicineToken / MedSegDiff

Medical Image Segmentation with Diffusion Model
MIT License
1.09k stars 166 forks source link

assert x_t.shape == eps.shape #201

Open 2039551625 opened 2 weeks ago

2039551625 commented 2 weeks ago

你好,我在对于DRIVE数据集上进行采样时,出现了这样问题,请问我该如何解决呢 Traceback (most recent call last): File "E:\deep_learning\Segmentation\MedSegDiff-master\scripts\segmentation_sample.py", line 214, in main() File "E:\deep_learning\Segmentation\MedSegDiff-master\scripts\segmentation_sample.py", line 123, in main sample, x_noisy, org, cal, cal_out = sample_fn( File "E:\deep_learning\Segmentation\MedSegDiff-master\guided_diffusion\gaussian_diffusion.py", line 565, in p_sample_loop_known for sample in self.p_sample_loop_progressive( File "E:\deep_learning\Segmentation\MedSegDiff-master\guided_diffusion\gaussian_diffusion.py", line 650, in p_sample_loop_progressive out = self.p_sample( File "E:\deep_learning\Segmentation\MedSegDiff-master\guided_diffusion\gaussian_diffusion.py", line 444, in p_sample out = self.p_mean_variance( File "E:\deep_learning\Segmentation\MedSegDiff-master\guided_diffusion\respace.py", line 90, in p_mean_variance return super().p_mean_variance(self._wrap_model(model), *args, **kwargs) File "E:\deep_learning\Segmentation\MedSegDiff-master\guided_diffusion\gaussian_diffusion.py", line 324, in p_mean_variance self._predict_xstart_from_eps(x_t=x, t=t, eps=model_output) File "E:\deep_learning\Segmentation\MedSegDiff-master\guided_diffusion\gaussian_diffusion.py", line 348, in _predict_xstart_from_eps assert x_t.shape == eps.shape AssertionError

Coder-li-jiahao commented 2 weeks ago

same question

Coder-li-jiahao commented 2 weeks ago

你好,我在对于DRIVE数据集上进行采样时,出现了这样问题,请问我该如何解决呢 Traceback (most recent call last): File "E:\deep_learning\Segmentation\MedSegDiff-master\scripts\segmentation_sample.py", line 214, in main() File "E:\deep_learning\Segmentation\MedSegDiff-master\scripts\segmentation_sample.py", line 123, in main sample, x_noisy, org, cal, cal_out = sample_fn( File "E:\deep_learning\Segmentation\MedSegDiff-master\guided_diffusion\gaussian_diffusion.py", line 565, in p_sample_loop_known for sample in self.p_sample_loop_progressive( File "E:\deep_learning\Segmentation\MedSegDiff-master\guided_diffusion\gaussian_diffusion.py", line 650, in p_sample_loop_progressive out = self.p_sample( File "E:\deep_learning\Segmentation\MedSegDiff-master\guided_diffusion\gaussian_diffusion.py", line 444, in p_sample out = self.p_mean_variance( File "E:\deep_learning\Segmentation\MedSegDiff-master\guided_diffusion\respace.py", line 90, in p_mean_variance return super().p_mean_variance(self._wrap_model(model), *args, **kwargs) File "E:\deep_learning\Segmentation\MedSegDiff-master\guided_diffusion\gaussian_diffusion.py", line 324, in p_mean_variance self._predict_xstart_from_eps(x_t=x, t=t, eps=model_output) File "E:\deep_learning\Segmentation\MedSegDiff-master\guided_diffusion\gaussian_diffusion.py", line 348, in _predict_xstart_from_eps assert x_t.shape == eps.shape AssertionError

same question

2039551625 commented 1 week ago

我尝试打印他们的形状,分别为x_t: torch.Size([1, 1, 64, 64]),eps: torch.Size([1, 2, 64, 64]),然后我打印出eps中的数据,发现他的两个通道的数据是一样的,所以我将eps就只取了第一通道,就跑通了

Issues-translate-bot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I try to print their shapes, which are x_t: torch.Size([1, 1, 64, 64]), eps: torch.Size([1, 2, 64, 64]), and then I print out the Data, I found that the data of his two channels are the same, so I only took the first channel of eps, and it ran through.

2039551625 commented 1 week ago

但是我对于问题出现的原因,还是存有我的疑问

Issues-translate-bot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


But I still have my doubts about the cause of the problem.

Coder-li-jiahao commented 1 week ago

但是我对于问题出现的原因,还是存有我的疑问

How is your segmentation effect? After running this experiment, I feel that the segmentation results are not as good as UNet

Coder-li-jiahao commented 1 week ago

我尝试打印他们的形状,分别为x_t: torch.Size([1, 1, 64, 64]),eps: torch.Size([1, 2, 64, 64]),然后我打印出eps中的数据,发现他的两个通道的数据是一样的,所以我将eps就只取了第一通道,就跑通了

My solution is the same as yours

2039551625 commented 1 week ago

但是我跑出的效果有点差 12_test_output_ens

Issues-translate-bot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


But the effect I ran out was a bit poor. 12_test_output_ens

2039551625 commented 1 week ago

请问你跑的数据集上的效果怎么样

Issues-translate-bot commented 1 week ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


What is the effect on the data set you ran?

Coder-li-jiahao commented 1 week ago

请问你跑的数据集上的效果怎么样

My results were also very poor