diff --git a/core/leras/nn.py b/core/leras/nn.py index 280bcdb..09900bf 100644 --- a/core/leras/nn.py +++ b/core/leras/nn.py @@ -76,15 +76,19 @@ class nn(): first_run = False - if sys.platform[0:3] == 'win': - devices_str = "" - for device in device_config.devices: - devices_str += "_" + device.name.replace(' ','_') - - compute_cache_path = Path(os.environ['APPDATA']) / 'NVIDIA' / ('ComputeCache' + devices_str) - if not compute_cache_path.exists(): - first_run = True - os.environ['CUDA_CACHE_PATH'] = str(compute_cache_path) + if not device_config.cpu_only: + if sys.platform[0:3] == 'win': + if all( [ x.name == device_config.devices[0].name for x in device_config.devices ] ): + devices_str = "_" + device_config.devices[0].name.replace(' ','_') + else: + devices_str = "" + for device in device_config.devices: + devices_str += "_" + device.name.replace(' ','_') + + compute_cache_path = Path(os.environ['APPDATA']) / 'NVIDIA' / ('ComputeCache' + devices_str) + if not compute_cache_path.exists(): + first_run = True + os.environ['CUDA_CACHE_PATH'] = str(compute_cache_path) os.environ['TF_MIN_GPU_MULTIPROCESSOR_COUNT'] = '2' os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # tf log errors only diff --git a/mainscripts/Extractor.py b/mainscripts/Extractor.py index 7d41684..7b40f2a 100644 --- a/mainscripts/Extractor.py +++ b/mainscripts/Extractor.py @@ -156,6 +156,8 @@ class ExtractSubprocessor(Subprocessor): landmarks_extractor, rects_extractor, ): + h, w, ch = image.shape + if data.rects_rotation == 0: rotated_image = image elif data.rects_rotation == 90: diff --git a/models/Model_SAEHD/Model.py b/models/Model_SAEHD/Model.py index 96e553d..b676a61 100644 --- a/models/Model_SAEHD/Model.py +++ b/models/Model_SAEHD/Model.py @@ -615,9 +615,9 @@ class SAEHDModel(ModelBase): with tf.device( f'/GPU:0' if len(devices) != 0 else f'/CPU:0'): if 'df' in archi: gpu_dst_code = self.inter(self.encoder(self.warped_dst)) - gpu_pred_src_dst = self.decoder_src(gpu_dst_code) - gpu_pred_dst_dstm = self.decoder_dstm(gpu_dst_code) - gpu_pred_src_dstm = self.decoder_srcm(gpu_dst_code) + gpu_pred_src_dst, gpu_pred_src_dstm = self.decoder_src(gpu_dst_code) + _, gpu_pred_dst_dstm = self.decoder_dst(gpu_dst_code) + elif 'liae' in archi: gpu_dst_code = self.encoder (self.warped_dst) gpu_dst_inter_B_code = self.inter_B (gpu_dst_code) @@ -625,9 +625,8 @@ class SAEHDModel(ModelBase): gpu_dst_code = tf.concat([gpu_dst_inter_B_code,gpu_dst_inter_AB_code],-1) gpu_src_dst_code = tf.concat([gpu_dst_inter_AB_code,gpu_dst_inter_AB_code],-1) - gpu_pred_src_dst = self.decoder(gpu_src_dst_code) - gpu_pred_dst_dstm = self.decoderm(gpu_dst_code) - gpu_pred_src_dstm = self.decoderm(gpu_src_dst_code) + gpu_pred_src_dst, gpu_pred_src_dstm = self.decoder(gpu_src_dst_code) + _, gpu_pred_dst_dstm = self.decoder(gpu_dst_code) if learn_mask: def AE_merge( warped_dst):