Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d96d83d12 | ||
|
|
5d91b56a63 | ||
|
|
ea683ac030 | ||
|
|
9cd9c6f12a | ||
|
|
46e37e22eb | ||
|
|
cba9d8ce90 | ||
|
|
655c70413b | ||
|
|
8514032837 | ||
|
|
2305a0ee23 |
+6
-8
@@ -1,11 +1,9 @@
|
|||||||
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_r7_3" > nohup/review/ae_static_r7_3.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_r7_3" > nohup/review/ae_body_r7_3.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 auto_encoder_curv.py --name="lhunor_ae_curv_r7_3" > nohup/review/ae_curv_r7_3.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 cvae.py --name="lhunor_abl_all_resnet_r7" > nohup/review/abl_all_resnet_r7.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 &
|
nohup python calculate_error.py --name abl_all_resnet_r7_70k > nohup/error/abl_all_resnet_r7_70k.out 2>&1 &
|
||||||
nohup python evaluate_ae_pyramid.py --name evaluate_ae_abl_32_64_skirt_no_curv_r1 > nohup/evaluate/abl_32_64_skirt_no_curv_r1.out 2>&1 &
|
nohup python evaluate_ae.py --name abl_all_resnet_r7_70k > nohup/evaluate/abl_all_resnet_r7_70k.out 2>&1 &
|
||||||
nohup python calculate_error.py --name error_abl_pyr_32_no_curv_r1 > nohup/error/abl_pyr_32_no_curv_r1.out 2>&1 &
|
|
||||||
nohup python calculate_error.py --name error_pyr_abl_32_64_skirt_no_curv_r1 > nohup/error/pyr_abl_32_64_skirt_no_curv_r1.out 2>&1 &
|
|
||||||
|
|
||||||
one final convolutional layer for smoothing, on the final coordinates
|
one final convolutional layer for smoothing, on the final coordinates
|
||||||
|
|
||||||
|
|||||||
+10
-5
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from configs.config_ae_body import config
|
from configs.review.config_ae_body import config
|
||||||
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
||||||
|
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
@@ -30,11 +30,11 @@ from tf_utils import check_tf_version, allow_memory_growth
|
|||||||
from losses import edge_loss, uv_mask_loss
|
from losses import edge_loss, uv_mask_loss
|
||||||
from dataset import DatasetFactory, StaticDataset
|
from dataset import DatasetFactory, StaticDataset
|
||||||
from custom_utils.custom_utils import batch_to_dict, plot_3d
|
from custom_utils.custom_utils import batch_to_dict, plot_3d
|
||||||
from models.cond_encoder import AutoEncoder
|
from models.cond_encoder import AutoEncoderNew as AutoEncoder
|
||||||
|
|
||||||
|
|
||||||
def init_wandb():
|
def init_wandb():
|
||||||
run = wandb.init(project='ae', name=config['name'], notes=config['notes'], dir='/home/workspace/local-data/temp')
|
run = wandb.init(project='ae', name=config['name'], notes=config['notes'], dir='/home/workspace/local-data/temp', tags=config['tags'])
|
||||||
artifact = wandb.Artifact('code', type='code')
|
artifact = wandb.Artifact('code', type='code')
|
||||||
artifact.add_file('auto_encoder_body.py')
|
artifact.add_file('auto_encoder_body.py')
|
||||||
artifact.add_file('losses.py')
|
artifact.add_file('losses.py')
|
||||||
@@ -42,7 +42,7 @@ def init_wandb():
|
|||||||
artifact.add_file('models/cond_encoder.py')
|
artifact.add_file('models/cond_encoder.py')
|
||||||
artifact.add_file('dataset.py')
|
artifact.add_file('dataset.py')
|
||||||
artifact.add_file('convnext/models/convnext_tf.py')
|
artifact.add_file('convnext/models/convnext_tf.py')
|
||||||
config_file_names = [key for key in sys.modules.keys() if key.startswith('configs.')]
|
config_file_names = [key for key in sys.modules.keys() if key.startswith('configs.review.')]
|
||||||
for config_file_name in config_file_names:
|
for config_file_name in config_file_names:
|
||||||
artifact.add_file('/'.join(config_file_name.split('.')) + '.py')
|
artifact.add_file('/'.join(config_file_name.split('.')) + '.py')
|
||||||
run.log_artifact(artifact)
|
run.log_artifact(artifact)
|
||||||
@@ -137,7 +137,10 @@ def train():
|
|||||||
if step == 0:
|
if step == 0:
|
||||||
to_log = { **to_log, **{ 'model/summary': wandb.Html(get_summary_html(model)) } }
|
to_log = { **to_log, **{ 'model/summary': wandb.Html(get_summary_html(model)) } }
|
||||||
|
|
||||||
wandb.log(to_log, step=step)
|
if step % 1000 == 0:
|
||||||
|
wandb.log(to_log, step=step, commit=True)
|
||||||
|
else:
|
||||||
|
wandb.log(to_log, step=step, commit=False)
|
||||||
|
|
||||||
if step % 10000 == 0:
|
if step % 10000 == 0:
|
||||||
manager_enc.save(checkpoint_number=step)
|
manager_enc.save(checkpoint_number=step)
|
||||||
@@ -171,6 +174,7 @@ if __name__ == '__main__':
|
|||||||
signature=config['signature_dynamic'],
|
signature=config['signature_dynamic'],
|
||||||
resolutions=[config['resolution']],
|
resolutions=[config['resolution']],
|
||||||
in_memory=config['dataset_in_memory'],
|
in_memory=config['dataset_in_memory'],
|
||||||
|
use_no_orient=config['remove_global_orientation'],
|
||||||
frames_file=config['frames_file'] if 'frames_file' in config.keys() else None,
|
frames_file=config['frames_file'] if 'frames_file' in config.keys() else None,
|
||||||
is_cape=config['is_cape'])
|
is_cape=config['is_cape'])
|
||||||
static_dataset_train = StaticDataset(folder=config['train_dir'],
|
static_dataset_train = StaticDataset(folder=config['train_dir'],
|
||||||
@@ -184,6 +188,7 @@ if __name__ == '__main__':
|
|||||||
signature=config['signature_dynamic'],
|
signature=config['signature_dynamic'],
|
||||||
resolutions=[config['resolution']],
|
resolutions=[config['resolution']],
|
||||||
in_memory=config['dataset_in_memory'],
|
in_memory=config['dataset_in_memory'],
|
||||||
|
use_no_orient=config['remove_global_orientation'],
|
||||||
frames_file=config['frames_file_valid'] if 'frames_file_valid' in config.keys() else None,
|
frames_file=config['frames_file_valid'] if 'frames_file_valid' in config.keys() else None,
|
||||||
is_cape=config['is_cape'])
|
is_cape=config['is_cape'])
|
||||||
static_dataset_valid = StaticDataset(folder=config['valid_dir'],
|
static_dataset_valid = StaticDataset(folder=config['valid_dir'],
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from configs.config_ae_curv_post import config
|
from configs.review.config_ae_curv import config
|
||||||
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
||||||
|
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
@@ -37,7 +37,7 @@ from models.cond_encoder import AutoEncoderNew as AutoEncoder
|
|||||||
testing = False
|
testing = False
|
||||||
def init_wandb():
|
def init_wandb():
|
||||||
if not testing:
|
if not testing:
|
||||||
run = wandb.init(project='ae', name=config['name'], notes=config['notes'], dir='/home/workspace/local-data/temp/')
|
run = wandb.init(project='ae', name=config['name'], notes=config['notes'], dir='/home/workspace/local-data/temp', tags=config['tags'])
|
||||||
artifact = wandb.Artifact('code', type='code')
|
artifact = wandb.Artifact('code', type='code')
|
||||||
artifact.add_file('auto_encoder_curv.py')
|
artifact.add_file('auto_encoder_curv.py')
|
||||||
artifact.add_file('losses.py')
|
artifact.add_file('losses.py')
|
||||||
@@ -45,7 +45,7 @@ def init_wandb():
|
|||||||
artifact.add_file('models/cond_encoder.py')
|
artifact.add_file('models/cond_encoder.py')
|
||||||
artifact.add_file('dataset.py')
|
artifact.add_file('dataset.py')
|
||||||
artifact.add_file('convnext/models/convnext_tf.py')
|
artifact.add_file('convnext/models/convnext_tf.py')
|
||||||
config_file_names = [key for key in sys.modules.keys() if key.startswith('configs.')]
|
config_file_names = [key for key in sys.modules.keys() if key.startswith('configs.review.')]
|
||||||
for config_file_name in config_file_names:
|
for config_file_name in config_file_names:
|
||||||
artifact.add_file('/'.join(config_file_name.split('.')) + '.py')
|
artifact.add_file('/'.join(config_file_name.split('.')) + '.py')
|
||||||
run.log_artifact(artifact)
|
run.log_artifact(artifact)
|
||||||
@@ -177,8 +177,11 @@ def train():
|
|||||||
if step == 0:
|
if step == 0:
|
||||||
to_log = { **to_log, **{ 'model/summary': wandb.Html(get_summary_html(model)) } }
|
to_log = { **to_log, **{ 'model/summary': wandb.Html(get_summary_html(model)) } }
|
||||||
|
|
||||||
wandb.log(to_log, step=step)
|
if step % 1000 == 0:
|
||||||
print(step)
|
wandb.log(to_log, step=step, commit=True)
|
||||||
|
else:
|
||||||
|
wandb.log(to_log, step=step, commit=False)
|
||||||
|
# print(step)
|
||||||
|
|
||||||
if step % 10000 == 0:
|
if step % 10000 == 0:
|
||||||
manager_enc.save(checkpoint_number=step)
|
manager_enc.save(checkpoint_number=step)
|
||||||
@@ -206,7 +209,7 @@ def test():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
init_wandb()
|
init_wandb()
|
||||||
allow_memory_growth()
|
# allow_memory_growth()
|
||||||
parser = argparse.ArgumentParser(description='')
|
parser = argparse.ArgumentParser(description='')
|
||||||
parser.add_argument('--name', type=str)
|
parser.add_argument('--name', type=str)
|
||||||
args = vars(parser.parse_args())
|
args = vars(parser.parse_args())
|
||||||
|
|||||||
+11
-5
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from configs.config_ae_static import config
|
from configs.review.config_ae_static import config
|
||||||
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
||||||
|
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
@@ -33,19 +33,20 @@ else:
|
|||||||
from tf_utils import check_tf_version, allow_memory_growth
|
from tf_utils import check_tf_version, allow_memory_growth
|
||||||
from dataset import DatasetFactory, StaticDataset
|
from dataset import DatasetFactory, StaticDataset
|
||||||
from custom_utils.custom_utils import batch_to_dict, plot_3d
|
from custom_utils.custom_utils import batch_to_dict, plot_3d
|
||||||
from models.cond_encoder import AutoEncoder
|
from models.cond_encoder import AutoEncoderNew as AutoEncoder
|
||||||
|
|
||||||
|
|
||||||
def init_wandb():
|
def init_wandb():
|
||||||
run = wandb.init(project='ae', name=config['name'], notes=config['notes'], dir='/home/workspace/local-data/temp')
|
run = wandb.init(project='ae', name=config['name'], notes=config['notes'], dir='/home/workspace/local-data/temp', tags=config['tags'])
|
||||||
artifact = wandb.Artifact('code', type='code')
|
artifact = wandb.Artifact('code', type='code')
|
||||||
artifact.add_file('auto_encoder_static.py')
|
artifact.add_file('auto_encoder_static.py')
|
||||||
artifact.add_file('losses.py')
|
artifact.add_file('losses.py')
|
||||||
artifact.add_file('models/base.py')
|
artifact.add_file('models/base.py')
|
||||||
|
artifact.add_file('models/resnet.py')
|
||||||
artifact.add_file('models/cond_encoder.py')
|
artifact.add_file('models/cond_encoder.py')
|
||||||
artifact.add_file('dataset.py')
|
artifact.add_file('dataset.py')
|
||||||
artifact.add_file('convnext/models/convnext_tf.py')
|
artifact.add_file('convnext/models/convnext_tf.py')
|
||||||
config_file_names = [key for key in sys.modules.keys() if key.startswith('configs.')]
|
config_file_names = [key for key in sys.modules.keys() if key.startswith('configs.review.')]
|
||||||
for config_file_name in config_file_names:
|
for config_file_name in config_file_names:
|
||||||
artifact.add_file('/'.join(config_file_name.split('.')) + '.py')
|
artifact.add_file('/'.join(config_file_name.split('.')) + '.py')
|
||||||
run.log_artifact(artifact)
|
run.log_artifact(artifact)
|
||||||
@@ -138,7 +139,10 @@ def train():
|
|||||||
if step == 0:
|
if step == 0:
|
||||||
to_log = { **to_log, **{ 'model/summary': wandb.Html(get_summary_html(model)) } }
|
to_log = { **to_log, **{ 'model/summary': wandb.Html(get_summary_html(model)) } }
|
||||||
|
|
||||||
|
# if step % 1000 == 0:
|
||||||
|
# wandb.log(to_log, step=step, commit=True)
|
||||||
|
# else:
|
||||||
|
# wandb.log(to_log, step=step, commit=False)
|
||||||
wandb.log(to_log, step=step)
|
wandb.log(to_log, step=step)
|
||||||
|
|
||||||
if step % 10000 == 0:
|
if step % 10000 == 0:
|
||||||
@@ -205,6 +209,7 @@ if __name__ == '__main__':
|
|||||||
signature=config['signature_dynamic'],
|
signature=config['signature_dynamic'],
|
||||||
resolutions=[config['resolution']],
|
resolutions=[config['resolution']],
|
||||||
in_memory=config['dataset_in_memory'],
|
in_memory=config['dataset_in_memory'],
|
||||||
|
use_no_orient=config['remove_global_orientation'],
|
||||||
frames_file=config['frames_file'] if 'frames_file' in config.keys() else None,
|
frames_file=config['frames_file'] if 'frames_file' in config.keys() else None,
|
||||||
is_cape=config['is_cape'])
|
is_cape=config['is_cape'])
|
||||||
static_dataset_train = StaticDataset(folder=config['train_dir'],
|
static_dataset_train = StaticDataset(folder=config['train_dir'],
|
||||||
@@ -218,6 +223,7 @@ if __name__ == '__main__':
|
|||||||
signature=config['signature_dynamic'],
|
signature=config['signature_dynamic'],
|
||||||
resolutions=[config['resolution']],
|
resolutions=[config['resolution']],
|
||||||
in_memory=config['dataset_in_memory'],
|
in_memory=config['dataset_in_memory'],
|
||||||
|
use_no_orient=config['remove_global_orientation'],
|
||||||
frames_file=config['frames_file_valid'] if 'frames_file_valid' in config.keys() else None,
|
frames_file=config['frames_file_valid'] if 'frames_file_valid' in config.keys() else None,
|
||||||
is_cape=config['is_cape'])
|
is_cape=config['is_cape'])
|
||||||
static_dataset_valid = StaticDataset(folder=config['valid_dir'],
|
static_dataset_valid = StaticDataset(folder=config['valid_dir'],
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from configs.config_abl_pyr_32_64_skirt_r1 import config
|
from configs.review.config_abl_all import config
|
||||||
|
|
||||||
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
||||||
# import tensorflow as tf
|
# import tensorflow as tf
|
||||||
@@ -59,13 +59,13 @@ if __name__ == '__main__':
|
|||||||
folder = config['test_dir']
|
folder = config['test_dir']
|
||||||
|
|
||||||
checkpoint_name = config['name']
|
checkpoint_name = config['name']
|
||||||
iteration = '50000'
|
iteration = ''
|
||||||
|
|
||||||
F = np.load("custom_utils/smpl_faces" + skirt_modifier + ".npy").astype(np.int32)
|
F = np.load("custom_utils/smpl_faces" + skirt_modifier + ".npy").astype(np.int32)
|
||||||
garment_type_table = np.load('custom_data/garment_type_table_test.npy', allow_pickle=True).item()
|
garment_type_table = np.load('custom_data/garment_type_table_test.npy', allow_pickle=True).item()
|
||||||
|
|
||||||
|
|
||||||
output_folder = '/home/workspace/data/results/' + checkpoint_name + '-' + iteration
|
output_folder = '/home/workspace/data/results/post/' + checkpoint_name + '-' + iteration
|
||||||
|
|
||||||
|
|
||||||
faces_folder = '/home/workspace/data/results/support/faces' + ('_skirt' if config['is_skirt'] else '')
|
faces_folder = '/home/workspace/data/results/support/faces' + ('_skirt' if config['is_skirt'] else '')
|
||||||
@@ -107,7 +107,7 @@ if __name__ == '__main__':
|
|||||||
for key in per_garment_errors.keys():
|
for key in per_garment_errors.keys():
|
||||||
print(key + ': ' + str(np.mean(per_garment_errors[key])))
|
print(key + ': ' + str(np.mean(per_garment_errors[key])))
|
||||||
|
|
||||||
with open('/home/workspace/data/results/errors/' + checkpoint_name + '-' + iteration + '.csv', mode='w') as f:
|
with open('/home/workspace/data/results/errors/post/' + checkpoint_name + '-' + iteration + '.csv', mode='w') as f:
|
||||||
file_writer = csv.writer(f, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
|
file_writer = csv.writer(f, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
|
||||||
|
|
||||||
for key in sorted(errors.keys()):
|
for key in sorted(errors.keys()):
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
config = dict()
|
config = dict()
|
||||||
|
|
||||||
config['gpu'] = '0'
|
config['gpu'] = '0'
|
||||||
config['name'] = 'pyr_abl_32_r1'
|
config['name'] = 'pyr_abl_32'
|
||||||
config['notes'] = ''
|
config['notes'] = ''
|
||||||
|
|
||||||
# DON'T FORGET TO RESET SSIM LOSS USAGE
|
# DON'T FORGET TO RESET SSIM LOSS USAGE
|
||||||
|
|||||||
@@ -1,189 +0,0 @@
|
|||||||
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]
|
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
config = dict()
|
config = dict()
|
||||||
|
|
||||||
config['gpu'] = '4'
|
config['gpu'] = '3'
|
||||||
config['name'] = 'pyr_abl_32_skirt_no_curv_r1'
|
config['name'] = 'pyr_abl_32_skirt_2'
|
||||||
config['notes'] = 'no curv, 10p data'
|
config['notes'] = 'continued from pyr_abl_32_skirt-180k'
|
||||||
config['tags'] = ['review_1']
|
|
||||||
|
|
||||||
# DON'T FORGET TO RESET SSIM LOSS USAGE
|
# DON'T FORGET TO RESET SSIM LOSS USAGE
|
||||||
# DON'T FORGET TO CHECK MODEL LOADING
|
# DON'T FORGET TO CHECK MODEL LOADING
|
||||||
@@ -19,30 +18,24 @@ config['use_skinning'] = True # and deshaping
|
|||||||
config['remove_global_orientation'] = True
|
config['remove_global_orientation'] = True
|
||||||
config['use_extra_losses'] = True # edge, collision, 3d mesh
|
config['use_extra_losses'] = True # edge, collision, 3d mesh
|
||||||
config['use_offsets'] = False
|
config['use_offsets'] = False
|
||||||
config['use_curvature'] = False
|
|
||||||
|
|
||||||
config['pyramid'] = dict()
|
config['pyramid'] = dict()
|
||||||
config['pyramid']['resolutions'] = [32]
|
config['pyramid']['resolutions'] = [32]
|
||||||
config['pyramid']['pretrained_pyramid'] = ''
|
config['pyramid']['pretrained_pyramid'] = ''
|
||||||
config['pyramid']['final_upscale_enhancer'] = 'checkpoints/32_512_skirt'
|
config['pyramid']['final_upscale_enhancer'] = 'checkpoints/32_512_skirt'
|
||||||
|
|
||||||
config['pretrained_model'] = ''
|
config['train_dir'] = '/home/workspace/local-data/train_skirt'
|
||||||
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['valid_dir'] = '/home/workspace/local-data/valid_skirt'
|
||||||
config['test_dir'] = '/home/workspace/data/dataset/test_skirt_ready_2'
|
config['test_dir'] = '/home/workspace/data/dataset/test_skirt_ready_2'
|
||||||
config['batch_size'] = 4
|
config['batch_size'] = 4
|
||||||
config['is_skirt'] = True
|
config['is_skirt'] = True
|
||||||
config['is_cape'] = False
|
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']['static_model'] = 'checkpoints/static_1_skirt'
|
||||||
config['pyramid']['body_model'] = 'checkpoints/body_1_skirt_2_2'
|
config['pyramid']['body_model'] = 'checkpoints/body_1_skirt_2_2'
|
||||||
config['pyramid']['curvature_model'] = 'checkpoints/curv_1_skirt'
|
config['pyramid']['curvature_model'] = 'checkpoints/curv_1_skirt'
|
||||||
|
|
||||||
config['dataset_in_memory'] = True
|
config['dataset_in_memory'] = False
|
||||||
config['resolution'] = None
|
config['resolution'] = None
|
||||||
config['latent_dim'] = 128
|
config['latent_dim'] = 128
|
||||||
|
|
||||||
@@ -72,7 +65,6 @@ config['signature_static'] = { 'uv_static': (512, 256, 3),
|
|||||||
config['pyramid']['is_label'] = False
|
config['pyramid']['is_label'] = False
|
||||||
config['pyramid']['latent_dim'] = config['latent_dim']
|
config['pyramid']['latent_dim'] = config['latent_dim']
|
||||||
config['pyramid']['add_noise'] = True
|
config['pyramid']['add_noise'] = True
|
||||||
config['pyramid']['noise_amount'] = 0.001
|
|
||||||
|
|
||||||
config['pyramid']['loss_weights'] = [1,1,1,1,1]
|
config['pyramid']['loss_weights'] = [1,1,1,1,1]
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
from configs.config_base import config
|
from configs.config_base import config
|
||||||
|
|
||||||
config['gpu'] = '1'
|
config['gpu'] = '2'
|
||||||
config['lr'] = 0.0001
|
config['lr'] = 0.0001
|
||||||
config['name'] = 'body_orig_10p_r1'
|
config['name'] = 'body_1_skirt_2_2'
|
||||||
config['tags'] = ['review_1']
|
|
||||||
|
|
||||||
config['notes'] = 'convnext + convnext, add dense with tanh at the end of reverse convnext, | \
|
config['notes'] = 'convnext + convnext, add dense with tanh at the end of reverse convnext, | \
|
||||||
flattened bottleneck with 128 latent_dim\ remove global orientation | \
|
flattened bottleneck with 128 latent_dim\ remove global orientation | \
|
||||||
@@ -16,7 +15,7 @@ config['notes'] = 'convnext + convnext, add dense with tanh at the end of revers
|
|||||||
continued from body_1_skirt_2 | \
|
continued from body_1_skirt_2 | \
|
||||||
'
|
'
|
||||||
|
|
||||||
config['dataset_in_memory'] = True
|
config['dataset_in_memory'] = False
|
||||||
config['batch_size'] = 32
|
config['batch_size'] = 32
|
||||||
|
|
||||||
config['signature_dynamic'] = { 'id': (), 'frame_nr': (),
|
config['signature_dynamic'] = { 'id': (), 'frame_nr': (),
|
||||||
|
|||||||
@@ -1,14 +1,44 @@
|
|||||||
from configs.config_base import config
|
config = dict()
|
||||||
|
|
||||||
config['gpu'] = '3'
|
|
||||||
|
config['batch_size'] = 4
|
||||||
|
config['train_dir'] = '/home/workspace/local-data/train'
|
||||||
|
config['valid_dir'] = '/home/workspace/local-data/valid'
|
||||||
|
config['test_dir'] = '/home/workspace/data/dataset/test_ready'
|
||||||
|
config['use_filled'] = False
|
||||||
|
config['resolution'] = 512
|
||||||
|
config['is_skirt'] = False
|
||||||
|
config['dataset_in_memory'] = True
|
||||||
|
config['is_cape'] = False
|
||||||
|
config['remove_global_orientation'] = True
|
||||||
|
|
||||||
|
config['smpl_res'] = 14475
|
||||||
|
if config['is_cape']:
|
||||||
|
config['smpl_res'] = 3638
|
||||||
|
|
||||||
|
config['latent_dim'] = 128
|
||||||
|
|
||||||
|
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'] = 8
|
||||||
|
config['cond_ae']['encoder_depths'] = [3, 3, 3, 27, 3]
|
||||||
|
config['cond_ae']['encoder_dims'] = [8, 16, 32, 32, config['cond_ae']['bottleneck_size']]
|
||||||
|
config['cond_ae']['decoder_depths'] = config['cond_ae']['encoder_depths']
|
||||||
|
config['cond_ae']['decoder_dims'] = config['cond_ae']['encoder_dims']
|
||||||
|
config['cond_ae']['activation'] = 'linear'
|
||||||
|
|
||||||
|
|
||||||
|
config['gpu'] = '0'
|
||||||
config['lr'] = 0.0005
|
config['lr'] = 0.0005
|
||||||
config['name'] = 'static_orig_10p_r1'
|
config['name'] = 'static_post_4'
|
||||||
config['tags'] = ['review_1']
|
config['notes'] = 'convnext + convnext, | \
|
||||||
config['notes'] = 'convnext + convnext, add dense with tanh at the end of reverse convnext, | \
|
\
|
||||||
flattened latent dim to 128 | \
|
| \
|
||||||
train on 100 garments | \
|
|
||||||
deeper model | \
|
deeper model | \
|
||||||
larger batch size | \
|
linear activation| \
|
||||||
'
|
'
|
||||||
|
|
||||||
config['cond_ae']['upscale_output'] = False
|
config['cond_ae']['upscale_output'] = False
|
||||||
|
|||||||
@@ -5,19 +5,17 @@ config['batch_size'] = 4
|
|||||||
# config['train_dir'] = '/home/workspace/local-data/cape_processed/train/female'
|
# config['train_dir'] = '/home/workspace/local-data/cape_processed/train/female'
|
||||||
# config['valid_dir'] = '/home/workspace/local-data/cape_processed/test/female'
|
# config['valid_dir'] = '/home/workspace/local-data/cape_processed/test/female'
|
||||||
# config['test_dir'] = '/home/workspace/local-data/cape_processed/test/female'
|
# config['test_dir'] = '/home/workspace/local-data/cape_processed/test/female'
|
||||||
config['train_dir'] = '/home/workspace/data/dataset/local-cache/train_skirt'
|
config['train_dir'] = '/home/workspace/local-data/train'
|
||||||
config['valid_dir'] = '/home/workspace/local-data/valid_skirt'
|
config['valid_dir'] = '/home/workspace/local-data/valid'
|
||||||
config['test_dir'] = '/home/workspace/data/dataset/test_ready_skirt_2'
|
config['test_dir'] = '/home/workspace/data/dataset/test_ready'
|
||||||
# config['train_dir'] = '/home/workspace/local-data/train_skirt'
|
# config['train_dir'] = '/home/workspace/local-data/train_skirt'
|
||||||
# config['valid_dir'] = '/home/workspace/local-data/valid_skirt'
|
# config['valid_dir'] = '/home/workspace/local-data/valid_skirt'
|
||||||
# config['test_dir'] = '/home/workspace/local-data/test_skirt_ready'
|
# config['test_dir'] = '/home/workspace/local-data/test_skirt_ready'
|
||||||
config['use_filled'] = False
|
config['use_filled'] = False
|
||||||
config['resolution'] = 512
|
config['resolution'] = 512
|
||||||
config['is_skirt'] = False
|
config['is_skirt'] = False
|
||||||
config['dataset_in_memory'] = True
|
config['dataset_in_memory'] = False
|
||||||
config['is_cape'] = False
|
config['is_cape'] = False
|
||||||
config['frames_file'] = 'frames_skirt_10p.txt'
|
|
||||||
config['frames_file_valid'] = 'frames_skirt_10p.txt'
|
|
||||||
|
|
||||||
config['smpl_res'] = 14475
|
config['smpl_res'] = 14475
|
||||||
if config['is_cape']:
|
if config['is_cape']:
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
config = dict()
|
config = dict()
|
||||||
|
|
||||||
config['gpu'] = '6'
|
config['gpu'] = '2'
|
||||||
config['name'] = 'abl_pyr_32'
|
config['name'] = 'abl_pyr_32'
|
||||||
config['notes'] = ''
|
config['notes'] = 'fixed noise handling'
|
||||||
config['tags'] = ['review_1']
|
config['tags'] = ['pyr_post']
|
||||||
|
|
||||||
# DON'T FORGET TO RESET SSIM LOSS USAGE
|
# DON'T FORGET TO RESET SSIM LOSS USAGE
|
||||||
# DON'T FORGET TO CHECK MODEL LOADING
|
# DON'T FORGET TO CHECK MODEL LOADING
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
config = dict()
|
||||||
|
|
||||||
|
# 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 AVG GARMENT USED
|
||||||
|
|
||||||
|
config['use_skinning'] = True # and deshaping
|
||||||
|
config['remove_global_orientation'] = True
|
||||||
|
config['use_curvature'] = True
|
||||||
|
config['use_extra_losses'] = True # edge, collision, 3d mesh
|
||||||
|
config['use_offsets'] = True
|
||||||
|
|
||||||
|
config['use_norm_loss'] = True
|
||||||
|
config['only_curvatures'] = False
|
||||||
|
|
||||||
|
ablation_count = [config['use_skinning'], config['remove_global_orientation'], config['use_curvature'], config['use_extra_losses'], config['use_offsets']].count(False)
|
||||||
|
assert ablation_count == 1 or ablation_count == 0
|
||||||
|
|
||||||
|
config['gpu'] = '4'
|
||||||
|
config['name'] = 'abl_all_resnet_r7'
|
||||||
|
config['notes'] = ''
|
||||||
|
|
||||||
|
config['avg_garment_path'] = 'custom_data/train_no_shape_avg_uv.npy' #custom_data/train_no_shape_avg_uv.npy # train_no_shape_avg_uv train_no_shape_one_hot_avg_uv
|
||||||
|
if config['use_skinning']:
|
||||||
|
assert (config['use_offsets'] and config['avg_garment_path'] != '') or (not config['use_offsets'] and config['avg_garment_path'] == '')
|
||||||
|
|
||||||
|
config['reg_loss_coeff'] = 0.1 # set to 0 if don't want to use edge+collision
|
||||||
|
|
||||||
|
config['batch_size'] = 4
|
||||||
|
config['resolution'] = 512
|
||||||
|
config['is_skirt'] = False
|
||||||
|
config['dataset_in_memory'] = False
|
||||||
|
config['is_cape'] = False
|
||||||
|
|
||||||
|
config['train_dir'] = '/home/workspace/local-data/train'
|
||||||
|
config['valid_dir'] = '/home/workspace/local-data/valid'
|
||||||
|
config['test_dir'] = '/home/workspace/data/dataset/test_ready'
|
||||||
|
|
||||||
|
# config['frames_file'] = 'frames_dress_30k.txt'
|
||||||
|
# config['frames_file_valid'] = 'frames_dress_30k.txt'
|
||||||
|
# config['frames_file_test'] = 'frames_dress_30k.txt'
|
||||||
|
|
||||||
|
config['static_model'] = 'checkpoints/post/static_r7_3'
|
||||||
|
config['body_model'] = 'checkpoints/post/body_r7_3'
|
||||||
|
config['curvature_model'] = 'checkpoints/post/curv_r7_3'
|
||||||
|
|
||||||
|
|
||||||
|
config['smpl_res'] = 14475
|
||||||
|
if config['is_cape']:
|
||||||
|
config['smpl_res'] = 3638
|
||||||
|
|
||||||
|
|
||||||
|
config['pretrained_model'] = ''
|
||||||
|
|
||||||
|
###############
|
||||||
|
config['lr'] = 0.0001# 0.0001
|
||||||
|
###############
|
||||||
|
config['starting_balancing_coeff'] = 0.001
|
||||||
|
|
||||||
|
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,),
|
||||||
|
'uv_curvature': (512, 256, 7),
|
||||||
|
}
|
||||||
|
config['signature_static'] = { 'uv_static': (512, 256, 3),
|
||||||
|
'mesh_mask': (config['smpl_res'],),
|
||||||
|
'uv_mask': (512, 256,),
|
||||||
|
}
|
||||||
|
|
||||||
|
if config['use_skinning']:
|
||||||
|
config['signature_dynamic']['uv_unposed'] = (512, 256, 3)
|
||||||
|
config['signature_dynamic']['mesh_unposed'] = (config['smpl_res'], 3,)
|
||||||
|
else:
|
||||||
|
config['signature_dynamic']['uv_posed'] = (512, 256, 3)
|
||||||
|
|
||||||
|
|
||||||
|
config['upscale_enhancer'] = ''
|
||||||
|
config['freeze_encoders'] = True
|
||||||
|
config['use_one_hot'] = False
|
||||||
|
|
||||||
|
config['cvae'] = dict()
|
||||||
|
config['cvae']['is_label'] = False
|
||||||
|
config['cvae']['add_noise'] = True
|
||||||
|
config['cvae']['noise_amount'] = 0.001
|
||||||
|
|
||||||
|
config['cvae']['kernel_size'] = 7
|
||||||
|
config['cvae']['encoder_depths'] = [3, 3, 3, 9, 3]
|
||||||
|
config['cvae']['encoder_dims'] = [32, 64, 128, 256, 64]
|
||||||
|
config['cvae']['decoder_depths'] = config['cvae']['encoder_depths']
|
||||||
|
config['cvae']['decoder_dims'] = config['cvae']['encoder_dims']
|
||||||
|
|
||||||
|
|
||||||
|
config['cond_ae_static'] = dict()
|
||||||
|
config['cond_ae_static']['is_label'] = False
|
||||||
|
config['cond_ae_static']['kernel_size'] = 7
|
||||||
|
config['cond_ae_static']['bottleneck_size'] = 8
|
||||||
|
config['cond_ae_static']['encoder_depths'] = [3, 3, 3, 9, 3]
|
||||||
|
config['cond_ae_static']['encoder_dims'] = [16, 32, 64, 64, config['cond_ae_static']['bottleneck_size']]
|
||||||
|
config['cond_ae_static']['decoder_depths'] = config['cond_ae_static']['encoder_depths']
|
||||||
|
config['cond_ae_static']['decoder_dims'] = config['cond_ae_static']['encoder_dims']
|
||||||
|
config['cond_ae_static']['activation'] = 'tanh'
|
||||||
|
|
||||||
|
config['cond_ae_curv'] = dict()
|
||||||
|
config['cond_ae_curv']['is_label'] = True
|
||||||
|
config['cond_ae_curv']['kernel_size'] = 7
|
||||||
|
config['cond_ae_curv']['bottleneck_size'] = 40
|
||||||
|
config['cond_ae_curv']['encoder_depths'] = [3, 3, 9, 9, 3]
|
||||||
|
config['cond_ae_curv']['encoder_dims'] = [16, 32, 64, 128, config['cond_ae_curv']['bottleneck_size']]
|
||||||
|
config['cond_ae_curv']['decoder_depths'] = config['cond_ae_curv']['encoder_depths']
|
||||||
|
config['cond_ae_curv']['decoder_dims'] = config['cond_ae_curv']['encoder_dims']
|
||||||
|
config['cond_ae_curv']['activation'] = 'tanh'
|
||||||
|
|
||||||
|
config['cond_ae_body'] = dict()
|
||||||
|
config['cond_ae_body']['is_label'] = False
|
||||||
|
config['cond_ae_body']['kernel_size'] = 7
|
||||||
|
config['cond_ae_body']['bottleneck_size'] = 16
|
||||||
|
config['cond_ae_body']['encoder_depths'] = [3, 3, 9, 9, 3]
|
||||||
|
config['cond_ae_body']['encoder_dims'] = [16, 32, 64, 128, config['cond_ae_body']['bottleneck_size']]
|
||||||
|
config['cond_ae_body']['decoder_depths'] = config['cond_ae_body']['encoder_depths']
|
||||||
|
config['cond_ae_body']['decoder_dims'] = config['cond_ae_body']['encoder_dims']
|
||||||
|
config['cond_ae_body']['activation'] = 'tanh'
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
config = dict()
|
||||||
|
|
||||||
|
|
||||||
|
config['batch_size'] = 4
|
||||||
|
config['train_dir'] = '/home/workspace/local-data/train'
|
||||||
|
config['valid_dir'] = '/home/workspace/local-data/valid'
|
||||||
|
config['test_dir'] = '/home/workspace/data/dataset/test_ready'
|
||||||
|
config['use_filled'] = False
|
||||||
|
config['resolution'] = 512
|
||||||
|
config['is_skirt'] = False
|
||||||
|
config['dataset_in_memory'] = False
|
||||||
|
config['is_cape'] = False
|
||||||
|
config['remove_global_orientation'] = True
|
||||||
|
|
||||||
|
config['smpl_res'] = 14475
|
||||||
|
if config['is_cape']:
|
||||||
|
config['smpl_res'] = 3638
|
||||||
|
|
||||||
|
config['latent_dim'] = 128
|
||||||
|
|
||||||
|
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'] = 16
|
||||||
|
config['cond_ae']['encoder_depths'] = [3, 3, 9, 9, 3]
|
||||||
|
config['cond_ae']['encoder_dims'] = [16, 32, 64, 128, config['cond_ae']['bottleneck_size']]
|
||||||
|
config['cond_ae']['decoder_depths'] = config['cond_ae']['encoder_depths']
|
||||||
|
config['cond_ae']['decoder_dims'] = config['cond_ae']['encoder_dims']
|
||||||
|
config['cond_ae']['activation'] = 'tanh'
|
||||||
|
|
||||||
|
|
||||||
|
config['gpu'] = '4'
|
||||||
|
config['lr'] = 0.0001
|
||||||
|
config['name'] = 'body_r7_3'
|
||||||
|
config['notes'] = 'resnet18'
|
||||||
|
config['tags'] = ['review_7']
|
||||||
|
|
||||||
|
config['cond_ae']['upscale_output'] = False
|
||||||
|
config['pretrained_model'] = ''
|
||||||
|
|
||||||
|
|
||||||
|
config['signature_dynamic'] = { 'id': (), 'frame_nr': (),
|
||||||
|
'pose_shape': (72 + 11,),
|
||||||
|
'uv_body_posed': (3, 512, 256,),
|
||||||
|
'mesh_body_posed': (config['smpl_res'], 3,),
|
||||||
|
}
|
||||||
|
config['signature_static'] = {
|
||||||
|
'mesh_mask': (config['smpl_res'],),
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
config = dict()
|
||||||
|
|
||||||
|
|
||||||
|
config['batch_size'] = 4
|
||||||
|
config['train_dir'] = '/home/workspace/local-data/train'
|
||||||
|
config['valid_dir'] = '/home/workspace/local-data/valid'
|
||||||
|
config['test_dir'] = '/home/workspace/data/dataset/test_ready'
|
||||||
|
config['use_filled'] = False
|
||||||
|
config['resolution'] = 512
|
||||||
|
config['is_skirt'] = False
|
||||||
|
config['dataset_in_memory'] = False
|
||||||
|
config['is_cape'] = False
|
||||||
|
config['remove_global_orientation'] = True
|
||||||
|
|
||||||
|
config['smpl_res'] = 14475
|
||||||
|
if config['is_cape']:
|
||||||
|
config['smpl_res'] = 3638
|
||||||
|
|
||||||
|
config['latent_dim'] = 128
|
||||||
|
|
||||||
|
config['cond_ae'] = dict()
|
||||||
|
config['cond_ae']['is_label'] = True
|
||||||
|
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'] = 40
|
||||||
|
config['cond_ae']['encoder_depths'] = [3, 3, 9, 9, 3]
|
||||||
|
config['cond_ae']['encoder_dims'] = [16, 32, 64, 128, config['cond_ae']['bottleneck_size']]
|
||||||
|
config['cond_ae']['decoder_depths'] = config['cond_ae']['encoder_depths']
|
||||||
|
config['cond_ae']['decoder_dims'] = config['cond_ae']['encoder_dims']
|
||||||
|
config['cond_ae']['activation'] = 'tanh'
|
||||||
|
|
||||||
|
|
||||||
|
config['gpu'] = '3'
|
||||||
|
config['lr'] = 0.001
|
||||||
|
config['name'] = 'curv_r7_3'
|
||||||
|
config['notes'] = 'resnet18'
|
||||||
|
config['tags'] = ['review_7']
|
||||||
|
|
||||||
|
config['cond_ae']['upscale_output'] = False
|
||||||
|
config['pretrained_model'] = ''
|
||||||
|
|
||||||
|
|
||||||
|
config['signature_dynamic'] = { 'id': (), 'frame_nr': (),
|
||||||
|
'uv_curvature': (512, 256, 7),
|
||||||
|
'mesh_curvature': (config['smpl_res'])
|
||||||
|
}
|
||||||
|
config['signature_static'] = { 'mesh_mask': (config['smpl_res'],),
|
||||||
|
'uv_mask': (512, 256,),
|
||||||
|
}
|
||||||
@@ -31,15 +31,13 @@ config['cond_ae']['decoder_dims'] = config['cond_ae']['encoder_dims']
|
|||||||
config['cond_ae']['activation'] = 'linear'
|
config['cond_ae']['activation'] = 'linear'
|
||||||
|
|
||||||
|
|
||||||
config['gpu'] = '5'
|
config['gpu'] = '6'
|
||||||
config['lr'] = 0.0005
|
config['lr'] = 0.0005
|
||||||
config['name'] = 'static_post_4'
|
config['name'] = 'static_r7_3'
|
||||||
config['notes'] = 'convnext + convnext, | \
|
config['notes'] = 'resnet18 based, one more block'
|
||||||
\
|
config['tags'] = ['review_7']
|
||||||
| \
|
|
||||||
deeper model | \
|
|
||||||
linear activation| \
|
|
||||||
'
|
|
||||||
|
|
||||||
config['cond_ae']['upscale_output'] = False
|
config['cond_ae']['upscale_output'] = False
|
||||||
config['pretrained_model'] = ''
|
config['pretrained_model'] = ''
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from configs.config_abl_all_post import config
|
from configs.review.config_abl_all import config
|
||||||
|
|
||||||
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
@@ -58,7 +58,9 @@ def init_wandb():
|
|||||||
artifact.add_file('convnext/models/convnext_tf.py')
|
artifact.add_file('convnext/models/convnext_tf.py')
|
||||||
config_file_names = [key for key in sys.modules.keys() if key.startswith('configs.')]
|
config_file_names = [key for key in sys.modules.keys() if key.startswith('configs.')]
|
||||||
for config_file_name in config_file_names:
|
for config_file_name in config_file_names:
|
||||||
artifact.add_file('/'.join(config_file_name.split('.')) + '.py')
|
file_name = '/'.join(config_file_name.split('.')) + '.py'
|
||||||
|
if os.path.exists(file_name):
|
||||||
|
artifact.add_file(file_name)
|
||||||
run.log_artifact(artifact)
|
run.log_artifact(artifact)
|
||||||
|
|
||||||
uv2mesh = UV2Mesh(res=256, is_skirt=config['is_skirt'], is_adaptive=False, is_smpl_orig=config['is_cape'])
|
uv2mesh = UV2Mesh(res=256, is_skirt=config['is_skirt'], is_adaptive=False, is_smpl_orig=config['is_cape'])
|
||||||
@@ -73,7 +75,7 @@ def kl_loss(mean, logvar):
|
|||||||
|
|
||||||
# 3d loss on posed !!!!!!!!!!!!
|
# 3d loss on posed !!!!!!!!!!!!
|
||||||
|
|
||||||
# @tf.function
|
@tf.function
|
||||||
def train_step(batch):
|
def train_step(batch):
|
||||||
|
|
||||||
with tf.GradientTape() as tape:
|
with tf.GradientTape() as tape:
|
||||||
@@ -425,8 +427,6 @@ def sample(folder):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test():
|
def test():
|
||||||
str_split = config['name'].split('_')
|
str_split = config['name'].split('_')
|
||||||
test_idx = str_split.index('test')
|
test_idx = str_split.index('test')
|
||||||
@@ -476,7 +476,7 @@ def test():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# init_wandb()
|
init_wandb()
|
||||||
parser = argparse.ArgumentParser(description='')
|
parser = argparse.ArgumentParser(description='')
|
||||||
parser.add_argument('--name', type=str)
|
parser.add_argument('--name', type=str)
|
||||||
args = vars(parser.parse_args())
|
args = vars(parser.parse_args())
|
||||||
|
|||||||
+14
-18
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from configs.config_abl_pyr_32_64_skirt_r1 import config
|
from configs.post.config_abl_pyr_64_128_5 import config
|
||||||
|
|
||||||
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
@@ -41,7 +41,7 @@ from losses import collision_loss as collision_penalty
|
|||||||
from custom_utils.custom_utils import batch_to_dict, load_model
|
from custom_utils.custom_utils import batch_to_dict, load_model
|
||||||
from dataset import DatasetFactory, StaticDataset
|
from dataset import DatasetFactory, StaticDataset
|
||||||
from custom_utils.smpl import SMPL
|
from custom_utils.smpl import SMPL
|
||||||
from models.pyramid_model_optimized import Pyramid
|
from models.pyramid_model_optimized import PyramidNew as Pyramid
|
||||||
from postprocessing import fix_collision
|
from postprocessing import fix_collision
|
||||||
|
|
||||||
|
|
||||||
@@ -59,11 +59,9 @@ def init_wandb():
|
|||||||
artifact.add_file('models/cond_encoder.py')
|
artifact.add_file('models/cond_encoder.py')
|
||||||
artifact.add_file('dataset.py')
|
artifact.add_file('dataset.py')
|
||||||
artifact.add_file('convnext/models/convnext_tf.py')
|
artifact.add_file('convnext/models/convnext_tf.py')
|
||||||
config_file_names = [key for key in sys.modules.keys() if key.startswith('configs')]
|
config_file_names = [key for key in sys.modules.keys() if key.startswith('configs.post.')]
|
||||||
for config_file_name in config_file_names:
|
for config_file_name in config_file_names:
|
||||||
file_name = '/'.join(config_file_name.split('.')) + '.py'
|
artifact.add_file('/'.join(config_file_name.split('.')) + '.py')
|
||||||
if os.path.exists(file_name):
|
|
||||||
artifact.add_file(file_name)
|
|
||||||
run.log_artifact(artifact)
|
run.log_artifact(artifact)
|
||||||
|
|
||||||
uv2mesh = UV2Mesh(res=256, is_skirt=config['is_skirt'], is_smpl_orig=config['is_cape'])
|
uv2mesh = UV2Mesh(res=256, is_skirt=config['is_skirt'], is_smpl_orig=config['is_cape'])
|
||||||
@@ -263,8 +261,8 @@ def train_step(batch):
|
|||||||
else:
|
else:
|
||||||
reconstr_loss_total = reconstr_loss_total + config['pyramid']['loss_weights'][i] * (l2_loss)
|
reconstr_loss_total = reconstr_loss_total + config['pyramid']['loss_weights'][i] * (l2_loss)
|
||||||
|
|
||||||
# if config['use_norm_loss'] and step > 2000:
|
if config['use_norm_loss'] and step > 2000:
|
||||||
# reconstr_loss_total = reconstr_loss_total + n_loss * config['reg_loss_coeff']
|
reconstr_loss_total = reconstr_loss_total + n_loss * config['reg_loss_coeff']
|
||||||
|
|
||||||
kl_total += kl
|
kl_total += kl
|
||||||
|
|
||||||
@@ -336,8 +334,8 @@ def valid_step(batch):
|
|||||||
else:
|
else:
|
||||||
reconstr_loss_total = reconstr_loss_total + config['pyramid']['loss_weights'][i] * (l2_loss)
|
reconstr_loss_total = reconstr_loss_total + config['pyramid']['loss_weights'][i] * (l2_loss)
|
||||||
|
|
||||||
# if config['use_norm_loss'] and step > 2000:
|
if config['use_norm_loss'] and step > 2000:
|
||||||
# reconstr_loss_total = reconstr_loss_total + n_loss * config['reg_loss_coeff']
|
reconstr_loss_total = reconstr_loss_total + n_loss * config['reg_loss_coeff']
|
||||||
|
|
||||||
kl_total += kl
|
kl_total += kl
|
||||||
|
|
||||||
@@ -792,7 +790,7 @@ if __name__ == '__main__':
|
|||||||
# generate_results()
|
# generate_results()
|
||||||
|
|
||||||
ckpt = tf.train.Checkpoint(model=model)
|
ckpt = tf.train.Checkpoint(model=model)
|
||||||
manager = tf.train.CheckpointManager(ckpt, 'checkpoints/' + config['name'], max_to_keep=20)
|
manager = tf.train.CheckpointManager(ckpt, 'checkpoints/post/' + config['name'], max_to_keep=20)
|
||||||
|
|
||||||
# load_model(model, 'checkpoints/pyr_abl_32_skirt', iteration='180000')
|
# load_model(model, 'checkpoints/pyr_abl_32_skirt', iteration='180000')
|
||||||
|
|
||||||
@@ -803,26 +801,24 @@ if __name__ == '__main__':
|
|||||||
if len(config['pyramid']['resolutions']) == 1:
|
if len(config['pyramid']['resolutions']) == 1:
|
||||||
model.static_enc.trainable = False
|
model.static_enc.trainable = False
|
||||||
model.body_enc.trainable = False
|
model.body_enc.trainable = False
|
||||||
if config['use_curvature']:
|
|
||||||
model.curv_enc.trainable = False
|
model.curv_enc.trainable = False
|
||||||
else:
|
else:
|
||||||
load_model(model, config['pyramid']['pretrained_pyramid'], iteration=(config['pyramid']['pretrained_pyramid_iteration'] if 'pretrained_pyramid_iteration' in config.keys() else ''))
|
load_model(model, config['pyramid']['pretrained_pyramid'], iteration=(config['pyramid']['pretrained_pyramid_iteration'] if 'pretrained_pyramid_iteration' in config.keys() else ''))
|
||||||
model.static_enc.trainable = False
|
model.static_enc.trainable = False
|
||||||
model.body_enc.trainable = False
|
model.body_enc.trainable = False
|
||||||
if config['use_curvature']:
|
|
||||||
model.curv_enc.trainable = False
|
model.curv_enc.trainable = False
|
||||||
model.cond_encoder.trainable = False
|
|
||||||
|
|
||||||
# load_model(model.levels[0].upscale_enhancer, config['pyramid']['levels'][0]['upscale_enhancer'])
|
# load_model(model.levels[0].upscale_enhancer, config['pyramid']['levels'][0]['upscale_enhancer'])
|
||||||
# model.levels[0].upscale_enhancer.trainable = False
|
# model.levels[0].upscale_enhancer.trainable = False
|
||||||
|
|
||||||
|
|
||||||
for i in range(len(model.levels)-1):
|
for i in range(len(model.levels)):
|
||||||
load_model(model.levels[i].upscale_enhancer, config['pyramid']['levels'][i]['upscale_enhancer'])
|
load_model(model.levels[i].upscale_enhancer, config['pyramid']['levels'][i]['upscale_enhancer'])
|
||||||
model.levels[i].upscale_enhancer.trainable = False
|
model.levels[i].upscale_enhancer.trainable = False
|
||||||
if config['pyramid']['resolutions'][-1] != 512:
|
# if config['pyramid']['resolutions'][-1] != 512:
|
||||||
load_model(model.upscale_enhancer, config['pyramid']['final_upscale_enhancer'])
|
# load_model(model.upscale_enhancer, config['pyramid']['final_upscale_enhancer'])
|
||||||
model.upscale_enhancer.trainable = False
|
# model.upscale_enhancer.trainable = False
|
||||||
|
|
||||||
for i in range(len(model.levels)-1):
|
for i in range(len(model.levels)-1):
|
||||||
model.levels[i].trainable = False
|
model.levels[i].trainable = False
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from configs.config_abl_all_post import config
|
from configs.review.config_abl_all import config
|
||||||
|
|
||||||
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from configs.config_abl_pyr_32_64_skirt_r1 import config
|
from configs.config_abl_2_pyr_32_64_128_256_512 import config
|
||||||
|
|
||||||
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
os.environ["CUDA_VISIBLE_DEVICES"] = config['gpu']
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
|
|||||||
+31
-15
@@ -1,5 +1,7 @@
|
|||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
from convnext.models.convnext_tf import ConvNeXt, ConvNeXtReverse, Block, ConvNeXtReverseLabels
|
from convnext.models.convnext_tf import ConvNeXt, ConvNeXtReverse, Block, ConvNeXtReverseLabels
|
||||||
|
from models.resnet import resnet_18, make_basic_block_layer
|
||||||
|
|
||||||
|
|
||||||
class Bottleneck(tf.keras.Model):
|
class Bottleneck(tf.keras.Model):
|
||||||
|
|
||||||
@@ -111,20 +113,34 @@ class Decoder(tf.keras.Model):
|
|||||||
|
|
||||||
class VariationalEncoderNew(tf.keras.Model):
|
class VariationalEncoderNew(tf.keras.Model):
|
||||||
|
|
||||||
def __init__(self, depths, dims, kernel_size=7):
|
def __init__(self, features):
|
||||||
super(VariationalEncoderNew, self).__init__()
|
super(VariationalEncoderNew, self).__init__()
|
||||||
|
|
||||||
self.encoder = ConvNeXt(depths=depths, dims=dims, include_top=False, kernel_size=kernel_size)
|
self.encoder = resnet_18(features)
|
||||||
|
|
||||||
self.mean_branch = tf.keras.Sequential(
|
self.mean_branch = tf.keras.Sequential([
|
||||||
[Block(dim=64, drop_path=0, kernel_size=kernel_size,
|
tf.keras.layers.Conv2D(filters=features,
|
||||||
layer_scale_init_value=1e-6, prefix=f'bottleneck{j}') for j in range(5)]
|
kernel_size=(3, 3),
|
||||||
)
|
strides=1,
|
||||||
|
padding="same"),
|
||||||
|
tf.keras.layers.BatchNormalization(),
|
||||||
|
tf.keras.layers.Conv2D(filters=features,
|
||||||
|
kernel_size=(3, 3),
|
||||||
|
strides=1,
|
||||||
|
padding="same")
|
||||||
|
])
|
||||||
|
|
||||||
self.var_branch = tf.keras.Sequential(
|
self.var_branch = tf.keras.Sequential([
|
||||||
[Block(dim=64, drop_path=0, kernel_size=kernel_size,
|
tf.keras.layers.Conv2D(filters=features,
|
||||||
layer_scale_init_value=1e-6, prefix=f'bottleneck{j}') for j in range(5)]
|
kernel_size=(3, 3),
|
||||||
)
|
strides=1,
|
||||||
|
padding="same"),
|
||||||
|
tf.keras.layers.BatchNormalization(),
|
||||||
|
tf.keras.layers.Conv2D(filters=features,
|
||||||
|
kernel_size=(3, 3),
|
||||||
|
strides=1,
|
||||||
|
padding="same")
|
||||||
|
])
|
||||||
|
|
||||||
self.flatten_mean = tf.keras.layers.Flatten()
|
self.flatten_mean = tf.keras.layers.Flatten()
|
||||||
self.flatten_var = tf.keras.layers.Flatten()
|
self.flatten_var = tf.keras.layers.Flatten()
|
||||||
@@ -147,10 +163,10 @@ class VariationalEncoderNew(tf.keras.Model):
|
|||||||
|
|
||||||
class AEEncoderNew(tf.keras.Model):
|
class AEEncoderNew(tf.keras.Model):
|
||||||
|
|
||||||
def __init__(self, depths, dims, kernel_size=7, activation='tanh'):
|
def __init__(self, features, activation='tanh'):
|
||||||
super(AEEncoderNew, self).__init__()
|
super(AEEncoderNew, self).__init__()
|
||||||
|
|
||||||
self.encoder = ConvNeXt(depths=depths, dims=dims, include_top=False, kernel_size=kernel_size)
|
self.encoder = resnet_18(features)
|
||||||
self.act = tf.keras.layers.Activation(activation)
|
self.act = tf.keras.layers.Activation(activation)
|
||||||
|
|
||||||
|
|
||||||
@@ -171,15 +187,15 @@ class AEEncoderNew(tf.keras.Model):
|
|||||||
|
|
||||||
class DecoderNew(tf.keras.Model):
|
class DecoderNew(tf.keras.Model):
|
||||||
|
|
||||||
def __init__(self, depths, dims, kernel_size=7, is_label=False):
|
def __init__(self, features, is_label=False, is_cvae=False):
|
||||||
super(DecoderNew, self).__init__()
|
super(DecoderNew, self).__init__()
|
||||||
|
|
||||||
self.is_label = is_label
|
self.is_label = is_label
|
||||||
|
|
||||||
if not is_label:
|
if not is_label:
|
||||||
self.decoder = ConvNeXtReverse(depths=depths, dims=dims, kernel_size=kernel_size)
|
self.decoder = resnet_18(features, reversed=True, is_cvae=is_cvae)
|
||||||
else:
|
else:
|
||||||
self.decoder = ConvNeXtReverseLabels(depths=depths, dims=dims, nr_of_classes=7)
|
self.decoder = resnet_18(features, reversed=True, labels=6, is_cvae=is_cvae)
|
||||||
|
|
||||||
|
|
||||||
def call(self, inputs, training):
|
def call(self, inputs, training):
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ class AutoEncoderNew(tf.keras.Model):
|
|||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
super(AutoEncoderNew, self).__init__()
|
super(AutoEncoderNew, self).__init__()
|
||||||
|
|
||||||
self.encoder : AEEncoderNew = AEEncoderNew(config['encoder_depths'], config['encoder_dims'], config['kernel_size'], config['activation'])
|
self.encoder : AEEncoderNew = AEEncoderNew(config['bottleneck_size'], config['activation'])
|
||||||
self.decoder : DecoderNew = DecoderNew(config['decoder_depths'], config['decoder_dims'], kernel_size=config['kernel_size'], is_label=config['is_label'])
|
self.decoder : DecoderNew = DecoderNew(config['bottleneck_size'], is_label=config['is_label'])
|
||||||
|
|
||||||
|
|
||||||
def call(self, inputs, training):
|
def call(self, inputs, training):
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class CVAE(tf.keras.Model):
|
|||||||
self.cond_encoder = tf.keras.Sequential([tf.keras.layers.Dense(512, activation='relu'),
|
self.cond_encoder = tf.keras.Sequential([tf.keras.layers.Dense(512, activation='relu'),
|
||||||
tf.keras.layers.Dense(256, activation='relu'),
|
tf.keras.layers.Dense(256, activation='relu'),
|
||||||
tf.keras.layers.Dense(128, activation='relu'),
|
tf.keras.layers.Dense(128, activation='relu'),
|
||||||
# tf.keras.layers.Lambda(lambda x: x / 1000),
|
tf.keras.layers.Lambda(lambda x: x / 1000),
|
||||||
tf.keras.layers.Dense(config['latent_dim'], activation='tanh')])
|
tf.keras.layers.Dense(config['latent_dim'], activation='tanh')])
|
||||||
|
|
||||||
self.encoder = VariationalEncoder(config['cvae']['latent_dim'], config['cvae']['encoder_depths'], config['cvae']['encoder_dims'], kernel_size=config['cvae']['kernel_size'])
|
self.encoder = VariationalEncoder(config['cvae']['latent_dim'], config['cvae']['encoder_depths'], config['cvae']['encoder_dims'], kernel_size=config['cvae']['kernel_size'])
|
||||||
@@ -159,16 +159,16 @@ class CVAENew(tf.keras.Model):
|
|||||||
self.size = config['resolution']
|
self.size = config['resolution']
|
||||||
|
|
||||||
if not('only_curvatures' in config.keys() and config['only_curvatures'] == True):
|
if not('only_curvatures' in config.keys() and config['only_curvatures'] == True):
|
||||||
self.static_enc : AEEncoderNew = AEEncoderNew(config['cond_ae_static']['encoder_depths'], config['cond_ae_static']['encoder_dims'], config['cond_ae_static']['kernel_size'], config['cond_ae_static']['activation'])
|
self.static_enc : AEEncoderNew = AEEncoderNew(config['cond_ae_static']['bottleneck_size'], config['cond_ae_static']['activation'])
|
||||||
if config['static_model'] != '':
|
if config['static_model'] != '':
|
||||||
load_model(self.static_enc, config['static_model'] + '_enc')
|
load_model(self.static_enc, config['static_model'] + '_enc')
|
||||||
|
|
||||||
self.body_enc : AEEncoderNew = AEEncoderNew(config['cond_ae_body']['encoder_depths'], config['cond_ae_body']['encoder_dims'], config['cond_ae_body']['kernel_size'])
|
self.body_enc : AEEncoderNew = AEEncoderNew(config['cond_ae_body']['bottleneck_size'])
|
||||||
if config['body_model'] != '':
|
if config['body_model'] != '':
|
||||||
load_model(self.body_enc, config['body_model'] + '_enc')
|
load_model(self.body_enc, config['body_model'] + '_enc')
|
||||||
|
|
||||||
if config['use_curvature']:
|
if config['use_curvature']:
|
||||||
self.curv_enc : AEEncoderNew = AEEncoderNew(config['cond_ae_curv']['encoder_depths'], config['cond_ae_curv']['encoder_dims'], config['cond_ae_curv']['kernel_size'], config['cond_ae_curv']['activation'])
|
self.curv_enc : AEEncoderNew = AEEncoderNew(config['cond_ae_curv']['bottleneck_size'], config['cond_ae_curv']['activation'])
|
||||||
if config['curvature_model'] != '':
|
if config['curvature_model'] != '':
|
||||||
load_model(self.curv_enc, config['curvature_model'] + '_enc')
|
load_model(self.curv_enc, config['curvature_model'] + '_enc')
|
||||||
|
|
||||||
@@ -179,10 +179,10 @@ class CVAENew(tf.keras.Model):
|
|||||||
if config['use_curvature']:
|
if config['use_curvature']:
|
||||||
self.curv_enc.trainable = False
|
self.curv_enc.trainable = False
|
||||||
|
|
||||||
self.encoder = VariationalEncoderNew(config['cvae']['encoder_depths'], config['cvae']['encoder_dims'], kernel_size=config['cvae']['kernel_size'])
|
self.encoder = VariationalEncoderNew(config['cvae']['encoder_dims'][-1])
|
||||||
self.decoder = DecoderNew(config['cvae']['decoder_depths'], config['cvae']['decoder_dims'], config['cvae']['kernel_size'])
|
self.decoder = DecoderNew(config['cvae']['decoder_dims'][-1], is_cvae=True)
|
||||||
|
|
||||||
self.reshape = tf.keras.layers.Reshape((8, 4, 64))
|
self.reshape = tf.keras.layers.Reshape((8, 4, config['cvae']['decoder_dims'][-1]))
|
||||||
|
|
||||||
if config['avg_garment_path'] != '':
|
if config['avg_garment_path'] != '':
|
||||||
self.avg_garment = np.load(config['avg_garment_path'])
|
self.avg_garment = np.load(config['avg_garment_path'])
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ class Pyramid(tf.keras.Model):
|
|||||||
if config['pyramid']['body_model'] != '':
|
if config['pyramid']['body_model'] != '':
|
||||||
load_model(self.body_enc, config['pyramid']['body_model'] + '_enc')
|
load_model(self.body_enc, config['pyramid']['body_model'] + '_enc')
|
||||||
|
|
||||||
if config['use_curvature']:
|
|
||||||
self.curv_enc : AEEncoder = AEEncoder(config['cond_ae']['latent_dim'], config['cond_ae']['encoder_depths'], config['cond_ae']['encoder_dims'], config['cond_ae']['bottleneck_size'], config['cond_ae']['kernel_size'])
|
self.curv_enc : AEEncoder = AEEncoder(config['cond_ae']['latent_dim'], config['cond_ae']['encoder_depths'], config['cond_ae']['encoder_dims'], config['cond_ae']['bottleneck_size'], config['cond_ae']['kernel_size'])
|
||||||
if config['pyramid']['curvature_model'] != '':
|
if config['pyramid']['curvature_model'] != '':
|
||||||
load_model(self.curv_enc, config['pyramid']['curvature_model'] + '_enc')
|
load_model(self.curv_enc, config['pyramid']['curvature_model'] + '_enc')
|
||||||
@@ -33,7 +32,6 @@ class Pyramid(tf.keras.Model):
|
|||||||
if config['pyramid']['freeze_encoders']:
|
if config['pyramid']['freeze_encoders']:
|
||||||
self.static_enc.trainable = False
|
self.static_enc.trainable = False
|
||||||
self.body_enc.trainable = False
|
self.body_enc.trainable = False
|
||||||
if config['use_curvature']:
|
|
||||||
self.curv_enc.trainable = False
|
self.curv_enc.trainable = False
|
||||||
|
|
||||||
self.cond_encoder = tf.keras.Sequential([tf.keras.layers.Dense(512, activation='relu'),
|
self.cond_encoder = tf.keras.Sequential([tf.keras.layers.Dense(512, activation='relu'),
|
||||||
@@ -72,12 +70,11 @@ class Pyramid(tf.keras.Model):
|
|||||||
self.add_noise = config['pyramid']['add_noise']
|
self.add_noise = config['pyramid']['add_noise']
|
||||||
self.noise_amount = config['pyramid']['noise_amount']
|
self.noise_amount = config['pyramid']['noise_amount']
|
||||||
self.use_offsets = config['use_offsets']
|
self.use_offsets = config['use_offsets']
|
||||||
self.use_curvature = config['use_curvature']
|
|
||||||
|
|
||||||
self.upscale_enhancer = None
|
self.upscale_enhancer = None
|
||||||
if config['pyramid']['final_upscale_enhancer'] != '':
|
if config['pyramid']['final_upscale_enhancer'] != '':
|
||||||
k_size = config['pyramid']['final_upscale_enhancer_kernel_size'] if 'final_upscale_enhancer_kernel_size' in config['pyramid'].keys() else ((3 if config['pyramid']['resolutions'][-1] <= 64 else 5))
|
k_size = config['pyramid']['final_upscale_enhancer_kernel_size'] if 'final_upscale_enhancer_kernel_size' in config['pyramid'].keys() else ((3 if config['pyramid']['resolutions'][-1] <= 64 else 5))
|
||||||
self.upscale_enhancer : tf.keras.Model = UpscalerBasicConv(low_res=config['pyramid']['resolutions'][-1], kernel_size=k_size)
|
self.upscale_enhancer = UpscalerBasicConv(low_res=config['pyramid']['resolutions'][-1], kernel_size=k_size)
|
||||||
load_model(self.upscale_enhancer, config['pyramid']['final_upscale_enhancer'])
|
load_model(self.upscale_enhancer, config['pyramid']['final_upscale_enhancer'])
|
||||||
self.upscale_enhancer.trainable = False
|
self.upscale_enhancer.trainable = False
|
||||||
|
|
||||||
@@ -88,11 +85,9 @@ class Pyramid(tf.keras.Model):
|
|||||||
def encode_conds(self, uv_template, uv_body_posed, uv_curv, training):
|
def encode_conds(self, uv_template, uv_body_posed, uv_curv, training):
|
||||||
z_static = self.static_enc(uv_template, training)
|
z_static = self.static_enc(uv_template, training)
|
||||||
z_body = self.body_enc(uv_body_posed, training)
|
z_body = self.body_enc(uv_body_posed, training)
|
||||||
if self.use_curvature:
|
z_curv = self.curv_enc(uv_curv, training)
|
||||||
z_curv = self.curv_enc(uv_curv, training=training)
|
|
||||||
z_cond = tf.concat([z_static, z_body, z_curv], axis=-1)
|
z_cond = tf.concat([z_static, z_body, z_curv], axis=-1)
|
||||||
else:
|
|
||||||
z_cond = tf.concat([z_static, z_body], axis=-1)
|
|
||||||
z_cond = self.cond_encoder(z_cond, training=training)
|
z_cond = self.cond_encoder(z_cond, training=training)
|
||||||
|
|
||||||
return z_cond
|
return z_cond
|
||||||
@@ -299,7 +294,6 @@ class PyramidNew(tf.keras.Model):
|
|||||||
self.add_noise = config['pyramid']['add_noise']
|
self.add_noise = config['pyramid']['add_noise']
|
||||||
self.noise_amount = config['pyramid']['noise_amount']
|
self.noise_amount = config['pyramid']['noise_amount']
|
||||||
self.use_offsets = config['use_offsets']
|
self.use_offsets = config['use_offsets']
|
||||||
self.use_curvature = config['use_curvature']
|
|
||||||
|
|
||||||
self.upscale_enhancer = None
|
self.upscale_enhancer = None
|
||||||
if config['pyramid']['final_upscale_enhancer'] != '':
|
if config['pyramid']['final_upscale_enhancer'] != '':
|
||||||
@@ -315,11 +309,9 @@ class PyramidNew(tf.keras.Model):
|
|||||||
def encode_conds(self, uv_template, uv_body_posed, uv_curv, training):
|
def encode_conds(self, uv_template, uv_body_posed, uv_curv, training):
|
||||||
z_static = self.static_enc(uv_template, training)
|
z_static = self.static_enc(uv_template, training)
|
||||||
z_body = self.body_enc(uv_body_posed, training)
|
z_body = self.body_enc(uv_body_posed, training)
|
||||||
if self.use_curvature:
|
z_curv = self.curv_enc(uv_curv, training)
|
||||||
z_curv = self.curv_enc(uv_curv, training=training)
|
|
||||||
z_cond = tf.concat([z_static, z_body, z_curv], axis=-1)
|
z_cond = tf.concat([z_static, z_body, z_curv], axis=-1)
|
||||||
else:
|
|
||||||
z_cond = tf.concat([z_static, z_body], axis=-1)
|
|
||||||
|
|
||||||
return z_cond
|
return z_cond
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,254 @@
|
|||||||
|
# taken from https://github.com/calmisential/TensorFlow2.0_ResNet/blob/master/models/resnet.py
|
||||||
|
|
||||||
|
import tensorflow as tf
|
||||||
|
|
||||||
|
|
||||||
|
class BasicBlock(tf.keras.layers.Layer):
|
||||||
|
|
||||||
|
def __init__(self, filter_num, stride=1, upsample=False):
|
||||||
|
super(BasicBlock, self).__init__()
|
||||||
|
if not upsample:
|
||||||
|
self.conv1 = tf.keras.layers.Conv2D(filters=filter_num,
|
||||||
|
kernel_size=(3, 3),
|
||||||
|
strides=stride,
|
||||||
|
padding="same")
|
||||||
|
else:
|
||||||
|
self.conv1 = tf.keras.layers.Conv2DTranspose(filters=filter_num,
|
||||||
|
kernel_size=(3, 3),
|
||||||
|
strides=stride,
|
||||||
|
padding="same")
|
||||||
|
self.bn1 = tf.keras.layers.BatchNormalization()
|
||||||
|
self.conv2 = tf.keras.layers.Conv2D(filters=filter_num,
|
||||||
|
kernel_size=(3, 3),
|
||||||
|
strides=1,
|
||||||
|
padding="same")
|
||||||
|
self.bn2 = tf.keras.layers.BatchNormalization()
|
||||||
|
if stride != 1:
|
||||||
|
if not upsample:
|
||||||
|
self.updownsample = tf.keras.Sequential()
|
||||||
|
self.updownsample.add(tf.keras.layers.Conv2D(filters=filter_num,
|
||||||
|
kernel_size=(1, 1),
|
||||||
|
strides=stride))
|
||||||
|
self.updownsample.add(tf.keras.layers.BatchNormalization())
|
||||||
|
else:
|
||||||
|
self.updownsample = tf.keras.Sequential()
|
||||||
|
self.updownsample.add(tf.keras.layers.Conv2DTranspose(filters=filter_num,
|
||||||
|
kernel_size=(1, 1),
|
||||||
|
strides=stride))
|
||||||
|
self.updownsample.add(tf.keras.layers.BatchNormalization())
|
||||||
|
else:
|
||||||
|
self.updownsample = lambda x: x
|
||||||
|
|
||||||
|
def call(self, inputs, training=None, **kwargs):
|
||||||
|
residual = self.updownsample(inputs)
|
||||||
|
|
||||||
|
x = self.conv1(inputs)
|
||||||
|
x = self.bn1(x, training=training)
|
||||||
|
x = tf.nn.relu(x)
|
||||||
|
x = self.conv2(x)
|
||||||
|
x = self.bn2(x, training=training)
|
||||||
|
|
||||||
|
output = tf.nn.relu(tf.keras.layers.add([residual, x]))
|
||||||
|
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
class BottleNeck(tf.keras.layers.Layer):
|
||||||
|
def __init__(self, filter_num, stride=1):
|
||||||
|
super(BottleNeck, self).__init__()
|
||||||
|
self.conv1 = tf.keras.layers.Conv2D(filters=filter_num,
|
||||||
|
kernel_size=(1, 1),
|
||||||
|
strides=1,
|
||||||
|
padding='same')
|
||||||
|
self.bn1 = tf.keras.layers.BatchNormalization()
|
||||||
|
self.conv2 = tf.keras.layers.Conv2D(filters=filter_num,
|
||||||
|
kernel_size=(3, 3),
|
||||||
|
strides=stride,
|
||||||
|
padding='same')
|
||||||
|
self.bn2 = tf.keras.layers.BatchNormalization()
|
||||||
|
self.conv3 = tf.keras.layers.Conv2D(filters=filter_num * 4,
|
||||||
|
kernel_size=(1, 1),
|
||||||
|
strides=1,
|
||||||
|
padding='same')
|
||||||
|
self.bn3 = tf.keras.layers.BatchNormalization()
|
||||||
|
|
||||||
|
self.downsample = tf.keras.Sequential()
|
||||||
|
self.downsample.add(tf.keras.layers.Conv2D(filters=filter_num * 4,
|
||||||
|
kernel_size=(1, 1),
|
||||||
|
strides=stride))
|
||||||
|
self.downsample.add(tf.keras.layers.BatchNormalization())
|
||||||
|
|
||||||
|
def call(self, inputs, training=None, **kwargs):
|
||||||
|
residual = self.downsample(inputs)
|
||||||
|
|
||||||
|
x = self.conv1(inputs)
|
||||||
|
x = self.bn1(x, training=training)
|
||||||
|
x = tf.nn.relu(x)
|
||||||
|
x = self.conv2(x)
|
||||||
|
x = self.bn2(x, training=training)
|
||||||
|
x = tf.nn.relu(x)
|
||||||
|
x = self.conv3(x)
|
||||||
|
x = self.bn3(x, training=training)
|
||||||
|
|
||||||
|
output = tf.nn.relu(tf.keras.layers.add([residual, x]))
|
||||||
|
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
def make_basic_block_layer(filter_num, blocks, stride=1, upsample=False):
|
||||||
|
res_block = tf.keras.Sequential()
|
||||||
|
res_block.add(BasicBlock(filter_num, stride=stride, upsample=upsample))
|
||||||
|
|
||||||
|
for _ in range(1, blocks):
|
||||||
|
res_block.add(BasicBlock(filter_num, stride=1))
|
||||||
|
|
||||||
|
return res_block
|
||||||
|
|
||||||
|
|
||||||
|
def make_bottleneck_layer(filter_num, blocks, stride=1):
|
||||||
|
res_block = tf.keras.Sequential()
|
||||||
|
res_block.add(BottleNeck(filter_num, stride=stride))
|
||||||
|
|
||||||
|
for _ in range(1, blocks):
|
||||||
|
res_block.add(BottleNeck(filter_num, stride=1))
|
||||||
|
|
||||||
|
return res_block
|
||||||
|
|
||||||
|
|
||||||
|
class ResNetTypeI(tf.keras.Model):
|
||||||
|
def __init__(self, layer_params, features, reversed=False, labels=None, is_cvae=False):
|
||||||
|
super(ResNetTypeI, self).__init__()
|
||||||
|
self.reversed = reversed
|
||||||
|
self.labels = labels
|
||||||
|
|
||||||
|
if not reversed:
|
||||||
|
self.conv1 = tf.keras.layers.Conv2D(filters=64,
|
||||||
|
kernel_size=(7, 7),
|
||||||
|
strides=2,
|
||||||
|
padding="same")
|
||||||
|
self.bn1 = tf.keras.layers.BatchNormalization()
|
||||||
|
self.pool1 = tf.keras.layers.MaxPool2D(pool_size=(3, 3),
|
||||||
|
strides=2,
|
||||||
|
padding="same")
|
||||||
|
else:
|
||||||
|
self.conv1 = tf.keras.layers.Conv2DTranspose(filters=3 if labels is None else labels,
|
||||||
|
kernel_size=(7, 7),
|
||||||
|
strides=2,
|
||||||
|
padding="same")
|
||||||
|
self.bn1 = tf.keras.layers.BatchNormalization()
|
||||||
|
# self.pool1 = tf.keras.layers.MaxPool2D(pool_size=(3, 3),
|
||||||
|
# strides=2,
|
||||||
|
# padding="same")
|
||||||
|
self.pool1 = tf.keras.layers.UpSampling2D()
|
||||||
|
|
||||||
|
self.layer1 = make_basic_block_layer(filter_num=64,
|
||||||
|
blocks=layer_params[0],
|
||||||
|
stride=1 if not reversed else 2,
|
||||||
|
upsample=reversed)
|
||||||
|
self.layer2 = make_basic_block_layer(filter_num=64,
|
||||||
|
blocks=layer_params[1],
|
||||||
|
stride=2,
|
||||||
|
upsample=reversed)
|
||||||
|
self.layer3 = make_basic_block_layer(filter_num=64,
|
||||||
|
blocks=layer_params[2],
|
||||||
|
stride=2,
|
||||||
|
upsample=reversed)
|
||||||
|
self.layer4 = make_basic_block_layer(filter_num=128,
|
||||||
|
blocks=layer_params[3],
|
||||||
|
stride=2,
|
||||||
|
upsample=reversed)
|
||||||
|
self.layer5 = make_basic_block_layer(filter_num=features if not is_cvae else features*2,
|
||||||
|
blocks=layer_params[4],
|
||||||
|
stride=2 if not reversed else 1,
|
||||||
|
upsample=reversed)
|
||||||
|
|
||||||
|
def call(self, inputs, training=None, mask=None):
|
||||||
|
if not self.reversed:
|
||||||
|
x = self.conv1(inputs)
|
||||||
|
x = self.bn1(x, training=training)
|
||||||
|
x = tf.nn.relu(x)
|
||||||
|
x = self.pool1(x)
|
||||||
|
x = self.layer1(x, training=training)
|
||||||
|
x = self.layer2(x, training=training)
|
||||||
|
x = self.layer3(x, training=training)
|
||||||
|
x = self.layer4(x, training=training)
|
||||||
|
x = self.layer5(x, training=training)
|
||||||
|
else:
|
||||||
|
x = self.layer5(inputs, training=training)
|
||||||
|
x = self.layer4(x, training=training)
|
||||||
|
x = self.layer3(x, training=training)
|
||||||
|
x = self.layer2(x, training=training)
|
||||||
|
x = self.layer1(x, training=training)
|
||||||
|
|
||||||
|
x = self.pool1(x)
|
||||||
|
x = self.bn1(x, training=training)
|
||||||
|
# x = tf.nn.relu(x)
|
||||||
|
x = self.conv1(x)
|
||||||
|
if self.labels is None:
|
||||||
|
x = tf.nn.tanh(x)
|
||||||
|
# else:
|
||||||
|
# x = tf.nn.softmax(x)
|
||||||
|
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
|
class ResNetTypeII(tf.keras.Model):
|
||||||
|
def __init__(self, layer_params):
|
||||||
|
super(ResNetTypeII, self).__init__()
|
||||||
|
self.conv1 = tf.keras.layers.Conv2D(filters=64,
|
||||||
|
kernel_size=(7, 7),
|
||||||
|
strides=2,
|
||||||
|
padding="same")
|
||||||
|
self.bn1 = tf.keras.layers.BatchNormalization()
|
||||||
|
self.pool1 = tf.keras.layers.MaxPool2D(pool_size=(3, 3),
|
||||||
|
strides=2,
|
||||||
|
padding="same")
|
||||||
|
|
||||||
|
self.layer1 = make_bottleneck_layer(filter_num=64,
|
||||||
|
blocks=layer_params[0])
|
||||||
|
self.layer2 = make_bottleneck_layer(filter_num=128,
|
||||||
|
blocks=layer_params[1],
|
||||||
|
stride=2)
|
||||||
|
self.layer3 = make_bottleneck_layer(filter_num=256,
|
||||||
|
blocks=layer_params[2],
|
||||||
|
stride=2)
|
||||||
|
self.layer4 = make_bottleneck_layer(filter_num=512,
|
||||||
|
blocks=layer_params[3],
|
||||||
|
stride=2)
|
||||||
|
|
||||||
|
self.avgpool = tf.keras.layers.GlobalAveragePooling2D()
|
||||||
|
self.fc = tf.keras.layers.Dense(units=NUM_CLASSES, activation=tf.keras.activations.softmax)
|
||||||
|
|
||||||
|
def call(self, inputs, training=None, mask=None):
|
||||||
|
x = self.conv1(inputs)
|
||||||
|
x = self.bn1(x, training=training)
|
||||||
|
x = tf.nn.relu(x)
|
||||||
|
x = self.pool1(x)
|
||||||
|
x = self.layer1(x, training=training)
|
||||||
|
x = self.layer2(x, training=training)
|
||||||
|
x = self.layer3(x, training=training)
|
||||||
|
x = self.layer4(x, training=training)
|
||||||
|
x = self.avgpool(x)
|
||||||
|
output = self.fc(x)
|
||||||
|
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
def resnet_18(features, reversed=False, labels=None, is_cvae=False):
|
||||||
|
return ResNetTypeI(layer_params=[2, 2, 2, 2, 2], features=features, reversed=reversed, labels=labels, is_cvae=is_cvae)
|
||||||
|
|
||||||
|
|
||||||
|
def resnet_34():
|
||||||
|
return ResNetTypeI(layer_params=[3, 4, 6, 3])
|
||||||
|
|
||||||
|
|
||||||
|
def resnet_50():
|
||||||
|
return ResNetTypeII(layer_params=[3, 4, 6, 3])
|
||||||
|
|
||||||
|
|
||||||
|
def resnet_101():
|
||||||
|
return ResNetTypeII(layer_params=[3, 4, 23, 3])
|
||||||
|
|
||||||
|
|
||||||
|
def resnet_152():
|
||||||
|
return ResNetTypeII(layer_params=[3, 8, 36, 3])
|
||||||
+8
-8
@@ -232,17 +232,17 @@ def generate_frames_file(folder, ratio=0.1):
|
|||||||
selected = []
|
selected = []
|
||||||
|
|
||||||
for id in tqdm.tqdm(sub_ids):
|
for id in tqdm.tqdm(sub_ids):
|
||||||
# if garment_type_table[id] != 'Dress':
|
if garment_type_table[id] != 'Dress':
|
||||||
# continue
|
continue
|
||||||
# if len(selected) > 30000:
|
if len(selected) > 30000:
|
||||||
# break
|
break
|
||||||
|
|
||||||
# frames = glob.glob(os.path.join(folder, 'pose_shape', id + '_*'))
|
# frames = glob.glob(os.path.join(folder, 'pose_shape', id + '_*'))
|
||||||
frames = [frame for frame in all_frames if frame.startswith(id + '_')]
|
frames = [frame for frame in all_frames if frame.startswith(id + '_')]
|
||||||
frames = [frame.split('/')[-1].split('.')[0] for frame in frames]
|
frames = [frame.split('/')[-1].split('.')[0] for frame in frames]
|
||||||
selected.extend(frames)
|
selected.extend(frames)
|
||||||
|
|
||||||
with open(os.path.join(folder, 'frames_skirt_10p.txt'), 'w') as f:
|
with open(os.path.join(folder, 'frames_dress_30k.txt'), 'w') as f:
|
||||||
for i, frame in enumerate(selected):
|
for i, frame in enumerate(selected):
|
||||||
f.write(frame + '\n')
|
f.write(frame + '\n')
|
||||||
|
|
||||||
@@ -293,9 +293,9 @@ def generate_frames_file_filtered_cape():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
src_folder = '/home/workspace/local-data/valid_skirt' #cloth3d_skirt
|
src_folder = '/home/workspace/local-data/train_skirt' #cloth3d_skirt
|
||||||
# src_folder = r'D:\Work\Dataset\validation_2'
|
# src_folder = r'D:\Work\Dataset\validation_2'
|
||||||
dest_folder = '/home/workspace/data/dataset/local-cache/train_skirt'
|
dest_folder = '/home/workspace/data/dataset/validation'
|
||||||
|
|
||||||
|
|
||||||
# create_no_orient_body(src_folder)
|
# create_no_orient_body(src_folder)
|
||||||
@@ -306,5 +306,5 @@ if __name__ == '__main__':
|
|||||||
# verify_poses(src_folder)
|
# verify_poses(src_folder)
|
||||||
# create_garment_type_table()
|
# create_garment_type_table()
|
||||||
# generate_faces()
|
# generate_faces()
|
||||||
generate_frames_file(src_folder, ratio=0.1)
|
generate_frames_file(src_folder, ratio=1)
|
||||||
# generate_frames_file_filtered_cape()
|
# generate_frames_file_filtered_cape()
|
||||||
|
|||||||
Reference in New Issue
Block a user