From 38db612469466393baca683777b9b04aaedf9be2 Mon Sep 17 00:00:00 2001 From: Hunor Laczko Date: Sat, 28 Jan 2023 11:29:25 +0000 Subject: [PATCH] train next level, evaluate first --- aaa_helpers.txt | 2 + configs/config_abl_pyr_32_64_skirt_r1.py | 189 +++++++++++++++++++++++ configs/config_abl_pyr_32_skirt.py | 2 +- cvae_pyramid.py | 2 +- evaluate_ae_pyramid.py | 4 +- 5 files changed, 195 insertions(+), 4 deletions(-) create mode 100644 configs/config_abl_pyr_32_64_skirt_r1.py diff --git a/aaa_helpers.txt b/aaa_helpers.txt index 55a08b1..0338d6d 100644 --- a/aaa_helpers.txt +++ b/aaa_helpers.txt @@ -1,6 +1,8 @@ nohup python cvae_pyramid.py --name="lhunor_abl_pyr_32_no_curv_r1" > nohup/review/abl_pyr_32_no_curv_r1.out 2>&1 & nohup python auto_encoder_static.py --name="lhunor_ae_static_orig_10p_r1" > nohup/review/static_orig_10p_r1.out 2>&1 & nohup python auto_encoder_body.py --name="lhunor_ae_body_orig_10p_r1" > nohup/review/body_orig_10p_r1.out 2>&1 & +nohup python cvae_pyramid.py --name="lhunor_abl_32_64_skirt_no_curv_r1" > nohup/review/abl_pyr_32_64_skirt_no_curv_r1.out 2>&1 & +nohup python evaluate_ae_pyramid.py --name evaluate_ae_abl_pyr_32_no_curv_r1 > nohup/evaluate/abl_pyr_32_no_curv_r1.out 2>&1 & one final convolutional layer for smoothing, on the final coordinates diff --git a/configs/config_abl_pyr_32_64_skirt_r1.py b/configs/config_abl_pyr_32_64_skirt_r1.py new file mode 100644 index 0000000..3acdd33 --- /dev/null +++ b/configs/config_abl_pyr_32_64_skirt_r1.py @@ -0,0 +1,189 @@ +config = dict() + +config['gpu'] = '1' +config['name'] = 'pyr_abl_32_64_skirt_no_curv_r1' +config['notes'] = 'no curv, 10p data' +config['tags'] = ['review_1'] + +# DON'T FORGET TO RESET SSIM LOSS USAGE +# DON'T FORGET TO CHECK MODEL LOADING +# DON'T FORGET TO CHECK IF STORE IN MEMORY +# DON'T FORGET TO CHECK REG LOSS COEFF +# DON'T FORGET TO LOAD FINAL UPSCALER UNLESS HAVE LEVEL 512 +# DON'T FORGET TO CHECK IF SKIRT +# DON'T FORGET TO CHECK IF CAPE +# DON'T FORGET TO CHECK IF USING DOWNSCALE NONE OR _2 +# DON'T FORGET TO CHECK UPSCALING and ENCODER CHECKPOINTS + +config['use_skinning'] = True # and deshaping +config['remove_global_orientation'] = True +config['use_extra_losses'] = True # edge, collision, 3d mesh +config['use_offsets'] = False +config['use_curvature'] = False + +config['pyramid'] = dict() +config['pyramid']['resolutions'] = [32, 64] +config['pyramid']['pretrained_pyramid'] = 'checkpoints/pyr_abl_32_skirt_no_curv_r1' +config['pyramid']['final_upscale_enhancer'] = 'checkpoints/64_512_skirt' + +config['pretrained_model'] = '' +config['pretrained_model_iteration'] = '' + +config['train_dir'] = '/home/workspace/data/dataset/local-cache/train_skirt' +config['valid_dir'] = '/home/workspace/local-data/valid_skirt' +config['test_dir'] = '/home/workspace/data/dataset/test_skirt_ready_2' +config['batch_size'] = 4 +config['is_skirt'] = True +config['is_cape'] = False +config['frames_file'] = 'frames_skirt_10p.txt' +config['frames_file_valid'] = 'frames_skirt_10p.txt' + +config['pyramid']['static_model'] = 'checkpoints/static_1_skirt' +config['pyramid']['body_model'] = 'checkpoints/body_1_skirt_2_2' +config['pyramid']['curvature_model'] = 'checkpoints/curv_1_skirt' + +config['dataset_in_memory'] = True +config['resolution'] = None +config['latent_dim'] = 128 + +config['smpl_res'] = 14475 +if config['is_cape']: + config['smpl_res'] = 3638 + +config['lr'] = 0.0001 +config['starting_balancing_coeff'] = 0.0001 +config['reg_loss_coeff'] = 0.1 # set to 0 if don't want to use edge+collision +config['avg_garment_path'] = '' + +config['signature_dynamic'] = { 'id': (), 'frame_nr': (), + 'pose_shape': (72 + 11,), + 'uv_body_posed': (512, 256, 3), + 'mesh_body_posed': (config['smpl_res'], 3,), + 'mesh_posed': (config['smpl_res'], 3,), + 'mesh_unposed': (config['smpl_res'], 3,), + 'uv_unposed': (512, 256, 3), + 'uv_curvature': (512, 256, 7), + } +config['signature_static'] = { 'uv_static': (512, 256, 3), + 'mesh_mask': (config['smpl_res'],), + 'uv_mask': (512, 256,), + } + +config['pyramid']['is_label'] = False +config['pyramid']['latent_dim'] = config['latent_dim'] +config['pyramid']['add_noise'] = True +config['pyramid']['noise_amount'] = 0.001 + +config['pyramid']['loss_weights'] = [1,1,1,1,1] + +for res in config['pyramid']['resolutions']: + if res != 512: + res_modifier = '_' + str(res) + config['signature_dynamic']['uv_body_posed' + res_modifier] = (res, res//2, 3) + config['signature_dynamic']['uv_unposed' + res_modifier] = (res, res//2, 3) + config['signature_dynamic']['uv_curvature' + res_modifier] = (res, res//2, 7) + config['signature_static']['uv_static' + res_modifier] = (res, res//2, 3) + config['signature_static']['uv_mask' + res_modifier] = (res, res//2) + + + +config['pyramid']['freeze_encoders'] = True + +config['pyramid']['levels'] = [] +for res in config['pyramid']['resolutions']: + if res == 512: + level = dict() + level['resolution'] = 512 + level['latent_dim'] = config['latent_dim'] + level['kernel_size'] = 7 + level['encoder_depths'] = [3, 3, 9, 3] + level['encoder_dims'] = [32, 64, 128, 256] + level['decoder_input'] = (16, 8, 80) + level['decoder_depths'] = [3, 3, 9, 3] + level['decoder_dims'] = [256, 128, 64, 16] + level['avg_garment_path'] = '' + level['upscale_enhancer'] = '' + config['pyramid']['levels'].append(level) + elif res == 256: + level = dict() + level['resolution'] = 256 + level['latent_dim'] = config['latent_dim'] + level['kernel_size'] = 7 + level['encoder_depths'] = [9, 9, 9, 9] + level['encoder_dims'] = [32, 64, 128, 256] + level['decoder_input'] = (8, 4, 128) + level['decoder_depths'] = [9, 9, 9, 9] + level['decoder_dims'] = [256, 128, 64, 16] + level['avg_garment_path'] = '' + level['upscale_enhancer'] = ''#'checkpoints/up_3_d256_512_2' + level['upscale_enhancer_freeze'] = True + config['pyramid']['levels'].append(level) + elif res == 128: + level = dict() + level['resolution'] = 128 + level['latent_dim'] = config['latent_dim'] + level['kernel_size'] = 5 + level['encoder_depths'] = [16, 9, 9, 9] + level['encoder_dims'] = [64, 128, 128, 256] + level['decoder_input'] = (4, 2, 128) + level['decoder_depths'] = [16, 9, 9, 9] + level['decoder_dims'] = [256, 128, 128, 64] + level['avg_garment_path'] = '' + level['upscale_enhancer'] = ''#'checkpoints/up_3_d128_256_2' + level['upscale_enhancer_freeze'] = True + config['pyramid']['levels'].append(level) + elif res == 64: + level = dict() + level['resolution'] = 64 + level['latent_dim'] = config['latent_dim'] + level['kernel_size'] = 5 + level['encoder_depths'] = [9, 9, 9] + level['encoder_dims'] = [64, 128, 256] + level['decoder_input'] = (4, 2, 256) + level['decoder_depths'] = [9, 9, 9] + level['decoder_dims'] = [256, 128, 64] + level['avg_garment_path'] = '' + level['upscale_enhancer'] = ''#checkpoints/up_3_d64_128_2' + level['upscale_enhancer_freeze'] = False + config['pyramid']['levels'].append(level) + elif res == 32: + level = dict() + level['resolution'] = 32 + level['latent_dim'] = config['latent_dim'] + level['kernel_size'] = 3 + level['encoder_depths'] = [9, 9] + level['encoder_dims'] = [256, 256] + level['decoder_input'] = (4, 2, 256) + level['decoder_depths'] = [9, 9] + level['decoder_dims'] = [256, 256] + level['avg_garment_path'] = '' + level['upscale_enhancer'] = 'checkpoints/32_512_skirt'#'checkpoints/up_3_d32_64_2' + level['upscale_enhancer_freeze'] = True + config['pyramid']['levels'].append(level) + else: + raise NotImplementedError + + + +config['cond_ae'] = dict() +config['cond_ae']['is_label'] = False +config['cond_ae']['upscale_output'] = False +config['cond_ae']['latent_dim'] = config['latent_dim'] +config['cond_ae']['kernel_size'] = 7 +config['cond_ae']['bottleneck_size'] = 64 +config['cond_ae']['encoder_depths'] = [3, 3, 9, 9, 3] +config['cond_ae']['encoder_dims'] = [32, 64, 128, 256, config['cond_ae']['bottleneck_size']] +config['cond_ae']['decoder_input'] = (8, 4, config['cond_ae']['bottleneck_size']) +config['cond_ae']['decoder_depths'] = [3, 3, 9, 3, 3] +config['cond_ae']['decoder_dims'] = [config['cond_ae']['bottleneck_size'], 256, 128, 64, 16] + +config['cond_ae_body'] = dict() +config['cond_ae_body']['latent_dim'] = config['latent_dim'] +config['cond_ae_body']['kernel_size'] = 7 +config['cond_ae_body']['upscale_output'] = True +config['cond_ae_body']['bottleneck_size'] = 512 +config['cond_ae_body']['encoder_depths'] = [3, 3, 9, 9, 3, 3] +config['cond_ae_body']['encoder_dims'] = [32, 64, 128, 256, 256, config['cond_ae_body']['bottleneck_size']] +config['cond_ae_body']['decoder_input'] = (4, 2, config['cond_ae_body']['bottleneck_size']) +config['cond_ae_body']['decoder_depths'] = [3, 3, 9, 3] +config['cond_ae_body']['decoder_dims'] = [config['cond_ae_body']['bottleneck_size'], 128, 64, 16] \ No newline at end of file diff --git a/configs/config_abl_pyr_32_skirt.py b/configs/config_abl_pyr_32_skirt.py index a250033..304da70 100644 --- a/configs/config_abl_pyr_32_skirt.py +++ b/configs/config_abl_pyr_32_skirt.py @@ -1,6 +1,6 @@ config = dict() -config['gpu'] = '6' +config['gpu'] = '4' config['name'] = 'pyr_abl_32_skirt_no_curv_r1' config['notes'] = 'no curv, 10p data' config['tags'] = ['review_1'] diff --git a/cvae_pyramid.py b/cvae_pyramid.py index 196944e..2a3c439 100644 --- a/cvae_pyramid.py +++ b/cvae_pyramid.py @@ -1,6 +1,6 @@ import os import sys -from configs.config_abl_pyr_32_skirt import config +from configs.config_abl_pyr_32_64_skirt_r1 import config os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu'] import tensorflow as tf diff --git a/evaluate_ae_pyramid.py b/evaluate_ae_pyramid.py index 730e000..c6cb185 100644 --- a/evaluate_ae_pyramid.py +++ b/evaluate_ae_pyramid.py @@ -1,6 +1,6 @@ import os import sys -from configs.config_abl_2_pyr_32_64_128_256_512 import config +from configs.config_abl_pyr_32_skirt import config os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu'] import tensorflow as tf @@ -97,7 +97,7 @@ if __name__ == '__main__': ids = [id.split('_')[0] for id in ids] ids = set(ids) - iteration = '50000' + iteration = '340000' load_model(model, 'checkpoints/' + checkpoint_name, iteration=iteration) # load_model(model, 'checkpoints/' + 'abl_all_120k')