Skip to content
Snippets Groups Projects
Commit 64bc5ca7 authored by Laurent COLBOIS's avatar Laurent COLBOIS
Browse files

Fix StyleGAN2 pickle loading

parent 84ef2f60
No related branches found
No related tags found
No related merge requests found
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,
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment