Pre-train option available anytime (not just first run)

This commit is contained in:
jh 2019-09-18 14:55:04 -07:00
commit 8a0eec510b

View file

@ -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):