VToonify icon indicating copy to clipboard operation
VToonify copied to clipboard

Is it possible to change the resolution of output image?

Open dongyun-kim-arch opened this issue 3 years ago • 5 comments

Awesome model!

I would like to know if I can change the size of output image. It looks like the resolution of generated image is not the same as the input image, I mean, it just resizes the result. I wonder if I can adjust the setting to get detailed toonified results.

dongyun-kim-arch avatar Oct 31 '22 01:10 dongyun-kim-arch

Use padding to adjust the output resolution: --padding (default: 200, 200, 200, 200): left, right, top, bottom paddings to the eye center.

image

williamyang1991 avatar Oct 31 '22 01:10 williamyang1991

Our encoder accepts H/4xW/4 input for HxW output. If you want the input to have the same resolution of output, you need to train your own model with in_size=1024,

https://github.com/williamyang1991/VToonify/blob/db57c27b4189023a5330c21b015a8e78cc111b87/model/vtoonify.py#L130-L139

williamyang1991 avatar Oct 31 '22 01:10 williamyang1991

Thank you for the explanation.

I tested 2000x2000 image as an input, and the size of generated image was the same, but the image was blurry so I thought it was just resized. Could you explain the details of this part? It seems like the model was trained with 256 size and it is able to generate 4 times bigger image, maintaining the quality.

dongyun-kim-arch avatar Oct 31 '22 01:10 dongyun-kim-arch

This is the relationship between the input resolution and output resolution. The face will be resized so that the eye distance is about 64 pixels to match the scale of our model.

image

williamyang1991 avatar Oct 31 '22 01:10 williamyang1991

ahhh! I see. So, the output size is quite fixed... Thank you for the quick reply and detailed explanation!

dongyun-kim-arch avatar Oct 31 '22 01:10 dongyun-kim-arch