HieuPhan33 / MaskGAN

MaskGAN for unpaired MR-to-CT synthesis. Official implementation of MICCAI 2023
20 stars 5 forks source link

Question #8

Closed TMDTom closed 3 weeks ago

TMDTom commented 1 month ago

Hello, thanks for your nice work. I find the mask in your network is kind of different 996ded4cbeb40cee9c353d74ea7cef6erom mine. the background of mine is black 0, and your background is white 1. Can you tell me the differnet. Thanks a lot.

HieuPhan33 commented 1 month ago

Hi @TMDTom, Thanks for being interested in our work.

Our MaskGAN retains the content in the background region by multiplying the background attention with the original input image: https://github.com/HieuPhan33/MaskGAN/blob/55b2cd3b31f3e0dd3e4c4cfcc5ae90a9faefcef6/models/networks.py#L472.

During training, the background mask should have the value of 1: https://github.com/HieuPhan33/MaskGAN/blob/55b2cd3b31f3e0dd3e4c4cfcc5ae90a9faefcef6/models/mask_gan_model.py#L200.

During data loading, it takes the mask with bg = 0, and convert it to the value of 1, as shown here: https://github.com/HieuPhan33/MaskGAN/blob/55b2cd3b31f3e0dd3e4c4cfcc5ae90a9faefcef6/data/augmentations.py#L26.

If your input masks (the raw png format) have background of 0, it is correct. The dataloader will read and convert it to the value of 1 during training the background attention.

TMDTom commented 1 month ago

Hi @TMDTom, Thanks for being interested in our work.

Our MaskGAN retains the content in the background region by multiplying the background attention with the original input image:

https://github.com/HieuPhan33/MaskGAN/blob/55b2cd3b31f3e0dd3e4c4cfcc5ae90a9faefcef6/models/networks.py#L472

. During training, the background mask should have the value of 1:

https://github.com/HieuPhan33/MaskGAN/blob/55b2cd3b31f3e0dd3e4c4cfcc5ae90a9faefcef6/models/mask_gan_model.py#L200

. During data loading, it takes the mask with bg = 0, and convert it to the value of 1, as shown here:

https://github.com/HieuPhan33/MaskGAN/blob/55b2cd3b31f3e0dd3e4c4cfcc5ae90a9faefcef6/data/augmentations.py#L26

. If your input masks (the raw png format) have background of 0, it is correct. The dataloader will read and convert it to the value of 1 during training the background attention.

Thanks for your nice answer. I did't get to the augmentation code before. So I'm confused. Now I get it. Thank you very mush.Thanks a lot!