diff --git a/bob/paper/ijcb2021_synthetic_dataset/stylegan2/generator.py b/bob/paper/ijcb2021_synthetic_dataset/stylegan2/generator.py index 31b2877b9e2f2a50329572589a13cbd747a50eaf..56057546e5068ad7a8233f1d59e4819415b3b65a 100644 --- a/bob/paper/ijcb2021_synthetic_dataset/stylegan2/generator.py +++ b/bob/paper/ijcb2021_synthetic_dataset/stylegan2/generator.py @@ -1,10 +1,11 @@ -from . import dnnlib, pretrained_networks +from . import dnnlib from .dnnlib import tflib from .. import utils from bob.extension import rc import numpy as np import bob.io.image import tensorflow as tf +import pickle class StyleGAN2Generator(object): def __init__(self, @@ -24,7 +25,9 @@ class StyleGAN2Generator(object): and for all at initialization. :param image_postprocessing_fn : Additional function to apply to the generated images before saving. """ - _G, _D, Gs = pretrained_networks.load_networks(sg2_path) + with open(sg2_path, 'rb') as pkl_file: + _G, _D, Gs = pickle.load(pkl_file) + self.network = Gs self.latent_dim = self.network.input_shape[-1] self.run_kwargs = {'randomize_noise': randomize_noise, diff --git a/bob/paper/ijcb2021_synthetic_dataset/stylegan2/pretrained_networks.py b/bob/paper/ijcb2021_synthetic_dataset/stylegan2/pretrained_networks.py index 9ad3e5e78641638e38dc613110176fc1bf1d8ca4..7573ac03441120e3f2d4fc60849e63872063e75e 100644 --- a/bob/paper/ijcb2021_synthetic_dataset/stylegan2/pretrained_networks.py +++ b/bob/paper/ijcb2021_synthetic_dataset/stylegan2/pretrained_networks.py @@ -9,7 +9,6 @@ import pickle import sys import os -sys.path.append('/idiap/home/lcolbois/colbois_reporting/synthface/synthface/stylegan2') from . import dnnlib from dnnlib import tflib