MedSegDiff icon indicating copy to clipboard operation
MedSegDiff copied to clipboard

Sampling problem

Open jojo803 opened this issue 1 year ago • 3 comments

When I ran sample.py , I got this problem: Traceback (most recent call last): File "F:\dpm\MedSegDiff-master-v2\v2\scripts\segmentation_sample.py", line 194, in main() File "F:\dpm\MedSegDiff-master-v2\v2\scripts\segmentation_sample.py", line 116, in main sample, x_noisy, org, cal, cal_out = sample_fn( File "F:\dpm\MedSegDiff-master-v2\v2\scripts..\guided_diffusion\gaussian_diffusion.py", line 563, in p_sample_loop_known for sample in self.p_sample_loop_progressive( File "F:\dpm\MedSegDiff-master-v2\v2\scripts..\guided_diffusion\gaussian_diffusion.py", line 648, in p_sample_loop_progressive out = self.p_sample( File "F:\dpm\MedSegDiff-master-v2\v2\scripts..\guided_diffusion\gaussian_diffusion.py", line 443, in p_sample out = self.p_mean_variance( File "F:\dpm\MedSegDiff-master-v2\v2\scripts..\guided_diffusion\respace.py", line 90, in p_mean_variance return super().p_mean_variance(self._wrap_model(model), *args, **kwargs) File "F:\dpm\MedSegDiff-master-v2\v2\scripts..\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 "F:\dpm\MedSegDiff-master-v2\v2\scripts..\guided_diffusion\gaussian_diffusion.py", line 347, in _predict_xstart_from_eps assert x_t.shape == eps.shape AssertionError

My Brats2020 dataset is the same as yours, but my testing data has ground truth. I can't figure it out, can you please help me with it?

jojo803 avatar May 26 '23 07:05 jojo803

I also meet this problem. I think it's because your "x_t".shape(B, 1, H, W) is not the same as the "eps".shape(B, 2, H, W). You set the output of the model in "script_util" to 2, so the eps".shape will to be(B, 2, H, W).

smallboy-code avatar Jun 20 '23 07:06 smallboy-code

我也遇到了这个问题。我认为这是因为您的“x_t”.shape(B, 1, H, W) 与“eps”.shape(B, 2, H, W) 不同。您将“script_util”中模型的输出设置为 2,因此 eps“.shape 将为 (B, 2, H, W)。

Hello, I've also encountered this issue. I'd like to ask you specifically which parameter you modified in the "script_util" file, or which line of code you changed to resolve this problem? Can you help me with that?

rrrrrrrrrice avatar Sep 04 '23 16:09 rrrrrrrrrice

我也遇到了这个问题。我认为这是因为您的“x_t”.shape(B, 1, H, W) 与“eps”.shape(B, 2, H, W) 不同。您将“script_util”中模型的输出设置为 2,因此 eps“.shape 将为 (B, 2, H, W)。

Hello, I've also encountered this issue. I'd like to ask you specifically which parameter you modified in the "script_util" file, or which line of code you changed to resolve this problem? Can you help me with that?

你好,请问你解决了吗

HEL7777 avatar Nov 18 '23 14:11 HEL7777