maskbit icon indicating copy to clipboard operation
maskbit copied to clipboard

Reconstruction seems very Bad with MaskBit-Tokenizer (18* bits)

Open Luckygyana opened this issue 1 year ago • 5 comments

I have tested few samples and It's seem very bad

Input image

Output image

Also, Other VQGAN choice of proprocessing [-1, 1] and in here why it is [0, 1]

Luckygyana avatar Dec 12 '24 18:12 Luckygyana

Checked with other model too, All are giving very bad results too. Can you share script for a sample reconstruction?

def prepare_image(img):
    """ Transform and normalize PIL Image to tensor. """
    transform = T.Compose([
            T.RandomResizedCrop(256, scale=(1., 1.), ratio=(1., 1.), interpolation=T.InterpolationMode.BICUBIC),
            T.ToTensor(),
        ])
    arr = transform(img)
    return arr

Luckygyana avatar Dec 12 '24 18:12 Luckygyana

Hi, what you observe is a dataset bias. Models trained on ImageNet have a lot of issues in reconstructing faces. This is common issues that all model that are only trained on ImageNet will have. If you want it the model to work with human faces, I'd encourage you to train on datasets such as FFHQ.

I can add an example script soon.

markweberdev avatar Dec 13 '24 23:12 markweberdev

For me it would also be interesting to know why the image data is normalized between [0,1] and not [-1,1]?

Psarpei avatar Dec 15 '24 15:12 Psarpei

Certainly!

We followed Huggingface's open muse implementation for the dataset preprocessing. I have tried to switch from [0,1] to [-1,1], but that had no positive effect back then. Moreover, it would only affect the first convolution, as we have normalisation directly after that layer anyway. That being said, if you experience improvements with different normalisation or have some pointers on literature discussing this, I would like to learn more about it!

markweberdev avatar Dec 16 '24 22:12 markweberdev

Added demo notebook.

markweberdev avatar Feb 27 '25 07:02 markweberdev