In [0]:
!git clone https://github.com/wuhuikai/GP-GAN.git
In [0]:
%cd GP-GAN
In [0]:
%cd models
Download the pretrained models
In [0]:
!gdown https://drive.google.com/uc?id=0Bybnpq8dvwudXzZFLU1iOXVOZ3c
!gdown https://drive.google.com/uc?id=0Bybnpq8dvwudRzRLUm1xYmt6R1E
!gdown https://drive.google.com/uc?id=0Bybnpq8dvwudOEFELWkzcGJJVjA
Install repo requirements
In [0]:
%cd ..
In [0]:
!pip install -r requirements/test/requirements.txt
It's ok to restart the runtime, you will just have to cd into the correct directory again with %cd GP-GAN.
Drag and drop 3 images into your GP-GAN/images/test_images folder on the left: The source image (the one you want to cut something out of), the destination image (where you want to add the cropped one), and the mask image(in png format).
In [0]:
%cd GP-GAN
In [0]:
!python run_gp_gan.py --src_image images/test_images/src.jpg --dst_image images/test_images/dst.jpg --mask_image images/test_images/mask.png --blended_image images/test_images/result_image.png
In [0]:
from IPython.display import Image
Image('images/test_images/result_image.png')
Huzzah!
Here is another way of doing it (unsupervised):
In [0]:
!python run_gp_gan.py --src_image images/test_images/src.jpg --dst_image images/test_images/dst.jpg --mask_image images/test_images/mask.png --blended_image images/test_images/result_image_unsupervised.png --supervised False
In [0]:
from IPython.display import Image
Image('images/test_images/result_image_unsupervised.png')
Notebook Version by Tyler Suard, www.TylerSuard.com
Contributed to https://github.com/wuhuikai/GP-GAN, a project by Wu Huikai