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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
|
| 4 |
+
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
|
| 5 |
+
# holder of all proprietary rights on this computer program.
|
| 6 |
+
# You can only use this computer program if you have closed
|
| 7 |
+
# a license agreement with MPG or you get the right to use the computer
|
| 8 |
+
# program from someone who is authorized to grant you that right.
|
| 9 |
+
# Any use of the computer program without a valid license is prohibited and
|
| 10 |
+
# liable to prosecution.
|
| 11 |
+
#
|
| 12 |
+
# Copyright©2019 Max-Planck-Gesellschaft zur Förderung
|
| 13 |
+
# der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute
|
| 14 |
+
# for Intelligent Systems. All rights reserved.
|
| 15 |
+
#
|
| 16 |
+
# Contact: [email protected]
|
| 17 |
+
|
| 18 |
+
from yacs.config import CfgNode as CN
|
| 19 |
+
import os
|
| 20 |
+
|
| 21 |
+
_C = CN(new_allowed=True)
|
| 22 |
+
|
| 23 |
+
# needed by trainer
|
| 24 |
+
_C.name = 'default'
|
| 25 |
+
_C.gpus = [0]
|
| 26 |
+
_C.test_gpus = [1]
|
| 27 |
+
_C.root = "./data/"
|
| 28 |
+
_C.ckpt_dir = './data/ckpt/'
|
| 29 |
+
_C.resume_path = ''
|
| 30 |
+
_C.normal_path = ''
|
| 31 |
+
_C.corr_path = ''
|
| 32 |
+
_C.results_path = './data/results/'
|
| 33 |
+
_C.projection_mode = 'orthogonal'
|
| 34 |
+
_C.num_views = 1
|
| 35 |
+
_C.sdf = False
|
| 36 |
+
_C.sdf_clip = 5.0
|
| 37 |
+
|
| 38 |
+
_C.lr_G = 1e-3
|
| 39 |
+
_C.lr_C = 1e-3
|
| 40 |
+
_C.lr_N = 2e-4
|
| 41 |
+
_C.weight_decay = 0.0
|
| 42 |
+
_C.momentum = 0.0
|
| 43 |
+
_C.optim = 'RMSprop'
|
| 44 |
+
_C.schedule = [5, 10, 15]
|
| 45 |
+
_C.gamma = 0.1
|
| 46 |
+
|
| 47 |
+
_C.overfit = False
|
| 48 |
+
_C.resume = False
|
| 49 |
+
_C.test_mode = False
|
| 50 |
+
_C.test_uv = False
|
| 51 |
+
_C.draw_geo_thres = 0.60
|
| 52 |
+
_C.num_sanity_val_steps = 2
|
| 53 |
+
_C.fast_dev = 0
|
| 54 |
+
_C.get_fit = False
|
| 55 |
+
_C.agora = False
|
| 56 |
+
_C.optim_cloth = False
|
| 57 |
+
_C.optim_body = False
|
| 58 |
+
_C.mcube_res = 256
|
| 59 |
+
_C.clean_mesh = True
|
| 60 |
+
_C.remesh = False
|
| 61 |
+
|
| 62 |
+
_C.batch_size = 4
|
| 63 |
+
_C.num_threads = 8
|
| 64 |
+
|
| 65 |
+
_C.num_epoch = 10
|
| 66 |
+
_C.freq_plot = 0.01
|
| 67 |
+
_C.freq_show_train = 0.1
|
| 68 |
+
_C.freq_show_val = 0.2
|
| 69 |
+
_C.freq_eval = 0.5
|
| 70 |
+
_C.accu_grad_batch = 4
|
| 71 |
+
|
| 72 |
+
_C.test_items = ['sv', 'mv', 'mv-fusion', 'hybrid', 'dc-pred', 'gt']
|
| 73 |
+
|
| 74 |
+
_C.net = CN()
|
| 75 |
+
_C.net.gtype = 'HGPIFuNet'
|
| 76 |
+
_C.net.ctype = 'resnet18'
|
| 77 |
+
_C.net.classifierIMF = 'MultiSegClassifier'
|
| 78 |
+
_C.net.netIMF = 'resnet18'
|
| 79 |
+
_C.net.norm = 'group'
|
| 80 |
+
_C.net.norm_mlp = 'group'
|
| 81 |
+
_C.net.norm_color = 'group'
|
| 82 |
+
_C.net.hg_down = 'ave_pool'
|
| 83 |
+
_C.net.num_views = 1
|
| 84 |
+
|
| 85 |
+
# kernel_size, stride, dilation, padding
|
| 86 |
+
|
| 87 |
+
_C.net.conv1 = [7, 2, 1, 3]
|
| 88 |
+
_C.net.conv3x3 = [3, 1, 1, 1]
|
| 89 |
+
|
| 90 |
+
_C.net.num_stack = 4
|
| 91 |
+
_C.net.num_hourglass = 2
|
| 92 |
+
_C.net.hourglass_dim = 256
|
| 93 |
+
_C.net.voxel_dim = 32
|
| 94 |
+
_C.net.resnet_dim = 120
|
| 95 |
+
_C.net.mlp_dim = [320, 1024, 512, 256, 128, 1]
|
| 96 |
+
_C.net.mlp_dim_knn = [320, 1024, 512, 256, 128, 3]
|
| 97 |
+
_C.net.mlp_dim_color = [513, 1024, 512, 256, 128, 3]
|
| 98 |
+
_C.net.mlp_dim_multiseg = [1088, 2048, 1024, 500]
|
| 99 |
+
_C.net.res_layers = [2, 3, 4]
|
| 100 |
+
_C.net.filter_dim = 256
|
| 101 |
+
_C.net.smpl_dim = 3
|
| 102 |
+
|
| 103 |
+
_C.net.cly_dim = 3
|
| 104 |
+
_C.net.soft_dim = 64
|
| 105 |
+
_C.net.z_size = 200.0
|
| 106 |
+
_C.net.N_freqs = 10
|
| 107 |
+
_C.net.geo_w = 0.1
|
| 108 |
+
_C.net.norm_w = 0.1
|
| 109 |
+
_C.net.dc_w = 0.1
|
| 110 |
+
_C.net.C_cat_to_G = False
|
| 111 |
+
|
| 112 |
+
_C.net.skip_hourglass = True
|
| 113 |
+
_C.net.use_tanh = True
|
| 114 |
+
_C.net.soft_onehot = True
|
| 115 |
+
_C.net.no_residual = True
|
| 116 |
+
_C.net.use_attention = False
|
| 117 |
+
|
| 118 |
+
_C.net.prior_type = "sdf"
|
| 119 |
+
_C.net.smpl_feats = ['sdf', 'cmap', 'norm', 'vis']
|
| 120 |
+
_C.net.use_filter = True
|
| 121 |
+
_C.net.use_cc = False
|
| 122 |
+
_C.net.use_PE = False
|
| 123 |
+
_C.net.use_IGR = False
|
| 124 |
+
_C.net.in_geo = ()
|
| 125 |
+
_C.net.in_nml = ()
|
| 126 |
+
|
| 127 |
+
_C.dataset = CN()
|
| 128 |
+
_C.dataset.root = ''
|
| 129 |
+
_C.dataset.set_splits = [0.95, 0.04]
|
| 130 |
+
_C.dataset.types = [
|
| 131 |
+
"3dpeople", "axyz", "renderpeople", "renderpeople_p27", "humanalloy"
|
| 132 |
+
]
|
| 133 |
+
_C.dataset.scales = [1.0, 100.0, 1.0, 1.0, 100.0 / 39.37]
|
| 134 |
+
_C.dataset.rp_type = "pifu900"
|
| 135 |
+
_C.dataset.th_type = 'train'
|
| 136 |
+
_C.dataset.input_size = 512
|
| 137 |
+
_C.dataset.rotation_num = 3
|
| 138 |
+
_C.dataset.num_precomp = 10 # Number of segmentation classifiers
|
| 139 |
+
_C.dataset.num_multiseg = 500 # Number of categories per classifier
|
| 140 |
+
_C.dataset.num_knn = 10 # for loss/error
|
| 141 |
+
_C.dataset.num_knn_dis = 20 # for accuracy
|
| 142 |
+
_C.dataset.num_verts_max = 20000
|
| 143 |
+
_C.dataset.zray_type = False
|
| 144 |
+
_C.dataset.online_smpl = False
|
| 145 |
+
_C.dataset.noise_type = ['z-trans', 'pose', 'beta']
|
| 146 |
+
_C.dataset.noise_scale = [0.0, 0.0, 0.0]
|
| 147 |
+
_C.dataset.num_sample_geo = 10000
|
| 148 |
+
_C.dataset.num_sample_color = 0
|
| 149 |
+
_C.dataset.num_sample_seg = 0
|
| 150 |
+
_C.dataset.num_sample_knn = 10000
|
| 151 |
+
|
| 152 |
+
_C.dataset.sigma_geo = 5.0
|
| 153 |
+
_C.dataset.sigma_color = 0.10
|
| 154 |
+
_C.dataset.sigma_seg = 0.10
|
| 155 |
+
_C.dataset.thickness_threshold = 20.0
|
| 156 |
+
_C.dataset.ray_sample_num = 2
|
| 157 |
+
_C.dataset.semantic_p = False
|
| 158 |
+
_C.dataset.remove_outlier = False
|
| 159 |
+
|
| 160 |
+
_C.dataset.train_bsize = 1.0
|
| 161 |
+
_C.dataset.val_bsize = 1.0
|
| 162 |
+
_C.dataset.test_bsize = 1.0
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
def get_cfg_defaults():
|
| 166 |
+
"""Get a yacs CfgNode object with default values for my_project."""
|
| 167 |
+
# Return a clone so that the defaults will not be altered
|
| 168 |
+
# This is for the "local variable" use pattern
|
| 169 |
+
return _C.clone()
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
# Alternatively, provide a way to import the defaults as
|
| 173 |
+
# a global singleton:
|
| 174 |
+
cfg = _C # users can `from config import cfg`
|
| 175 |
+
|
| 176 |
+
# cfg = get_cfg_defaults()
|
| 177 |
+
# cfg.merge_from_file('./configs/example.yaml')
|
| 178 |
+
|
| 179 |
+
# # Now override from a list (opts could come from the command line)
|
| 180 |
+
# opts = ['dataset.root', './data/XXXX', 'learning_rate', '1e-2']
|
| 181 |
+
# cfg.merge_from_list(opts)
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
def update_cfg(cfg_file):
|
| 185 |
+
# cfg = get_cfg_defaults()
|
| 186 |
+
_C.merge_from_file(cfg_file)
|
| 187 |
+
# return cfg.clone()
|
| 188 |
+
return _C
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
def parse_args(args):
|
| 192 |
+
cfg_file = args.cfg_file
|
| 193 |
+
if args.cfg_file is not None:
|
| 194 |
+
cfg = update_cfg(args.cfg_file)
|
| 195 |
+
else:
|
| 196 |
+
cfg = get_cfg_defaults()
|
| 197 |
+
|
| 198 |
+
# if args.misc is not None:
|
| 199 |
+
# cfg.merge_from_list(args.misc)
|
| 200 |
+
|
| 201 |
+
return cfg
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
def parse_args_extend(args):
|
| 205 |
+
if args.resume:
|
| 206 |
+
if not os.path.exists(args.log_dir):
|
| 207 |
+
raise ValueError(
|
| 208 |
+
'Experiment are set to resume mode, but log directory does not exist.'
|
| 209 |
+
)
|
| 210 |
+
|
| 211 |
+
# load log's cfg
|
| 212 |
+
cfg_file = os.path.join(args.log_dir, 'cfg.yaml')
|
| 213 |
+
cfg = update_cfg(cfg_file)
|
| 214 |
+
|
| 215 |
+
if args.misc is not None:
|
| 216 |
+
cfg.merge_from_list(args.misc)
|
| 217 |
+
else:
|
| 218 |
+
parse_args(args)
|