From 8a0eec510ba761719807bbf02cc50e8e586605ca Mon Sep 17 00:00:00 2001 From: jh Date: Wed, 18 Sep 2019 14:55:04 -0700 Subject: [PATCH] Pre-train option available anytime (not just first run) --- models/Model_SAE/Model.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/models/Model_SAE/Model.py b/models/Model_SAE/Model.py index c2d26c6..61f6b02 100644 --- a/models/Model_SAE/Model.py +++ b/models/Model_SAE/Model.py @@ -155,6 +155,18 @@ class SAEModel(ModelBase): else: self.options['clipgrad'] = False + self.options['pretrain'] = io.input_bool("Pretrain the model? (y/n, ?:help skip:n) : ", False, + help_message="Pretrain the model with large amount of various " + "faces. This technique may help to train the fake " + "with overly different face shapes and light " + "conditions of src/dst data. Face will be look more " + "like a morphed. To reduce the morph effect, " + "some model files will be initialized but not be " + "updated after pretrain: LIAE: inter_AB.h5 DF: " + "encoder.h5. The longer you pretrain the model the " + "more morphed face will look. After that, " + "save and run the training again.") + else: self.options['pixel_loss'] = self.options.get('pixel_loss', False) self.options['face_style_power'] = self.options.get('face_style_power', default_face_style_power) @@ -162,12 +174,7 @@ class SAEModel(ModelBase): self.options['apply_random_ct'] = self.options.get('apply_random_ct', ColorTransferMode.NONE) self.options['clipgrad'] = self.options.get('clipgrad', False) self.options['random_color_change'] = self.options.get('random_color_change', False) - - if is_first_run: - self.options['pretrain'] = io.input_bool("Pretrain the model? (y/n, ?:help skip:n) : ", False, - help_message="Pretrain the model with large amount of various faces. This technique may help to train the fake with overly different face shapes and light conditions of src/dst data. Face will be look more like a morphed. To reduce the morph effect, some model files will be initialized but not be updated after pretrain: LIAE: inter_AB.h5 DF: encoder.h5. The longer you pretrain the model the more morphed face will look. After that, save and run the training again.") - else: - self.options['pretrain'] = False + self.options['pretrain'] = self.options.get('pretrain', False) #override def onInitialize(self):