williamyang1991 / StyleGANEX

[ICCV 2023] StyleGANEX: StyleGAN-Based Manipulation Beyond Cropped Aligned Faces
Other
510 stars 36 forks source link

inversion #14

Closed 123456klk1 closed 1 year ago

123456klk1 commented 1 year ago

Hi, I'm interested in your work, Here are my inversion results, the inversion is a bit fuzzy (blocky pixels), Is this normal? 00000 00000_inversion

00001 00001_inversion

williamyang1991 commented 1 year ago

You can try apply some gaussain blurring to the input image. For very high-resolution images, bilinear downsampling will lead to too sharp low-resolution image, which will cause your artifacts.

https://github.com/williamyang1991/VToonify/blob/35922e049acad7c87c058929b15cef44c9968b30/style_transfer.py#L124-L129

123456klk1 commented 1 year ago

00001_inversion

Code as above: kernel_size = (3, 3) sigma = 1.5
y_hat[0] = transforms.GaussianBlur(kernel_size, sigma)(y_hat[0])

Looks like the picture is still a little blurry.

williamyang1991 commented 1 year ago

As in https://github.com/williamyang1991/VToonify/blob/35922e049acad7c87c058929b15cef44c9968b30/style_transfer.py#L124-L129 My blur kernel is 4*4, and will apply it to the image twice for very large input.

sibadakesi commented 1 year ago

You can try pillow to resize pic, this works for me。

123456klk1 commented 1 year ago

Ok, thanks