From 22208bf9e85a1766ee4370c664a9871a8a0e3898 Mon Sep 17 00:00:00 2001 From: lzzyzlbb <287246233@qq.com> Date: Mon, 29 Nov 2021 19:23:31 +0800 Subject: [PATCH] add default output for stylegan and fom (#501) --- ppgan/models/firstorder_model.py | 2 ++ ppgan/models/styleganv2_model.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ppgan/models/firstorder_model.py b/ppgan/models/firstorder_model.py index e60e7aa..2a17c43 100755 --- a/ppgan/models/firstorder_model.py +++ b/ppgan/models/firstorder_model.py @@ -226,6 +226,8 @@ class FirstOrderModel(BaseModel): driving2 = {'value': value2, 'jacobian': j2} driving3 = {'value': value, 'jacobian': j} + if output_dir is None: + output_dir = 'inference_model' outpath = os.path.join(output_dir, "fom_dy2st") if not os.path.exists(outpath): os.makedirs(outpath) diff --git a/ppgan/models/styleganv2_model.py b/ppgan/models/styleganv2_model.py index 73ac5c9..71f33b9 100644 --- a/ppgan/models/styleganv2_model.py +++ b/ppgan/models/styleganv2_model.py @@ -314,6 +314,8 @@ class StyleGAN2Model(BaseModel): infer_generator.set_generator(self.nets['gen']) style = paddle.rand(shape=inputs_size[0], dtype='float32') truncation = paddle.rand(shape=inputs_size[1], dtype='float32') + if output_dir is None: + output_dir = 'inference_model' paddle.jit.save(infer_generator, os.path.join(output_dir, "stylegan2model_gen"), input_spec=[style, truncation]) -- GitLab