nothing interesting

This commit is contained in:
iperov 2019-04-20 15:22:00 +04:00
parent 046649e6be
commit 3ffdc50576
2 changed files with 28 additions and 22 deletions

View file

@ -85,12 +85,13 @@ class ModelBase(object):
else: else:
self.options['write_preview_history'] = self.options.get('write_preview_history', False) self.options['write_preview_history'] = self.options.get('write_preview_history', False)
if ask_target_iter and (self.iter == 0 or ask_override): if ask_target_iter:
self.options['target_iter'] = max(0, io.input_int("Target iteration (skip:unlimited/default) : ", 0)) if (self.iter == 0 or ask_override):
else: self.options['target_iter'] = max(0, io.input_int("Target iteration (skip:unlimited/default) : ", 0))
self.options['target_iter'] = max(model_data.get('target_iter',0), self.options.get('target_epoch',0)) else:
if 'target_epoch' in self.options: self.options['target_iter'] = max(model_data.get('target_iter',0), self.options.get('target_epoch',0))
self.options.pop('target_epoch') if 'target_epoch' in self.options:
self.options.pop('target_epoch')
if ask_batch_size and (self.iter == 0 or ask_override): if ask_batch_size and (self.iter == 0 or ask_override):
default_batch_size = 0 if self.iter == 0 else self.options.get('batch_size',0) default_batch_size = 0 if self.iter == 0 else self.options.get('batch_size',0)
@ -98,20 +99,23 @@ class ModelBase(object):
else: else:
self.options['batch_size'] = self.options.get('batch_size', 0) self.options['batch_size'] = self.options.get('batch_size', 0)
if ask_sort_by_yaw and (self.iter == 0): if ask_sort_by_yaw:
self.options['sort_by_yaw'] = io.input_bool("Feed faces to network sorted by yaw? (y/n ?:help skip:n) : ", False, help_message="NN will not learn src face directions that don't match dst face directions." ) if (self.iter == 0):
else: self.options['sort_by_yaw'] = io.input_bool("Feed faces to network sorted by yaw? (y/n ?:help skip:n) : ", False, help_message="NN will not learn src face directions that don't match dst face directions." )
self.options['sort_by_yaw'] = self.options.get('sort_by_yaw', False) else:
self.options['sort_by_yaw'] = self.options.get('sort_by_yaw', False)
if ask_random_flip and (self.iter == 0): if ask_random_flip:
self.options['random_flip'] = io.input_bool("Flip faces randomly? (y/n ?:help skip:y) : ", True, help_message="Predicted face will look more naturally without this option, but src faceset should cover all face directions as dst faceset.") if (self.iter == 0):
else: self.options['random_flip'] = io.input_bool("Flip faces randomly? (y/n ?:help skip:y) : ", True, help_message="Predicted face will look more naturally without this option, but src faceset should cover all face directions as dst faceset.")
self.options['random_flip'] = self.options.get('random_flip', True) else:
self.options['random_flip'] = self.options.get('random_flip', True)
if ask_src_scale_mod and (self.iter == 0): if ask_src_scale_mod:
self.options['src_scale_mod'] = np.clip( io.input_int("Src face scale modifier % ( -30...30, ?:help skip:0) : ", 0, help_message="If src face shape is wider than dst, try to decrease this value to get a better result."), -30, 30) if (self.iter == 0):
else: self.options['src_scale_mod'] = np.clip( io.input_int("Src face scale modifier % ( -30...30, ?:help skip:0) : ", 0, help_message="If src face shape is wider than dst, try to decrease this value to get a better result."), -30, 30)
self.options['src_scale_mod'] = self.options.get('src_scale_mod', 0) else:
self.options['src_scale_mod'] = self.options.get('src_scale_mod', 0)
self.write_preview_history = self.options['write_preview_history'] self.write_preview_history = self.options['write_preview_history']
if not self.options['write_preview_history']: if not self.options['write_preview_history']:

View file

@ -42,11 +42,13 @@ class SampleGeneratorImageTemporal(SampleGeneratorBase):
if samples_len == 0: if samples_len == 0:
raise ValueError('No training data provided.') raise ValueError('No training data provided.')
if samples_len - self.temporal_image_count < 0: mult_max = 4
l = samples_len - (self.temporal_image_count-1)*mult_max + 1
if l < 0:
raise ValueError('Not enough samples to fit temporal line.') raise ValueError('Not enough samples to fit temporal line.')
shuffle_idxs = [] shuffle_idxs = []
samples_sub_len = samples_len - self.temporal_image_count + 1 samples_sub_len = samples_len - l + 1
while True: while True:
@ -60,9 +62,9 @@ class SampleGeneratorImageTemporal(SampleGeneratorBase):
idx = shuffle_idxs.pop() idx = shuffle_idxs.pop()
temporal_samples = [] temporal_samples = []
mult = np.random.randint(mult_max)
for i in range( self.temporal_image_count ): for i in range( self.temporal_image_count ):
sample = samples[ idx+i ] sample = samples[ idx+i*mult ]
try: try:
temporal_samples += SampleProcessor.process (sample, self.sample_process_options, self.output_sample_types, self.debug) temporal_samples += SampleProcessor.process (sample, self.sample_process_options, self.output_sample_types, self.debug)
except: except: