StyleAlign
StyleAlign copied to clipboard
how to get the npy file of w_plus?
how to get the npy file of w_plus?
We use e4e encoder to invert real images into w+ space. We provide pretrained e4e models for FFHQ512, FFHQ512_dog, FFHQ512_dog_cat in here.
Please clone the e4e repo and download the pretrained models, and run
python scripts/inference.py \
--images_dir=/path/to/images/directory \
--save_dir=/path/to/saving/directory \
path/to/checkpoint.pt
in e4e folder. The w_plus latent codes will be in the save_dir. Then you just need to save the torch file to npy file.
@betterze Thanks you for explaining the code of model. As I try to run the code There is an error happened. But I have no idea how to fix it. Would you please give me some suggestion for dealing it ?
python3 projector_z.py --outdir=./example/dog/ --target=./example/dog/ --network=./checkpoint/ffhq512_dog.pkl
I run the sample code on colab
And the error of tensor is happend
Is there anything wrong?
@snow1929 which tensorflow version you are using? I use 1.14
I use tensorflow 1.15
I try to change the version of tensorflow and run it again.
thank you
I run the sample code on colab And the error of tensor is happend Is there anything wrong?
This error is related to the environment (gcc). Pls install the environment following stylegan2-ada.
Hi @betterze , I have already check the source of image. All of the image is 512x512. Thus, I have no idea how to fix this trouble.
Traceback (most recent call last):
File "Compare.py", line 89, in <module>
main()
File "Compare.py", line 79, in main
out=np.concatenate([imgs,invert,target],axis=1)
File "<__array_function__ internals>", line 6, in concatenate
ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 2, the array at index 0 has size 512 and the array at index 2 has size 256
Would you mind printing the shape of [imgs,invert,target] separately?
name = ['flickr_dog_000043.jpg', 'flickr_dog_000045.jpg', 'flickr_dog_000054.jpg', 'flickr_dog_000059.jpg']
imgs_shape= (512, 512, 3)
invert_shape= (512, 512, 3)
target_shape= (256, 256, 3)
The target images are in shape (256,256), rather than (512, 512). So it causes the error.
Which target model (target_pkl) you are using?
I choose the model of "stylegan2-ffhq512_dog_cat-config-f.pkl" as target_pkl!!
The images in the target_path are in (256, 256), could you doublecheck this. Go to the folder and check the image size.
Remove all images in the target_path, and rerun
python I2I.py --network $target_pkl \
--source_path $source_path \
--target_path $target_path
python Compare.py --source_img_path $source_img_path \
--source_path $source_path \
--target_path $target_path \
--save_path $compare_html
@betterze If I want to use e4e encoder to invert real images into w+ space with my own dataset.
how to get "checkpoint.pt"
I have to finished the prtrained model by [e4e encoder]? Or, can I invert the stylegan-ada prtrained model to pt filetype? how to do it?