marcoaversa / diffinfinite

DiffInfinite Official Code
MIT License
23 stars 3 forks source link

why are you normalising the mask in the original dataloader ? #8

Closed joihn closed 3 months ago

joihn commented 3 months ago

Hello, thanks for this repo

issue location

    if self.transform is not None:
            img,mask = self.transform((img,mask))

ref : https://github.com/marcoaversa/diffinfinite/blob/4d2309606e5ce6190828b96f436cfa962ec5d1ec/dataset.py#L394

            transform=ComposeState([
                        T.ToTensor(),
                        T.RandomHorizontalFlip(),
                        T.RandomVerticalFlip(),
                        RandomRotate90(),
                        ])

ref https://github.com/marcoaversa/diffinfinite/blob/4d2309606e5ce6190828b96f436cfa962ec5d1ec/dm.py#L646

issue summary

the T.ToTensor() will normalise your image and mask between 0 and 1. are you sure it is a good idea for the mask ? maybe it would be better to keep as an int [0-255]

joihn commented 3 months ago

moreover there is a discrepancy with the jupyter notebook, where unormalized ints (1,2,3,4)are used fot the mask

image

joihn commented 3 months ago

nevermind, actually the method multi_to_single_mask bring the mask back to [0-255]

    def multi_to_single_mask(self, mask):
        mask=(mask*255).int()