Tutorial: GAN-based customized function

1. Install the external package and pretrained weights

cd beacon_aug/generator/gan_based
bash prepare_gan_ensembling.sh

2. Generate an inferencing function

Check the example in beacon_aug/generator/gan_based/Stylemix.py

3. Run augmentation in beacon-aug

[14]:
import beacon_aug as BA
import os
import sys
import matplotlib.pyplot as plt
import numpy as np

package_path=os.path.join(os.path.dirname(BA.__file__), "external/gan-ensembling")
os.chdir(package_path)
sys.path.append(package_path)


aug = BA.Stylemix(library = "custom")
image= np.zeros((255,255))

image_auged = aug(image=image)["image"]

plt.imshow(image_auged)

[14]:
<matplotlib.image.AxesImage at 0x7f7c5a3c65f8>
../_images/ipynbs_tutorial_gan_based_2_1.svg