ControlVAR icon indicating copy to clipboard operation
ControlVAR copied to clipboard

Inpainting

Open SII-Ferenas opened this issue 2 years ago • 7 comments

Hi, thanks for sharing this work! I am interested about how to to process Inpainting for VAR/Control VAR. Are the masked image regions set to 0, and fed to VAR for inference directly?

SII-Ferenas avatar Aug 26 '24 05:08 SII-Ferenas

Thanks for your interest. We teacher-force some regions in the image and predict the remaining to achieve the inpainting.

lxa9867 avatar Aug 27 '24 02:08 lxa9867

hi, thanks for ur reply! However, I still got confused about this. VAR will generate the output tokens, e.g., 680 tokens, with inputing and scaling the whole image tokenized features, and perform next-scale-token prediction. So how to specifically teacher-force some regions? Theoretically, all image region should serve as the input to generate the corresponding scale-level tokens, thereafter performing reconstruction.

SII-Ferenas avatar Aug 27 '24 04:08 SII-Ferenas

In our implementation, we start from a 256x256 size binary mask and then resize it (nearest) to low resolution to teacher-force the unmasked regions.

I believe VAR uses the same way to conduct the inpainting.

lxa9867 avatar Aug 27 '24 04:08 lxa9867

Thanks for ur reply! I have tried to implement what you said, and the code line shall look like:

截屏2024-08-27 15 00 59

Here I interpolate the an extra binary mask as the scale increases, and directly erasing the corresponding f_hat in idxBl_to_var_input function, is this implementation correct?

SII-Ferenas avatar Aug 27 '24 07:08 SII-Ferenas

The code looks reasonable to me. You may verify it with visualized images.

lxa9867 avatar Aug 27 '24 14:08 lxa9867

@Ferenas I have same issue for inpaint. Have you tried this ?

zijinY avatar Nov 19 '24 15:11 zijinY

@Ferenas the performace?

egbertYeah avatar Dec 18 '24 09:12 egbertYeah