mage icon indicating copy to clipboard operation
mage copied to clipboard

Is there any script to generate the Fig.2 in the paper?

Open LinB203 opened this issue 1 year ago • 13 comments

I want to mask part of the image and then rebuild it, not randomly.

LinB203 avatar Mar 22 '23 05:03 LinB203

We may release a colab for image editing in the next few months.

LTH14 avatar Mar 22 '23 07:03 LTH14

We may release a colab for image editing in the next few months.

I try to reproduce Fig.2, but I found the temperature is so sentitive for generating images. So how to set temperature in Fig.2? The sampled_ids can be sampled by torch.distributions.categorical.Categorical(logits=logits), but it also can be generate by torch.argmax(logits, dim=-1), so if I want to reproduce the Fig.2, should I change torch.distributions.categorical.Categorical(logits=logits) to torch.argmax(logits, dim=-1) ?

LinB203 avatar Apr 19 '23 08:04 LinB203

by sample. temp=4.5, num_iter=1 image

LinB203 avatar Apr 19 '23 08:04 LinB203

# get token prediction
# sample_dist = torch.distributions.categorical.Categorical(logits=logits)
# sampled_ids = sample_dist.sample()
sampled_ids = torch.argmax(logits, dim=-1)

by argmax. temp=4.5, num_iter=1 image

LinB203 avatar Apr 19 '23 08:04 LinB203

Yes, the temperature selection is a bit tricky. For iter=1, we use argmax and temp=0.0 if I remember correctly. For iter=6, we use categorical sampling and temp=4.5.

LTH14 avatar Apr 19 '23 08:04 LTH14

Yes, the temperature selection is a bit tricky. For iter=1, we use argmax and temp=0.0 if I remember correctly. For iter=6, we use categorical sampling and temp=4.5.

I use vit-large to reconstruct masked images in Fig.2. Am I right?

LinB203 avatar Apr 19 '23 08:04 LinB203

You can use either ViT-B or ViT-L for that. ViT-L will give you slightly visually better results.

LTH14 avatar Apr 19 '23 08:04 LTH14

I want to mask part of the image and then rebuild it, not randomly.

Hello, may I ask you how to reconstrcut an image with a pretrained MAGE model like the original MAE? Why I get the output image almoset the same with the input image?

cannonli7 avatar Oct 26 '23 14:10 cannonli7

I want to mask part of the image and then rebuild it, not randomly.

I also want to reproduce Figure 2. Could you please tell me how you achieved it?

longhuiX avatar Feb 19 '24 11:02 longhuiX

I want to mask part of the image and then rebuild it, not randomly.

I was wondering if you could share the code you used to reproduce it?

longhuiX avatar Feb 19 '24 14:02 longhuiX

I add an inference code, but looks not correct. Here is a input and output for my code. imagenet_1k_1 00000

The inference code is based on gen_img_uncond.py, I followed the process on def gen_image(). The checkpoint I used is magec ViTl. According to the result, would you mind tell me which part may not correct.

The mask ratio is fixed in 0.1.

44825762 avatar Apr 11 '24 09:04 44825762

@LTH14 would you mind send me a inference code? my email is: [email protected]. Thank you very much.

44825762 avatar Apr 12 '24 03:04 44825762

I add an inference code, but looks not correct. Here is a input and output for my code. imagenet_1k_1 00000

The inference code is based on gen_img_uncond.py, I followed the process on def gen_image(). The checkpoint I used is magec ViTl. According to the result, would you mind tell me which part may not correct.

The mask ratio is fixed in 0.1.

Please don't use MAGE-C for generation task -- the contrastive loss is only for representation learning. For generation, please use the MAGE ViT-L checkpoint (without -C)

LTH14 avatar Apr 12 '24 03:04 LTH14