Created
October 20, 2020 13:48
-
-
Save edgeboyo/f8bc3eaad08b07d410db2f0dbdf5a422 to your computer and use it in GitHub Desktop.
Revisions
-
edgeboyo revised this gist
Oct 20, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,2 @@ pip install PyYAML==5.3.1 git clone https://github.com/AliaksandrSiarohin/first-order-model -
edgeboyo created this gist
Oct 20, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ import imageio import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from skimage.transform import resize # from IPython.display import HTML import warnings warnings.filterwarnings("ignore") source_image = imageio.imread(input("Point to source picture: ")) reader = imageio.get_reader(input("Point to trainer video: )) #Resize image and video to 256x256 source_image = resize(source_image, (256, 256))[..., :3] fps = reader.get_meta_data()['fps'] driving_video = [] try: for im in reader: driving_video.append(im) except RuntimeError: pass reader.close() driving_video = [resize(frame, (256, 256))[..., :3] for frame in driving_video] from demo import load_checkpoints generator, kp_detector = load_checkpoints(config_path='config/vox-256.yaml', checkpoint_path='damedame/vox-cpk.pth.tar') from demo import make_animation from skimage import img_as_ubyte predictions = make_animation(source_image, driving_video, generator, kp_detector, relative=True) #save resulting video imageio.mimsave('../generated.mp4', [img_as_ubyte(frame) for frame in predictions], fps=fps) #video can be downloaded from /content folder # HTML(display(source_image, driving_video, predictions).to_html5_video()) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ !pip install PyYAML==5.3.1 !git clone https://github.com/AliaksandrSiarohin/first-order-model