(Image from https://github.com/yuval-alaluf/restyle-encoder/blob/main/notebooks/images/)
Shape : (1, 3, 1024, 1024)
Face alignment and reshaped to : (1, 3, 256, 256)
* Note: From left to right: 1st, 2nd, 3rd, 4th, 5th iteration, and original (face aligned) image.
Automatically downloads the onnx and prototxt files on the first run. It is necessary to be connected to the Internet while downloading.
For the sample image,
$ python3 restyle-encoder.py
If you want to specify the input image, put the image path after the --input
option.
You can use --savepath
option to change the name of the output file to save.
$ python3 restyle-encoder.py --input IMAGE_PATH --savepath SAVE_IMAGE_PATH
By specifying the -iter
option, you can choose how many iterations you want to generate the output image (default 5).
$ python3 restyle-encoder.py -iter 3
By specifying the -toon
option, you can run the toonification task.
$ python3 restyle-encoder.py -toon --input img/toonify_img.jpg --savepath img/output_toonify.png
By adding the --video
option, you can input the video.
If you pass 0
as an argument to VIDEO_PATH, you can use the webcam input instead of the video file.
$ python3 restyle-encoder.py --video VIDEO_PATH
By adding the --use_dlib
option, you can use original version of face alignment.
Pytorch 1.10.0
Python 3.6.7+
ONNX opset=11