DragGAN
DragGAN copied to clipboard
Adding functions to input custom image
Hi, I combined part of the PTI code into the visualizer so that custom image can be uploaded directly. It add some code and makes some change to the viz/renderer. Maybe after testing, it can be added as a branch.
@tianhaoxie very cool! how do we change the base model? is the default the horse one?
@tianhaoxie very cool! how do we change the base model? is the default the horse one?
It follows the original way of DragGAN, default is lion and you can change it by changing checkpoints.
sorry, I just notice that, testing! great it uses the selected checkpoint 👏 very cool!
It is not working with stylegan_human_v2_1024, tried resize = (1024, 512) on L69 in inversion.py and also at L227 def train(self,img,w_plus=False): resize = (1024,512) if torch.is_tensor(img) == False: transform = transforms.Compose( [ transforms.Resize(resize, ),
transforms.ToTensor(),
transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5]),
]
)
.... It will run, but wont make better results,
It is not working with stylegan_human_v2_1024, tried resize = (1024, 512) on L69 in inversion.py and also at L227 def train(self,img,w_plus=False): resize = (1024,512) if torch.is_tensor(img) == False: transform = transforms.Compose( [ transforms.Resize(resize, ),
transforms.ToTensor(), transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5]), ] )
.... It will run, but wont make better results,
It only supports the pre-trained models that you can download in the script. Since the GAN inversion is based on PTI, I'm not sure if it supports stylegan_human.
hi @tianhaoxie , I also noticed that you might need to update the generator on the current model following this https://github.com/danielroich/PTI/issues/26 wdyt?
tmp['G_ema'] = old_G.eval().requires_grad_(False).cpu()# copy.deepcopy(new_G).eval().requires_grad_(False).cpu()
tmp['G'] = new_G.eval().requires_grad_(False).cpu() # copy.deepcopy(new_G).eval().requires_grad_(False).cpu()
tmp['D'] = old_D
tmp['training_set_kwargs'] = None
tmp['augment_pipe'] = None
I follow the PTI and meet this https://github.com/danielroich/PTI/issues/50 , I hope this pr can help me.
Hi, i got a picture when i run pti, but the picture is blurry。
please help me, thanks
@tianhaoxie
I follow the PTI and meet this danielroich/PTI#50 , I hope this pr can help me.
It's because the image resolution is depended on the stylegan checkpoint you selected. If the image you input is not exactly the resolution of the checkpoint, you need to crop and resize.
Hi, i got a picture when i run pti, but the picture is blurry。
please help me, thanks @tianhaoxie
It is normal for inversion to get results blurred and distorted.
is there a possibility that in the future we can edit any image we add?
@tianhaoxie I am trying to run the gradio visualizer from your github but it is not working! Can you possibly lay down the steps you followed to generate the gan_inv checkpoints and what all are the limitations for running this demo? When I load the custom image, the gradio UI is stuck somewhere.
@tianhaoxie I am trying to run the gradio visualizer from your github but it is not working! Can you possibly lay down the steps you followed to generate the gan_inv checkpoints and what all are the limitations for running this demo? When I load the custom image, the gradio UI is stuck somewhere.
Except for the stylegan human, all other checkpoints should work. Btw, you should upload your image by clicking 'inverse custom image', rather than drop it in the image box.
@tianhaoxie I am trying to run the gradio visualizer from your github but it is not working! Can you possibly lay down the steps you followed to generate the gan_inv checkpoints and what all are the limitations for running this demo? When I load the custom image, the gradio UI is stuck somewhere.
Except for the stylegan human, all other checkpoints should work. Btw, you should upload your image by clicking 'inverse custom image', rather than drop it in the image box.
we have feature in draggan for edit any uploaded image?
@tianhaoxie I am trying to run the gradio visualizer from your github but it is not working! Can you possibly lay down the steps you followed to generate the gan_inv checkpoints and what all are the limitations for running this demo? When I load the custom image, the gradio UI is stuck somewhere.
Except for the stylegan human, all other checkpoints should work. Btw, you should upload your image by clicking 'inverse custom image', rather than drop it in the image box.
we have feature in draggan for edit any uploaded image?
no, only the categories that the pre-trained checkpoints we have(i.e. horse, face).
@tianhaoxie I am trying to run the gradio visualizer from your github but it is not working! Can you possibly lay down the steps you followed to generate the gan_inv checkpoints and what all are the limitations for running this demo? When I load the custom image, the gradio UI is stuck somewhere.
Except for the stylegan human, all other checkpoints should work. Btw, you should upload your image by clicking 'inverse custom image', rather than drop it in the image box.
we have feature in draggan for edit any uploaded image?
no, only the categories that the pre-trained checkpoints we have(i.e. horse, face).
if i good understand you have pre-trained categories e.g. face, horse.. and i can upload any photo where is face e.g. face of my sister and edit with draggan but i can't upload some category which is not trained e.g. cat?
@tianhaoxie I am trying to run the gradio visualizer from your github but it is not working! Can you possibly lay down the steps you followed to generate the gan_inv checkpoints and what all are the limitations for running this demo? When I load the custom image, the gradio UI is stuck somewhere.
Except for the stylegan human, all other checkpoints should work. Btw, you should upload your image by clicking 'inverse custom image', rather than drop it in the image box.
we have feature in draggan for edit any uploaded image?
no, only the categories that the pre-trained checkpoints we have(i.e. horse, face).
if i good understand you have pre-trained categories e.g. face, horse.. and i can upload any photo where is face e.g. face of my sister and edit with draggan but i can't upload some category which is not trained e.g. cat?
I believe so, the provided image should roughly belong to a data distribution approximated by any of the provided trained stylegan models.
looking forward