mazurowski-lab / segmentation-guided-diffusion

[MICCAI 2024] Easy diffusion models (optionally with segmentation guidance) for medical images and beyond.
https://arxiv.org/abs/2402.05210
Other
56 stars 4 forks source link

Questions about mask colour #6

Closed railgun122 closed 3 weeks ago

railgun122 commented 1 month ago

Firstly,really appreciate your work on making a clean model for medical image generation

I have some questions about how the mask images are made, does the colour has to be exact colours that mentioned in the paper? for example, white, red and blue. Also, does the code work and produce properly for different channels of masked images? Since I have looked at the 'multi' command from the code.

Thank you for your effort again. Hope you have a good day.

nickk124 commented 1 month ago

Hi,

The chosen mask colors shown in the figures are just for visualization. What matters is that you save the mask .pngs with integer mask class values of 0,1,2,... etc., corresponding to whichever object classes you have.

For example, you can create a new mask image by making a numpy array for the given mask with 0s for the background class, 1s for the first class (whatever that is, e.g. breast in our case of breast MRI), 2s for the second class (e.g. blood vessel in our case of breast MRI), etc., then saving it as a .png, e.g. using PIL.

The network only sees these mask class values and learns to associate them with their respective image object (also the code technically first normalizes the mask to the [0, 1] range in the ToTensor() operation before network input).

Does that help?

nickk124 commented 3 weeks ago

Hi, I'm closing this for now due to no response, but feel free to open again if you have questions.