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

run_step and out_channels problems #7

Closed Rengongzhineng1999zxwang closed 1 year ago

Rengongzhineng1999zxwang commented 1 year ago
  1. There are two self.run_step(batch, cond) within run_loop in guided_diffusion/train_util.py, is it right? One run_step(batch, cond) might be ok?

def run_loop(self): ...... ...... self.run_step(batch, cond) sample = self.run_step(batch, cond) i += 1 ...... ......

  1. I don't understand the out_channels=2 in UNetModel. Maybe out_channels=1 is better? because it's the binary image

Thank u for your help

JuliaWolleb commented 1 year ago
  1. You are right, this mistake is already corrected in the current commit.
  2. This depends on your flags. if you set the flag --learn_sigma True, then your out_channels=2*in_channels. This is because you need to learn the mean and the variance. If your set --learn_sigma False, then you only learn the mean, and out_channels=in_channels.
Rengongzhineng1999zxwang commented 1 year ago

Thank you. The in_channel here is 5, but I think I need to set out_channels as 1 in guided_diffusion/script_util.py when learn_sigma is False, is it right?

return UNetModel( image_size=image_size, in_channels=5, model_channels=num_channels, out_channels=2 .... )

JuliaWolleb commented 1 year ago

yes, that should work

Rengongzhineng1999zxwang commented 1 year ago

all right. thank you