├── .gitignore ├── README.md ├── assets ├── demo.gif └── teaser.png ├── configs ├── base.yaml ├── s2 │ ├── finetuning │ │ ├── neus-domedenseraw-ddc-s2-smooth2-itw-finetune2-new2-meta-demo.yaml │ │ ├── neus-domedenseraw-ddc-s2-smooth2-itw-finetune2-new2-meta.yaml │ │ ├── neus-domedenseraw-ddc-s2-smooth2-itw-finetune2-new2-notmeta.yaml │ │ ├── neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-meta-animation.yaml │ │ ├── neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-meta-demo.yaml │ │ ├── neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-meta-eight.yaml │ │ ├── neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-meta-one-oh.yaml │ │ ├── neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-meta-two.yaml │ │ ├── neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-meta.yaml │ │ └── neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-notmeta.yaml │ ├── groundtruth │ │ └── neus-domedenseraw-ddc-s2-smooth2-test-gt.yaml │ ├── interpolation │ │ └── neusinterpolation-domedenseraw-ddc-s2-smooth2-test.yaml │ └── metalearning │ │ └── metaneusseq-domedenserawseq_meta-ddc-s2-smooth2-24-more-newthreshold0-100Frame-100Camera.yaml ├── s27 │ ├── finetuning │ │ ├── neus-domedenseraw-ddc-s27-smooth2-itw-finetune2-new2-meta.yaml │ │ ├── neus-domedenseraw-ddc-s27-smooth2-itw-finetune2-new2-notmeta.yaml │ │ ├── neus-domedenseraw-ddc-s27-smooth2-test-finetune2-new2-meta.yaml │ │ └── neus-domedenseraw-ddc-s27-smooth2-test-finetune2-new2-notmeta.yaml │ ├── groundtruth │ │ └── neus-domedenseraw-ddc-s27-smooth2-test-gt.yaml │ └── metalearning │ │ └── metaneusseq-domedenserawseq-ddc-s27-smooth2-24-more-newthreshold2-100Frame.yaml ├── s3 │ ├── finetuning │ │ ├── neus-domedenseraw-ddc-s3-smooth2-test-finetune2-new2-meta.yaml │ │ └── neus-domedenseraw-ddc-s3-smooth2-test-finetune2-new2-notmeta.yaml │ ├── groundtruth │ │ └── neus-domedenseraw-ddc-s3-smooth2-test-gt.yaml │ └── metalearning │ │ └── metaneusseq-domedenserawseq-ddc-s3-smooth2-24-more-newthreshold2-100Frame.yaml └── s5 │ ├── finetuning │ ├── neus-domedenseraw-ddc-s5-smooth2-test-finetune2-new2-meta.yaml │ └── neus-domedenseraw-ddc-s5-smooth2-test-finetune2-new2-notmeta.yaml │ ├── groundtruth │ └── neus-domedenseraw-ddc-s5-smooth2-test-gt.yaml │ └── metalearning │ └── metaneusseq-domedenserawseq-ddc-s5-smooth2-24-more-newthreshold0-pointcloud-zero4.yaml ├── datas ├── SMPLX │ └── smpl │ │ └── Download_SMPL_models_follwing_Readme ├── color_proxy_s2 │ └── Download_proxy_images_masks_camera_parameters_following_readme ├── ddc_configs │ ├── default.yaml │ ├── s27_smooth_eg.yaml │ ├── s2_smooth_eg.yaml │ ├── s3_smooth_eg.yaml │ └── s5_smooth_eg.yaml ├── preprocess_data.py ├── render_depth_s5.py └── vis │ ├── cylinder2.obj │ ├── cylinder5.obj │ ├── env_sh.npy │ └── sphere2.obj ├── datasets ├── __init__.py ├── domedenseraw.py ├── domedenserawseq_meta.py └── human_info.py ├── evaluations ├── 00_move_Mesh_GT.py ├── 00_move_RGB_Mask_GT.py ├── 00_move_metacap.py ├── 00_prepare_T_w2s.py ├── 01_evaluate_mesh_metacap.py ├── 01_evaluate_rgb_metacap.py └── 02_summary_evaluate_metacap.py ├── launch.py ├── models ├── __init__.py ├── base.py ├── geometry.py ├── network_utils.py ├── neus.py ├── ray_utils.py ├── texture.py ├── triplane.py └── utils.py ├── requirements.txt ├── submit_1gpu_12hour_s27_100Frame-100Camera.sh ├── submit_1gpu_12hour_s2_100Frame-100Camera-SMPL.sh ├── submit_1gpu_12hour_s2_100Frame-100Camera.sh ├── submit_1gpu_12hour_s3_100Frame-100Camera.sh ├── submit_1gpu_12hour_s5_100Frame-100Camera.sh ├── systems ├── __init__.py ├── base.py ├── criterions.py ├── metaneusseq.py ├── neus.py ├── neusinterpolation.py └── utils.py └── tools ├── __init__.py ├── __pycache__ ├── __init__.cpython-38.pyc ├── cam_tools.cpython-38.pyc ├── mesh_tools.cpython-38.pyc ├── omni_tools.cpython-38.pyc ├── pyrender_tools.cpython-38.pyc ├── rotation_tools.cpython-38.pyc ├── skel_tools.cpython-38.pyc └── torch3d_transforms.cpython-38.pyc ├── cam_tools.py ├── config_tools.py ├── extensions ├── implicit_waterproofing.py └── libmesh │ ├── inside_mesh.py │ ├── setup.py │ ├── triangle_hash.cpp │ └── triangle_hash.pyx ├── ezmocap ├── __init__.py ├── body_model.py ├── body_param.py ├── lbfgs.py ├── lbs.py ├── optimize.py └── utils.py ├── mesh_tools.py ├── metric_tools.py ├── omni_tools.py ├── pyrender_tools.py ├── rotation_tools.py ├── skel_tools.py ├── smplx ├── __init__.py ├── body_models.py ├── joint_names.py ├── lbs.py ├── utils.py ├── vertex_ids.py └── vertex_joint_selector.py ├── torch3d_transforms.py └── utils ├── __init__.py ├── callbacks.py ├── loggers.py ├── mesh.py ├── misc.py ├── mixins.py └── obj.py /.gitignore: -------------------------------------------------------------------------------- 1 | ./datas/color_proxy_s2/mask_imgs/*.png 2 | ./datas/color_proxy_s2/*.npz 3 | 4 | ./datas/rotate_dir/*.png 5 | ./datas/rotate_dir/*.npz 6 | 7 | ./datas/SMPLX/smpl/*.pkl 8 | 9 | ./tools/extensions/libmesh/build/* 10 | ./tools/extensions/libmesh/dist/* 11 | ./tools/extensions/libmesh/libmesh.egg-info/* 12 | ./tools/extensions/libmesh/triangle_hash.cp38-win_amd64 13 | ./tools/extensions/libmesh/triangle_hash.cpython-38-x86_64-linux-gnu.so 14 | -------------------------------------------------------------------------------- /assets/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/assets/demo.gif -------------------------------------------------------------------------------- /assets/teaser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/assets/teaser.png -------------------------------------------------------------------------------- /configs/base.yaml: -------------------------------------------------------------------------------- 1 | root_dir: /CT/HOIMOCAP4/work/code/metacap 2 | exp_dir: /CT/HOIMOCAP4/work/results/metacap/exp/${dataset.subject} 3 | runs_dir: /CT/HOIMOCAP4/work/results/metacap/runs/${dataset.subject} 4 | 5 | dataset: 6 | smpl_dir: ${root_dir}/datas/SMPLX/smpl 7 | rotate_shift: 0 8 | camera_scale: 1000.0 9 | model: 10 | grid_pre: False -------------------------------------------------------------------------------- /configs/s2/finetuning/neus-domedenseraw-ddc-s2-smooth2-itw-finetune2-new2-meta-demo.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-ITW-demo 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0002 11 | frame: -1 12 | data_dir: ${root_dir}/datas/demo/${dataset.subject}/tight/inTheWild_demo 13 | scene: ${dataset.subject}-${dataset.frame} 14 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 15 | near_plane: 2.0 16 | far_plane: 6.0 17 | train_split: 'train' 18 | val_split: 'val' 19 | test_split: 'test' 20 | deformer: 'ddc' 21 | cano_motion: 'template' # 'world' 22 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 23 | config_path: ${root_dir}/datas/ddc_configs/s2_smooth_eg.yaml 24 | active_camera: [3, 4, 0, 2] 25 | active_camera_all: False 26 | active_camera_test: [1, 3, 4, 0, 2] 27 | smooth: True 28 | smoothDQ: False 29 | subdiv: 0 30 | loose: False 31 | rotate: False 32 | rotate_dir: /CT/HOIMOCAP2/nobackup/debug/deform_nsr/360 33 | rotate_template: False 34 | compute_occlusion: False 35 | test_interval: 1 36 | rotate_w: 540 37 | occlusion_template_dir: ${root_dir}/datas/color_proxy_s2 38 | threshold_smpl: 0.075 39 | threshold_ddc : 0.05 40 | erode_mask: False #True #False #True 41 | smpl_name: "smpl_params_smplx.npz" 42 | smpl_gender: 'neutral' 43 | rotate_ele: [0] 44 | rotate_step: 4 45 | rotate_scale: 1.0 46 | ddc_name: "ddc_all_smooth_less_new.npz" 47 | with_depth: False 48 | threshold_rigid: 0.05 49 | preload: True 50 | depth_shift: 0.0 51 | 52 | model: 53 | decay_step: 5000 54 | grid_resolution: 256 #64 #256 55 | name: neus 56 | radius: 1.25 57 | num_samples_per_ray: 1024 58 | train_num_rays: 256 59 | max_train_num_rays: 8192 60 | grid_prune: true 61 | grid_prune_occ_thre: 0.001 62 | dynamic_ray_sampling: true 63 | batch_image_sampling: true 64 | randomized: true 65 | ray_chunk: 4096 66 | cos_anneal_end: 20000 67 | learned_background: false 68 | background_color: random 69 | variance: 70 | init_val: 0.3 71 | modulate: false 72 | geometry: 73 | name: volume-sdf 74 | radius: ${model.radius} 75 | feature_dim: 13 76 | grad_type: analytic 77 | isosurface: 78 | method: mc 79 | resolution: [256,512,256] 80 | chunk: 2097152 81 | threshold: 0. 82 | xyz_encoding_config: 83 | otype: HashGrid 84 | n_levels: 12 #14 85 | n_features_per_level: 2 86 | log2_hashmap_size: 19 87 | base_resolution: 16 88 | per_level_scale: 1.447269237440378 89 | include_xyz: true 90 | include_feat: false 91 | mlp_network_config: 92 | otype: VanillaMLP 93 | activation: ReLU 94 | output_activation: none 95 | n_neurons: 64 96 | n_hidden_layers: 1 97 | sphere_init: true 98 | sphere_init_radius: 0.5 99 | weight_norm: false 100 | 101 | texture: 102 | name: volume-radiance 103 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 104 | dir_encoding_config: 105 | otype: Identity 106 | scale: 1.0 107 | offset: 0.0 108 | mlp_network_config: 109 | otype: FullyFusedMLP 110 | activation: ReLU 111 | output_activation: none 112 | n_neurons: 64 113 | n_hidden_layers: 2 114 | color_activation: sigmoid 115 | delta: 116 | name: delta-base 117 | radius: ${model.radius} 118 | xyz_encoding_config: 119 | otype: VanillaFrequency 120 | n_frequencies: 10 121 | mlp_network_config: 122 | otype: FullyFusedMLP 123 | activation: ReLU 124 | output_activation: none 125 | n_neurons: 64 126 | n_hidden_layers: 4 127 | 128 | system: 129 | name: neus-system 130 | loss: 131 | lambda_rgb_huber: 10.0 132 | lambda_rgb_mse: 0. 133 | lambda_rgb_l1: 0. 134 | lambda_mask: 0.1 135 | lambda_eikonal: 0.1 136 | lambda_sparsity: 0.01 137 | lambda_distortion: 0. 138 | lambda_opaque: 0. 139 | sparsity_scale: 1. 140 | lambda_sdf_reg: 0 141 | 142 | optimizer: 143 | name: Adam 144 | args: 145 | lr: 0.01 146 | betas: [0.9, 0.99] 147 | eps: 1.e-15 148 | params: 149 | geometry: 150 | lr: 0.01 151 | texture: 152 | lr: 0.01 153 | variance: 154 | lr: 0.01 155 | 156 | warmup_steps: 0 157 | scheduler: 158 | name: SequentialLR 159 | interval: step 160 | milestones: 161 | - ${system.warmup_steps} 162 | schedulers: 163 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 164 | args: 165 | start_factor: 0.01 #0.0001 -> 0.1 166 | end_factor: 1.0 167 | total_iters: ${system.warmup_steps} 168 | - name: ExponentialLR 169 | args: 170 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 171 | 172 | 173 | checkpoint: 174 | save_top_k: -1 175 | every_n_train_steps: ${trainer.max_steps} 176 | 177 | 178 | export: 179 | save_mesh: True 180 | chunk_size: 2097152 181 | export_vertex_color: True 182 | 183 | trainer: 184 | max_steps: 3000 185 | log_every_n_steps: 10 186 | num_sanity_val_steps: 0 187 | val_check_interval: 3000 188 | limit_train_batches: 1.0 189 | limit_val_batches: 2 190 | enable_progress_bar: true 191 | precision: 16 192 | -------------------------------------------------------------------------------- /configs/s2/finetuning/neus-domedenseraw-ddc-s2-smooth2-itw-finetune2-new2-meta.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-ITW 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0002 11 | frame: -1 12 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/inTheWild 13 | scene: ${dataset.subject}-${dataset.frame} 14 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 15 | near_plane: 2.0 16 | far_plane: 6.0 17 | train_split: 'train' 18 | val_split: 'val' 19 | test_split: 'test' 20 | deformer: 'ddc' 21 | cano_motion: 'template' # 'world' 22 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 23 | config_path: ${root_dir}/datas/ddc_configs/s2_smooth_eg.yaml 24 | active_camera: [3, 4, 0, 2] 25 | active_camera_all: False 26 | active_camera_test: [1, 3, 4, 0, 2] 27 | smooth: True 28 | smoothDQ: False 29 | subdiv: 0 30 | loose: False 31 | rotate: False 32 | rotate_dir: /CT/HOIMOCAP2/nobackup/debug/deform_nsr/360 33 | rotate_template: False 34 | compute_occlusion: False 35 | test_interval: 1 36 | rotate_w: 540 37 | occlusion_template_dir: ${root_dir}/datas/color_proxy_s2 38 | threshold_smpl: 0.075 39 | threshold_ddc : 0.05 40 | erode_mask: False #True #False #True 41 | smpl_name: "smpl_params_smplx.npz" 42 | smpl_gender: 'neutral' 43 | rotate_ele: [0] 44 | rotate_step: 4 45 | rotate_scale: 1.0 46 | ddc_name: "ddc_all_smooth_less_new.npz" 47 | with_depth: False 48 | threshold_rigid: 0.05 49 | preload: True 50 | depth_shift: 0.0 51 | 52 | model: 53 | decay_step: 5000 54 | grid_resolution: 256 #64 #256 55 | name: neus 56 | radius: 1.25 57 | num_samples_per_ray: 1024 58 | train_num_rays: 256 59 | max_train_num_rays: 8192 60 | grid_prune: true 61 | grid_prune_occ_thre: 0.001 62 | dynamic_ray_sampling: true 63 | batch_image_sampling: true 64 | randomized: true 65 | ray_chunk: 4096 66 | cos_anneal_end: 20000 67 | learned_background: false 68 | background_color: random 69 | variance: 70 | init_val: 0.3 71 | modulate: false 72 | geometry: 73 | name: volume-sdf 74 | radius: ${model.radius} 75 | feature_dim: 13 76 | grad_type: analytic 77 | isosurface: 78 | method: mc 79 | resolution: [256,512,256] 80 | chunk: 2097152 81 | threshold: 0. 82 | xyz_encoding_config: 83 | otype: HashGrid 84 | n_levels: 12 #14 85 | n_features_per_level: 2 86 | log2_hashmap_size: 19 87 | base_resolution: 16 88 | per_level_scale: 1.447269237440378 89 | include_xyz: true 90 | include_feat: false 91 | mlp_network_config: 92 | otype: VanillaMLP 93 | activation: ReLU 94 | output_activation: none 95 | n_neurons: 64 96 | n_hidden_layers: 1 97 | sphere_init: true 98 | sphere_init_radius: 0.5 99 | weight_norm: false 100 | 101 | texture: 102 | name: volume-radiance 103 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 104 | dir_encoding_config: 105 | otype: Identity 106 | scale: 1.0 107 | offset: 0.0 108 | mlp_network_config: 109 | otype: FullyFusedMLP 110 | activation: ReLU 111 | output_activation: none 112 | n_neurons: 64 113 | n_hidden_layers: 2 114 | color_activation: sigmoid 115 | delta: 116 | name: delta-base 117 | radius: ${model.radius} 118 | xyz_encoding_config: 119 | otype: VanillaFrequency 120 | n_frequencies: 10 121 | mlp_network_config: 122 | otype: FullyFusedMLP 123 | activation: ReLU 124 | output_activation: none 125 | n_neurons: 64 126 | n_hidden_layers: 4 127 | 128 | system: 129 | name: neus-system 130 | loss: 131 | lambda_rgb_huber: 10.0 132 | lambda_rgb_mse: 0. 133 | lambda_rgb_l1: 0. 134 | lambda_mask: 0.1 135 | lambda_eikonal: 0.1 136 | lambda_sparsity: 0.01 137 | lambda_distortion: 0. 138 | lambda_opaque: 0. 139 | sparsity_scale: 1. 140 | lambda_sdf_reg: 0 141 | 142 | optimizer: 143 | name: Adam 144 | args: 145 | lr: 0.01 146 | betas: [0.9, 0.99] 147 | eps: 1.e-15 148 | params: 149 | geometry: 150 | lr: 0.01 151 | texture: 152 | lr: 0.01 153 | variance: 154 | lr: 0.01 155 | 156 | warmup_steps: 0 157 | scheduler: 158 | name: SequentialLR 159 | interval: step 160 | milestones: 161 | - ${system.warmup_steps} 162 | schedulers: 163 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 164 | args: 165 | start_factor: 0.01 #0.0001 -> 0.1 166 | end_factor: 1.0 167 | total_iters: ${system.warmup_steps} 168 | - name: ExponentialLR 169 | args: 170 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 171 | 172 | 173 | checkpoint: 174 | save_top_k: -1 175 | every_n_train_steps: ${trainer.max_steps} 176 | 177 | 178 | export: 179 | save_mesh: True 180 | chunk_size: 2097152 181 | export_vertex_color: True 182 | 183 | trainer: 184 | max_steps: 3000 185 | log_every_n_steps: 10 186 | num_sanity_val_steps: 0 187 | val_check_interval: 3000 188 | limit_train_batches: 1.0 189 | limit_val_batches: 2 190 | enable_progress_bar: true 191 | precision: 16 192 | -------------------------------------------------------------------------------- /configs/s2/finetuning/neus-domedenseraw-ddc-s2-smooth2-itw-finetune2-new2-notmeta.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-ITW 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0002 11 | frame: -1 12 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/inTheWild 13 | scene: ${dataset.subject}-${dataset.frame} 14 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 15 | near_plane: 2.0 16 | far_plane: 6.0 17 | train_split: 'train' 18 | val_split: 'val' 19 | test_split: 'test' 20 | deformer: 'ddc' 21 | cano_motion: 'template' # 'world' 22 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 23 | config_path: ${root_dir}/datas/ddc_configs/s2_smooth_eg.yaml 24 | active_camera: [3, 4, 0, 2] 25 | active_camera_all: False 26 | active_camera_test: [1, 3, 4, 0, 2] 27 | smooth: True 28 | smoothDQ: False 29 | subdiv: 0 30 | loose: False 31 | rotate: False 32 | rotate_dir: /CT/HOIMOCAP2/nobackup/debug/deform_nsr/360 33 | rotate_template: False 34 | compute_occlusion: False 35 | test_interval: 1 36 | rotate_w: 540 37 | occlusion_template_dir: ${root_dir}/datas/color_proxy_s2 38 | threshold_smpl: 0.075 39 | threshold_ddc : 0.05 40 | erode_mask: False #True #False #True 41 | smpl_name: "smpl_params_smplx.npz" 42 | smpl_gender: 'neutral' 43 | rotate_ele: [0] 44 | rotate_step: 4 45 | rotate_scale: 1.0 46 | ddc_name: "ddc_all_smooth_less_new.npz" 47 | with_depth: False 48 | threshold_rigid: 0.05 49 | preload: True 50 | depth_shift: 0.0 51 | 52 | model: 53 | decay_step: 5000 54 | grid_resolution: 256 #64 #256 55 | name: neus 56 | radius: 1.25 57 | num_samples_per_ray: 1024 58 | train_num_rays: 256 59 | max_train_num_rays: 8192 60 | grid_prune: true 61 | grid_prune_occ_thre: 0.001 62 | dynamic_ray_sampling: true 63 | batch_image_sampling: true 64 | randomized: true 65 | ray_chunk: 4096 66 | cos_anneal_end: 20000 67 | learned_background: false 68 | background_color: random 69 | variance: 70 | init_val: 0.3 71 | modulate: false 72 | geometry: 73 | name: volume-sdf 74 | radius: ${model.radius} 75 | feature_dim: 13 76 | grad_type: analytic 77 | isosurface: 78 | method: mc 79 | resolution: [256,512,256] 80 | chunk: 2097152 81 | threshold: 0. 82 | xyz_encoding_config: 83 | otype: HashGrid 84 | n_levels: 12 #14 85 | n_features_per_level: 2 86 | log2_hashmap_size: 19 87 | base_resolution: 16 88 | per_level_scale: 1.447269237440378 89 | include_xyz: true 90 | include_feat: false 91 | mlp_network_config: 92 | otype: VanillaMLP 93 | activation: ReLU 94 | output_activation: none 95 | n_neurons: 64 96 | n_hidden_layers: 1 97 | sphere_init: true 98 | sphere_init_radius: 0.5 99 | weight_norm: false 100 | 101 | texture: 102 | name: volume-radiance 103 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 104 | dir_encoding_config: 105 | otype: Identity 106 | scale: 1.0 107 | offset: 0.0 108 | mlp_network_config: 109 | otype: FullyFusedMLP 110 | activation: ReLU 111 | output_activation: none 112 | n_neurons: 64 113 | n_hidden_layers: 2 114 | color_activation: sigmoid 115 | delta: 116 | name: delta-base 117 | radius: ${model.radius} 118 | xyz_encoding_config: 119 | otype: VanillaFrequency 120 | n_frequencies: 10 121 | mlp_network_config: 122 | otype: FullyFusedMLP 123 | activation: ReLU 124 | output_activation: none 125 | n_neurons: 64 126 | n_hidden_layers: 4 127 | 128 | system: 129 | name: neus-system 130 | loss: 131 | lambda_rgb_huber: 10.0 132 | lambda_rgb_mse: 0. 133 | lambda_rgb_l1: 0. 134 | lambda_mask: 0.1 135 | lambda_eikonal: 0.1 136 | lambda_sparsity: 0.01 137 | lambda_distortion: 0. 138 | lambda_opaque: 0. 139 | sparsity_scale: 1. 140 | lambda_sdf_reg: 0 141 | 142 | optimizer: 143 | name: Adam 144 | args: 145 | lr: 0.01 146 | betas: [0.9, 0.99] 147 | eps: 1.e-15 148 | params: 149 | geometry: 150 | lr: 0.01 151 | texture: 152 | lr: 0.01 153 | variance: 154 | lr: 0.01 155 | 156 | warmup_steps: 500 157 | scheduler: 158 | name: SequentialLR 159 | interval: step 160 | milestones: 161 | - ${system.warmup_steps} 162 | schedulers: 163 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 164 | args: 165 | start_factor: 0.01 #0.0001 -> 0.1 166 | end_factor: 1.0 167 | total_iters: ${system.warmup_steps} 168 | - name: ExponentialLR 169 | args: 170 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 171 | 172 | 173 | checkpoint: 174 | save_top_k: -1 175 | every_n_train_steps: ${trainer.max_steps} 176 | 177 | 178 | export: 179 | save_mesh: True 180 | chunk_size: 2097152 181 | export_vertex_color: True 182 | 183 | trainer: 184 | max_steps: 3000 185 | log_every_n_steps: 10 186 | num_sanity_val_steps: 0 187 | val_check_interval: 3000 188 | limit_train_batches: 1.0 189 | limit_val_batches: 2 190 | enable_progress_bar: true 191 | precision: 16 192 | -------------------------------------------------------------------------------- /configs/s2/finetuning/neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-meta-animation.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0002 11 | 12 | frame: -1 13 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/testing 14 | scene: ${dataset.subject}-${dataset.frame} 15 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 16 | camera_scale: 1000.0 17 | near_plane: 2.0 18 | far_plane: 6.0 19 | train_split: 'train' 20 | val_split: 'val' 21 | test_split: 'test' 22 | deformer: 'ddc' 23 | cano_motion: 'template' # 'world' 24 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 25 | config_path: ${root_dir}/datas/ddc_configs/s2_smooth_eg.yaml 26 | active_camera: [47, 66, 77, 89] 27 | active_camera_all: False 28 | active_camera_test: [1, 14, 25, 39, 111, 113] 29 | smooth: True 30 | smoothDQ: False 31 | subdiv: 0 32 | loose: False 33 | rotate: False 34 | rotate_dir: ${root_dir}/datas/rotate_dir 35 | rotate_template: False 36 | compute_occlusion: False 37 | test_interval: 1 38 | rotate_w: 540 39 | occlusion_template_dir: ${root_dir}/datas/color_proxy_s2 40 | threshold_smpl: 0.075 41 | threshold_ddc : 0.05 42 | threshold_outer : 0.05 43 | erode_mask: False #True #False #True 44 | smpl_name: "smpl_params_smplx.npz" 45 | smpl_gender: 'neutral' 46 | rotate_ele: [0] 47 | rotate_step: 4 48 | rotate_scale: 1.0 49 | ddc_name: "ddc_all_smooth_less_new.npz" 50 | with_depth: False 51 | threshold_rigid: 0.05 52 | preload: True 53 | depth_shift: 0.0 54 | model: 55 | decay_step: 5000 56 | grid_resolution: 256 57 | name: neus 58 | radius: 1.25 59 | num_samples_per_ray: 1024 60 | train_num_rays: 256 61 | max_train_num_rays: 8192 62 | grid_prune: true 63 | grid_prune_occ_thre: 0.001 64 | dynamic_ray_sampling: false 65 | batch_image_sampling: true 66 | randomized: true 67 | ray_chunk: 4096 68 | cos_anneal_end: 20000 69 | learned_background: false 70 | background_color: random 71 | variance: 72 | init_val: 0.3 73 | modulate: false 74 | geometry: 75 | name: volume-sdf 76 | radius: ${model.radius} 77 | feature_dim: 13 78 | grad_type: analytic 79 | isosurface: 80 | method: mc 81 | resolution: [256,512,256] 82 | chunk: 2097152 83 | threshold: 0. 84 | xyz_encoding_config: 85 | otype: HashGrid 86 | n_levels: 12 #14 87 | n_features_per_level: 2 88 | log2_hashmap_size: 19 89 | base_resolution: 16 90 | per_level_scale: 1.447269237440378 91 | include_xyz: true 92 | include_feat: false 93 | mlp_network_config: 94 | otype: VanillaMLP 95 | activation: ReLU 96 | output_activation: none 97 | n_neurons: 64 98 | n_hidden_layers: 1 99 | sphere_init: true 100 | sphere_init_radius: 0.5 101 | weight_norm: false 102 | texture: 103 | name: volume-radiance 104 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 105 | dir_encoding_config: 106 | otype: Identity 107 | scale: 1.0 108 | offset: 0.0 109 | mlp_network_config: 110 | otype: FullyFusedMLP 111 | activation: ReLU 112 | output_activation: none 113 | n_neurons: 64 114 | n_hidden_layers: 2 115 | color_activation: sigmoid 116 | 117 | system: 118 | name: neus-system 119 | loss: 120 | lambda_rgb_huber: 10.0 121 | lambda_rgb_mse: 0. 122 | lambda_rgb_l1: 0. 123 | lambda_mask: 0.1 124 | lambda_eikonal: 0.1 125 | lambda_sparsity: 0.01 126 | lambda_distortion: 0. 127 | lambda_opaque: 0. 128 | sparsity_scale: 1. 129 | lambda_sdf_reg: 0 130 | optimizer: 131 | name: Adam 132 | args: 133 | lr: 0.01 134 | betas: [0.9, 0.99] 135 | eps: 1.e-15 136 | # params: 137 | # geometry: 138 | # lr: 0.01 139 | # texture: 140 | # lr: 0.01 141 | ## lr: 0.001 142 | # variance: 143 | ## lr: 0.001 144 | # lr: 0.01 145 | 146 | warmup_steps: 0 147 | scheduler: 148 | name: SequentialLR 149 | interval: step 150 | milestones: 151 | - ${system.warmup_steps} 152 | schedulers: 153 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 154 | args: 155 | start_factor: 0.01 #0.0001 -> 0.1 156 | end_factor: 1.0 157 | total_iters: ${system.warmup_steps} 158 | - name: ExponentialLR 159 | args: 160 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 161 | 162 | checkpoint: 163 | save_top_k: -1 164 | every_n_train_steps: ${trainer.max_steps} 165 | 166 | export: 167 | save_mesh: True 168 | chunk_size: 2097152 169 | export_vertex_color: True 170 | 171 | trainer: 172 | max_steps: 3000 173 | log_every_n_steps: 10 174 | num_sanity_val_steps: 0 175 | val_check_interval: 3000 176 | limit_train_batches: 1.0 177 | limit_val_batches: 15 178 | enable_progress_bar: true 179 | precision: 16 -------------------------------------------------------------------------------- /configs/s2/finetuning/neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-meta-demo.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test-demo 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0002 11 | 12 | frame: -1 13 | data_dir: ${root_dir}/datas/demo/${dataset.subject}/tight/testing_demo 14 | scene: ${dataset.subject}-${dataset.frame} 15 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 16 | camera_scale: 1000.0 17 | near_plane: 2.0 18 | far_plane: 6.0 19 | train_split: 'train' 20 | val_split: 'val' 21 | test_split: 'test' 22 | deformer: 'ddc' 23 | cano_motion: 'template' # 'world' 24 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 25 | config_path: ${root_dir}/datas/ddc_configs/s2_smooth_eg.yaml 26 | active_camera: [47, 66, 77, 89] 27 | active_camera_all: False 28 | active_camera_test: [1, 14, 25, 39, 111, 113] 29 | smooth: True 30 | smoothDQ: False 31 | subdiv: 0 32 | loose: False 33 | rotate: False 34 | rotate_dir: ${root_dir}/datas/rotate_dir 35 | rotate_template: False 36 | compute_occlusion: False 37 | test_interval: 1 38 | rotate_w: 540 39 | occlusion_template_dir: ${root_dir}/datas/color_proxy_s2 40 | threshold_smpl: 0.075 41 | threshold_ddc : 0.05 42 | threshold_outer : 0.05 43 | erode_mask: False #True #False #True 44 | smpl_name: "smpl_params_smplx.npz" 45 | smpl_gender: 'neutral' 46 | rotate_ele: [0] 47 | rotate_step: 4 48 | rotate_scale: 1.0 49 | ddc_name: "ddc_all_smooth_less_new.npz" 50 | with_depth: False 51 | threshold_rigid: 0.05 52 | preload: True 53 | depth_shift: 0.0 54 | model: 55 | decay_step: 5000 56 | grid_resolution: 256 57 | name: neus 58 | radius: 1.25 59 | num_samples_per_ray: 1024 60 | train_num_rays: 256 61 | max_train_num_rays: 8192 62 | grid_prune: true 63 | grid_prune_occ_thre: 0.001 64 | dynamic_ray_sampling: false 65 | batch_image_sampling: true 66 | randomized: true 67 | ray_chunk: 4096 68 | cos_anneal_end: 20000 69 | learned_background: false 70 | background_color: random 71 | variance: 72 | init_val: 0.3 73 | modulate: false 74 | geometry: 75 | name: volume-sdf 76 | radius: ${model.radius} 77 | feature_dim: 13 78 | grad_type: analytic 79 | isosurface: 80 | method: mc 81 | resolution: [256,512,256] 82 | chunk: 2097152 83 | threshold: 0. 84 | xyz_encoding_config: 85 | otype: HashGrid 86 | n_levels: 12 #14 87 | n_features_per_level: 2 88 | log2_hashmap_size: 19 89 | base_resolution: 16 90 | per_level_scale: 1.447269237440378 91 | include_xyz: true 92 | include_feat: false 93 | mlp_network_config: 94 | otype: VanillaMLP 95 | activation: ReLU 96 | output_activation: none 97 | n_neurons: 64 98 | n_hidden_layers: 1 99 | sphere_init: true 100 | sphere_init_radius: 0.5 101 | weight_norm: false 102 | texture: 103 | name: volume-radiance 104 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 105 | dir_encoding_config: 106 | otype: Identity 107 | scale: 1.0 108 | offset: 0.0 109 | mlp_network_config: 110 | otype: FullyFusedMLP 111 | activation: ReLU 112 | output_activation: none 113 | n_neurons: 64 114 | n_hidden_layers: 2 115 | color_activation: sigmoid 116 | 117 | system: 118 | name: neus-system 119 | loss: 120 | lambda_rgb_huber: 10.0 121 | lambda_rgb_mse: 0. 122 | lambda_rgb_l1: 0. 123 | lambda_mask: 0.1 124 | lambda_eikonal: 0.1 125 | lambda_sparsity: 0.01 126 | lambda_distortion: 0. 127 | lambda_opaque: 0. 128 | sparsity_scale: 1. 129 | lambda_sdf_reg: 0 130 | optimizer: 131 | name: Adam 132 | args: 133 | lr: 0.01 134 | betas: [0.9, 0.99] 135 | eps: 1.e-15 136 | # params: 137 | # geometry: 138 | # lr: 0.01 139 | # texture: 140 | # lr: 0.01 141 | ## lr: 0.001 142 | # variance: 143 | ## lr: 0.001 144 | # lr: 0.01 145 | 146 | warmup_steps: 0 147 | scheduler: 148 | name: SequentialLR 149 | interval: step 150 | milestones: 151 | - ${system.warmup_steps} 152 | schedulers: 153 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 154 | args: 155 | start_factor: 0.01 #0.0001 -> 0.1 156 | end_factor: 1.0 157 | total_iters: ${system.warmup_steps} 158 | - name: ExponentialLR 159 | args: 160 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 161 | 162 | checkpoint: 163 | save_top_k: -1 164 | every_n_train_steps: ${trainer.max_steps} 165 | 166 | export: 167 | save_mesh: True 168 | chunk_size: 2097152 169 | export_vertex_color: True 170 | 171 | trainer: 172 | max_steps: 3000 173 | log_every_n_steps: 10 174 | num_sanity_val_steps: 0 175 | val_check_interval: 3000 176 | limit_train_batches: 1.0 177 | limit_val_batches: 15 178 | enable_progress_bar: true 179 | precision: 16 -------------------------------------------------------------------------------- /configs/s2/finetuning/neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-meta-eight.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0002 11 | 12 | frame: -1 13 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/testing 14 | scene: ${dataset.subject}-${dataset.frame} 15 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 16 | camera_scale: 1000.0 17 | near_plane: 2.0 18 | far_plane: 6.0 19 | train_split: 'train' 20 | val_split: 'val' 21 | test_split: 'test' 22 | deformer: 'ddc' 23 | cano_motion: 'template' # 'world' 24 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 25 | config_path: ${root_dir}/datas/ddc_configs/s2_smooth_eg.yaml 26 | active_camera: [47, 60, 66, 71, 77, 82, 89, 97] 27 | active_camera_all: False 28 | active_camera_test: [1, 14, 25, 39, 111, 113] 29 | smooth: True 30 | smoothDQ: False 31 | subdiv: 0 32 | loose: False 33 | rotate: False 34 | rotate_dir: ${root_dir}/datas/rotate_dir 35 | rotate_template: False 36 | compute_occlusion: False 37 | test_interval: 1 38 | rotate_w: 540 39 | occlusion_template_dir: ${root_dir}/datas/color_proxy_s2 40 | threshold_smpl: 0.075 41 | threshold_ddc : 0.05 42 | threshold_outer : 0.05 43 | erode_mask: False #True #False #True 44 | smpl_name: "smpl_params_smplx.npz" 45 | smpl_gender: 'neutral' 46 | rotate_ele: [0] 47 | rotate_step: 4 48 | rotate_scale: 1.0 49 | ddc_name: "ddc_all_smooth_less_new.npz" 50 | with_depth: False 51 | threshold_rigid: 0.05 52 | preload: True 53 | depth_shift: 0.0 54 | model: 55 | decay_step: 5000 56 | grid_resolution: 256 57 | name: neus 58 | radius: 1.25 59 | num_samples_per_ray: 1024 60 | train_num_rays: 256 61 | max_train_num_rays: 8192 62 | grid_prune: true 63 | grid_prune_occ_thre: 0.001 64 | dynamic_ray_sampling: false 65 | batch_image_sampling: true 66 | randomized: true 67 | ray_chunk: 4096 68 | cos_anneal_end: 20000 69 | learned_background: false 70 | background_color: random 71 | variance: 72 | init_val: 0.3 73 | modulate: false 74 | geometry: 75 | name: volume-sdf 76 | radius: ${model.radius} 77 | feature_dim: 13 78 | grad_type: analytic 79 | isosurface: 80 | method: mc 81 | resolution: [256,512,256] 82 | chunk: 2097152 83 | threshold: 0. 84 | xyz_encoding_config: 85 | otype: HashGrid 86 | n_levels: 12 #14 87 | n_features_per_level: 2 88 | log2_hashmap_size: 19 89 | base_resolution: 16 90 | per_level_scale: 1.447269237440378 91 | include_xyz: true 92 | include_feat: false 93 | mlp_network_config: 94 | otype: VanillaMLP 95 | activation: ReLU 96 | output_activation: none 97 | n_neurons: 64 98 | n_hidden_layers: 1 99 | sphere_init: true 100 | sphere_init_radius: 0.5 101 | weight_norm: false 102 | texture: 103 | name: volume-radiance 104 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 105 | dir_encoding_config: 106 | otype: Identity 107 | scale: 1.0 108 | offset: 0.0 109 | mlp_network_config: 110 | otype: FullyFusedMLP 111 | activation: ReLU 112 | output_activation: none 113 | n_neurons: 64 114 | n_hidden_layers: 2 115 | color_activation: sigmoid 116 | 117 | system: 118 | name: neus-system 119 | loss: 120 | lambda_rgb_huber: 10.0 121 | lambda_rgb_mse: 0. 122 | lambda_rgb_l1: 0. 123 | lambda_mask: 0.1 124 | lambda_eikonal: 0.1 125 | lambda_sparsity: 0.01 126 | lambda_distortion: 0. 127 | lambda_opaque: 0. 128 | sparsity_scale: 1. 129 | lambda_sdf_reg: 0 130 | optimizer: 131 | name: Adam 132 | args: 133 | lr: 0.01 134 | betas: [0.9, 0.99] 135 | eps: 1.e-15 136 | # params: 137 | # geometry: 138 | # lr: 0.01 139 | # texture: 140 | # lr: 0.01 141 | ## lr: 0.001 142 | # variance: 143 | ## lr: 0.001 144 | # lr: 0.01 145 | 146 | warmup_steps: 0 147 | scheduler: 148 | name: SequentialLR 149 | interval: step 150 | milestones: 151 | - ${system.warmup_steps} 152 | schedulers: 153 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 154 | args: 155 | start_factor: 0.01 #0.0001 -> 0.1 156 | end_factor: 1.0 157 | total_iters: ${system.warmup_steps} 158 | - name: ExponentialLR 159 | args: 160 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 161 | 162 | checkpoint: 163 | save_top_k: -1 164 | every_n_train_steps: ${trainer.max_steps} 165 | 166 | export: 167 | save_mesh: True 168 | chunk_size: 2097152 169 | export_vertex_color: True 170 | 171 | trainer: 172 | max_steps: 3000 173 | log_every_n_steps: 10 174 | num_sanity_val_steps: 0 175 | val_check_interval: 3000 176 | limit_train_batches: 1.0 177 | limit_val_batches: 15 178 | enable_progress_bar: true 179 | precision: 16 -------------------------------------------------------------------------------- /configs/s2/finetuning/neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-meta-one-oh.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0002 11 | frame: -1 12 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/testing 13 | scene: ${dataset.subject}-${dataset.frame} 14 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 15 | near_plane: 2.0 16 | far_plane: 6.0 17 | train_split: 'train' 18 | val_split: 'val' 19 | test_split: 'test' 20 | deformer: 'ddc' 21 | cano_motion: 'template' # 'world' 22 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 23 | config_path: ${root_dir}/datas/ddc_configs/s2_smooth_eg.yaml 24 | active_camera: [ 46 ] 25 | active_camera_all: False 26 | active_camera_test: [1, 14, 25, 39, 111, 113] 27 | smooth: True 28 | smoothDQ: False 29 | subdiv: 0 30 | loose: False 31 | rotate: False 32 | rotate_dir: ${root_dir}/datas/rotate_dir 33 | rotate_template: False 34 | compute_occlusion: True 35 | occlusion_template_dir: ${root_dir}/datas/color_proxy_s2 36 | test_interval: 1 37 | rotate_w: 540 38 | threshold_smpl: 0.075 39 | threshold_ddc : 0.05 40 | erode_mask: False #True #False #True 41 | smpl_name: "smpl_params_smplx.npz" 42 | smpl_gender: 'neutral' 43 | rotate_ele: [0] 44 | rotate_step: 4 45 | rotate_scale: 1.0 46 | ddc_name: "ddc_all_smooth_less_new.npz" 47 | with_depth: False 48 | threshold_rigid: 0.05 49 | preload: True 50 | depth_shift: 0.0 51 | threshold_outer: 0.05 52 | model: 53 | decay_step: 5000 54 | grid_resolution: 256 55 | name: neus 56 | radius: 1.25 57 | num_samples_per_ray: 1024 58 | train_num_rays: 256 59 | max_train_num_rays: 4096 60 | grid_prune: true 61 | grid_prune_occ_thre: 0.001 62 | dynamic_ray_sampling: true 63 | batch_image_sampling: true 64 | randomized: true 65 | ray_chunk: 4096 66 | cos_anneal_end: 20000 67 | learned_background: false 68 | background_color: random 69 | variance: 70 | init_val: 0.3 71 | modulate: false 72 | geometry: 73 | name: volume-sdf 74 | radius: ${model.radius} 75 | feature_dim: 13 76 | grad_type: analytic 77 | isosurface: 78 | method: mc 79 | resolution: [256,512,256] 80 | chunk: 2097152 81 | threshold: 0. 82 | xyz_encoding_config: 83 | otype: HashGrid 84 | n_levels: 12 #14 85 | n_features_per_level: 2 86 | log2_hashmap_size: 19 87 | base_resolution: 16 88 | per_level_scale: 1.447269237440378 89 | include_xyz: true 90 | include_feat: false 91 | mlp_network_config: 92 | otype: VanillaMLP 93 | activation: ReLU 94 | output_activation: none 95 | n_neurons: 64 96 | n_hidden_layers: 1 97 | sphere_init: true 98 | sphere_init_radius: 0.5 99 | weight_norm: false 100 | texture: 101 | name: volume-radiance 102 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 103 | dir_encoding_config: 104 | otype: Identity 105 | scale: 1.0 106 | offset: 0.0 107 | mlp_network_config: 108 | otype: FullyFusedMLP 109 | activation: ReLU 110 | output_activation: none 111 | n_neurons: 64 112 | n_hidden_layers: 2 113 | color_activation: sigmoid 114 | 115 | system: 116 | name: neus-system 117 | loss: 118 | lambda_rgb_huber: 10.0 119 | lambda_rgb_mse: 0. 120 | lambda_rgb_l1: 0. 121 | lambda_mask: 0.1 122 | lambda_eikonal: 0.1 123 | lambda_sparsity: 0.01 124 | lambda_distortion: 0. 125 | lambda_opaque: 0. 126 | sparsity_scale: 1. 127 | lambda_sdf_reg: 0 128 | optimizer: 129 | name: Adam 130 | args: 131 | lr: 0.01 132 | betas: [0.9, 0.99] 133 | eps: 1.e-15 134 | # params: 135 | # geometry: 136 | # lr: 0.01 137 | # texture: 138 | # lr: 0.01 139 | # variance: 140 | ## lr: 0.001 141 | # lr: 0.01 142 | 143 | warmup_steps: 0 144 | scheduler: 145 | name: SequentialLR 146 | interval: step 147 | milestones: 148 | - ${system.warmup_steps} 149 | schedulers: 150 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 151 | args: 152 | start_factor: 0.01 #0.0001 -> 0.1 153 | end_factor: 1.0 154 | total_iters: ${system.warmup_steps} 155 | - name: ExponentialLR 156 | args: 157 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}}} 158 | 159 | checkpoint: 160 | save_top_k: -1 161 | every_n_train_steps: ${trainer.max_steps} 162 | 163 | export: 164 | save_mesh: True 165 | chunk_size: 2097152 166 | export_vertex_color: True 167 | 168 | trainer: 169 | max_steps: 3000 170 | log_every_n_steps: 10 171 | num_sanity_val_steps: 0 172 | val_check_interval: 3000 173 | limit_train_batches: 1.0 174 | limit_val_batches: 2 175 | enable_progress_bar: true 176 | precision: 16 177 | -------------------------------------------------------------------------------- /configs/s2/finetuning/neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-meta-two.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0002 11 | 12 | frame: -1 13 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/testing 14 | scene: ${dataset.subject}-${dataset.frame} 15 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 16 | camera_scale: 1000.0 17 | near_plane: 2.0 18 | far_plane: 6.0 19 | train_split: 'train' 20 | val_split: 'val' 21 | test_split: 'test' 22 | deformer: 'ddc' 23 | cano_motion: 'template' # 'world' 24 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 25 | config_path: ${root_dir}/datas/ddc_configs/s2_smooth_eg.yaml 26 | active_camera: [47, 77] 27 | active_camera_all: False 28 | active_camera_test: [1, 14, 25, 39, 111, 113] 29 | smooth: True 30 | smoothDQ: False 31 | subdiv: 0 32 | loose: False 33 | rotate: False 34 | rotate_dir: ${root_dir}/datas/rotate_dir 35 | rotate_template: False 36 | compute_occlusion: False 37 | test_interval: 1 38 | rotate_w: 540 39 | occlusion_template_dir: ${root_dir}/datas/color_proxy_s2 40 | threshold_smpl: 0.075 41 | threshold_ddc : 0.05 42 | threshold_outer : 0.05 43 | erode_mask: False #True #False #True 44 | smpl_name: "smpl_params_smplx.npz" 45 | smpl_gender: 'neutral' 46 | rotate_ele: [0] 47 | rotate_step: 4 48 | rotate_scale: 1.0 49 | ddc_name: "ddc_all_smooth_less_new.npz" 50 | with_depth: False 51 | threshold_rigid: 0.05 52 | preload: True 53 | depth_shift: 0.0 54 | model: 55 | decay_step: 5000 56 | grid_resolution: 256 57 | name: neus 58 | radius: 1.25 59 | num_samples_per_ray: 1024 60 | train_num_rays: 256 61 | max_train_num_rays: 8192 62 | grid_prune: true 63 | grid_prune_occ_thre: 0.001 64 | dynamic_ray_sampling: false 65 | batch_image_sampling: true 66 | randomized: true 67 | ray_chunk: 4096 68 | cos_anneal_end: 20000 69 | learned_background: false 70 | background_color: random 71 | variance: 72 | init_val: 0.3 73 | modulate: false 74 | geometry: 75 | name: volume-sdf 76 | radius: ${model.radius} 77 | feature_dim: 13 78 | grad_type: analytic 79 | isosurface: 80 | method: mc 81 | resolution: [256,512,256] 82 | chunk: 2097152 83 | threshold: 0. 84 | xyz_encoding_config: 85 | otype: HashGrid 86 | n_levels: 12 #14 87 | n_features_per_level: 2 88 | log2_hashmap_size: 19 89 | base_resolution: 16 90 | per_level_scale: 1.447269237440378 91 | include_xyz: true 92 | include_feat: false 93 | mlp_network_config: 94 | otype: VanillaMLP 95 | activation: ReLU 96 | output_activation: none 97 | n_neurons: 64 98 | n_hidden_layers: 1 99 | sphere_init: true 100 | sphere_init_radius: 0.5 101 | weight_norm: false 102 | texture: 103 | name: volume-radiance 104 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 105 | dir_encoding_config: 106 | otype: Identity 107 | scale: 1.0 108 | offset: 0.0 109 | mlp_network_config: 110 | otype: FullyFusedMLP 111 | activation: ReLU 112 | output_activation: none 113 | n_neurons: 64 114 | n_hidden_layers: 2 115 | color_activation: sigmoid 116 | 117 | system: 118 | name: neus-system 119 | loss: 120 | lambda_rgb_huber: 10.0 121 | lambda_rgb_mse: 0. 122 | lambda_rgb_l1: 0. 123 | lambda_mask: 0.1 124 | lambda_eikonal: 0.1 125 | lambda_sparsity: 0.01 126 | lambda_distortion: 0. 127 | lambda_opaque: 0. 128 | sparsity_scale: 1. 129 | lambda_sdf_reg: 0 130 | optimizer: 131 | name: Adam 132 | args: 133 | lr: 0.01 134 | betas: [0.9, 0.99] 135 | eps: 1.e-15 136 | # params: 137 | # geometry: 138 | # lr: 0.01 139 | # texture: 140 | # lr: 0.01 141 | ## lr: 0.001 142 | # variance: 143 | ## lr: 0.001 144 | # lr: 0.01 145 | 146 | warmup_steps: 0 147 | scheduler: 148 | name: SequentialLR 149 | interval: step 150 | milestones: 151 | - ${system.warmup_steps} 152 | schedulers: 153 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 154 | args: 155 | start_factor: 0.01 #0.0001 -> 0.1 156 | end_factor: 1.0 157 | total_iters: ${system.warmup_steps} 158 | - name: ExponentialLR 159 | args: 160 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 161 | 162 | checkpoint: 163 | save_top_k: -1 164 | every_n_train_steps: ${trainer.max_steps} 165 | 166 | export: 167 | save_mesh: True 168 | chunk_size: 2097152 169 | export_vertex_color: True 170 | 171 | trainer: 172 | max_steps: 3000 173 | log_every_n_steps: 10 174 | num_sanity_val_steps: 0 175 | val_check_interval: 3000 176 | limit_train_batches: 1.0 177 | limit_val_batches: 15 178 | enable_progress_bar: true 179 | precision: 16 -------------------------------------------------------------------------------- /configs/s2/finetuning/neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-meta.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0002 11 | 12 | frame: -1 13 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/testing 14 | scene: ${dataset.subject}-${dataset.frame} 15 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 16 | camera_scale: 1000.0 17 | near_plane: 2.0 18 | far_plane: 6.0 19 | train_split: 'train' 20 | val_split: 'val' 21 | test_split: 'test' 22 | deformer: 'ddc' 23 | cano_motion: 'template' # 'world' 24 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 25 | config_path: ${root_dir}/datas/ddc_configs/s2_smooth_eg.yaml 26 | active_camera: [47, 66, 77, 89] 27 | active_camera_all: False 28 | active_camera_test: [1, 14, 25, 39, 111, 113] 29 | smooth: True 30 | smoothDQ: False 31 | subdiv: 0 32 | loose: False 33 | rotate: False 34 | rotate_dir: ${root_dir}/datas/rotate_dir 35 | rotate_template: False 36 | compute_occlusion: False 37 | test_interval: 1 38 | rotate_w: 540 39 | occlusion_template_dir: ${root_dir}/datas/color_proxy_s2 40 | threshold_smpl: 0.075 41 | threshold_ddc : 0.05 42 | threshold_outer : 0.05 43 | erode_mask: False #True #False #True 44 | smpl_name: "smpl_params_smplx.npz" 45 | smpl_gender: 'neutral' 46 | rotate_ele: [0] 47 | rotate_step: 4 48 | rotate_scale: 1.0 49 | ddc_name: "ddc_all_smooth_less_new.npz" 50 | with_depth: False 51 | threshold_rigid: 0.05 52 | preload: True 53 | depth_shift: 0.0 54 | model: 55 | decay_step: 5000 56 | grid_resolution: 256 57 | name: neus 58 | radius: 1.25 59 | num_samples_per_ray: 1024 60 | train_num_rays: 256 61 | max_train_num_rays: 8192 62 | grid_prune: true 63 | grid_prune_occ_thre: 0.001 64 | dynamic_ray_sampling: false 65 | batch_image_sampling: true 66 | randomized: true 67 | ray_chunk: 4096 68 | cos_anneal_end: 20000 69 | learned_background: false 70 | background_color: random 71 | variance: 72 | init_val: 0.3 73 | modulate: false 74 | geometry: 75 | name: volume-sdf 76 | radius: ${model.radius} 77 | feature_dim: 13 78 | grad_type: analytic 79 | isosurface: 80 | method: mc 81 | resolution: [256,512,256] 82 | chunk: 2097152 83 | threshold: 0. 84 | xyz_encoding_config: 85 | otype: HashGrid 86 | n_levels: 12 #14 87 | n_features_per_level: 2 88 | log2_hashmap_size: 19 89 | base_resolution: 16 90 | per_level_scale: 1.447269237440378 91 | include_xyz: true 92 | include_feat: false 93 | mlp_network_config: 94 | otype: VanillaMLP 95 | activation: ReLU 96 | output_activation: none 97 | n_neurons: 64 98 | n_hidden_layers: 1 99 | sphere_init: true 100 | sphere_init_radius: 0.5 101 | weight_norm: false 102 | texture: 103 | name: volume-radiance 104 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 105 | dir_encoding_config: 106 | otype: Identity 107 | scale: 1.0 108 | offset: 0.0 109 | mlp_network_config: 110 | otype: FullyFusedMLP 111 | activation: ReLU 112 | output_activation: none 113 | n_neurons: 64 114 | n_hidden_layers: 2 115 | color_activation: sigmoid 116 | 117 | system: 118 | name: neus-system 119 | loss: 120 | lambda_rgb_huber: 10.0 121 | lambda_rgb_mse: 0. 122 | lambda_rgb_l1: 0. 123 | lambda_mask: 0.1 124 | lambda_eikonal: 0.1 125 | lambda_sparsity: 0.01 126 | lambda_distortion: 0. 127 | lambda_opaque: 0. 128 | sparsity_scale: 1. 129 | lambda_sdf_reg: 0 130 | optimizer: 131 | name: Adam 132 | args: 133 | lr: 0.01 134 | betas: [0.9, 0.99] 135 | eps: 1.e-15 136 | params: 137 | geometry: 138 | lr: 0.01 139 | texture: 140 | lr: 0.01 141 | # lr: 0.001 142 | variance: 143 | # lr: 0.001 144 | lr: 0.01 145 | 146 | warmup_steps: 0 147 | scheduler: 148 | name: SequentialLR 149 | interval: step 150 | milestones: 151 | - ${system.warmup_steps} 152 | schedulers: 153 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 154 | args: 155 | start_factor: 0.01 #0.0001 -> 0.1 156 | end_factor: 1.0 157 | total_iters: ${system.warmup_steps} 158 | - name: ExponentialLR 159 | args: 160 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 161 | 162 | checkpoint: 163 | save_top_k: -1 164 | every_n_train_steps: ${trainer.max_steps} 165 | 166 | export: 167 | save_mesh: True 168 | chunk_size: 2097152 169 | export_vertex_color: True 170 | 171 | trainer: 172 | max_steps: 3000 173 | log_every_n_steps: 10 174 | num_sanity_val_steps: 0 175 | val_check_interval: 3000 176 | limit_train_batches: 1.0 177 | limit_val_batches: 15 178 | enable_progress_bar: true 179 | precision: 16 -------------------------------------------------------------------------------- /configs/s2/finetuning/neus-domedenseraw-ddc-s2-smooth2-test-finetune2-new2-notmeta.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0002 11 | 12 | frame: -1 13 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/testing 14 | scene: ${dataset.subject}-${dataset.frame} 15 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 16 | camera_scale: 1000.0 17 | near_plane: 2.0 18 | far_plane: 6.0 19 | train_split: 'train' 20 | val_split: 'val' 21 | test_split: 'test' 22 | deformer: 'ddc' 23 | cano_motion: 'template' # 'world' 24 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 25 | config_path: ${root_dir}/datas/ddc_configs/s2_smooth_eg.yaml 26 | active_camera: [47, 66, 77, 89] 27 | active_camera_all: False 28 | active_camera_test: [1, 14, 25, 39, 111, 113, 47, 66, 77, 89] 29 | smooth: True 30 | smoothDQ: False 31 | subdiv: 0 32 | loose: False 33 | rotate: False 34 | rotate_dir: ${root_dir}/datas/rotate_dir 35 | rotate_template: False 36 | compute_occlusion: False 37 | test_interval: 1 38 | rotate_w: 540 39 | occlusion_template_dir: ${root_dir}/datas/color_proxy_s2 40 | threshold_smpl: 0.075 41 | threshold_ddc : 0.05 42 | threshold_outer : 0.05 43 | erode_mask: False #True #False #True 44 | smpl_name: "smpl_params_smplx.npz" 45 | smpl_gender: 'neutral' 46 | rotate_ele: [0] 47 | rotate_step: 4 48 | rotate_scale: 1.0 49 | ddc_name: "ddc_all_smooth_less_new.npz" 50 | with_depth: False 51 | threshold_rigid: 0.05 52 | preload: True 53 | depth_shift: 0.0 54 | model: 55 | decay_step: 5000 56 | grid_resolution: 256 57 | name: neus 58 | radius: 1.25 59 | num_samples_per_ray: 1024 60 | train_num_rays: 256 61 | max_train_num_rays: 8192 62 | grid_prune: true 63 | grid_prune_occ_thre: 0.001 64 | dynamic_ray_sampling: false 65 | batch_image_sampling: true 66 | randomized: true 67 | ray_chunk: 4096 68 | cos_anneal_end: 20000 69 | learned_background: false 70 | background_color: random 71 | variance: 72 | init_val: 0.3 73 | modulate: false 74 | geometry: 75 | name: volume-sdf 76 | radius: ${model.radius} 77 | feature_dim: 13 78 | grad_type: analytic 79 | isosurface: 80 | method: mc 81 | resolution: [256,512,256] 82 | chunk: 2097152 83 | threshold: 0. 84 | xyz_encoding_config: 85 | otype: HashGrid 86 | n_levels: 12 #14 87 | n_features_per_level: 2 88 | log2_hashmap_size: 19 89 | base_resolution: 16 90 | per_level_scale: 1.447269237440378 91 | include_xyz: true 92 | include_feat: false 93 | mlp_network_config: 94 | otype: VanillaMLP 95 | activation: ReLU 96 | output_activation: none 97 | n_neurons: 64 98 | n_hidden_layers: 1 99 | sphere_init: true 100 | sphere_init_radius: 0.5 101 | weight_norm: false 102 | texture: 103 | name: volume-radiance 104 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 105 | dir_encoding_config: 106 | otype: Identity 107 | scale: 1.0 108 | offset: 0.0 109 | mlp_network_config: 110 | otype: FullyFusedMLP 111 | activation: ReLU 112 | output_activation: none 113 | n_neurons: 64 114 | n_hidden_layers: 2 115 | color_activation: sigmoid 116 | 117 | system: 118 | name: neus-system 119 | loss: 120 | lambda_rgb_huber: 10.0 121 | lambda_rgb_mse: 0. 122 | lambda_rgb_l1: 0. 123 | lambda_mask: 0.1 124 | lambda_eikonal: 0.1 125 | lambda_sparsity: 0.01 126 | lambda_distortion: 0. 127 | lambda_opaque: 0. 128 | sparsity_scale: 1. 129 | lambda_sdf_reg: 0 130 | optimizer: 131 | name: Adam 132 | args: 133 | lr: 0.01 134 | betas: [0.9, 0.99] 135 | eps: 1.e-15 136 | params: 137 | geometry: 138 | lr: 0.01 139 | texture: 140 | lr: 0.01 141 | # lr: 0.001 142 | variance: 143 | # lr: 0.001 144 | lr: 0.01 145 | 146 | warmup_steps: 500 147 | scheduler: 148 | name: SequentialLR 149 | interval: step 150 | milestones: 151 | - ${system.warmup_steps} 152 | schedulers: 153 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 154 | args: 155 | start_factor: 0.01 #0.0001 -> 0.1 156 | end_factor: 1.0 157 | total_iters: ${system.warmup_steps} 158 | - name: ExponentialLR 159 | args: 160 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 161 | 162 | checkpoint: 163 | save_top_k: -1 164 | every_n_train_steps: ${trainer.max_steps} 165 | 166 | export: 167 | save_mesh: True 168 | chunk_size: 2097152 169 | export_vertex_color: True 170 | 171 | trainer: 172 | max_steps: 3000 173 | log_every_n_steps: 10 174 | num_sanity_val_steps: 0 175 | val_check_interval: 3000 176 | limit_train_batches: 1.0 177 | limit_val_batches: 15 178 | enable_progress_bar: true 179 | precision: 16 -------------------------------------------------------------------------------- /configs/s2/groundtruth/neus-domedenseraw-ddc-s2-smooth2-test-gt.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0002 11 | frame: -1 12 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/testing 13 | scene: ${dataset.subject}-${dataset.frame} 14 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 15 | camera_scale: 1000.0 16 | near_plane: 2.0 17 | far_plane: 6.0 18 | train_split: 'train' 19 | val_split: 'val' 20 | test_split: 'test' 21 | deformer: 'ddc' 22 | cano_motion: 'template' # 'world' 23 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 24 | config_path: ${root_dir}/datas/ddc_configs/s2_smooth_eg.yaml 25 | active_camera : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 23, 24, 25, 26, 27, 28, 29, 30, 31, 26 | 32, 33, 34, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 48, 49, 51, 52, 53, 54, 55, 56, 57, 58, 59, 27 | 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 28 | 90, 91, 92, 93, 94, 95, 97, 98, 99, 100, 102, 103, 107, 108, 109, 110, 111, 112, 113, 114, 115] 29 | active_camera_all: False 30 | active_camera_test: [ 1, 14, 25, 39, 111, 113, 47, 66, 77, 89 ] 31 | smooth: True 32 | smoothDQ: False 33 | subdiv: 0 34 | loose: False 35 | rotate: False 36 | rotate_dir: ${root_dir}/datas/rotate_dir 37 | rotate_template: False 38 | compute_occlusion: False 39 | test_interval: 1 40 | rotate_w: 540 41 | occlusion_template_dir: ${root_dir}/datas/color_proxy_s2 42 | threshold_smpl: 0.075 43 | threshold_ddc : 0.05 44 | erode_mask: False #True #False #True 45 | smpl_name: "smpl_params_smplx.npz" 46 | smpl_gender: 'neutral' 47 | rotate_ele: [0] 48 | rotate_step: 4 49 | rotate_scale: 1.0 50 | ddc_name: "ddc_all_smooth_less_new.npz" 51 | with_depth: False 52 | threshold_rigid: 0.05 53 | preload: True 54 | depth_shift: 0.0 55 | 56 | model: 57 | decay_step: 5000 58 | grid_resolution: 256 59 | name: neus 60 | radius: 1.25 61 | num_samples_per_ray: 1024 62 | train_num_rays: 256 63 | max_train_num_rays: 8192 64 | grid_prune: true 65 | grid_prune_occ_thre: 0.001 66 | dynamic_ray_sampling: true 67 | batch_image_sampling: true 68 | randomized: true 69 | ray_chunk: 4096 70 | cos_anneal_end: 20000 71 | learned_background: false 72 | background_color: random 73 | variance: 74 | init_val: 0.3 75 | modulate: false 76 | geometry: 77 | name: volume-sdf 78 | radius: ${model.radius} 79 | feature_dim: 13 80 | grad_type: analytic 81 | isosurface: 82 | method: mc 83 | resolution: [256,512,256] 84 | chunk: 2097152 85 | threshold: 0. 86 | xyz_encoding_config: 87 | otype: HashGrid 88 | n_levels: 12 #14 89 | n_features_per_level: 2 90 | log2_hashmap_size: 19 91 | base_resolution: 16 92 | per_level_scale: 1.447269237440378 93 | include_xyz: true 94 | include_feat: false 95 | mlp_network_config: 96 | otype: VanillaMLP 97 | activation: ReLU 98 | output_activation: none 99 | n_neurons: 64 100 | n_hidden_layers: 1 101 | sphere_init: true 102 | sphere_init_radius: 0.5 103 | weight_norm: false 104 | texture: 105 | name: volume-radiance 106 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 107 | dir_encoding_config: 108 | otype: Identity 109 | scale: 1.0 110 | offset: 0.0 111 | mlp_network_config: 112 | otype: FullyFusedMLP 113 | activation: ReLU 114 | output_activation: none 115 | n_neurons: 64 116 | n_hidden_layers: 2 117 | color_activation: sigmoid 118 | system: 119 | name: neus-system 120 | loss: 121 | lambda_rgb_huber: 10.0 122 | lambda_rgb_mse: 0. 123 | lambda_rgb_l1: 0. 124 | lambda_mask: 0.1 125 | lambda_eikonal: 0.1 126 | lambda_sparsity: 0.01 127 | lambda_distortion: 0. 128 | lambda_opaque: 0. 129 | sparsity_scale: 1. 130 | lambda_sdf_reg: 0 131 | optimizer: 132 | name: Adam 133 | args: 134 | lr: 0.01 135 | betas: [0.9, 0.99] 136 | eps: 1.e-15 137 | # params: 138 | # geometry: 139 | # lr: 0.01 140 | # texture: 141 | # lr: 0.01 142 | ## lr: 0.001 143 | # variance: 144 | ## lr: 0.001 145 | # lr: 0.01 146 | 147 | warmup_steps: 500 148 | scheduler: 149 | name: SequentialLR 150 | interval: step 151 | milestones: 152 | - ${system.warmup_steps} 153 | schedulers: 154 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 155 | args: 156 | start_factor: 0.01 #0.0001 -> 0.1 157 | end_factor: 1.0 158 | total_iters: ${system.warmup_steps} 159 | - name: ExponentialLR 160 | args: 161 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 162 | 163 | checkpoint: 164 | save_top_k: -1 165 | every_n_train_steps: ${trainer.max_steps} 166 | 167 | export: 168 | save_mesh: True 169 | chunk_size: 2097152 170 | export_vertex_color: True 171 | 172 | trainer: 173 | max_steps: 3000 174 | log_every_n_steps: 10 175 | num_sanity_val_steps: 0 176 | val_check_interval: 3000 177 | limit_train_batches: 1.0 178 | limit_val_batches: 2 179 | enable_progress_bar: true 180 | precision: 16 181 | -------------------------------------------------------------------------------- /configs/s2/interpolation/neusinterpolation-domedenseraw-ddc-s2-smooth2-test.yaml: -------------------------------------------------------------------------------- 1 | name: neusinterpolation-domedenseraw-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0002 11 | 12 | frame: -1 13 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/testing 14 | scene: ${dataset.subject}-${dataset.frame} 15 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 16 | camera_scale: 1000.0 17 | near_plane: 2.0 18 | far_plane: 6.0 19 | train_split: 'train' 20 | val_split: 'val' 21 | test_split: 'test' 22 | deformer: 'ddc' 23 | cano_motion: 'template' # 'world' 24 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 25 | config_path: ${root_dir}/datas/ddc_configs/s2_smooth_eg.yaml 26 | active_camera: [ 47, 66, 77, 89 ] 27 | active_camera_all: False 28 | active_camera_test: [ 1, 14, 25, 39, 111, 113, 47, 66, 77, 89 ] 29 | smooth: True 30 | smoothDQ: False 31 | subdiv: 0 32 | loose: False 33 | rotate: False 34 | rotate_dir: ${root_dir}/datas/rotate_dir 35 | rotate_template: False 36 | compute_occlusion: False 37 | test_interval: 1 38 | rotate_w: 540 39 | occlusion_template_dir: ${root_dir}/datas/color_proxy_s2 40 | rotate_step: 2 41 | rotate_ele: [0] 42 | rotate_scale: 1.0 43 | threshold_smpl: 0.075 44 | threshold_ddc: 0.05 45 | threshold_outer: 0.05 46 | erode_mask: False #True #False #True 47 | smpl_name: "smpl_params_smplx.npz" 48 | smpl_gender: 'neutral' 49 | ddc_name: "ddc_all_smooth_less_new.npz" 50 | with_depth: False 51 | threshold_rigid: 0.05 52 | preload: True 53 | depth_shift: 0.0 54 | 55 | model: 56 | decay_step: 5000 57 | grid_resolution: 256 58 | name: neus 59 | radius: 1.25 60 | num_samples_per_ray: 1024 61 | train_num_rays: 256 62 | max_train_num_rays: 8192 63 | grid_prune: true 64 | grid_prune_occ_thre: 0.001 65 | dynamic_ray_sampling: true 66 | batch_image_sampling: true 67 | randomized: true 68 | ray_chunk: 4096 69 | cos_anneal_end: 20000 70 | learned_background: false 71 | background_color: random 72 | variance: 73 | init_val: 0.3 74 | modulate: false 75 | geometry: 76 | name: volume-sdf 77 | radius: ${model.radius} 78 | feature_dim: 13 79 | grad_type: analytic 80 | isosurface: 81 | method: mc 82 | resolution: [256,512,256] 83 | chunk: 2097152 84 | threshold: 0. 85 | xyz_encoding_config: 86 | otype: HashGrid 87 | n_levels: 12 #14 88 | n_features_per_level: 2 89 | log2_hashmap_size: 19 90 | base_resolution: 16 91 | per_level_scale: 1.447269237440378 92 | include_xyz: true 93 | include_feat: false 94 | mlp_network_config: 95 | otype: VanillaMLP 96 | activation: ReLU 97 | output_activation: none 98 | n_neurons: 64 99 | n_hidden_layers: 1 100 | sphere_init: true 101 | sphere_init_radius: 0.5 102 | weight_norm: false 103 | texture: 104 | name: volume-radiance 105 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 106 | dir_encoding_config: 107 | otype: Identity 108 | scale: 1.0 109 | offset: 0.0 110 | mlp_network_config: 111 | otype: FullyFusedMLP 112 | activation: ReLU 113 | output_activation: none 114 | n_neurons: 64 115 | n_hidden_layers: 2 116 | color_activation: sigmoid 117 | 118 | system: 119 | name: neusinterpolation-system 120 | loss: 121 | lambda_rgb_huber: 10.0 122 | lambda_rgb_mse: 0. 123 | lambda_rgb_l1: 0. 124 | lambda_mask: 0.1 125 | lambda_eikonal: 0.1 126 | lambda_sparsity: 0.01 127 | lambda_distortion: 0. 128 | lambda_opaque: 0. 129 | sparsity_scale: 1. 130 | lambda_sdf_reg: 0 131 | optimizer: 132 | name: Adam 133 | args: 134 | lr: 0.01 135 | betas: [0.9, 0.99] 136 | eps: 1.e-15 137 | # params: 138 | # geometry: 139 | # lr: 0.01 140 | # texture: 141 | # lr: 0.01 142 | # variance: 143 | ## lr: 0.001 144 | # lr: 0.01 145 | 146 | warmup_steps: 500 147 | scheduler: 148 | name: SequentialLR 149 | interval: step 150 | milestones: 151 | - ${system.warmup_steps} 152 | schedulers: 153 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 154 | args: 155 | start_factor: 0.01 #0.0001 -> 0.1 156 | end_factor: 1.0 157 | total_iters: ${system.warmup_steps} 158 | - name: ExponentialLR 159 | args: 160 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}}} 161 | 162 | checkpoint: 163 | save_top_k: -1 164 | every_n_train_steps: ${trainer.max_steps} 165 | 166 | export: 167 | save_mesh: True 168 | chunk_size: 2097152 169 | export_vertex_color: True 170 | 171 | trainer: 172 | max_steps: 3000 173 | log_every_n_steps: 10 174 | num_sanity_val_steps: 0 175 | val_check_interval: 500 176 | limit_train_batches: 1.0 177 | limit_val_batches: 2 178 | enable_progress_bar: true 179 | precision: 16 -------------------------------------------------------------------------------- /configs/s27/finetuning/neus-domedenseraw-ddc-s27-smooth2-itw-finetune2-new2-meta.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-ITW 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0027 11 | frame: -1 12 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/inTheWild 13 | scene: ${dataset.subject}-${dataset.frame} 14 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 15 | near_plane: 2.0 16 | far_plane: 6.0 17 | train_split: 'train' 18 | val_split: 'val' 19 | test_split: 'test' 20 | deformer: 'ddc' 21 | cano_motion: 'template' # 'world' 22 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 23 | config_path: ${root_dir}/datas/ddc_configs/s27_smooth_eg.yaml 24 | active_camera: [3, 0, 1, 4] 25 | active_camera_all: False 26 | active_camera_test: [2, 3, 0, 1, 4] 27 | smooth: True 28 | smoothDQ: False 29 | subdiv: 0 30 | loose: False 31 | rotate: False 32 | rotate_dir: /CT/HOIMOCAP2/nobackup/debug/deform_nsr/360 33 | rotate_template: False 34 | compute_occlusion: False 35 | test_interval: 1 36 | rotate_w: 540 37 | occlusion_template_dir: /CT/HOIMOCAP2/work/code/instant-nsr-pl/exp/neus-domedense-Subject0002-100/canoInterTest360ForCano@20230719-230931/save 38 | threshold_smpl: 0.075 39 | threshold_ddc : 0.05 40 | erode_mask: False #True #False #True 41 | smpl_name: "smpl_params_smplx.npz" 42 | smpl_gender: 'neutral' 43 | rotate_ele: [0] 44 | rotate_step: 4 45 | rotate_scale: 1.0 46 | ddc_name: "ddc_all_smooth_less.npz" 47 | with_depth: False 48 | threshold_rigid: 0.05 49 | preload: True 50 | depth_shift: 0.0 51 | 52 | model: 53 | decay_step: 5000 54 | grid_resolution: 256 55 | name: neus 56 | radius: 1.25 57 | num_samples_per_ray: 1024 58 | train_num_rays: 256 59 | max_train_num_rays: 8192 60 | grid_prune: true 61 | grid_prune_occ_thre: 0.001 62 | dynamic_ray_sampling: false 63 | batch_image_sampling: true 64 | randomized: true 65 | ray_chunk: 4096 66 | cos_anneal_end: 20000 67 | learned_background: false 68 | background_color: random 69 | variance: 70 | init_val: 0.3 71 | modulate: false 72 | geometry: 73 | name: volume-sdf 74 | radius: ${model.radius} 75 | feature_dim: 13 76 | grad_type: analytic 77 | isosurface: 78 | method: mc 79 | resolution: [256,512,256] 80 | chunk: 2097152 81 | threshold: 0. 82 | xyz_encoding_config: 83 | otype: HashGrid 84 | n_levels: 12 #14 85 | n_features_per_level: 2 86 | log2_hashmap_size: 19 87 | base_resolution: 16 88 | per_level_scale: 1.447269237440378 89 | include_xyz: true 90 | include_feat: false 91 | mlp_network_config: 92 | otype: VanillaMLP 93 | activation: ReLU 94 | output_activation: none 95 | n_neurons: 64 96 | n_hidden_layers: 1 97 | sphere_init: true 98 | sphere_init_radius: 0.5 99 | weight_norm: false 100 | texture: 101 | name: volume-radiance 102 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 103 | dir_encoding_config: 104 | otype: Identity 105 | scale: 1.0 106 | offset: 0.0 107 | mlp_network_config: 108 | otype: FullyFusedMLP 109 | activation: ReLU 110 | output_activation: none 111 | n_neurons: 64 112 | n_hidden_layers: 2 113 | color_activation: sigmoid 114 | 115 | system: 116 | name: neus-system 117 | loss: 118 | lambda_rgb_huber: 10.0 119 | lambda_rgb_mse: 0. 120 | lambda_rgb_l1: 0. 121 | lambda_mask: 0.1 122 | lambda_eikonal: 0.1 123 | lambda_sparsity: 0.01 124 | lambda_distortion: 0. 125 | lambda_opaque: 0. 126 | sparsity_scale: 1. 127 | lambda_sdf_reg: 0 128 | optimizer: 129 | name: Adam 130 | args: 131 | lr: 0.01 132 | betas: [0.9, 0.99] 133 | eps: 1.e-15 134 | # params: 135 | # geometry: 136 | # lr: 0.01 137 | # texture: 138 | # lr: 0.01 139 | ## lr: 0.001 140 | # variance: 141 | ## lr: 0.001 142 | # lr: 0.01 143 | 144 | warmup_steps: 0 145 | scheduler: 146 | name: SequentialLR 147 | interval: step 148 | milestones: 149 | - ${system.warmup_steps} 150 | schedulers: 151 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 152 | args: 153 | start_factor: 0.01 #0.0001 -> 0.1 154 | end_factor: 1.0 155 | total_iters: ${system.warmup_steps} 156 | - name: ExponentialLR 157 | args: 158 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 159 | 160 | checkpoint: 161 | save_top_k: -1 162 | every_n_train_steps: ${trainer.max_steps} 163 | 164 | export: 165 | save_mesh: True 166 | chunk_size: 2097152 167 | export_vertex_color: True 168 | 169 | trainer: 170 | max_steps: 3000 171 | log_every_n_steps: 10 172 | num_sanity_val_steps: 0 173 | val_check_interval: 3000 174 | limit_train_batches: 1.0 175 | limit_val_batches: 15 176 | enable_progress_bar: true 177 | precision: 16 178 | -------------------------------------------------------------------------------- /configs/s27/finetuning/neus-domedenseraw-ddc-s27-smooth2-itw-finetune2-new2-notmeta.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-ITW 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0027 11 | frame: -1 12 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/inTheWild 13 | scene: ${dataset.subject}-${dataset.frame} 14 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 15 | near_plane: 2.0 16 | far_plane: 6.0 17 | train_split: 'train' 18 | val_split: 'val' 19 | test_split: 'test' 20 | deformer: 'ddc' 21 | cano_motion: 'template' # 'world' 22 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 23 | config_path: ${root_dir}/datas/ddc_configs/s27_smooth_eg.yaml 24 | active_camera: [3, 0, 1, 4] 25 | active_camera_all: False 26 | active_camera_test: [2, 3, 0, 1, 4] 27 | smooth: True 28 | smoothDQ: False 29 | subdiv: 0 30 | loose: False 31 | rotate: False 32 | rotate_dir: /CT/HOIMOCAP2/nobackup/debug/deform_nsr/360 33 | rotate_template: False 34 | compute_occlusion: False 35 | test_interval: 1 36 | rotate_w: 540 37 | occlusion_template_dir: /CT/HOIMOCAP2/work/code/instant-nsr-pl/exp/neus-domedense-Subject0002-100/canoInterTest360ForCano@20230719-230931/save 38 | threshold_smpl: 0.075 39 | threshold_ddc : 0.05 40 | erode_mask: False #True #False #True 41 | smpl_name: "smpl_params_smplx.npz" 42 | smpl_gender: 'neutral' 43 | rotate_ele: [0] 44 | rotate_step: 4 45 | rotate_scale: 1.0 46 | ddc_name: "ddc_all_smooth_less.npz" 47 | with_depth: False 48 | threshold_rigid: 0.05 49 | preload: True 50 | depth_shift: 0.0 51 | 52 | model: 53 | decay_step: 5000 54 | grid_resolution: 256 55 | name: neus 56 | radius: 1.25 57 | num_samples_per_ray: 1024 58 | train_num_rays: 256 59 | max_train_num_rays: 8192 60 | grid_prune: true 61 | grid_prune_occ_thre: 0.001 62 | dynamic_ray_sampling: false 63 | batch_image_sampling: true 64 | randomized: true 65 | ray_chunk: 4096 66 | cos_anneal_end: 20000 67 | learned_background: false 68 | background_color: random 69 | variance: 70 | init_val: 0.3 71 | modulate: false 72 | geometry: 73 | name: volume-sdf 74 | radius: ${model.radius} 75 | feature_dim: 13 76 | grad_type: analytic 77 | isosurface: 78 | method: mc 79 | resolution: [256,512,256] 80 | chunk: 2097152 81 | threshold: 0. 82 | xyz_encoding_config: 83 | otype: HashGrid 84 | n_levels: 12 #14 85 | n_features_per_level: 2 86 | log2_hashmap_size: 19 87 | base_resolution: 16 88 | per_level_scale: 1.447269237440378 89 | include_xyz: true 90 | include_feat: false 91 | mlp_network_config: 92 | otype: VanillaMLP 93 | activation: ReLU 94 | output_activation: none 95 | n_neurons: 64 96 | n_hidden_layers: 1 97 | sphere_init: true 98 | sphere_init_radius: 0.5 99 | weight_norm: false 100 | texture: 101 | name: volume-radiance 102 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 103 | dir_encoding_config: 104 | otype: Identity 105 | scale: 1.0 106 | offset: 0.0 107 | mlp_network_config: 108 | otype: FullyFusedMLP 109 | activation: ReLU 110 | output_activation: none 111 | n_neurons: 64 112 | n_hidden_layers: 2 113 | color_activation: sigmoid 114 | 115 | system: 116 | name: neus-system 117 | loss: 118 | lambda_rgb_huber: 10.0 119 | lambda_rgb_mse: 0. 120 | lambda_rgb_l1: 0. 121 | lambda_mask: 0.1 122 | lambda_eikonal: 0.1 123 | lambda_sparsity: 0.01 124 | lambda_distortion: 0. 125 | lambda_opaque: 0. 126 | sparsity_scale: 1. 127 | lambda_sdf_reg: 0 128 | optimizer: 129 | name: Adam 130 | args: 131 | lr: 0.01 132 | betas: [0.9, 0.99] 133 | eps: 1.e-15 134 | # params: 135 | # geometry: 136 | # lr: 0.01 137 | # texture: 138 | # lr: 0.01 139 | ## lr: 0.001 140 | # variance: 141 | ## lr: 0.001 142 | # lr: 0.01 143 | 144 | warmup_steps: 500 145 | scheduler: 146 | name: SequentialLR 147 | interval: step 148 | milestones: 149 | - ${system.warmup_steps} 150 | schedulers: 151 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 152 | args: 153 | start_factor: 0.01 #0.0001 -> 0.1 154 | end_factor: 1.0 155 | total_iters: ${system.warmup_steps} 156 | - name: ExponentialLR 157 | args: 158 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 159 | 160 | checkpoint: 161 | save_top_k: -1 162 | every_n_train_steps: ${trainer.max_steps} 163 | 164 | export: 165 | save_mesh: True 166 | chunk_size: 2097152 167 | export_vertex_color: True 168 | 169 | trainer: 170 | max_steps: 3000 171 | log_every_n_steps: 10 172 | num_sanity_val_steps: 0 173 | val_check_interval: 3000 174 | limit_train_batches: 1.0 175 | limit_val_batches: 15 176 | enable_progress_bar: true 177 | precision: 16 178 | -------------------------------------------------------------------------------- /configs/s27/finetuning/neus-domedenseraw-ddc-s27-smooth2-test-finetune2-new2-meta.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0027 11 | frame: -1 12 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/testing 13 | scene: ${dataset.subject}-${dataset.frame} 14 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 15 | near_plane: 2.0 16 | far_plane: 6.0 17 | train_split: 'train' 18 | val_split: 'val' 19 | test_split: 'test' 20 | deformer: 'ddc' 21 | cano_motion: 'template' # 'world' 22 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 23 | config_path: ${root_dir}/datas/ddc_configs/s27_smooth_eg.yaml 24 | active_camera: [47, 66, 76, 88] 25 | active_camera_all: False 26 | active_camera_test: [0, 14, 26, 39, 55, 53] 27 | smooth: True 28 | smoothDQ: False 29 | subdiv: 0 30 | loose: False 31 | rotate: False 32 | rotate_dir: /CT/HOIMOCAP2/nobackup/debug/deform_nsr/360 33 | rotate_template: False 34 | compute_occlusion: False 35 | test_interval: 1 36 | rotate_w: 540 37 | occlusion_template_dir: /CT/HOIMOCAP2/work/code/instant-nsr-pl/exp/neus-domedense-Subject0002-100/canoInterTest360ForCano@20230719-230931/save 38 | threshold_smpl: 0.075 39 | threshold_ddc : 0.05 40 | erode_mask: False #True #False #True 41 | smpl_name: "smpl_params_smplx.npz" 42 | smpl_gender: 'neutral' 43 | rotate_ele: [0] 44 | rotate_step: 4 45 | rotate_scale: 1.0 46 | ddc_name: "ddc_all_smooth_less.npz" 47 | with_depth: False 48 | threshold_rigid: 0.05 49 | preload: True 50 | depth_shift: 0.0 51 | 52 | model: 53 | decay_step: 5000 54 | grid_resolution: 256 55 | name: neus 56 | radius: 1.25 57 | num_samples_per_ray: 1024 58 | train_num_rays: 256 59 | max_train_num_rays: 8192 60 | grid_prune: true 61 | grid_prune_occ_thre: 0.001 62 | dynamic_ray_sampling: false 63 | batch_image_sampling: true 64 | randomized: true 65 | ray_chunk: 4096 66 | cos_anneal_end: 20000 67 | learned_background: false 68 | background_color: random 69 | variance: 70 | init_val: 0.3 71 | modulate: false 72 | geometry: 73 | name: volume-sdf 74 | radius: ${model.radius} 75 | feature_dim: 13 76 | grad_type: analytic 77 | isosurface: 78 | method: mc 79 | resolution: [256,512,256] 80 | chunk: 2097152 81 | threshold: 0. 82 | xyz_encoding_config: 83 | otype: HashGrid 84 | n_levels: 12 #14 85 | n_features_per_level: 2 86 | log2_hashmap_size: 19 87 | base_resolution: 16 88 | per_level_scale: 1.447269237440378 89 | include_xyz: true 90 | include_feat: false 91 | mlp_network_config: 92 | otype: VanillaMLP 93 | activation: ReLU 94 | output_activation: none 95 | n_neurons: 64 96 | n_hidden_layers: 1 97 | sphere_init: true 98 | sphere_init_radius: 0.5 99 | weight_norm: false 100 | texture: 101 | name: volume-radiance 102 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 103 | dir_encoding_config: 104 | otype: Identity 105 | scale: 1.0 106 | offset: 0.0 107 | mlp_network_config: 108 | otype: FullyFusedMLP 109 | activation: ReLU 110 | output_activation: none 111 | n_neurons: 64 112 | n_hidden_layers: 2 113 | color_activation: sigmoid 114 | 115 | system: 116 | name: neus-system 117 | loss: 118 | lambda_rgb_huber: 10.0 119 | lambda_rgb_mse: 0. 120 | lambda_rgb_l1: 0. 121 | lambda_mask: 0.1 122 | lambda_eikonal: 0.1 123 | lambda_sparsity: 0.01 124 | lambda_distortion: 0. 125 | lambda_opaque: 0. 126 | sparsity_scale: 1. 127 | lambda_sdf_reg: 0 128 | optimizer: 129 | name: Adam 130 | args: 131 | lr: 0.01 132 | betas: [0.9, 0.99] 133 | eps: 1.e-15 134 | # params: 135 | # geometry: 136 | # lr: 0.01 137 | # texture: 138 | # lr: 0.01 139 | ## lr: 0.001 140 | # variance: 141 | ## lr: 0.001 142 | # lr: 0.01 143 | 144 | warmup_steps: 0 145 | scheduler: 146 | name: SequentialLR 147 | interval: step 148 | milestones: 149 | - ${system.warmup_steps} 150 | schedulers: 151 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 152 | args: 153 | start_factor: 0.01 #0.0001 -> 0.1 154 | end_factor: 1.0 155 | total_iters: ${system.warmup_steps} 156 | - name: ExponentialLR 157 | args: 158 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 159 | 160 | checkpoint: 161 | save_top_k: -1 162 | every_n_train_steps: ${trainer.max_steps} 163 | 164 | export: 165 | save_mesh: True 166 | chunk_size: 2097152 167 | export_vertex_color: True 168 | 169 | trainer: 170 | max_steps: 3000 171 | log_every_n_steps: 10 172 | num_sanity_val_steps: 0 173 | val_check_interval: 3000 174 | limit_train_batches: 1.0 175 | limit_val_batches: 15 176 | enable_progress_bar: true 177 | precision: 16 178 | -------------------------------------------------------------------------------- /configs/s27/finetuning/neus-domedenseraw-ddc-s27-smooth2-test-finetune2-new2-notmeta.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0027 11 | frame: -1 12 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/testing 13 | scene: ${dataset.subject}-${dataset.frame} 14 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 15 | near_plane: 2.0 16 | far_plane: 6.0 17 | train_split: 'train' 18 | val_split: 'val' 19 | test_split: 'test' 20 | deformer: 'ddc' 21 | cano_motion: 'template' # 'world' 22 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 23 | config_path: ${root_dir}/datas/ddc_configs/s27_smooth_eg.yaml 24 | active_camera: [47, 66, 76, 88] 25 | active_camera_all: False 26 | active_camera_test: [0, 14, 26, 39, 55, 53] 27 | smooth: True 28 | smoothDQ: False 29 | subdiv: 0 30 | loose: False 31 | rotate: False 32 | rotate_dir: /CT/HOIMOCAP2/nobackup/debug/deform_nsr/360 33 | rotate_template: False 34 | compute_occlusion: False 35 | test_interval: 1 36 | rotate_w: 540 37 | occlusion_template_dir: /CT/HOIMOCAP2/work/code/instant-nsr-pl/exp/neus-domedense-Subject0002-100/canoInterTest360ForCano@20230719-230931/save 38 | threshold_smpl: 0.075 39 | threshold_ddc : 0.05 40 | erode_mask: False #True #False #True 41 | smpl_name: "smpl_params_smplx.npz" 42 | smpl_gender: 'neutral' 43 | rotate_ele: [0] 44 | rotate_step: 4 45 | rotate_scale: 1.0 46 | ddc_name: "ddc_all_smooth_less.npz" 47 | with_depth: False 48 | threshold_rigid: 0.05 49 | preload: True 50 | depth_shift: 0.0 51 | 52 | model: 53 | decay_step: 5000 54 | grid_resolution: 256 55 | name: neus 56 | radius: 1.25 57 | num_samples_per_ray: 1024 58 | train_num_rays: 256 59 | max_train_num_rays: 8192 60 | grid_prune: true 61 | grid_prune_occ_thre: 0.001 62 | dynamic_ray_sampling: false 63 | batch_image_sampling: true 64 | randomized: true 65 | ray_chunk: 4096 66 | cos_anneal_end: 20000 67 | learned_background: false 68 | background_color: random 69 | variance: 70 | init_val: 0.3 71 | modulate: false 72 | geometry: 73 | name: volume-sdf 74 | radius: ${model.radius} 75 | feature_dim: 13 76 | grad_type: analytic 77 | isosurface: 78 | method: mc 79 | resolution: [256,512,256] 80 | chunk: 2097152 81 | threshold: 0. 82 | xyz_encoding_config: 83 | otype: HashGrid 84 | n_levels: 12 #14 85 | n_features_per_level: 2 86 | log2_hashmap_size: 19 87 | base_resolution: 16 88 | per_level_scale: 1.447269237440378 89 | include_xyz: true 90 | include_feat: false 91 | mlp_network_config: 92 | otype: VanillaMLP 93 | activation: ReLU 94 | output_activation: none 95 | n_neurons: 64 96 | n_hidden_layers: 1 97 | sphere_init: true 98 | sphere_init_radius: 0.5 99 | weight_norm: false 100 | texture: 101 | name: volume-radiance 102 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 103 | dir_encoding_config: 104 | otype: Identity 105 | scale: 1.0 106 | offset: 0.0 107 | mlp_network_config: 108 | otype: FullyFusedMLP 109 | activation: ReLU 110 | output_activation: none 111 | n_neurons: 64 112 | n_hidden_layers: 2 113 | color_activation: sigmoid 114 | 115 | system: 116 | name: neus-system 117 | loss: 118 | lambda_rgb_huber: 10.0 119 | lambda_rgb_mse: 0. 120 | lambda_rgb_l1: 0. 121 | lambda_mask: 0.1 122 | lambda_eikonal: 0.1 123 | lambda_sparsity: 0.01 124 | lambda_distortion: 0. 125 | lambda_opaque: 0. 126 | sparsity_scale: 1. 127 | lambda_sdf_reg: 0 128 | optimizer: 129 | name: Adam 130 | args: 131 | lr: 0.01 132 | betas: [0.9, 0.99] 133 | eps: 1.e-15 134 | # params: 135 | # geometry: 136 | # lr: 0.01 137 | # texture: 138 | # lr: 0.01 139 | ## lr: 0.001 140 | # variance: 141 | ## lr: 0.001 142 | # lr: 0.01 143 | 144 | warmup_steps: 500 145 | scheduler: 146 | name: SequentialLR 147 | interval: step 148 | milestones: 149 | - ${system.warmup_steps} 150 | schedulers: 151 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 152 | args: 153 | start_factor: 0.01 #0.0001 -> 0.1 154 | end_factor: 1.0 155 | total_iters: ${system.warmup_steps} 156 | - name: ExponentialLR 157 | args: 158 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 159 | 160 | checkpoint: 161 | save_top_k: -1 162 | every_n_train_steps: ${trainer.max_steps} 163 | 164 | export: 165 | save_mesh: True 166 | chunk_size: 2097152 167 | export_vertex_color: True 168 | 169 | trainer: 170 | max_steps: 3000 171 | log_every_n_steps: 10 172 | num_sanity_val_steps: 0 173 | val_check_interval: 3000 174 | limit_train_batches: 1.0 175 | limit_val_batches: 15 176 | enable_progress_bar: true 177 | precision: 16 178 | -------------------------------------------------------------------------------- /configs/s3/finetuning/neus-domedenseraw-ddc-s3-smooth2-test-finetune2-new2-meta.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0003 11 | frame: -1 12 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/testing 13 | scene: ${dataset.subject}-${dataset.frame} 14 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 15 | near_plane: 2.0 16 | far_plane: 6.0 17 | train_split: 'train' 18 | val_split: 'val' 19 | test_split: 'test' 20 | deformer: 'ddc' 21 | cano_motion: 'template' # 'world' 22 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 23 | config_path: ${root_dir}/datas/ddc_configs/s3_smooth_eg.yaml 24 | active_camera: [65, 77, 40, 57] 25 | active_camera_all: False 26 | active_camera_test: [ 23, 36, 45, 62, 49, 47] 27 | smooth: True 28 | smoothDQ: False 29 | subdiv: 0 30 | loose: False 31 | rotate: False 32 | rotate_dir: /CT/HOIMOCAP2/nobackup/debug/deform_nsr/360 33 | rotate_template: False 34 | compute_occlusion: False 35 | test_interval: 1 36 | rotate_w: 540 37 | occlusion_template_dir: "./none" 38 | threshold_smpl: 0.075 39 | threshold_ddc : 0.05 40 | erode_mask: False #True #False #True 41 | smpl_name: "smpl_params_smplx.npz" 42 | smpl_gender: 'neutral' 43 | rotate_ele: [0] 44 | rotate_step: 4 45 | rotate_scale: 1.0 46 | ddc_name: "ddc_all_smooth_less.npz" 47 | with_depth: False 48 | threshold_rigid: 0.05 49 | preload: True 50 | depth_shift: 0.0 51 | 52 | model: 53 | decay_step: 5000 54 | grid_resolution: 256 #64 # 256 55 | name: neus 56 | radius: 1.25 57 | num_samples_per_ray: 1024 58 | train_num_rays: 256 59 | max_train_num_rays: 8192 60 | grid_prune: true 61 | grid_prune_occ_thre: 0.001 62 | dynamic_ray_sampling: true 63 | batch_image_sampling: true 64 | randomized: true 65 | ray_chunk: 4096 66 | cos_anneal_end: 20000 67 | learned_background: false 68 | background_color: random 69 | variance: 70 | init_val: 0.3 71 | modulate: false 72 | geometry: 73 | name: volume-sdf 74 | radius: ${model.radius} 75 | feature_dim: 13 76 | grad_type: analytic 77 | isosurface: 78 | method: mc 79 | resolution: [256,512,256] 80 | chunk: 2097152 81 | threshold: 0. 82 | xyz_encoding_config: 83 | otype: HashGrid 84 | n_levels: 12 #14 85 | n_features_per_level: 2 86 | log2_hashmap_size: 19 87 | base_resolution: 16 88 | per_level_scale: 1.447269237440378 89 | include_xyz: true 90 | include_feat: false 91 | mlp_network_config: 92 | otype: VanillaMLP 93 | activation: ReLU 94 | output_activation: none 95 | n_neurons: 64 96 | n_hidden_layers: 1 97 | sphere_init: true 98 | sphere_init_radius: 0.5 99 | weight_norm: false 100 | 101 | texture: 102 | name: volume-radiance 103 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 104 | dir_encoding_config: 105 | otype: Identity 106 | scale: 1.0 107 | offset: 0.0 108 | mlp_network_config: 109 | otype: FullyFusedMLP 110 | activation: ReLU 111 | output_activation: none 112 | n_neurons: 64 113 | n_hidden_layers: 2 114 | color_activation: sigmoid 115 | 116 | system: 117 | name: neus-system 118 | loss: 119 | lambda_rgb_huber: 10.0 120 | lambda_rgb_mse: 0. 121 | lambda_rgb_l1: 0. 122 | lambda_mask: 0.1 123 | lambda_eikonal: 0.1 124 | lambda_sparsity: 0.01 125 | lambda_distortion: 0. 126 | lambda_opaque: 0. 127 | sparsity_scale: 1. 128 | lambda_sdf_reg: 0 129 | 130 | optimizer: 131 | name: Adam 132 | args: 133 | lr: 0.01 134 | betas: [0.9, 0.99] 135 | eps: 1.e-15 136 | params: 137 | geometry: 138 | lr: 0.01 139 | texture: 140 | lr: 0.01 141 | variance: 142 | lr: 0.01 143 | 144 | warmup_steps: 0 145 | scheduler: 146 | name: SequentialLR 147 | interval: step 148 | milestones: 149 | - ${system.warmup_steps} 150 | schedulers: 151 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 152 | args: 153 | start_factor: 0.01 #0.0001 -> 0.1 154 | end_factor: 1.0 155 | total_iters: ${system.warmup_steps} 156 | - name: ExponentialLR 157 | args: 158 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 159 | 160 | 161 | checkpoint: 162 | save_top_k: -1 163 | every_n_train_steps: ${trainer.max_steps} 164 | 165 | 166 | export: 167 | save_mesh: True 168 | chunk_size: 2097152 169 | export_vertex_color: True 170 | 171 | trainer: 172 | max_steps: 3000 173 | log_every_n_steps: 10 174 | num_sanity_val_steps: 0 175 | val_check_interval: 3000 176 | limit_train_batches: 1.0 177 | limit_val_batches: 2 178 | enable_progress_bar: true 179 | precision: 16 -------------------------------------------------------------------------------- /configs/s3/finetuning/neus-domedenseraw-ddc-s3-smooth2-test-finetune2-new2-notmeta.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0003 11 | frame: -1 12 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/testing 13 | scene: ${dataset.subject}-${dataset.frame} 14 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 15 | near_plane: 2.0 16 | far_plane: 6.0 17 | train_split: 'train' 18 | val_split: 'val' 19 | test_split: 'test' 20 | deformer: 'ddc' 21 | cano_motion: 'template' # 'world' 22 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 23 | config_path: ${root_dir}/datas/ddc_configs/s3_smooth_eg.yaml 24 | active_camera: [65, 77, 40, 57] 25 | active_camera_all: False 26 | active_camera_test: [ 23, 36, 45, 62, 49, 47] 27 | smooth: True 28 | smoothDQ: False 29 | subdiv: 0 30 | loose: False 31 | rotate: False 32 | rotate_dir: /CT/HOIMOCAP2/nobackup/debug/deform_nsr/360 33 | rotate_template: False 34 | compute_occlusion: False 35 | test_interval: 1 36 | rotate_w: 540 37 | occlusion_template_dir: "./none" 38 | threshold_smpl: 0.075 39 | threshold_ddc : 0.05 40 | erode_mask: False #True #False #True 41 | smpl_name: "smpl_params_smplx.npz" 42 | smpl_gender: 'neutral' 43 | rotate_ele: [0] 44 | rotate_step: 4 45 | rotate_scale: 1.0 46 | ddc_name: "ddc_all_smooth_less.npz" 47 | with_depth: False 48 | threshold_rigid: 0.05 49 | preload: True 50 | depth_shift: 0.0 51 | 52 | model: 53 | decay_step: 5000 54 | grid_resolution: 256 #64 # 256 55 | name: neus 56 | radius: 1.25 57 | num_samples_per_ray: 1024 58 | train_num_rays: 256 59 | max_train_num_rays: 8192 60 | grid_prune: true 61 | grid_prune_occ_thre: 0.001 62 | dynamic_ray_sampling: true 63 | batch_image_sampling: true 64 | randomized: true 65 | ray_chunk: 4096 66 | cos_anneal_end: 20000 67 | learned_background: false 68 | background_color: random 69 | variance: 70 | init_val: 0.3 71 | modulate: false 72 | geometry: 73 | name: volume-sdf 74 | radius: ${model.radius} 75 | feature_dim: 13 76 | grad_type: analytic 77 | isosurface: 78 | method: mc 79 | resolution: [256,512,256] 80 | chunk: 2097152 81 | threshold: 0. 82 | xyz_encoding_config: 83 | otype: HashGrid 84 | n_levels: 12 #14 85 | n_features_per_level: 2 86 | log2_hashmap_size: 19 87 | base_resolution: 16 88 | per_level_scale: 1.447269237440378 89 | include_xyz: true 90 | include_feat: false 91 | mlp_network_config: 92 | otype: VanillaMLP 93 | activation: ReLU 94 | output_activation: none 95 | n_neurons: 64 96 | n_hidden_layers: 1 97 | sphere_init: true 98 | sphere_init_radius: 0.5 99 | weight_norm: false 100 | 101 | texture: 102 | name: volume-radiance 103 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 104 | dir_encoding_config: 105 | otype: Identity 106 | scale: 1.0 107 | offset: 0.0 108 | mlp_network_config: 109 | otype: FullyFusedMLP 110 | activation: ReLU 111 | output_activation: none 112 | n_neurons: 64 113 | n_hidden_layers: 2 114 | color_activation: sigmoid 115 | 116 | system: 117 | name: neus-system 118 | loss: 119 | lambda_rgb_huber: 10.0 120 | lambda_rgb_mse: 0. 121 | lambda_rgb_l1: 0. 122 | lambda_mask: 0.1 123 | lambda_eikonal: 0.1 124 | lambda_sparsity: 0.01 125 | lambda_distortion: 0. 126 | lambda_opaque: 0. 127 | sparsity_scale: 1. 128 | lambda_sdf_reg: 0 129 | 130 | optimizer: 131 | name: Adam 132 | args: 133 | lr: 0.01 134 | betas: [0.9, 0.99] 135 | eps: 1.e-15 136 | params: 137 | geometry: 138 | lr: 0.01 139 | texture: 140 | lr: 0.01 141 | variance: 142 | lr: 0.01 143 | 144 | warmup_steps: 500 145 | scheduler: 146 | name: SequentialLR 147 | interval: step 148 | milestones: 149 | - ${system.warmup_steps} 150 | schedulers: 151 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 152 | args: 153 | start_factor: 0.01 #0.0001 -> 0.1 154 | end_factor: 1.0 155 | total_iters: ${system.warmup_steps} 156 | - name: ExponentialLR 157 | args: 158 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 159 | 160 | 161 | checkpoint: 162 | save_top_k: -1 163 | every_n_train_steps: ${trainer.max_steps} 164 | 165 | 166 | export: 167 | save_mesh: True 168 | chunk_size: 2097152 169 | export_vertex_color: True 170 | 171 | trainer: 172 | max_steps: 3000 173 | log_every_n_steps: 10 174 | num_sanity_val_steps: 0 175 | val_check_interval: 3000 176 | limit_train_batches: 1.0 177 | limit_val_batches: 2 178 | enable_progress_bar: true 179 | precision: 16 -------------------------------------------------------------------------------- /configs/s3/groundtruth/neus-domedenseraw-ddc-s3-smooth2-test-gt.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenseraw 10 | subject: Subject0003 11 | frame: -1 12 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/testing 13 | scene: ${dataset.subject}-${dataset.frame} 14 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 15 | near_plane: 2.0 16 | far_plane: 6.0 17 | train_split: 'train' 18 | val_split: 'val' 19 | test_split: 'test' 20 | deformer: 'ddc' 21 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 22 | config_path: ${root_dir}/datas/ddc_configs/s3_smooth_eg.yaml 23 | active_camera : [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 | 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 25 | 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 26 | 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 27 | 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 ] 28 | active_camera_all: False 29 | active_camera_test: [ 23, 36, 45, 62, 49, 47] 30 | smooth: True 31 | subdiv: 0 32 | loose: True 33 | rotate: False 34 | rotate_dir: /CT/HOIMOCAP2/nobackup/debug/deform_nsr/360 35 | rotate_template: False 36 | compute_occlusion: False 37 | test_interval: 1 38 | rotate_w: 540 39 | occlusion_template_dir: /CT/HOIMOCAP2/work/code/instant-nsr-pl/exp/neus-domedense-Subject0002-100/canoInterTest360ForCano@20230719-230931/save 40 | threshold_smpl: 0.075 41 | threshold_ddc : 0.05 42 | erode_mask: False #True #False #True 43 | smpl_name: "smpl_params_smplx.npz" 44 | smpl_gender: 'neutral' 45 | rotate_ele: [0] 46 | rotate_step: 4 47 | rotate_scale: 1.0 48 | ddc_name: "ddc_all_smooth_less_zero.npz" 49 | with_depth: False 50 | threshold_rigid: 0.05 51 | preload: True 52 | depth_shift: 0.0 53 | 54 | model: 55 | decay_step: 5000 56 | grid_resolution: 256 57 | name: neus 58 | radius: 1.25 59 | num_samples_per_ray: 1024 60 | train_num_rays: 256 61 | max_train_num_rays: 8192 62 | grid_prune: true 63 | grid_prune_occ_thre: 0.001 64 | dynamic_ray_sampling: true 65 | batch_image_sampling: true 66 | randomized: true 67 | ray_chunk: 4096 68 | cos_anneal_end: 20000 69 | learned_background: false 70 | background_color: random 71 | variance: 72 | init_val: 0.3 73 | modulate: false 74 | geometry: 75 | name: volume-sdf 76 | radius: ${model.radius} 77 | feature_dim: 13 78 | grad_type: analytic 79 | isosurface: 80 | method: mc 81 | resolution: [256,512,256] 82 | chunk: 2097152 83 | threshold: 0. 84 | xyz_encoding_config: 85 | otype: HashGrid 86 | n_levels: 12 #14 87 | n_features_per_level: 2 88 | log2_hashmap_size: 19 89 | base_resolution: 16 90 | per_level_scale: 1.447269237440378 91 | include_xyz: true 92 | include_feat: false 93 | mlp_network_config: 94 | otype: VanillaMLP 95 | activation: ReLU 96 | output_activation: none 97 | n_neurons: 64 98 | n_hidden_layers: 1 99 | sphere_init: true 100 | sphere_init_radius: 0.5 101 | weight_norm: false 102 | 103 | texture: 104 | name: volume-radiance 105 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 106 | dir_encoding_config: 107 | otype: Identity 108 | scale: 1.0 109 | offset: 0.0 110 | mlp_network_config: 111 | otype: FullyFusedMLP 112 | activation: ReLU 113 | output_activation: none 114 | n_neurons: 64 115 | n_hidden_layers: 2 116 | color_activation: sigmoid 117 | 118 | system: 119 | name: neus-system 120 | loss: 121 | lambda_rgb_huber: 10.0 122 | lambda_rgb_mse: 0. 123 | lambda_rgb_l1: 0. 124 | lambda_mask: 0.1 125 | lambda_eikonal: 0.1 126 | lambda_sparsity: 0.01 127 | lambda_distortion: 0. 128 | lambda_opaque: 0. 129 | sparsity_scale: 1. 130 | lambda_sdf_reg: 131 | optimizer: 132 | name: Adam 133 | args: 134 | lr: 0.01 135 | betas: [0.9, 0.99] 136 | eps: 1.e-15 137 | params: 138 | geometry: 139 | lr: 0.01 140 | texture: 141 | lr: 0.01 142 | variance: 143 | lr: 0.01 144 | 145 | warmup_steps: 500 146 | scheduler: 147 | name: SequentialLR 148 | interval: step 149 | milestones: 150 | - ${system.warmup_steps} 151 | schedulers: 152 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 153 | args: 154 | start_factor: 0.01 #0.0001 -> 0.1 155 | end_factor: 1.0 156 | total_iters: ${system.warmup_steps} 157 | - name: ExponentialLR 158 | args: 159 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 160 | 161 | 162 | checkpoint: 163 | save_top_k: -1 164 | every_n_train_steps: ${trainer.max_steps} 165 | 166 | export: 167 | save_mesh: True 168 | chunk_size: 2097152 169 | export_vertex_color: True 170 | 171 | trainer: 172 | max_steps: 3000 173 | log_every_n_steps: 10 174 | num_sanity_val_steps: 0 175 | val_check_interval: 3000 176 | limit_train_batches: 1.0 177 | limit_val_batches: 2 178 | enable_progress_bar: true 179 | precision: 16 -------------------------------------------------------------------------------- /configs/s3/metalearning/metaneusseq-domedenserawseq-ddc-s3-smooth2-24-more-newthreshold2-100Frame.yaml: -------------------------------------------------------------------------------- 1 | name: metaneusseq-domedenseseq_meta-${dataset.scene} 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenserawseq_meta 10 | subject: Subject0003 11 | frames: [1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 3600, 3800, 4000, 4200, 4400, 4600, 4800, 5000, 5200, 5400, 5600, 5800, 6000, 6200, 6400, 6600, 6800, 7000, 7200, 7400, 7600, 7800, 8000, 8200, 8400, 8600, 8800, 9000, 9200, 9400, 9600, 9800, 10000, 10200, 10400, 10600, 10800, 11000, 11200, 11400, 11600, 11800, 12000, 12200, 12400, 12600, 12800, 13000, 13200, 13400, 13600, 13800, 14000, 14200, 14400, 14600, 14800, 15000, 15200, 15400, 15600, 15800, 16000, 16200, 16400, 16600, 16800, 17000, 17200, 17400, 17600, 17800, 18000, 18200, 18400, 18600, 18800] 12 | 13 | 14 | frames_path: 15 | data_dir: ${root_dir}/datas/${dataset.subject}/tight/training 16 | scene: ${dataset.subject} 17 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 18 | near_plane: 2.0 19 | far_plane: 6.0 20 | train_split: 'train' 21 | val_split: 'val' 22 | test_split: 'test' 23 | deformer: 'ddc' 24 | cano_motion: 'template' # 'world' 25 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 26 | config_path: ${root_dir}/datas/ddc_configs/s3_smooth_eg.yaml 27 | active_camera: [] 28 | active_camera_all: True 29 | smooth: True 30 | smoothDQ: False 31 | subdiv: 0 32 | loose: True 33 | inner_steps: 24 34 | blur: False 35 | blurNum: 1 36 | threshold_smpl: 0.075 37 | threshold_ddc: 0.05 38 | smpl_name: "smpl_params_smplx.npz" 39 | smpl_gender: 'neutral' 40 | ddc_name: "ddc_all_smooth_less.npz" 41 | with_depth: False 42 | depth_shift: 0.0 43 | threshold_rigid: 0.05 44 | threshold_outer: 0.01 45 | preload: True 46 | model: 47 | decay_step: 300 48 | grid_resolution: 256 49 | name: neus 50 | radius: 1.25 51 | num_samples_per_ray: 1024 52 | train_num_rays: 256 53 | max_train_num_rays: 8192 54 | grid_prune: true 55 | grid_prune_occ_thre: 0.001 56 | dynamic_ray_sampling: true 57 | batch_image_sampling: true 58 | randomized: true 59 | ray_chunk: 4096 60 | cos_anneal_end: 20000 61 | learned_background: false 62 | background_color: random 63 | variance: 64 | init_val: 0.3 65 | modulate: false 66 | geometry: 67 | name: volume-sdf 68 | radius: ${model.radius} 69 | feature_dim: 13 70 | grad_type: analytic 71 | isosurface: 72 | method: mc 73 | resolution: [256,512,256] 74 | chunk: 2097152 75 | threshold: 0. 76 | xyz_encoding_config: 77 | otype: HashGrid 78 | n_levels: 12 #14 79 | n_features_per_level: 2 80 | log2_hashmap_size: 19 81 | base_resolution: 16 82 | per_level_scale: 1.447269237440378 83 | include_xyz: true 84 | mlp_network_config: 85 | otype: VanillaMLP 86 | activation: ReLU 87 | output_activation: none 88 | n_neurons: 64 89 | n_hidden_layers: 1 90 | sphere_init: true 91 | sphere_init_radius: 0.5 92 | weight_norm: false 93 | 94 | texture: 95 | name: volume-radiance 96 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 97 | dir_encoding_config: 98 | otype: Identity 99 | scale: 1.0 100 | offset: 0.0 101 | mlp_network_config: 102 | otype: FullyFusedMLP 103 | activation: ReLU 104 | output_activation: none 105 | n_neurons: 64 106 | n_hidden_layers: 2 107 | color_activation: sigmoid 108 | 109 | system: 110 | name: metaneusseq-system 111 | loss: 112 | lambda_rgb_huber: 10.0 113 | lambda_rgb_mse: 0. 114 | lambda_rgb_l1: 0. 115 | lambda_mask: 0.1 116 | lambda_eikonal: 0.1 117 | lambda_sparsity: 0.01 118 | lambda_distortion: 0. 119 | lambda_opaque: 0. 120 | sparsity_scale: 1. 121 | lambda_sdf_reg: 0 122 | 123 | outer_optimizer: 124 | name: SGD 125 | args: 126 | lr: 1.0 127 | 128 | inner_optimizer: 129 | name: Adam 130 | args: 131 | lr: 0.01 132 | betas: [ 0.9, 0.99 ] 133 | eps: 1.e-15 134 | 135 | warmup_steps: 100 136 | warmup_steps_inner: 50 137 | scheduler: 138 | name: LinearLR # linear warm-up in the first system.warmup_steps steps 139 | interval: step 140 | args: 141 | start_factor: 1.0 #0.01 #0.0001 -> 0.1 142 | end_factor: 1.0 143 | total_iters: ${system.warmup_steps} 144 | # scheduler: 145 | # name: SequentialLR 146 | # interval: step 147 | # milestones: 148 | # - ${system.warmup_steps} 149 | # schedulers: 150 | # - name: LinearLR # linear warm-up in the first system.warmup_steps steps 151 | # args: 152 | # start_factor: 0.01 #0.0001 -> 0.1 153 | # end_factor: 1.0 154 | # total_iters: ${system.warmup_steps} 155 | # - name: ExponentialLR 156 | # args: 157 | # gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}}} 158 | 159 | checkpoint: 160 | save_top_k: -1 161 | every_n_train_steps: 200 162 | 163 | export: 164 | save_mesh: false 165 | chunk_size: 2097152 166 | export_vertex_color: True 167 | 168 | trainer: 169 | max_steps: 3000 170 | log_every_n_steps: 10 171 | num_sanity_val_steps: 0 172 | val_check_interval: 20 173 | limit_train_batches: 1.0 174 | limit_val_batches: 2 175 | enable_progress_bar: true 176 | precision: 32 177 | -------------------------------------------------------------------------------- /configs/s5/finetuning/neus-domedenseraw-ddc-s5-smooth2-test-finetune2-new2-meta.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | 9 | dataset: 10 | name: domedenseraw 11 | subject: Subject0005 12 | frame: -1 13 | data_dir: ${root_dir}/datas/${dataset.subject}/loose/testing 14 | scene: ${dataset.subject}-${dataset.frame} 15 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 16 | near_plane: 2.0 17 | far_plane: 6.0 18 | train_split: 'train' 19 | val_split: 'val' 20 | test_split: 'test' 21 | deformer: 'ddc' 22 | cano_motion: 'template' # 'world' 23 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 24 | config_path: ${root_dir}/datas/ddc_configs/s5_smooth_eg.yaml 25 | active_camera: [62, 75, 85, 51] 26 | active_camera_all: False 27 | active_camera_test: [ 21, 34, 46, 57, 91, 90] 28 | smooth: True 29 | smoothDQ: False 30 | subdiv: 0 31 | loose: False 32 | rotate: False 33 | rotate_dir: /CT/HOIMOCAP2/nobackup/debug/deform_nsr/360 34 | rotate_template: False 35 | compute_occlusion: False 36 | test_interval: 1 37 | rotate_w: 540 38 | occlusion_template_dir: /CT/HOIMOCAP2/work/code/instant-nsr-pl/exp/neus-domedense-Subject0002-100/canoInterTest360ForCano@20230719-230931/save 39 | threshold_smpl: 0.075 40 | threshold_ddc : 0.05 41 | erode_mask: False #True #False #True 42 | smpl_name: "smpl_params_smplx.npz" 43 | smpl_gender: 'neutral' 44 | rotate_ele: [0] 45 | rotate_step: 4 46 | rotate_scale: 1.0 47 | ddc_name: "ddc_all_smooth_less_pointcloud_zero.npz" 48 | with_depth: False 49 | threshold_rigid: 0.05 50 | preload: True 51 | depth_shift: 0.0 52 | 53 | model: 54 | decay_step: 5000 55 | grid_resolution: 256 #64 # 256 56 | name: neus 57 | radius: 1.25 58 | num_samples_per_ray: 1024 59 | train_num_rays: 256 60 | max_train_num_rays: 8192 61 | grid_prune: true 62 | grid_prune_occ_thre: 0.001 63 | dynamic_ray_sampling: true 64 | batch_image_sampling: true 65 | randomized: true 66 | ray_chunk: 4096 67 | cos_anneal_end: 20000 68 | learned_background: false 69 | background_color: random 70 | variance: 71 | init_val: 0.3 72 | modulate: false 73 | geometry: 74 | name: volume-sdf 75 | radius: ${model.radius} 76 | feature_dim: 13 77 | grad_type: analytic 78 | isosurface: 79 | method: mc 80 | resolution: [256,512,256] 81 | chunk: 2097152 82 | threshold: 0. 83 | xyz_encoding_config: 84 | otype: HashGrid 85 | n_levels: 12 #14 86 | n_features_per_level: 2 87 | log2_hashmap_size: 19 88 | base_resolution: 16 89 | per_level_scale: 1.447269237440378 90 | include_xyz: true 91 | include_feat: false 92 | mlp_network_config: 93 | otype: VanillaMLP 94 | activation: ReLU 95 | output_activation: none 96 | n_neurons: 64 97 | n_hidden_layers: 1 98 | sphere_init: true 99 | sphere_init_radius: 0.5 100 | weight_norm: false 101 | 102 | texture: 103 | name: volume-radiance 104 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 105 | dir_encoding_config: 106 | otype: Identity 107 | scale: 1.0 108 | offset: 0.0 109 | mlp_network_config: 110 | otype: FullyFusedMLP 111 | activation: ReLU 112 | output_activation: none 113 | n_neurons: 64 114 | n_hidden_layers: 2 115 | color_activation: sigmoid 116 | 117 | system: 118 | name: neus-system 119 | loss: 120 | lambda_rgb_huber: 10.0 121 | lambda_rgb_mse: 0. 122 | lambda_rgb_l1: 0. 123 | lambda_mask: 0.1 124 | lambda_eikonal: 0.1 125 | lambda_sparsity: 0.01 126 | lambda_distortion: 0. 127 | lambda_opaque: 0. 128 | sparsity_scale: 1. 129 | lambda_sdf_reg: 0 130 | optimizer: 131 | name: Adam 132 | args: 133 | lr: 0.01 134 | betas: [0.9, 0.99] 135 | eps: 1.e-15 136 | params: 137 | geometry: 138 | lr: 0.01 139 | texture: 140 | lr: 0.01 141 | variance: 142 | lr: 0.01 143 | 144 | warmup_steps: 0 145 | scheduler: 146 | name: SequentialLR 147 | interval: step 148 | milestones: 149 | - ${system.warmup_steps} 150 | schedulers: 151 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 152 | args: 153 | start_factor: 0.01 #0.0001 -> 0.1 154 | end_factor: 1.0 155 | total_iters: ${system.warmup_steps} 156 | - name: ExponentialLR 157 | args: 158 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 159 | 160 | 161 | checkpoint: 162 | save_top_k: -1 163 | every_n_train_steps: ${trainer.max_steps} 164 | 165 | 166 | export: 167 | save_mesh: True 168 | chunk_size: 2097152 169 | export_vertex_color: True 170 | 171 | trainer: 172 | max_steps: 3000 173 | log_every_n_steps: 10 174 | num_sanity_val_steps: 0 175 | val_check_interval: 3000 176 | limit_train_batches: 1.0 177 | limit_val_batches: 2 178 | enable_progress_bar: true 179 | precision: 16 180 | -------------------------------------------------------------------------------- /configs/s5/finetuning/neus-domedenseraw-ddc-s5-smooth2-test-finetune2-new2-notmeta.yaml: -------------------------------------------------------------------------------- 1 | name: neus-domedense-${dataset.scene}-test 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | 9 | dataset: 10 | name: domedenseraw 11 | subject: Subject0005 12 | frame: -1 13 | data_dir: ${root_dir}/datas/${dataset.subject}/loose/testing 14 | scene: ${dataset.subject}-${dataset.frame} 15 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 16 | near_plane: 2.0 17 | far_plane: 6.0 18 | train_split: 'train' 19 | val_split: 'val' 20 | test_split: 'test' 21 | deformer: 'ddc' 22 | cano_motion: 'template' # 'world' 23 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 24 | config_path: ${root_dir}/datas/ddc_configs/s5_smooth_eg.yaml 25 | active_camera: [62, 75, 85, 51] 26 | active_camera_all: False 27 | active_camera_test: [ 21, 34, 46, 57, 91, 90] 28 | smooth: True 29 | smoothDQ: False 30 | subdiv: 0 31 | loose: False 32 | rotate: False 33 | rotate_dir: /CT/HOIMOCAP2/nobackup/debug/deform_nsr/360 34 | rotate_template: False 35 | compute_occlusion: False 36 | test_interval: 1 37 | rotate_w: 540 38 | occlusion_template_dir: /CT/HOIMOCAP2/work/code/instant-nsr-pl/exp/neus-domedense-Subject0002-100/canoInterTest360ForCano@20230719-230931/save 39 | threshold_smpl: 0.075 40 | threshold_ddc : 0.05 41 | erode_mask: False #True #False #True 42 | smpl_name: "smpl_params_smplx.npz" 43 | smpl_gender: 'neutral' 44 | rotate_ele: [0] 45 | rotate_step: 4 46 | rotate_scale: 1.0 47 | ddc_name: "ddc_all_smooth_less_pointcloud_zero.npz" 48 | with_depth: False 49 | threshold_rigid: 0.05 50 | preload: True 51 | depth_shift: 0.0 52 | 53 | model: 54 | decay_step: 5000 55 | grid_resolution: 256 #64 # 256 56 | name: neus 57 | radius: 1.25 58 | num_samples_per_ray: 1024 59 | train_num_rays: 256 60 | max_train_num_rays: 8192 61 | grid_prune: true 62 | grid_prune_occ_thre: 0.001 63 | dynamic_ray_sampling: true 64 | batch_image_sampling: true 65 | randomized: true 66 | ray_chunk: 4096 67 | cos_anneal_end: 20000 68 | learned_background: false 69 | background_color: random 70 | variance: 71 | init_val: 0.3 72 | modulate: false 73 | geometry: 74 | name: volume-sdf 75 | radius: ${model.radius} 76 | feature_dim: 13 77 | grad_type: analytic 78 | isosurface: 79 | method: mc 80 | resolution: [256,512,256] 81 | chunk: 2097152 82 | threshold: 0. 83 | xyz_encoding_config: 84 | otype: HashGrid 85 | n_levels: 12 #14 86 | n_features_per_level: 2 87 | log2_hashmap_size: 19 88 | base_resolution: 16 89 | per_level_scale: 1.447269237440378 90 | include_xyz: true 91 | include_feat: false 92 | mlp_network_config: 93 | otype: VanillaMLP 94 | activation: ReLU 95 | output_activation: none 96 | n_neurons: 64 97 | n_hidden_layers: 1 98 | sphere_init: true 99 | sphere_init_radius: 0.5 100 | weight_norm: false 101 | 102 | texture: 103 | name: volume-radiance 104 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 105 | dir_encoding_config: 106 | otype: Identity 107 | scale: 1.0 108 | offset: 0.0 109 | mlp_network_config: 110 | otype: FullyFusedMLP 111 | activation: ReLU 112 | output_activation: none 113 | n_neurons: 64 114 | n_hidden_layers: 2 115 | color_activation: sigmoid 116 | 117 | system: 118 | name: neus-system 119 | loss: 120 | lambda_rgb_huber: 10.0 121 | lambda_rgb_mse: 0. 122 | lambda_rgb_l1: 0. 123 | lambda_mask: 0.1 124 | lambda_eikonal: 0.1 125 | lambda_sparsity: 0.01 126 | lambda_distortion: 0. 127 | lambda_opaque: 0. 128 | sparsity_scale: 1. 129 | lambda_sdf_reg: 0 130 | optimizer: 131 | name: Adam 132 | args: 133 | lr: 0.01 134 | betas: [0.9, 0.99] 135 | eps: 1.e-15 136 | params: 137 | geometry: 138 | lr: 0.01 139 | texture: 140 | lr: 0.01 141 | variance: 142 | lr: 0.01 143 | 144 | warmup_steps: 500 145 | scheduler: 146 | name: SequentialLR 147 | interval: step 148 | milestones: 149 | - ${system.warmup_steps} 150 | schedulers: 151 | - name: LinearLR # linear warm-up in the first system.warmup_steps steps 152 | args: 153 | start_factor: 0.01 #0.0001 -> 0.1 154 | end_factor: 1.0 155 | total_iters: ${system.warmup_steps} 156 | - name: ExponentialLR 157 | args: 158 | gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}} } 159 | 160 | 161 | checkpoint: 162 | save_top_k: -1 163 | every_n_train_steps: ${trainer.max_steps} 164 | 165 | 166 | export: 167 | save_mesh: True 168 | chunk_size: 2097152 169 | export_vertex_color: True 170 | 171 | trainer: 172 | max_steps: 3000 173 | log_every_n_steps: 10 174 | num_sanity_val_steps: 0 175 | val_check_interval: 3000 176 | limit_train_batches: 1.0 177 | limit_val_batches: 2 178 | enable_progress_bar: true 179 | precision: 16 180 | -------------------------------------------------------------------------------- /configs/s5/metalearning/metaneusseq-domedenserawseq-ddc-s5-smooth2-24-more-newthreshold0-pointcloud-zero4.yaml: -------------------------------------------------------------------------------- 1 | name: metaneusseq-domedenseseq_meta-${dataset.scene} 2 | tag: '' 3 | seed: 42 4 | 5 | defaults: 6 | - ../../base.yaml 7 | 8 | dataset: 9 | name: domedenserawseq_meta 10 | subject: Subject0005 11 | frames: [1200, 1400, 2200, 2600, 2800, 3000, 3200, 3600, 3800, 4000, 4200, 12 | 5000, 5400, 6800, 7000, 7200, 7400, 7600, 13 | 7800, 8600, 9000, 9200, 9400, 9600, 9800, 10000, 10200, 11000, 11200, 14 | 11800, 12000, 12200, 12400, 12600, 12800, 13000, 13200, 13400, 13800, 14000, 14200, 15 | 14400, 14600, 14800, 15000, 15200, 15800, 16000, 16200, 16600, 16800, 16 | 17000, 17600, 17800, 18000, 18200, 18600, 18800, 19000] 17 | frames_path: 18 | data_dir: ${root_dir}/datas/${dataset.subject}/loose/training 19 | scene: ${dataset.subject} 20 | img_downscale: 1 # specify training image size by either img_wh or img_downscale 21 | near_plane: 2.0 22 | far_plane: 6.0 23 | train_split: 'train' 24 | val_split: 'val' 25 | test_split: 'test' 26 | deformer: 'ddc' 27 | cano_motion: 'template' # 'world' 28 | default_path: ${root_dir}/datas/ddc_configs/default.yaml 29 | config_path: ${root_dir}/datas/ddc_configs/s5_smooth_eg.yaml 30 | active_camera: [] 31 | active_camera_all: True 32 | smooth: True 33 | smoothDQ: False 34 | subdiv: 0 35 | loose: True 36 | inner_steps: 24 37 | blur: False 38 | blurNum: 1 39 | threshold_smpl: 0.075 40 | threshold_ddc: 0.05 41 | smpl_name: "smpl_params_smplx.npz" 42 | smpl_gender: 'neutral' 43 | ddc_name: "ddc_all_smooth_less_pointcloud_zero.npz" 44 | with_depth: False 45 | depth_shift: 0.0 46 | threshold_rigid: 0.05 47 | threshold_outer: 0.05 48 | preload: True 49 | model: 50 | decay_step: 300 51 | grid_resolution: 256 52 | name: neus 53 | radius: 1.25 54 | num_samples_per_ray: 1024 55 | train_num_rays: 256 56 | max_train_num_rays: 8192 57 | grid_prune: true 58 | grid_prune_occ_thre: 0.001 59 | dynamic_ray_sampling: true 60 | batch_image_sampling: true 61 | randomized: true 62 | ray_chunk: 4096 63 | cos_anneal_end: 20000 64 | learned_background: false 65 | background_color: random 66 | variance: 67 | init_val: 0.3 68 | modulate: false 69 | geometry: 70 | name: volume-sdf 71 | radius: ${model.radius} 72 | feature_dim: 13 73 | grad_type: analytic 74 | isosurface: 75 | method: mc 76 | resolution: [256,512,256] 77 | chunk: 2097152 78 | threshold: 0. 79 | xyz_encoding_config: 80 | otype: HashGrid 81 | n_levels: 12 #14 82 | n_features_per_level: 2 83 | log2_hashmap_size: 19 84 | base_resolution: 16 85 | per_level_scale: 1.447269237440378 86 | include_xyz: true 87 | mlp_network_config: 88 | otype: VanillaMLP 89 | activation: ReLU 90 | output_activation: none 91 | n_neurons: 64 92 | n_hidden_layers: 1 93 | sphere_init: true 94 | sphere_init_radius: 0.5 95 | weight_norm: false 96 | 97 | texture: 98 | name: volume-radiance 99 | input_feature_dim: ${add:${model.geometry.feature_dim},3} # surface normal as additional input 100 | dir_encoding_config: 101 | otype: Identity 102 | scale: 1.0 103 | offset: 0.0 104 | mlp_network_config: 105 | otype: FullyFusedMLP 106 | activation: ReLU 107 | output_activation: none 108 | n_neurons: 64 109 | n_hidden_layers: 2 110 | color_activation: sigmoid 111 | 112 | system: 113 | name: metaneusseq-system 114 | loss: 115 | lambda_rgb_huber: 10.0 116 | lambda_rgb_mse: 0. 117 | lambda_rgb_l1: 0. 118 | lambda_mask: 0.1 119 | lambda_eikonal: 0.1 120 | lambda_sparsity: 0.01 121 | lambda_distortion: 0. 122 | lambda_opaque: 0. 123 | sparsity_scale: 1. 124 | lambda_sdf_reg: 0 125 | 126 | outer_optimizer: 127 | name: SGD 128 | args: 129 | lr: 1.0 130 | 131 | inner_optimizer: 132 | name: Adam 133 | args: 134 | lr: 0.01 135 | betas: [ 0.9, 0.99 ] 136 | eps: 1.e-15 137 | 138 | warmup_steps: 100 139 | warmup_steps_inner: 50 140 | scheduler: 141 | name: LinearLR # linear warm-up in the first system.warmup_steps steps 142 | interval: step 143 | args: 144 | start_factor: 1.0 #0.01 #0.0001 -> 0.1 145 | end_factor: 1.0 146 | total_iters: ${system.warmup_steps} 147 | # scheduler: 148 | # name: SequentialLR 149 | # interval: step 150 | # milestones: 151 | # - ${system.warmup_steps} 152 | # schedulers: 153 | # - name: LinearLR # linear warm-up in the first system.warmup_steps steps 154 | # args: 155 | # start_factor: 0.01 #0.0001 -> 0.1 156 | # end_factor: 1.0 157 | # total_iters: ${system.warmup_steps} 158 | # - name: ExponentialLR 159 | # args: 160 | # gamma: ${calc_exp_lr_decay_rate:0.1,${sub:${trainer.max_steps},${system.warmup_steps}}} 161 | 162 | checkpoint: 163 | save_top_k: -1 164 | every_n_train_steps: 200 165 | 166 | export: 167 | save_mesh: false 168 | chunk_size: 2097152 169 | export_vertex_color: True 170 | 171 | trainer: 172 | max_steps: 3000 173 | log_every_n_steps: 10 174 | num_sanity_val_steps: 0 175 | val_check_interval: 20 176 | limit_train_batches: 1.0 177 | limit_val_batches: 2 178 | enable_progress_bar: true 179 | precision: 32 180 | -------------------------------------------------------------------------------- /datas/SMPLX/smpl/Download_SMPL_models_follwing_Readme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/datas/SMPLX/smpl/Download_SMPL_models_follwing_Readme -------------------------------------------------------------------------------- /datas/color_proxy_s2/Download_proxy_images_masks_camera_parameters_following_readme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/datas/color_proxy_s2/Download_proxy_images_masks_camera_parameters_following_readme -------------------------------------------------------------------------------- /datas/ddc_configs/default.yaml: -------------------------------------------------------------------------------- 1 | #Default 2 | 3 | # general settings 4 | projectName: DDC 5 | sequence: Default 6 | 7 | # Character related 8 | motionPath: 9 | characterPath: 10 | graphPath: 11 | connectionPath: 12 | compute_connection: False 13 | load_seg_weights: True 14 | compute_adjacency: True 15 | useDQ: True 16 | verbose: True 17 | 18 | # Datasets related 19 | configPath: 20 | countPath: 21 | debug: False 22 | dataDir: 23 | tfrecordName: 24 | tfrecordPrefix: 25 | outDir: 26 | indicesPath: 27 | cameraPath: 28 | renderH: -1 29 | renderW: -1 30 | numTrainCam: 20 31 | w: 350 32 | numWorkers: 4 33 | batchSize: 4 34 | activeCamera: [] 35 | 36 | # Model related 37 | egNetInit: zero 38 | lightingInit: zero 39 | deltaNetInit: zero 40 | texNetInit: zero 41 | weight_dir: 42 | 43 | # EGNet 44 | EGNet: 45 | denseInitializerScale: 0.001 46 | dataFormat: 'channels_first' 47 | featureSize1: 16 48 | featureSize2: 16 49 | useBatchNorm: True 50 | fullyConnected: 'nofull' 51 | ringValue: 2 52 | normalize: 1 53 | denseInnerBlock: 0 54 | numResidualBlocks: 8 55 | 56 | # DeltaNet 57 | DeltaNet: 58 | denseInitializerScale: 0.001 59 | dataFormat: 'channels_first' 60 | featureSize1: 16 61 | featureSize2: 16 62 | useBatchNorm: False 63 | fullyConnected: 'nofull' 64 | ringValue: 3 65 | normalize: 1 66 | denseInnerBlock: 1 67 | numResidualBlocks: 8 68 | 69 | 70 | 71 | # Training related 72 | gpus: [0] 73 | logFreq: 5 74 | logFreqTf: 5 75 | maxIter: 10000 76 | 77 | optimizer: 78 | type: Adamax 79 | args: 80 | lr: 0.0001 81 | weight_decay: 0 82 | 83 | lr_scheduler: 84 | type: MultiStepLR 85 | args: 86 | milestones: [999999] 87 | gamma: 1 88 | 89 | -------------------------------------------------------------------------------- /datas/ddc_configs/s27_smooth_eg.yaml: -------------------------------------------------------------------------------- 1 | #Default 2 | 3 | # general settings 4 | sequence: S27Smooth 5 | 6 | # Character related 7 | #motion_path: /CT/HOIMOCAP2/work/data/VladNew/training/motions/poseAngles.motion 8 | #camera_path: /CT/HOIMOCAP2/work/data/Subject0000/cameras_training.calibration 9 | characterPath: /CT/HOIMOCAP3/work/data/Subject0027/tight/smoothCharacter/actor.character 10 | graphPath: /CT/HOIMOCAP3/work/data/Subject0027/tight/smoothCharacter/actorSimplified.obj 11 | connectionPath: 12 | compute_connection: False 13 | useDQ: True 14 | verbose: True 15 | 16 | # Datasets related 17 | debug: True 18 | dataDir: /CT/HOIMOCAP3/work/data/Subject0027/tight/training 19 | tfrecordName: tfrecord 20 | tfrecordPrefix: test_indices 21 | outDir: /CT/HOIMOCAP3/work/data/Subject0027/tight/training/results 22 | indicesPath: /CT/HOIMOCAP3/work/data/Subject0027/tight/training/training_indices_less.txt 23 | cameraPath: /CT/HOIMOCAP3/work/data/Subject0027/tight/cameras_training.calibration 24 | renderH: -1 25 | renderW: -1 26 | numTrainCam: 20 27 | w: 350 28 | numWorkers: 4 29 | batchSize: 4 30 | activeCamera: [] 31 | # Model related 32 | # EGNet 33 | EGNet: 34 | denseInitializerScale: 0.001 35 | dataFormat: 'channels_first' 36 | featureSize1: 16 37 | featureSize2: 16 38 | useBatchNorm: False 39 | fullyConnected: 'nofull' 40 | ringValue: 2 41 | normalize: 1 42 | denseInnerBlock: 0 43 | numResidualBlocks: 8 44 | 45 | 46 | 47 | # DeltaNet 48 | 49 | 50 | # Training related 51 | gpus: [0] 52 | logFreq: 2 53 | logFreqTf: 2 54 | maxIter: 10000 55 | 56 | w_Silh: 100.0 57 | w_Render: 0.0 58 | w_Spatial: 0.0 59 | w_Chamfer: 0.0 60 | w_Iso: 0.0 61 | w_Arap: 1500.0 62 | 63 | 64 | -------------------------------------------------------------------------------- /datas/ddc_configs/s2_smooth_eg.yaml: -------------------------------------------------------------------------------- 1 | #Default 2 | 3 | # general settings 4 | #sequence: S5Smooth 5 | sequence: S2Smooth 6 | 7 | # Character related 8 | #motion_path: /CT/HOIMOCAP2/work/data/VladNew/training/motions/poseAngles.motion 9 | #camera_path: /CT/HOIMOCAP2/work/data/Subject0000/cameras_training.calibration 10 | characterPath: /CT/HOIMOCAP2/work/data/Subject0002/tight/smoothCharacter/actor.character 11 | graphPath: /CT/HOIMOCAP2/work/data/Subject0002/tight/smoothCharacter/actorSimplified.obj 12 | connectionPath: 13 | compute_connection: False 14 | useDQ: True 15 | verbose: True 16 | 17 | # Datasets related 18 | debug: True 19 | dataDir: /CT/HOIMOCAP2/work/data/Subject0000/tight/training 20 | tfrecordName: tfrecord 21 | tfrecordPrefix: test_indices 22 | outDir: /CT/HOIMOCAP2/work/data/Subject0000/tight/training/results 23 | indicesPath: /CT/HOIMOCAP2/work/data/Subject0000/tight/training/training_indices_less.txt 24 | cameraPath: /CT/HOIMOCAP2/work/data/Subject0000/tight/cameras_training.calibration 25 | renderH: -1 26 | renderW: -1 27 | numTrainCam: 20 28 | w: 350 29 | numWorkers: 4 30 | batchSize: 4 31 | 32 | # Model related 33 | # EGNet 34 | EGNet: 35 | denseInitializerScale: 0.001 36 | dataFormat: 'channels_first' 37 | featureSize1: 16 38 | featureSize2: 16 39 | useBatchNorm: False 40 | fullyConnected: 'nofull' 41 | ringValue: 2 42 | normalize: 1 43 | denseInnerBlock: 0 44 | numResidualBlocks: 8 45 | 46 | 47 | 48 | # DeltaNet 49 | 50 | 51 | # Training related 52 | gpus: [0] 53 | logFreq: 2 54 | logFreqTf: 2 55 | maxIter: 10000 56 | 57 | w_Silh: 100.0 58 | w_Render: 0.0 59 | w_Spatial: 0.0 60 | w_Chamfer: 0.0 61 | w_Iso: 0.0 62 | w_Arap: 1500.0 63 | 64 | 65 | -------------------------------------------------------------------------------- /datas/ddc_configs/s3_smooth_eg.yaml: -------------------------------------------------------------------------------- 1 | #Default 2 | 3 | # general settings 4 | sequence: S3Smooth 5 | 6 | # Character related 7 | #motion_path: /CT/HOIMOCAP2/work/data/VladNew/training/motions/poseAngles.motion 8 | #camera_path: /CT/HOIMOCAP2/work/data/Subject0000/cameras_training.calibration 9 | characterPath: /CT/HOIMOCAP3/work/data/Subject0003/tight/smoothCharacter/actor.character 10 | graphPath: /CT/HOIMOCAP3/work/data/Subject0003/tight/smoothCharacter/actorSimplified.obj 11 | connectionPath: 12 | compute_connection: False 13 | useDQ: True 14 | verbose: True 15 | 16 | # Datasets related 17 | debug: True 18 | dataDir: /CT/HOIMOCAP3/work/data/Subject0003/tight/training 19 | tfrecordName: tfrecord 20 | tfrecordPrefix: test_indices 21 | outDir: /CT/HOIMOCAP3/work/data/Subject0003/tight/training/results 22 | indicesPath: /CT/HOIMOCAP3/work/data/Subject0003/tight/training/training_indices_less.txt 23 | cameraPath: /CT/HOIMOCAP3/work/data/Subject0003/tight/cameras_training.calibration 24 | renderH: -1 25 | renderW: -1 26 | numTrainCam: 20 27 | w: 350 28 | numWorkers: 4 29 | batchSize: 4 30 | 31 | # Model related 32 | # EGNet 33 | EGNet: 34 | denseInitializerScale: 0.001 35 | dataFormat: 'channels_first' 36 | featureSize1: 16 37 | featureSize2: 16 38 | useBatchNorm: False 39 | fullyConnected: 'nofull' 40 | ringValue: 2 41 | normalize: 1 42 | denseInnerBlock: 0 43 | numResidualBlocks: 8 44 | 45 | 46 | 47 | # DeltaNet 48 | 49 | 50 | # Training related 51 | gpus: [0] 52 | logFreq: 2 53 | logFreqTf: 2 54 | maxIter: 10000 55 | 56 | w_Silh: 100.0 57 | w_Render: 0.0 58 | w_Spatial: 0.0 59 | w_Chamfer: 0.0 60 | w_Iso: 0.0 61 | w_Arap: 1500.0 62 | 63 | 64 | -------------------------------------------------------------------------------- /datas/ddc_configs/s5_smooth_eg.yaml: -------------------------------------------------------------------------------- 1 | #Default 2 | 3 | # general settings 4 | sequence: S5Smooth 5 | 6 | # Character related 7 | #motion_path: /CT/HOIMOCAP2/work/data/VladNew/training/motions/poseAngles.motion 8 | #camera_path: /CT/HOIMOCAP2/work/data/Subject0000/cameras_training.calibration 9 | characterPath: /CT/HOIMOCAP2/work/data/Subject0005/loose/smoothCharacter/actor.character 10 | graphPath: /CT/HOIMOCAP2/work/data/Subject0005/loose/smoothCharacter/actorSimplified.obj 11 | connectionPath: 12 | compute_connection: False 13 | useDQ: True 14 | verbose: True 15 | 16 | # Datasets related 17 | debug: True 18 | dataDir: /CT/HOIMOCAP2/work/data/Subject0005/loose/training 19 | tfrecordName: tfrecord 20 | tfrecordPrefix: test_indices 21 | outDir: /CT/HOIMOCAP2/work/data/Subject0005/loose/training/results 22 | indicesPath: /CT/HOIMOCAP2/work/data/Subject0005/loose/training/training_indices_less.txt 23 | cameraPath: /CT/HOIMOCAP2/work/data/Subject0005/loose/cameras_training.calibration 24 | renderH: -1 25 | renderW: -1 26 | numTrainCam: 20 27 | w: 350 28 | numWorkers: 4 29 | batchSize: 4 30 | 31 | # Model related 32 | # EGNet 33 | EGNet: 34 | denseInitializerScale: 0.001 35 | dataFormat: 'channels_first' 36 | featureSize1: 16 37 | featureSize2: 16 38 | useBatchNorm: False 39 | fullyConnected: 'nofull' 40 | ringValue: 2 41 | normalize: 1 42 | denseInnerBlock: 0 43 | numResidualBlocks: 8 44 | 45 | 46 | 47 | # DeltaNet 48 | 49 | 50 | # Training related 51 | gpus: [0] 52 | logFreq: 2 53 | logFreqTf: 2 54 | maxIter: 10000 55 | 56 | w_Silh: 100.0 57 | w_Render: 0.0 58 | w_Spatial: 0.0 59 | w_Chamfer: 0.0 60 | w_Iso: 0.0 61 | w_Arap: 1500.0 62 | 63 | 64 | -------------------------------------------------------------------------------- /datas/vis/cylinder2.obj: -------------------------------------------------------------------------------- 1 | #### 2 | # 3 | # OBJ File Generated by Meshlab 4 | # 5 | #### 6 | # Object cylinder2.obj 7 | # 8 | # Vertices: 34 9 | # Faces: 64 10 | # 11 | #### 12 | vn -0.076506 -0.824908 0.560066 13 | v -0.016180 -0.200212 1.000000 14 | vn 0.824908 -0.076506 0.560066 15 | v 0.200212 -0.016180 1.000000 16 | vn -0.826971 0.057451 0.559302 17 | v -0.200212 0.016180 1.000000 18 | vn -0.452357 0.832295 -0.320403 19 | v -0.091566 0.178781 -1.000000 20 | vn 0.656608 0.255150 -0.709764 21 | v 0.184776 0.076537 -1.000000 22 | vn 0.840220 0.298659 0.452586 23 | v 0.191164 0.061670 1.000000 24 | vn 0.732838 -0.386361 0.560066 25 | v 0.178781 -0.091566 1.000000 26 | vn 0.386361 0.732838 0.560066 27 | v 0.091566 0.178781 1.000000 28 | vn 0.244997 -0.791393 0.560066 29 | v 0.061670 -0.191164 1.000000 30 | vn -0.813240 0.170083 -0.556518 31 | v -0.196157 0.039018 -1.000000 32 | vn -0.824553 -0.088149 -0.558876 33 | v -0.200212 -0.016180 -1.000000 34 | vn -0.529200 -0.637396 -0.560066 35 | v -0.130131 -0.153012 -1.000000 36 | vn -0.708072 0.661076 0.248216 37 | v -0.146655 0.139534 1.000000 38 | vn 0.076506 -0.824908 -0.560066 39 | v 0.016180 -0.200212 -1.000000 40 | vn 0.280130 0.904883 -0.320490 41 | v 0.061670 0.191164 -1.000000 42 | vn 0.087477 0.943204 0.320490 43 | v 0.016180 0.200212 1.000000 44 | vn -0.732838 -0.386361 -0.560066 45 | v -0.178781 -0.091566 -1.000000 46 | vn -0.637396 -0.529200 0.560066 47 | v -0.153012 -0.130131 1.000000 48 | vn -0.527821 0.461127 -0.713279 49 | v -0.153012 0.130131 -1.000000 50 | vn 0.637396 -0.529200 -0.560066 51 | v 0.153012 -0.130131 -1.000000 52 | vn 0.699338 0.448580 -0.556509 53 | v 0.166294 0.111114 -1.000000 54 | vn -0.244997 -0.791393 -0.560066 55 | v -0.061670 -0.191164 -1.000000 56 | vn -0.016804 0.181184 -0.983306 57 | v -0.016180 0.200212 -1.000000 58 | vn 0.529200 -0.637396 0.560066 59 | v 0.130131 -0.153012 1.000000 60 | vn 0.629787 0.538288 0.560013 61 | v 0.153012 0.130131 1.000000 62 | vn 0.826037 0.069254 -0.559345 63 | v 0.200212 0.016180 -1.000000 64 | vn 0.791393 -0.244997 -0.560066 65 | v 0.191164 -0.061670 -1.000000 66 | vn -0.063459 0.196349 0.978479 67 | v -0.061670 0.191164 1.000000 68 | vn -0.386361 -0.732838 0.560066 69 | v -0.091566 -0.178781 1.000000 70 | vn -0.744763 0.367219 -0.557206 71 | v -0.184776 0.076537 -1.000000 72 | vn -0.775771 0.294481 0.558087 73 | v -0.184776 0.076537 1.000000 74 | vn -0.791393 -0.244997 0.560066 75 | v -0.191164 -0.061670 1.000000 76 | vn 0.386361 -0.732838 -0.560066 77 | v 0.091566 -0.178781 -1.000000 78 | vn 0.520716 0.645378 -0.558876 79 | v 0.130131 0.153012 -1.000000 80 | # 34 vertices, 0 vertices normals 81 | 82 | f 2//2 26//26 6//6 83 | f 2//2 6//6 28//28 84 | f 26//26 23//23 5//5 85 | f 26//26 5//5 6//6 86 | f 5//5 23//23 21//21 87 | f 5//5 21//21 6//6 88 | f 6//6 21//21 25//25 89 | f 6//6 25//25 28//28 90 | f 21//21 23//23 34//34 91 | f 21//21 34//34 25//25 92 | f 25//25 34//34 8//8 93 | f 25//25 8//8 28//28 94 | f 34//34 23//23 15//15 95 | f 34//34 15//15 8//8 96 | f 8//8 15//15 16//16 97 | f 8//8 16//16 28//28 98 | f 15//15 23//23 16//16 99 | f 16//16 23//23 28//28 100 | f 23//23 4//4 28//28 101 | f 28//28 4//4 13//13 102 | f 4//4 23//23 19//19 103 | f 4//4 19//19 13//13 104 | f 19//19 23//23 30//30 105 | f 19//19 30//30 13//13 106 | f 13//13 30//30 31//31 107 | f 13//13 31//31 28//28 108 | f 30//30 23//23 10//10 109 | f 30//30 10//10 31//31 110 | f 31//31 10//10 3//3 111 | f 31//31 3//3 28//28 112 | f 10//10 23//23 11//11 113 | f 10//10 11//11 3//3 114 | f 3//3 11//11 32//32 115 | f 3//3 32//32 28//28 116 | f 11//11 23//23 17//17 117 | f 11//11 17//17 32//32 118 | f 32//32 17//17 18//18 119 | f 32//32 18//18 28//28 120 | f 17//17 23//23 12//12 121 | f 17//17 12//12 18//18 122 | f 18//18 12//12 29//29 123 | f 18//18 29//29 28//28 124 | f 12//12 23//23 22//22 125 | f 12//12 22//22 29//29 126 | f 29//29 22//22 1//1 127 | f 29//29 1//1 28//28 128 | f 22//22 23//23 14//14 129 | f 22//22 14//14 1//1 130 | f 1//1 14//14 9//9 131 | f 1//1 9//9 28//28 132 | f 14//14 23//23 33//33 133 | f 14//14 33//33 9//9 134 | f 9//9 33//33 24//24 135 | f 9//9 24//24 28//28 136 | f 33//33 23//23 20//20 137 | f 33//33 20//20 24//24 138 | f 24//24 20//20 7//7 139 | f 24//24 7//7 28//28 140 | f 20//20 23//23 27//27 141 | f 20//20 27//27 7//7 142 | f 7//7 27//27 2//2 143 | f 7//7 2//2 28//28 144 | f 27//27 23//23 26//26 145 | f 27//27 26//26 2//2 146 | # 64 faces, 0 coords texture 147 | 148 | # End of File 149 | -------------------------------------------------------------------------------- /datas/vis/cylinder5.obj: -------------------------------------------------------------------------------- 1 | #### 2 | # 3 | # OBJ File Generated by Meshlab 4 | # 5 | #### 6 | # Object cylinder.obj 7 | # 8 | # Vertices: 52 9 | # Faces: 100 10 | # 11 | #### 12 | v 0.093865 0.153960 -0.731799 13 | v 0.197468 -0.057727 -0.633978 14 | v 0.212317 -0.144301 0.119305 15 | v 0.166168 -0.148016 0.508105 16 | v 0.232861 -0.038541 0.429329 17 | v 0.256829 0.040625 -0.144090 18 | v 0.197438 -0.143172 -0.319540 19 | v 0.215567 0.131134 0.247362 20 | v 0.107518 -0.233635 0.078843 21 | v 0.078836 -0.177179 -0.696732 22 | v 0.008688 -0.255726 0.032711 23 | v 0.072946 -0.196526 0.602173 24 | v 0.044056 -0.229222 -0.430819 25 | v 0.016628 0.025443 -1.012275 26 | v -0.055841 0.077088 -0.943601 27 | v -0.024283 0.176929 0.756259 28 | v -0.017026 -0.001155 1.023020 29 | v -0.026714 -0.173646 0.740966 30 | v -0.093062 -0.169719 -0.690675 31 | v -0.083611 -0.101389 -0.884623 32 | v -0.067667 -0.023662 -0.976442 33 | v -0.058150 0.173030 -0.727062 34 | v -0.146859 0.145645 0.596751 35 | v -0.198891 0.086231 0.558556 36 | v -0.240850 -0.049928 0.325791 37 | v -0.156166 0.047324 -0.792205 38 | v -0.128538 -0.214038 -0.269227 39 | v -0.074753 -0.238176 0.277169 40 | v -0.035818 -0.095484 0.943630 41 | v -0.144875 0.201846 -0.318197 42 | v 0.003075 0.257877 -0.014142 43 | v -0.020606 0.244488 0.328103 44 | v -0.116451 0.068167 0.856456 45 | v -0.150499 -0.160229 0.524284 46 | v -0.167031 -0.179759 0.325358 47 | v -0.184872 -0.066034 -0.650355 48 | v -0.212560 0.064330 -0.535415 49 | v -0.151312 -0.052826 0.806136 50 | v -0.230283 -0.100935 -0.274934 51 | v -0.163662 0.196052 0.114721 52 | v -0.254664 0.053426 0.076916 53 | v 0.134226 0.214080 0.123038 54 | v 0.061224 0.236579 -0.365307 55 | v 0.061819 0.101036 -0.910025 56 | v 0.053386 -0.064668 -0.964813 57 | v 0.151800 -0.029380 -0.840531 58 | v 0.140029 0.189694 0.427889 59 | v 0.124159 0.138760 0.729675 60 | v 0.128863 -0.020228 0.902456 61 | v 0.070550 -0.116671 0.866481 62 | v -0.010380 0.062701 0.996914 63 | v 0.187029 0.143688 -0.435086 64 | # 52 vertices, 0 vertices normals 65 | 66 | f 8 52 42 67 | f 8 6 52 68 | f 52 1 43 69 | f 46 1 52 70 | f 10 2 7 71 | f 9 7 3 72 | f 9 3 4 73 | f 5 8 48 74 | f 3 7 6 75 | f 2 6 7 76 | f 4 3 5 77 | f 48 8 47 78 | f 11 13 9 79 | f 12 11 9 80 | f 28 11 12 81 | f 10 19 20 82 | f 44 15 22 83 | f 27 11 28 84 | f 30 26 37 85 | f 24 25 38 86 | f 38 25 34 87 | f 41 39 25 88 | f 41 37 39 89 | f 37 26 36 90 | f 27 28 35 91 | f 16 32 23 92 | f 32 40 23 93 | f 31 30 40 94 | f 32 31 40 95 | f 33 23 24 96 | f 33 24 38 97 | f 36 19 39 98 | f 39 37 36 99 | f 39 19 27 100 | f 39 27 35 101 | f 25 39 35 102 | f 34 25 35 103 | f 34 18 38 104 | f 35 28 34 105 | f 51 33 17 106 | f 17 38 29 107 | f 33 38 17 108 | f 16 23 33 109 | f 16 33 51 110 | f 29 38 18 111 | f 28 18 34 112 | f 20 26 21 113 | f 36 26 20 114 | f 19 36 20 115 | f 30 37 41 116 | f 24 40 41 117 | f 40 30 41 118 | f 25 24 41 119 | f 40 24 23 120 | f 22 26 30 121 | f 26 15 21 122 | f 15 26 22 123 | f 15 14 21 124 | f 18 50 29 125 | f 29 49 17 126 | f 51 48 16 127 | f 47 32 16 128 | f 47 42 32 129 | f 1 22 43 130 | f 1 44 22 131 | f 46 14 44 132 | f 1 46 44 133 | f 45 14 46 134 | f 21 45 20 135 | f 14 45 21 136 | f 51 49 48 137 | f 49 51 17 138 | f 42 52 43 139 | f 42 43 31 140 | f 42 31 32 141 | f 47 16 48 142 | f 50 49 29 143 | f 18 12 50 144 | f 28 12 18 145 | f 43 30 31 146 | f 43 22 30 147 | f 44 14 15 148 | f 45 10 20 149 | f 19 13 27 150 | f 27 13 11 151 | f 19 10 13 152 | f 46 10 45 153 | f 12 4 50 154 | f 50 4 49 155 | f 8 42 47 156 | f 3 6 5 157 | f 5 6 8 158 | f 49 4 5 159 | f 49 5 48 160 | f 9 4 12 161 | f 9 13 7 162 | f 10 7 13 163 | f 2 10 46 164 | f 2 52 6 165 | f 2 46 52 166 | # 100 faces, 0 coords texture 167 | 168 | # End of File 169 | -------------------------------------------------------------------------------- /datas/vis/env_sh.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/datas/vis/env_sh.npy -------------------------------------------------------------------------------- /datas/vis/sphere2.obj: -------------------------------------------------------------------------------- 1 | #### 2 | # 3 | # OBJ File Generated by Meshlab 4 | # 5 | #### 6 | # Object sphere2.obj 7 | # 8 | # Vertices: 22 9 | # Faces: 40 10 | # 11 | #### 12 | vn -0.286044 0.954256 0.087034 13 | v -0.279364 1.009158 0.162307 14 | vn -0.820476 -0.285511 -0.495281 15 | v -0.877018 -0.269155 -0.592064 16 | vn -0.072136 -0.796696 -0.600060 17 | v -0.103003 -0.894468 -0.607915 18 | vn 0.113038 0.063435 -0.991564 19 | v 0.339814 0.189820 -0.990556 20 | vn 0.487548 -0.872777 -0.023584 21 | v 0.510931 -0.925432 -0.147252 22 | vn 0.814094 -0.211569 -0.540823 23 | v 0.841951 -0.288337 -0.593851 24 | vn 0.376864 -0.060604 0.924284 25 | v 0.339814 -0.189820 0.990556 26 | vn 0.094573 -0.725490 0.681704 27 | v 0.037600 -0.772517 0.695454 28 | vn 0.548815 0.531815 0.644961 29 | v 0.572430 0.546933 0.658999 30 | vn -0.094216 0.818144 -0.567243 31 | v -0.088387 0.821730 -0.622634 32 | vn -0.438962 -0.030567 0.897985 33 | v -0.530344 -0.032789 0.916169 34 | vn -0.055417 0.706155 0.705886 35 | v -0.035206 0.867863 0.661428 36 | vn 0.936384 0.278141 0.214062 37 | v 0.974666 0.231455 0.360465 38 | vn 0.842266 -0.440414 0.310844 39 | v 0.997333 -0.330848 0.241665 40 | vn -0.901265 0.332632 0.277629 41 | v -0.921458 0.393211 0.328351 42 | vn -0.176525 -0.950605 0.255323 43 | v -0.099368 -0.971468 0.319262 44 | vn -0.763313 -0.458839 0.454774 45 | v -0.792092 -0.451452 0.514189 46 | vn 0.475728 0.879082 0.029948 47 | v 0.566468 0.871497 -0.023265 48 | vn -0.699056 0.273142 -0.660843 49 | v -0.761280 0.242285 -0.735231 50 | vn -0.650489 -0.759511 -0.002582 51 | v -0.731736 -0.757204 0.044245 52 | vn -0.711267 0.670298 -0.211661 53 | v -0.819003 0.650852 -0.160755 54 | vn 0.673199 0.550071 -0.494191 55 | v 0.591924 0.659171 -0.560970 56 | # 22 vertices, 0 vertices normals 57 | 58 | f 15//15 11//11 12//12 59 | f 8//8 5//5 14//14 60 | f 11//11 15//15 17//17 61 | f 7//7 11//11 8//8 62 | f 16//16 20//20 3//3 63 | f 11//11 7//7 12//12 64 | f 14//14 5//5 6//6 65 | f 11//11 17//17 8//8 66 | f 10//10 18//18 22//22 67 | f 12//12 7//7 9//9 68 | f 7//7 13//13 9//9 69 | f 13//13 7//7 14//14 70 | f 8//8 17//17 16//16 71 | f 12//12 18//18 1//1 72 | f 17//17 20//20 16//16 73 | f 7//7 8//8 14//14 74 | f 12//12 1//1 15//15 75 | f 13//13 18//18 9//9 76 | f 18//18 12//12 9//9 77 | f 16//16 5//5 8//8 78 | f 17//17 2//2 20//20 79 | f 19//19 21//21 10//10 80 | f 13//13 6//6 22//22 81 | f 1//1 21//21 15//15 82 | f 15//15 2//2 17//17 83 | f 1//1 18//18 10//10 84 | f 15//15 21//21 19//19 85 | f 2//2 15//15 19//19 86 | f 16//16 3//3 5//5 87 | f 13//13 14//14 6//6 88 | f 18//18 13//13 22//22 89 | f 21//21 1//1 10//10 90 | f 3//3 20//20 2//2 91 | f 6//6 4//4 22//22 92 | f 6//6 5//5 3//3 93 | f 10//10 22//22 4//4 94 | f 10//10 4//4 19//19 95 | f 4//4 6//6 3//3 96 | f 19//19 4//4 2//2 97 | f 4//4 3//3 2//2 98 | # 40 faces, 0 coords texture 99 | 100 | # End of File 101 | -------------------------------------------------------------------------------- /datasets/__init__.py: -------------------------------------------------------------------------------- 1 | datasets = {} 2 | 3 | def register(name): 4 | def decorator(cls): 5 | datasets[name] = cls 6 | return cls 7 | return decorator 8 | 9 | 10 | def make(name, config): 11 | dataset = datasets[name](config) 12 | return dataset 13 | 14 | 15 | from . import domedenseraw, domedenserawseq_meta 16 | -------------------------------------------------------------------------------- /evaluations/00_move_Mesh_GT.py: -------------------------------------------------------------------------------- 1 | """ 2 | @Author: Guoxing Sun 3 | @Email: gsun@mpi-inf.mpg.de 4 | @Date: 2023-11-03 5 | """ 6 | 7 | import os 8 | import os.path as osp 9 | import pdb 10 | import sys 11 | sys.path.append('..') 12 | import glob 13 | import numpy as np 14 | import trimesh 15 | from sys import platform 16 | import shutil 17 | from multiprocessing import Pool 18 | import cv2 19 | from tqdm import tqdm 20 | import matplotlib.pyplot as plt 21 | import argparse 22 | 23 | from tools.omni_tools import makePath, checkPlatformDir, resizeImg, setup_logger, copyFile 24 | from tools.cam_tools import loadCameraJson 25 | from tools.metric_tools import get_chamfer_dist, get_surface_dist, get_psnr, get_ssim, my_lpips, get_normal_dist, get_mesh_iou 26 | from datasets.human_info import human_info 27 | 28 | if __name__ == '__main__': 29 | logger, _ = setup_logger(save=False) 30 | baseDir = checkPlatformDir('/CT/HOIMOCAP4/work/results/metacap/exp') 31 | outDir = checkPlatformDir('/CT/HOIMOCAP4/work/results/MetaCap_Summary') 32 | subjectList = [ 33 | 'Subject0002', 34 | # 'Subject0003', 35 | # 'Subject0005', 36 | # 'Subject0027', 37 | ] 38 | for subj in subjectList: 39 | clothType = human_info[subj]['cloth'] 40 | fileList = glob.glob( 41 | checkPlatformDir( 42 | '{}/{}/neus-domedense-{}-*-test/World_GT@*/save/T_w2s.npz'.format( 43 | baseDir, subj, subj) 44 | )) 45 | fileList = [ item.replace('\\', '/') for item in fileList] 46 | for item in fileList: 47 | fIdx = item.split('/')[8].split('-')[3] 48 | pathInTemp = osp.dirname(item) 49 | fileListSub = os.listdir(pathInTemp) 50 | if 'it0-test' in fileListSub: 51 | imgFolder = 'it0-test' 52 | meshName = 'it0-mc[256, 512, 256]_world.obj' 53 | else: 54 | imgFolder = 'it3000-test' 55 | meshName = 'it3000-mc[256, 512, 256]_world.obj' 56 | pathOut = osp.join(outDir, subj, clothType, "GT", str(fIdx).zfill(6)) 57 | makePath(pathOut) 58 | logger.info(pathInTemp + ' | | ' + pathOut) 59 | for i in range(6): 60 | pathIn = osp.join(pathInTemp, imgFolder) 61 | copyFile(pathIn, pathOut, '{}.png'.format(i)) 62 | copyFile(pathInTemp, pathOut, meshName, str(fIdx).zfill(6) + '.obj') -------------------------------------------------------------------------------- /evaluations/00_move_RGB_Mask_GT.py: -------------------------------------------------------------------------------- 1 | """ 2 | @Author: Guoxing Sun 3 | @Email: gsun@mpi-inf.mpg.de 4 | @Date: 2023-11-03 5 | """ 6 | 7 | import os 8 | import os.path as osp 9 | import sys 10 | sys.path.append('..') 11 | import glob 12 | import numpy as np 13 | import trimesh 14 | from sys import platform 15 | import shutil 16 | from multiprocessing import Pool 17 | import cv2 18 | from tqdm import tqdm 19 | import matplotlib.pyplot as plt 20 | import argparse 21 | 22 | from tools.omni_tools import makePath, checkPlatformDir, resizeImg, setup_logger, copyFile 23 | from tools.cam_tools import loadCameraJson 24 | from tools.metric_tools import get_chamfer_dist, get_surface_dist, get_psnr, get_ssim, my_lpips, get_normal_dist, get_mesh_iou 25 | from datasets.human_info import human_info 26 | 27 | np.set_printoptions(precision = 3, suppress=True) 28 | 29 | if __name__ == '__main__': 30 | logger, _ = setup_logger(save=False) 31 | baseDir = checkPlatformDir('/CT/HOIMOCAP4/work/data/WildDynaCap_official') 32 | outDir = checkPlatformDir('/CT/HOIMOCAP4/work/results/MetaCap_Summary') 33 | subjectList = [ 34 | 'Subject0002', 35 | # 'Subject0003', 36 | # 'Subject0005', 37 | # 'Subject0027', 38 | ] 39 | for subj in subjectList: 40 | clothType = human_info[subj]['cloth'] 41 | evalIdxList = human_info[subj]['test']['evalView'] 42 | 43 | idxList = human_info[subj]['test']['evalFrame'] 44 | for fIdx in tqdm(idxList): 45 | pathOut = osp.join(outDir, subj, clothType, "GT", str(fIdx).zfill(6)) 46 | makePath(pathOut) 47 | for i in range(6): 48 | cIdx = evalIdxList[i] 49 | pathIn = osp.join(baseDir, subj, clothType, "testing", "recon_neus2", "imgs", str(fIdx).zfill(6), ) 50 | copyFile(pathIn, pathOut, "image_c_{}_f_{}.png".format(str(cIdx).zfill(3) , str(fIdx).zfill(6)) , 'RGB_{}.png'.format(i)) 51 | -------------------------------------------------------------------------------- /evaluations/00_move_metacap.py: -------------------------------------------------------------------------------- 1 | """ 2 | @Author: Guoxing Sun 3 | @Email: gsun@mpi-inf.mpg.de 4 | @Date: 2023-11-03 5 | """ 6 | 7 | import os 8 | import os.path as osp 9 | import sys 10 | sys.path.append('..') 11 | import glob 12 | import numpy as np 13 | import trimesh 14 | from sys import platform 15 | import shutil 16 | from multiprocessing import Pool 17 | import cv2 18 | from tqdm import tqdm 19 | import matplotlib.pyplot as plt 20 | import argparse 21 | 22 | from tools.omni_tools import makePath, checkPlatformDir, resizeImg, setup_logger, copyFile 23 | from tools.cam_tools import loadCameraJson 24 | from tools.metric_tools import get_chamfer_dist, get_surface_dist, get_psnr, get_ssim, my_lpips, get_normal_dist, get_mesh_iou 25 | from datasets.human_info import human_info 26 | 27 | 28 | 29 | if __name__ == '__main__': 30 | logger, _ = setup_logger(save=False) 31 | baseDir = checkPlatformDir('/CT/HOIMOCAP4/work/results/metacap/exp') 32 | outDir = checkPlatformDir('/CT/HOIMOCAP4/work/results/MetaCap_Summary') 33 | subjectList = [ 34 | 'Subject0002', 35 | # 'Subject0003', 36 | # 'Subject0005', 37 | # 'Subject0027', 38 | ] 39 | for subj in subjectList: 40 | clothType = human_info[subj]['cloth'] 41 | fileList = glob.glob( 42 | checkPlatformDir( 43 | '{}/{}/neus-domedense-{}-*-test/Cano_Meta_DDC@*/save/T_w2s.npz'.format( 44 | baseDir, subj, subj) 45 | )) 46 | fileList = [ item.replace('\\', '/') for item in fileList] 47 | for item in tqdm(fileList): 48 | fIdx = item.split('/')[8].split('-')[3] 49 | pathInTemp = osp.dirname(item) 50 | fileListSub = os.listdir(pathInTemp) 51 | if 'it0-test' in fileListSub: 52 | imgFolder = 'it0-test' 53 | meshName = 'it0-mc[256, 512, 256]_world.obj' 54 | else: 55 | imgFolder = 'it3000-test' 56 | meshName = 'it3000-mc[256, 512, 256]_world.obj' 57 | pathOut = osp.join(outDir, subj, clothType, "MetaCap", str(fIdx).zfill(6)) 58 | makePath(pathOut) 59 | logger.info(pathInTemp + ' | | ' + pathOut) 60 | for i in range(6): 61 | pathIn = osp.join(pathInTemp, imgFolder) 62 | copyFile(pathIn, pathOut, '{}.png'.format(i) , '{}.png'.format(i)) 63 | copyFile(pathInTemp, pathOut, meshName, str(fIdx).zfill(6) + '.obj') 64 | 65 | 66 | -------------------------------------------------------------------------------- /evaluations/00_prepare_T_w2s.py: -------------------------------------------------------------------------------- 1 | """ 2 | @Author: Guoxing Sun 3 | @Email: gsun@mpi-inf.mpg.de 4 | @Date: 2023-11-03 5 | """ 6 | 7 | import os 8 | import os.path as osp 9 | import sys 10 | sys.path.append('..') 11 | import glob 12 | import numpy as np 13 | import trimesh 14 | from sys import platform 15 | import shutil 16 | from multiprocessing import Pool 17 | import cv2 18 | from tqdm import tqdm 19 | import matplotlib.pyplot as plt 20 | import argparse 21 | 22 | from tools.omni_tools import makePath, checkPlatformDir, resizeImg, setup_logger, copyFile 23 | from tools.cam_tools import loadCameraJson 24 | from tools.metric_tools import get_chamfer_dist, get_surface_dist, get_psnr, get_ssim, my_lpips, get_normal_dist, get_mesh_iou 25 | from datasets.human_info import human_info 26 | 27 | if __name__ == '__main__': 28 | logger, _ = setup_logger(save=False) 29 | baseDir = checkPlatformDir('/CT/HOIMOCAP4/work/results/metacap/exp') 30 | outDir = checkPlatformDir('/CT/HOIMOCAP4/work/results/MetaCap_Summary') 31 | subjectList = [ 32 | 'Subject0002', 33 | # 'Subject0003', 34 | # 'Subject0005', 35 | # 'Subject0027', 36 | ] 37 | for subj in subjectList: 38 | clothType = human_info[subj]['cloth'] 39 | fileList = glob.glob( 40 | checkPlatformDir( 41 | '{}/{}/neus-domedense-{}-*-test/World_GT@*/save/T_w2s.npz'.format( 42 | baseDir, subj, subj) 43 | )) 44 | fileList = [ item.replace('\\', '/') for item in fileList] 45 | for item in fileList: 46 | fIdx = item.split('/')[8].split('-')[3] 47 | # ckptPath = item 48 | # print(fIdx) 49 | pathIn = osp.dirname(item) 50 | baseName = osp.basename(item) 51 | pathOut = osp.join(outDir, subj, clothType, "T_w2s", str(fIdx).zfill(6)) 52 | makePath(pathOut) 53 | copyFile(pathIn, pathOut, baseName) 54 | print() 55 | # -------------------------------------------------------------------------------- /evaluations/01_evaluate_mesh_metacap.py: -------------------------------------------------------------------------------- 1 | """ 2 | @Author: Guoxing Sun 3 | @Email: gsun@mpi-inf.mpg.de 4 | @Date: 2023-11-03 5 | """ 6 | 7 | import os 8 | import os.path as osp 9 | import sys 10 | sys.path.append('..') 11 | import glob 12 | import numpy as np 13 | import trimesh 14 | from sys import platform 15 | import shutil 16 | from multiprocessing import Pool 17 | import cv2 18 | from tqdm import tqdm 19 | import matplotlib.pyplot as plt 20 | import argparse 21 | 22 | from tools.omni_tools import makePath, checkPlatformDir, resizeImg, setup_logger, copyFile 23 | from tools.cam_tools import loadCameraJson 24 | from tools.metric_tools import get_chamfer_dist, get_surface_dist, get_psnr, get_ssim, my_lpips, get_normal_dist, get_mesh_iou 25 | from datasets.human_info import human_info 26 | 27 | 28 | if __name__ == '__main__': 29 | logger, _ = setup_logger(save=False) 30 | baseDir = checkPlatformDir('/CT/HOIMOCAP4/work/results/MetaCap_Summary') 31 | subjectList = [ 32 | 'Subject0002', 33 | # 'Subject0003', 34 | # 'Subject0005', 35 | # 'Subject0027', 36 | ] 37 | parser = argparse.ArgumentParser(description="MetaCap") 38 | parser.add_argument("-subi", '--subject_idx', default=0, help="max epoch", type=int) 39 | args = parser.parse_args() 40 | subject_idx = args.subject_idx 41 | subj = subjectList[subject_idx] 42 | clothType = human_info[subj]['cloth'] 43 | idxList = human_info[subj]['test']['evalFrame'] 44 | 45 | for idx in tqdm(idxList): 46 | meshPath = osp.join(baseDir, subj, clothType, "MetaCap", str(idx).zfill(6), "{}.obj".format(str(idx).zfill(6))) 47 | meshPathGT = osp.join(baseDir, subj, clothType, "GT", str(idx).zfill(6), str(idx).zfill(6) + ".obj" ) 48 | outDir = osp.dirname(meshPath) 49 | GTDir = osp.dirname(meshPathGT) 50 | logger.info(osp.dirname(meshPath)) 51 | 52 | meshPred = trimesh.load(meshPath, process=False) 53 | # meshPred.apply_transform(T_w2s) 54 | meshGT = trimesh.load(meshPathGT, process=False) 55 | 56 | chamfer = get_chamfer_dist(meshGT, meshPred) 57 | p2s = get_surface_dist(meshGT, meshPred) 58 | iou = get_mesh_iou(meshGT, meshPred) 59 | nmlcosList = [] 60 | nmll2List = [] 61 | maskCommonList = [] 62 | for i in range(6): 63 | normPredTemp = cv2.imread(osp.join(outDir, str(i) + '.png'), -1) 64 | normPred = normPredTemp[:, 3600:4800,:3][:,:,::-1] 65 | maskPred = normPredTemp[:, 4800:, :3] 66 | 67 | normGTTemp = cv2.imread(osp.join(GTDir, str(i) + '.png'), -1) 68 | normGT = normGTTemp[:, 3600:4800,:3][:,:,::-1] 69 | maskGT = normGTTemp[:, 4800:,:3] 70 | 71 | maskPred = cv2.cvtColor(maskPred, cv2.COLOR_BGR2GRAY) 72 | _, maskPred = cv2.threshold(maskPred, 210, 255, cv2.THRESH_BINARY) 73 | maskGT = cv2.cvtColor(maskGT, cv2.COLOR_BGR2GRAY) 74 | _, maskGT = cv2.threshold(maskGT, 210, 255, cv2.THRESH_BINARY) 75 | 76 | maskCommon = cv2.bitwise_and(maskPred, maskGT) 77 | maskCommonList.append(maskCommon) 78 | 79 | nmlcos, nmll2, cos_diff_map_pred, l2_diff_map_pred = get_normal_dist(normGT, normPred, maskCommon[:,:,None]) 80 | nmlcosList.append(nmlcos) 81 | nmll2List.append(nmll2) 82 | # logger.info('{}_{} | nmlcos: {} nmll2: {} nml0.3: {}'.format(idx, i, nmlcos, nmll2, (cos_diff_map_pred[maskCommon>0]<0.01).sum() / (maskCommon>0).sum())) 83 | 84 | logger.info('{} | chamfer: {} p2s: {} iou: {}'.format(idx, chamfer, p2s, iou)) 85 | cv2.imwrite(osp.join(outDir, 'debug_mask_common.png'), np.concatenate(maskCommonList,1)) 86 | outPath = osp.join( outDir, 'eval_geo.npz') 87 | np.savez(outPath, 88 | chamfer = np.array(chamfer).reshape(1, 1), 89 | p2s = np.array(p2s).reshape(1, 1), 90 | iou = np.array(iou).reshape(1, 1), 91 | nmlcos = np.array(nmlcosList).reshape(1, 6), 92 | nmll2 = np.array(nmll2List).reshape(1, 6), 93 | ) 94 | -------------------------------------------------------------------------------- /evaluations/01_evaluate_rgb_metacap.py: -------------------------------------------------------------------------------- 1 | """ 2 | @Author: Guoxing Sun 3 | @Email: gsun@mpi-inf.mpg.de 4 | @Date: 2023-11-03 5 | """ 6 | 7 | import os 8 | import os.path as osp 9 | import sys 10 | sys.path.append('..') 11 | import glob 12 | import numpy as np 13 | import trimesh 14 | from sys import platform 15 | import shutil 16 | from multiprocessing import Pool 17 | import cv2 18 | from tqdm import tqdm 19 | import matplotlib.pyplot as plt 20 | import argparse 21 | 22 | from tools.omni_tools import makePath, checkPlatformDir, resizeImg, setup_logger, copyFile 23 | from tools.cam_tools import loadCameraJson 24 | from tools.metric_tools import get_chamfer_dist, get_surface_dist, get_psnr, get_ssim, my_lpips, get_normal_dist, get_mesh_iou 25 | from datasets.human_info import human_info 26 | 27 | 28 | if __name__ == '__main__': 29 | logger, _ = setup_logger(save=False) 30 | baseDir = checkPlatformDir('/CT/HOIMOCAP4/work/results/MetaCap_Summary') 31 | subjectList = [ 32 | 'Subject0002', 33 | # 'Subject0003', 34 | # 'Subject0005', 35 | # 'Subject0027', 36 | ] 37 | get_lpips = my_lpips() 38 | parser = argparse.ArgumentParser(description="MetaCap") 39 | parser.add_argument("-subi", '--subject_idx', default=0, help="max epoch", type=int) 40 | args = parser.parse_args() 41 | subject_idx = args.subject_idx 42 | subj = subjectList[subject_idx] 43 | clothType = human_info[subj]['cloth'] 44 | idxList = human_info[subj]['test']['evalFrame'] 45 | 46 | for idx in tqdm(idxList): 47 | meshPath = osp.join(baseDir, subj, clothType, "MetaCap", str(idx).zfill(6), "{}.obj".format(str(idx).zfill(6))) 48 | meshPathGT = osp.join(baseDir, subj, clothType, "GT", str(idx).zfill(6), str(idx).zfill(6) + ".obj" ) 49 | outDir = osp.dirname(meshPath) 50 | GTDir = osp.dirname(meshPathGT) 51 | 52 | psnrList = [] 53 | ssimList = [] 54 | lpipsList = [] 55 | maskCommonList = [] 56 | for i in range(6): 57 | rgbPredTemp = cv2.imread(osp.join(outDir, str(i) + '.png'), -1) 58 | rgbPred = rgbPredTemp[:, 1200: 2400,:3][:,:,::-1] 59 | maskPred = rgbPredTemp[:, 4800:, :3] 60 | _, maskPred = cv2.threshold(maskPred, 210, 255, cv2.THRESH_BINARY) 61 | rgbPred = np.where(maskPred==255, rgbPred, 0) 62 | 63 | rgbGTTemp = cv2.imread(osp.join(GTDir, 'RGB_' + str(i) + '.png'), -1) 64 | rgbGT = rgbGTTemp[:, 0: 1200,:3][:,:,::-1] 65 | maskGT = rgbGTTemp[:, 0 : 1200, 3:] 66 | _, maskGT = cv2.threshold(maskGT, 210, 255, cv2.THRESH_BINARY) 67 | 68 | lpips = get_lpips.forward(rgbGT/255.0, rgbPred/255.0, maskGT) 69 | psnr = get_psnr(rgbGT/255.0, rgbPred/255.0) 70 | ssim = get_ssim(rgbGT/255.0, rgbPred/255.0, maskGT) 71 | 72 | logger.info('{}_{} | lpips: {} psnr: {} ssim: {}'.format(idx, i, lpips, psnr, ssim)) 73 | psnrList.append( psnr ) 74 | ssimList.append( ssim ) 75 | lpipsList.append( lpips ) 76 | 77 | outPath = osp.join( outDir, 'eval_rgb.npz') 78 | np.savez(outPath, 79 | psnr = np.array(psnrList).reshape(1, 6), 80 | ssim = np.array(ssimList).reshape(1, 6), 81 | lpips=np.array(lpipsList).reshape(1, 6), 82 | ) 83 | 84 | -------------------------------------------------------------------------------- /evaluations/02_summary_evaluate_metacap.py: -------------------------------------------------------------------------------- 1 | """ 2 | @Author: Guoxing Sun 3 | @Email: gsun@mpi-inf.mpg.de 4 | @Date: 2023-11-03 5 | """ 6 | 7 | import os 8 | import os.path as osp 9 | import sys 10 | sys.path.append('..') 11 | import glob 12 | import numpy as np 13 | import trimesh 14 | from sys import platform 15 | import shutil 16 | from multiprocessing import Pool 17 | import cv2 18 | from tqdm import tqdm 19 | import matplotlib.pyplot as plt 20 | import argparse 21 | 22 | from tools.omni_tools import makePath, checkPlatformDir, resizeImg, setup_logger, copyFile 23 | from tools.cam_tools import loadCameraJson 24 | from tools.metric_tools import get_chamfer_dist, get_surface_dist, get_psnr, get_ssim, my_lpips, get_normal_dist, get_mesh_iou 25 | from datasets.human_info import human_info 26 | 27 | 28 | if __name__ == '__main__': 29 | logger, _ = setup_logger(save=False) 30 | baseDir = checkPlatformDir('/CT/HOIMOCAP4/work/results/MetaCap_Summary') 31 | subjectList = [ 32 | 'Subject0002', 33 | # 'Subject0003', 34 | # 'Subject0005', 35 | # 'Subject0027', 36 | ] 37 | parser = argparse.ArgumentParser(description="MetaCap") 38 | parser.add_argument("-subi", '--subject_idx', default=0, help="max epoch", type=int) 39 | args = parser.parse_args() 40 | subject_idx = args.subject_idx 41 | subj = subjectList[subject_idx] 42 | # clothType = human_info[subj]['cloth'] 43 | # idxList = human_info[subj]['test']['evalFrame'] 44 | 45 | for subj in subjectList: 46 | # subj = subjectList[slurm_id] 47 | clothType = human_info[subj]['cloth'] 48 | idxList = human_info[subj]['test']['evalFrame'] 49 | 50 | chamferList = [] 51 | p2sList = [] 52 | iouList = [] 53 | nmlcosList = [] 54 | nmll2List = [] 55 | 56 | psnrList = [] 57 | ssimList = [] 58 | lpipsList = [] 59 | for idx in tqdm(idxList): 60 | meshPath = osp.join(baseDir, subj, clothType, "MetaCap", str(idx).zfill(6), "{}.obj".format(str(idx).zfill(6))) 61 | meshPathGT = osp.join(baseDir, subj, clothType, "GT", str(idx).zfill(6), str(idx).zfill(6) + ".obj" ) 62 | outDir = osp.dirname(meshPath) 63 | GTDir = osp.dirname(meshPathGT) 64 | 65 | outPath = osp.join( outDir, 'eval_geo.npz') 66 | dataz = np.load(outPath) 67 | chamferList.append( dataz['chamfer'] ) 68 | p2sList.append( dataz['p2s'] ) 69 | iouList.append( dataz['iou'] ) 70 | nmlcosList.append( dataz['nmlcos'] ) 71 | nmll2List.append( dataz['nmll2'] ) 72 | 73 | outPath2 = osp.join( outDir, 'eval_rgb.npz') 74 | dataz2 = np.load(outPath2) 75 | psnrList.append(dataz2['psnr']) 76 | ssimList.append(dataz2['ssim']) 77 | lpipsList.append(dataz2['lpips']) 78 | chamferList = np.concatenate(chamferList, 0) 79 | p2sList = np.concatenate(p2sList, 0) 80 | iouList = np.concatenate(iouList, 0) 81 | nmlcosList = np.concatenate(nmlcosList, 0) 82 | nmll2List = np.concatenate(nmll2List, 0) 83 | 84 | 85 | psnrList = np.concatenate(psnrList, 0) 86 | ssimList = np.concatenate(ssimList, 0) 87 | lpipsList = np.concatenate(lpipsList, 0) 88 | print("\n {:<30} \n NmlCos : {:2.3f} \n NmlL2 : {:2.3f} \n\n Chamfer : {:.3f} \n P2S : {:.3f} \n IOU : {:.3f} \n\n".format(subj, 89 | nmlcosList.mean(), nmll2List.mean(), 90 | chamferList.mean(), 91 | p2sList.mean(), iouList.mean(), 92 | )) 93 | 94 | 95 | print("\n {:<30} \n PSNR : {:2.3f} \n SSIM : {:2.3f} \n LPIPS : {:2.3f} \n\n ".format(subj, 96 | psnrList.mean(), ssimList.mean(), 97 | lpipsList.mean(), 98 | )) 99 | -------------------------------------------------------------------------------- /models/__init__.py: -------------------------------------------------------------------------------- 1 | models = {} 2 | 3 | 4 | def register(name): 5 | def decorator(cls): 6 | models[name] = cls 7 | return cls 8 | return decorator 9 | 10 | 11 | def make(name, config): 12 | model = models[name](config) 13 | return model 14 | 15 | 16 | from . import neus, geometry, texture 17 | -------------------------------------------------------------------------------- /models/base.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import torch.nn as nn 3 | 4 | from tools.utils.misc import get_rank 5 | 6 | class BaseModel(nn.Module): 7 | def __init__(self, config): 8 | super().__init__() 9 | # self.config = config.model.geometry 10 | self.config = config 11 | # self.config_full = config 12 | self.rank = get_rank() 13 | self.setup() 14 | # import pdb 15 | # pdb.set_trace() 16 | # if self.config.get('weights', None): 17 | # self.load_state_dict(torch.load(self.config.weights), strict = False) 18 | 19 | def setup(self): 20 | raise NotImplementedError 21 | 22 | def update_step(self, epoch, global_step): 23 | pass 24 | 25 | def train(self, mode=True): 26 | return super().train(mode=mode) 27 | 28 | def eval(self): 29 | return super().eval() 30 | 31 | def regularizations(self, out): 32 | return {} 33 | 34 | @torch.no_grad() 35 | def export(self, export_config): 36 | return {} 37 | -------------------------------------------------------------------------------- /models/texture.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import torch.nn as nn 3 | 4 | import models 5 | from models.utils import get_activation 6 | from models.network_utils import get_encoding, get_mlp 7 | from systems.utils import update_module_step 8 | 9 | 10 | @models.register('volume-radiance') 11 | class VolumeRadiance(nn.Module): 12 | def __init__(self, config): 13 | super(VolumeRadiance, self).__init__() 14 | self.config = config 15 | self.n_dir_dims = self.config.get('n_dir_dims', 3) 16 | self.n_output_dims = 3 17 | encoding = get_encoding(self.n_dir_dims, self.config.dir_encoding_config) 18 | self.n_input_dims = self.config.input_feature_dim + encoding.n_output_dims 19 | network = get_mlp(self.n_input_dims, self.n_output_dims, self.config.mlp_network_config) 20 | self.encoding = encoding 21 | self.network = network 22 | 23 | def forward(self, features, dirs, *args): 24 | dirs = (dirs + 1.) / 2. # (-1, 1) => (0, 1) 25 | dirs_embd = self.encoding(dirs.view(-1, self.n_dir_dims)) 26 | network_inp = torch.cat([features.view(-1, features.shape[-1]), dirs_embd] + [arg.view(-1, arg.shape[-1]) for arg in args], dim=-1) 27 | color = self.network(network_inp).view(*features.shape[:-1], self.n_output_dims).float() 28 | if 'color_activation' in self.config: 29 | color = get_activation(self.config.color_activation)(color) 30 | return color 31 | 32 | def update_step(self, epoch, global_step): 33 | update_module_step(self.encoding, epoch, global_step) 34 | 35 | def regularizations(self, out): 36 | return {} 37 | 38 | 39 | @models.register('volume-color') 40 | class VolumeColor(nn.Module): 41 | def __init__(self, config): 42 | super(VolumeColor, self).__init__() 43 | self.config = config 44 | self.n_output_dims = 3 45 | self.n_input_dims = self.config.input_feature_dim 46 | network = get_mlp(self.n_input_dims, self.n_output_dims, self.config.mlp_network_config) 47 | self.network = network 48 | 49 | def forward(self, features, *args): 50 | network_inp = features.view(-1, features.shape[-1]) 51 | color = self.network(network_inp).view(*features.shape[:-1], self.n_output_dims).float() 52 | if 'color_activation' in self.config: 53 | color = get_activation(self.config.color_activation)(color) 54 | return color 55 | 56 | def regularizations(self, out): 57 | return {} 58 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # 2 | pytorch-lightning<2 3 | omegaconf==2.2.3 4 | #nerfacc==0.3.3 5 | # 6 | joblib==1.3.2 7 | #av==10.0.0 8 | numpy==1.23.0 9 | chumpy==0.70 10 | PyMCubes==0.1.2 11 | pandas==2.0.2 12 | dotmap==1.3.30 13 | pyrender==0.1.45 14 | trimesh==3.21.6 15 | opencv-python==4.7.0.72 16 | imageio==2.13.3 17 | imageio-ffmpeg==0.4.8 18 | scikit-image==0.18.1 19 | scikit-learn==1.3.0 20 | scipy==1.10.1 21 | cython==3.0.6 22 | av==11.0.0 23 | # 24 | smplx==0.1.28 25 | tensorboard==2.13.0 26 | lpips 27 | #tinycudann==1.6 28 | #Torch 29 | #torch==1.13.1+cu116 30 | torch-efficient-distloss==0.1.3 31 | #torchmetrics==0.11.4 32 | #torchsparse==1.4.0 33 | #torchvision==0.14.1+cu116 -------------------------------------------------------------------------------- /submit_1gpu_12hour_s27_100Frame-100Camera.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #SBATCH -p gpu20 4 | #SBATCH -t 0-12:00:00 5 | #SBATCH -o /CT/HOIMOCAP/work/exps/slurm_outputs/%A_%a.out 6 | #SBATCH -e /CT/HOIMOCAP/work/exps/slurm_outputs/%A_%a.err 7 | #SBATCH -a 1 8 | #SBATCH --gres gpu:1 9 | #SBATCH --mem-per-cpu 18000 10 | 11 | # setup the slurm 12 | #. ./slurmSetup.sh 13 | 14 | echo $PWD 15 | 16 | eval "$(conda shell.bash hook)" 17 | echo "Activate metacap environment" 18 | conda activate metacap 19 | 20 | echo python launch.py --config configs/s27/metalearning/metaneusseq-domedenserawseq-ddc-s27-smooth2-24-more-newthreshold2-100Frame.yaml --gpu 0 --train tag=Test_Down2.0_Blur_100Frame_100Camera_DDC dataset.img_downscale=2.0 dataset.blur=True dataset.preload=True 21 | python launch.py --config configs/s27/metalearning/metaneusseq-domedenserawseq-ddc-s27-smooth2-24-more-newthreshold2-100Frame.yaml --gpu 0 --train tag=Test_Down2.0_Blur_100Frame_100Camera_DDC dataset.img_downscale=2.0 dataset.blur=True dataset.preload=True 22 | 23 | -------------------------------------------------------------------------------- /submit_1gpu_12hour_s2_100Frame-100Camera-SMPL.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #SBATCH -p gpu20 4 | #SBATCH -t 0-12:00:00 5 | #SBATCH -o /CT/HOIMOCAP/work/exps/slurm_outputs/%A_%a.out 6 | #SBATCH -e /CT/HOIMOCAP/work/exps/slurm_outputs/%A_%a.err 7 | #SBATCH -a 1 8 | #SBATCH --gres gpu:1 9 | #SBATCH --mem-per-cpu 18000 10 | 11 | # setup the slurm 12 | #. ./slurmSetup.sh 13 | 14 | echo $PWD 15 | 16 | eval "$(conda shell.bash hook)" 17 | echo "Activate metacap environment" 18 | conda activate metacap 19 | 20 | echo python launch.py --config configs/s2/metalearning/metaneusseq-domedenserawseq_meta-ddc-s2-smooth2-24-more-newthreshold0-100Frame-100Camera.yaml --gpu 0 --train tag=Test_Down2.0_Blur_100Frame_100Camera_SMPL dataset.img_downscale=2.0 dataset.blur=True dataset.preload=True dataset.deformer=smpl dataset.threshold_outer=0.075 21 | python launch.py --config configs/s2/metalearning/metaneusseq-domedenserawseq_meta-ddc-s2-smooth2-24-more-newthreshold0-100Frame-100Camera.yaml --gpu 0 --train tag=Test_Down2.0_Blur_100Frame_100Camera_SMPL dataset.img_downscale=2.0 dataset.blur=True dataset.preload=True dataset.deformer=smpl dataset.threshold_outer=0.075 22 | 23 | -------------------------------------------------------------------------------- /submit_1gpu_12hour_s2_100Frame-100Camera.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #SBATCH -p gpu20 4 | #SBATCH -t 0-12:00:00 5 | #SBATCH -o /CT/HOIMOCAP/work/exps/slurm_outputs/%A_%a.out 6 | #SBATCH -e /CT/HOIMOCAP/work/exps/slurm_outputs/%A_%a.err 7 | #SBATCH -a 1 8 | #SBATCH --gres gpu:1 9 | #SBATCH --mem-per-cpu 18000 10 | 11 | # setup the slurm 12 | #. ./slurmSetup.sh 13 | 14 | echo $PWD 15 | 16 | eval "$(conda shell.bash hook)" 17 | echo "Activate metacap environment" 18 | conda activate metacap 19 | 20 | echo python launch.py --config configs/s2/metalearning/metaneusseq-domedenserawseq_meta-ddc-s2-smooth2-24-more-newthreshold0-100Frame-100Camera.yaml --gpu 0 --train tag=Test_Down2.0_Blur_100Frame_100Camera_DDC dataset.img_downscale=2.0 dataset.blur=True dataset.preload=True 21 | python launch.py --config configs/s2/metalearning/metaneusseq-domedenserawseq_meta-ddc-s2-smooth2-24-more-newthreshold0-100Frame-100Camera.yaml --gpu 0 --train tag=Test_Down2.0_Blur_100Frame_100Camera_DDC dataset.img_downscale=2.0 dataset.blur=True dataset.preload=True 22 | 23 | -------------------------------------------------------------------------------- /submit_1gpu_12hour_s3_100Frame-100Camera.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #SBATCH -p gpu20 4 | #SBATCH -t 0-12:00:00 5 | #SBATCH -o /CT/HOIMOCAP/work/exps/slurm_outputs/%A_%a.out 6 | #SBATCH -e /CT/HOIMOCAP/work/exps/slurm_outputs/%A_%a.err 7 | #SBATCH -a 1 8 | #SBATCH --gres gpu:1 9 | #SBATCH --mem-per-cpu 18000 10 | 11 | # setup the slurm 12 | #. ./slurmSetup.sh 13 | 14 | echo $PWD 15 | 16 | eval "$(conda shell.bash hook)" 17 | echo "Activate metacap environment" 18 | conda activate metacap 19 | 20 | echo python launch.py --config configs/s3/metalearning/metaneusseq-domedenserawseq-ddc-s3-smooth2-24-more-newthreshold2-100Frame.yaml --gpu 0 --train tag=Test_Down2.0_Blur_100Frame_100Camera_DDC dataset.img_downscale=2.0 dataset.blur=True dataset.preload=True 21 | python launch.py --config configs/s3/metalearning/metaneusseq-domedenserawseq-ddc-s3-smooth2-24-more-newthreshold2-100Frame.yaml --gpu 0 --train tag=Test_Down2.0_Blur_100Frame_100Camera_DDC dataset.img_downscale=2.0 dataset.blur=True dataset.preload=True 22 | 23 | -------------------------------------------------------------------------------- /submit_1gpu_12hour_s5_100Frame-100Camera.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #SBATCH -p gpu20 4 | #SBATCH -t 0-12:00:00 5 | #SBATCH -o /CT/HOIMOCAP/work/exps/slurm_outputs/%A_%a.out 6 | #SBATCH -e /CT/HOIMOCAP/work/exps/slurm_outputs/%A_%a.err 7 | #SBATCH -a 1 8 | #SBATCH --gres gpu:1 9 | #SBATCH --mem-per-cpu 18000 10 | 11 | # setup the slurm 12 | #. ./slurmSetup.sh 13 | 14 | echo $PWD 15 | 16 | eval "$(conda shell.bash hook)" 17 | echo "Activate metacap environment" 18 | conda activate metacap 19 | 20 | 21 | echo python launch.py --config configs/s5/metalearning/metaneusseq-domedenserawseq-ddc-s5-smooth2-24-more-newthreshold0-pointcloud-zero4.yaml --gpu 0 --train tag=Test_Down2.0_Blur_100Frame_100Camera_DDC dataset.img_downscale=2.0 dataset.blur=True dataset.preload=True dataset.blur=True dataset.with_depth=True model.decay_step=300 dataset.depth_shift=-0.1 system.loss.lambda_eikonal=0.5 dataset.smoothDQ=True 22 | python launch.py --config configs/s5/metalearning/metaneusseq-domedenserawseq-ddc-s5-smooth2-24-more-newthreshold0-pointcloud-zero4.yaml --gpu 0 --train tag=Test_Down2.0_Blur_100Frame_100Camera_DDC dataset.img_downscale=2.0 dataset.blur=True dataset.preload=True dataset.blur=True dataset.with_depth=True model.decay_step=300 dataset.depth_shift=-0.1 system.loss.lambda_eikonal=0.5 dataset.smoothDQ=True 23 | -------------------------------------------------------------------------------- /systems/__init__.py: -------------------------------------------------------------------------------- 1 | systems = {} 2 | 3 | def register(name): 4 | def decorator(cls): 5 | systems[name] = cls 6 | return cls 7 | return decorator 8 | 9 | 10 | def make(name, config, load_from_checkpoint=None): 11 | if load_from_checkpoint is None: 12 | system = systems[name](config) 13 | else: 14 | system = systems[name].load_from_checkpoint(load_from_checkpoint, strict=False, config=config) 15 | return system 16 | 17 | 18 | from . import neus, metaneusseq, neusinterpolation 19 | -------------------------------------------------------------------------------- /systems/base.py: -------------------------------------------------------------------------------- 1 | import pytorch_lightning as pl 2 | 3 | import models 4 | from systems.utils import parse_optimizer, parse_scheduler, update_module_step 5 | from tools.utils.mixins import SaverMixin 6 | from tools.utils.misc import config_to_primitive, get_rank 7 | import torch 8 | from .utils import updateStateName 9 | 10 | 11 | 12 | class BaseSystem(pl.LightningModule, SaverMixin): 13 | """ 14 | Two ways to print to console: 15 | 1. self.print: correctly handle progress bar 16 | 2. rank_zero_info: use the logging module 17 | """ 18 | def __init__(self, config): 19 | super().__init__() 20 | self.config = config 21 | self.rank = get_rank() 22 | self.prepare() 23 | self.model = models.make(self.config.model.name, self.config.model) 24 | if not self.config.model.ckpt is None: 25 | state_dict = torch.load(self.config.model.ckpt, map_location=lambda storage, loc: storage)['state_dict'] 26 | state_dict = updateStateName(state_dict) 27 | self.model.load_state_dict(state_dict, strict = False) 28 | print("\n[DEBUG] load ckpt from {}\n".format(self.config.model.ckpt)) 29 | # self.model = models.make(self.config.model.name, self.config) 30 | 31 | def prepare(self): 32 | pass 33 | 34 | def forward(self, batch): 35 | raise NotImplementedError 36 | 37 | def C(self, value): 38 | if isinstance(value, int) or isinstance(value, float): 39 | pass 40 | else: 41 | value = config_to_primitive(value) 42 | if not isinstance(value, list): 43 | raise TypeError('Scalar specification only supports list, got', type(value)) 44 | if len(value) == 3: 45 | value = [0] + value 46 | assert len(value) == 4 47 | start_step, start_value, end_value, end_step = value 48 | if isinstance(end_step, int): 49 | current_step = self.global_step 50 | value = start_value + (end_value - start_value) * max(min(1.0, (current_step - start_step) / (end_step - start_step)), 0.0) 51 | elif isinstance(end_step, float): 52 | current_step = self.current_epoch 53 | value = start_value + (end_value - start_value) * max(min(1.0, (current_step - start_step) / (end_step - start_step)), 0.0) 54 | return value 55 | 56 | def preprocess_data(self, batch, stage): 57 | pass 58 | 59 | """ 60 | Implementing on_after_batch_transfer of DataModule does the same. 61 | But on_after_batch_transfer does not support DP. 62 | """ 63 | def on_train_batch_start(self, batch, batch_idx, unused=0): 64 | self.dataset = self.trainer.datamodule.train_dataloader().dataset 65 | self.preprocess_data(batch, 'train') 66 | update_module_step(self.model, self.current_epoch, self.global_step) 67 | 68 | def on_validation_batch_start(self, batch, batch_idx, dataloader_idx): 69 | self.dataset = self.trainer.datamodule.val_dataloader().dataset 70 | self.preprocess_data(batch, 'validation') 71 | update_module_step(self.model, self.current_epoch, self.global_step) 72 | 73 | 74 | def on_test_batch_start(self, batch, batch_idx, dataloader_idx): 75 | self.dataset = self.trainer.datamodule.test_dataloader().dataset 76 | self.preprocess_data(batch, 'test') 77 | update_module_step(self.model, self.current_epoch, self.global_step) 78 | 79 | def on_predict_batch_start(self, batch, batch_idx, dataloader_idx): 80 | self.dataset = self.trainer.datamodule.predict_dataloader().dataset 81 | self.preprocess_data(batch, 'predict') 82 | update_module_step(self.model, self.current_epoch, self.global_step) 83 | 84 | def training_step(self, batch, batch_idx): 85 | raise NotImplementedError 86 | 87 | """ 88 | # aggregate outputs from different devices (DP) 89 | def training_step_end(self, out): 90 | pass 91 | """ 92 | 93 | """ 94 | # aggregate outputs from different iterations 95 | def training_epoch_end(self, out): 96 | pass 97 | """ 98 | 99 | def validation_step(self, batch, batch_idx): 100 | raise NotImplementedError 101 | 102 | """ 103 | # aggregate outputs from different devices when using DP 104 | def validation_step_end(self, out): 105 | pass 106 | """ 107 | 108 | def validation_epoch_end(self, out): 109 | """ 110 | Gather metrics from all devices, compute mean. 111 | Purge repeated results using data index. 112 | """ 113 | raise NotImplementedError 114 | 115 | def test_step(self, batch, batch_idx): 116 | raise NotImplementedError 117 | 118 | def test_epoch_end(self, out): 119 | """ 120 | Gather metrics from all devices, compute mean. 121 | Purge repeated results using data index. 122 | """ 123 | raise NotImplementedError 124 | 125 | def export(self): 126 | raise NotImplementedError 127 | 128 | def configure_optimizers(self): 129 | optim = parse_optimizer(self.config.system.optimizer, self.model) 130 | ret = { 131 | 'optimizer': optim, 132 | } 133 | if 'scheduler' in self.config.system: 134 | ret.update({ 135 | 'lr_scheduler': parse_scheduler(self.config.system.scheduler, optim), 136 | }) 137 | return ret 138 | 139 | -------------------------------------------------------------------------------- /tools/__init__.py: -------------------------------------------------------------------------------- 1 | # from .config_tools import * 2 | # from .cam_tools import * 3 | # from .mesh_tools import * 4 | # from .skel_tools import * 5 | # from .pyrender_class import * 6 | # from .torch3d_transforms import * 7 | # from .rotation_tools import * 8 | # from .omni_tools import * 9 | -------------------------------------------------------------------------------- /tools/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/tools/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /tools/__pycache__/cam_tools.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/tools/__pycache__/cam_tools.cpython-38.pyc -------------------------------------------------------------------------------- /tools/__pycache__/mesh_tools.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/tools/__pycache__/mesh_tools.cpython-38.pyc -------------------------------------------------------------------------------- /tools/__pycache__/omni_tools.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/tools/__pycache__/omni_tools.cpython-38.pyc -------------------------------------------------------------------------------- /tools/__pycache__/pyrender_tools.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/tools/__pycache__/pyrender_tools.cpython-38.pyc -------------------------------------------------------------------------------- /tools/__pycache__/rotation_tools.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/tools/__pycache__/rotation_tools.cpython-38.pyc -------------------------------------------------------------------------------- /tools/__pycache__/skel_tools.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/tools/__pycache__/skel_tools.cpython-38.pyc -------------------------------------------------------------------------------- /tools/__pycache__/torch3d_transforms.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/tools/__pycache__/torch3d_transforms.cpython-38.pyc -------------------------------------------------------------------------------- /tools/config_tools.py: -------------------------------------------------------------------------------- 1 | """ 2 | @Author: Guoxing Sun 3 | @Email: gsun@mpi-inf.mpg.de 4 | @Date: 2023-01-23 5 | """ 6 | from dotmap import DotMap 7 | import os 8 | import yaml 9 | 10 | def load_config_with_default(default_path, path, log=True, logger=None): 11 | cfgs = load_config(default_path) 12 | cfgExp = load_config(path) 13 | cfgs = cfgs.toDict() 14 | cfgExp = cfgExp.toDict() 15 | for key in cfgExp.keys(): 16 | cfgs[key] = cfgExp[key] 17 | if log: 18 | print_config(cfgs, logger=logger) 19 | return DotMap(cfgs, _dynamic=False) 20 | 21 | def load_config(default_ps_fname=None, **kwargs): 22 | if isinstance(default_ps_fname, str): 23 | assert os.path.exists(default_ps_fname), FileNotFoundError(default_ps_fname) 24 | assert default_ps_fname.lower().endswith('.yaml'), NotImplementedError('Only .yaml files are accepted.') 25 | default_ps = yaml.safe_load(open(default_ps_fname, 'r')) 26 | else: 27 | default_ps = {} 28 | 29 | default_ps.update(kwargs) 30 | 31 | return DotMap(default_ps, _dynamic=False) 32 | 33 | def dump_config(data, fname): 34 | ''' 35 | dump current configuration to an ini file 36 | :param fname: 37 | :return: 38 | ''' 39 | with open(fname, 'w') as file: 40 | yaml.dump(data.toDict(), file) 41 | return fname 42 | 43 | def print_config(cfg, logger=None): 44 | message = '' 45 | message += '----------------- Configs ---------------\n' 46 | if isinstance( cfg , DotMap ): 47 | cfg = cfg.toDict() 48 | # for k, v in sorted(vars(cfg).items()): 49 | # for k, v in sorted(cfg.items()): 50 | for k, v in cfg.items(): 51 | comment = '' 52 | if isinstance(v, dict): 53 | message += '{:->25}-----------------\n'.format(str(k)) 54 | for ks, vs in v.items(): 55 | message += '{:>25}: {:<30}{}\n'.format(str(ks), str(vs), comment) 56 | message += '{:->25}-----------------\n'.format(str(k)) 57 | else: 58 | message += '{:>25}: {:<30}{}\n'.format(str(k), str(v), comment) 59 | message += '----------------- End -------------------' 60 | if not logger is None: 61 | logger.info(message) 62 | else: 63 | print(message) -------------------------------------------------------------------------------- /tools/extensions/implicit_waterproofing.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import sys 3 | sys.path.append('..') 4 | from tools.extensions.libmesh.inside_mesh import check_mesh_contains 5 | # from libmesh.inside_mesh import check_mesh_contains 6 | import math 7 | 8 | 9 | def to_rotation_matrix(euler_angles): 10 | R_x = np.array([[1, 0, 0], 11 | [0, math.cos(euler_angles[0]), -math.sin(euler_angles[0])], 12 | [0, math.sin(euler_angles[0]), math.cos(euler_angles[0])] 13 | ]) 14 | 15 | R_y = np.array([[math.cos(euler_angles[1]), 0, math.sin(euler_angles[1])], 16 | [0, 1, 0], 17 | [-math.sin(euler_angles[1]), 0, math.cos(euler_angles[1])] 18 | ]) 19 | 20 | R_z = np.array([[math.cos(euler_angles[2]), -math.sin(euler_angles[2]), 0], 21 | [math.sin(euler_angles[2]), math.cos(euler_angles[2]), 0], 22 | [0, 0, 1] 23 | ]) 24 | 25 | R = np.dot(R_z, np.dot(R_y, R_x)) 26 | 27 | return R 28 | 29 | 30 | def implicit_waterproofing(mesh_source, query_points): 31 | occ_list, holes_list = check_mesh_contains(mesh_source, query_points) 32 | 33 | for euler_angles in np.array([[0, np.pi / 2, 0], [np.pi / 2, 0, 0], [0, 0, np.pi / 2]]): 34 | 35 | if not holes_list.any(): 36 | break 37 | print('iteration start') 38 | 39 | mesh = mesh_source.copy() 40 | r = to_rotation_matrix(euler_angles) 41 | r = np.pad(r, [(0, 1), (0, 1)], 'constant', constant_values=0) 42 | mesh.apply_transform(r) 43 | points = np.dot(r[:3, :3], query_points[holes_list].T).T 44 | occ_list_rot, holes_list_rot = check_mesh_contains(mesh, points) 45 | 46 | occ_list[holes_list] = occ_list_rot 47 | holes_list_updated = np.full(len(query_points), False) 48 | holes_list_updated[holes_list] = holes_list_rot 49 | holes_list = holes_list_updated 50 | 51 | return occ_list, holes_list 52 | 53 | 54 | # specifically for .binvox format (every cube has same hight,width and depth) 55 | def create_grid_points(mesh, res): 56 | bottom_cotner, upper_corner = mesh.bounds 57 | minimun = min(bottom_cotner) 58 | maximum = max(upper_corner) 59 | x = np.linspace(minimun, maximum, res) 60 | X, Y, Z = np.meshgrid(x, x, x, indexing='ij') 61 | X = X.reshape((np.prod(X.shape),)) 62 | Y = Y.reshape((np.prod(Y.shape),)) 63 | Z = Z.reshape((np.prod(Z.shape),)) 64 | 65 | points_list = np.column_stack((X, Y, Z)) 66 | del X, Y, Z, x 67 | return points_list 68 | 69 | def create_grid_points_from_bounds(minimun, maximum, res): 70 | x = np.linspace(minimun, maximum, res) 71 | X, Y, Z = np.meshgrid(x, x, x, indexing='ij') 72 | X = X.reshape((np.prod(X.shape),)) 73 | Y = Y.reshape((np.prod(Y.shape),)) 74 | Z = Z.reshape((np.prod(Z.shape),)) 75 | 76 | points_list = np.column_stack((X, Y, Z)) 77 | del X, Y, Z, x 78 | return points_list 79 | 80 | 81 | # # Converting to occupancy grid 82 | def to_occ(mesh, res): 83 | occ, holes = implicit_waterproofing(mesh, create_grid_points(mesh, res)) 84 | occ = np.reshape(occ,(res,res,res)) 85 | return occ -------------------------------------------------------------------------------- /tools/extensions/libmesh/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | from Cython.Build import cythonize 3 | # try: 4 | # from setuptools import setup 5 | # except ImportError: 6 | # from distutils.core import setup 7 | # from distutils.extension import Extension 8 | # from Cython.Build import cythonize 9 | # from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDAExtension 10 | import numpy 11 | 12 | setup(name = 'libmesh', 13 | ext_modules = cythonize("*.pyx"), 14 | include_dirs=[numpy.get_include()]) 15 | -------------------------------------------------------------------------------- /tools/extensions/libmesh/triangle_hash.pyx: -------------------------------------------------------------------------------- 1 | 2 | # distutils: language=c++ 3 | import numpy as np 4 | cimport numpy as np 5 | cimport cython 6 | from libcpp.vector cimport vector 7 | from libc.math cimport floor, ceil 8 | 9 | cdef class TriangleHash: 10 | cdef vector[vector[int]] spatial_hash 11 | cdef int resolution 12 | 13 | def __cinit__(self, double[:, :, :] triangles, int resolution): 14 | self.spatial_hash.resize(resolution * resolution) 15 | self.resolution = resolution 16 | self._build_hash(triangles) 17 | 18 | @cython.boundscheck(False) # Deactivate bounds checking 19 | @cython.wraparound(False) # Deactivate negative indexing. 20 | cdef int _build_hash(self, double[:, :, :] triangles): 21 | assert(triangles.shape[1] == 3) 22 | assert(triangles.shape[2] == 2) 23 | 24 | cdef int n_tri = triangles.shape[0] 25 | cdef int bbox_min[2] 26 | cdef int bbox_max[2] 27 | 28 | cdef int i_tri, j, x, y 29 | cdef int spatial_idx 30 | 31 | for i_tri in range(n_tri): 32 | # Compute bounding box 33 | for j in range(2): 34 | bbox_min[j] = min( 35 | triangles[i_tri, 0, j], triangles[i_tri, 1, j], triangles[i_tri, 2, j] 36 | ) 37 | bbox_max[j] = max( 38 | triangles[i_tri, 0, j], triangles[i_tri, 1, j], triangles[i_tri, 2, j] 39 | ) 40 | bbox_min[j] = min(max(bbox_min[j], 0), self.resolution - 1) 41 | bbox_max[j] = min(max(bbox_max[j], 0), self.resolution - 1) 42 | 43 | # Find all voxels where bounding box intersects 44 | for x in range(bbox_min[0], bbox_max[0] + 1): 45 | for y in range(bbox_min[1], bbox_max[1] + 1): 46 | spatial_idx = self.resolution * x + y 47 | self.spatial_hash[spatial_idx].push_back(i_tri) 48 | 49 | @cython.boundscheck(False) # Deactivate bounds checking 50 | @cython.wraparound(False) # Deactivate negative indexing. 51 | cpdef query(self, double[:, :] points): 52 | assert(points.shape[1] == 2) 53 | cdef int n_points = points.shape[0] 54 | 55 | cdef vector[int] points_indices 56 | cdef vector[int] tri_indices 57 | # cdef int[:] points_indices_np 58 | # cdef int[:] tri_indices_np 59 | 60 | cdef int i_point, k, x, y 61 | cdef int spatial_idx 62 | 63 | for i_point in range(n_points): 64 | x = int(points[i_point, 0]) 65 | y = int(points[i_point, 1]) 66 | if not (0 <= x < self.resolution and 0 <= y < self.resolution): 67 | continue 68 | 69 | spatial_idx = self.resolution * x + y 70 | for i_tri in self.spatial_hash[spatial_idx]: 71 | points_indices.push_back(i_point) 72 | tri_indices.push_back(i_tri) 73 | 74 | points_indices_np = np.zeros(points_indices.size(), dtype=np.int32) 75 | tri_indices_np = np.zeros(tri_indices.size(), dtype=np.int32) 76 | 77 | cdef int[:] points_indices_view = points_indices_np 78 | cdef int[:] tri_indices_view = tri_indices_np 79 | 80 | for k in range(points_indices.size()): 81 | points_indices_view[k] = points_indices[k] 82 | 83 | for k in range(tri_indices.size()): 84 | tri_indices_view[k] = tri_indices[k] 85 | 86 | return points_indices_np, tri_indices_np 87 | -------------------------------------------------------------------------------- /tools/ezmocap/body_param.py: -------------------------------------------------------------------------------- 1 | ''' 2 | @ Date: 2020-11-20 13:34:54 3 | @ Author: Qing Shuai 4 | @ LastEditors: Qing Shuai 5 | @ LastEditTime: 2021-05-25 19:21:12 6 | @ FilePath: /EasyMocap/easymocap/smplmodel/body_param.py 7 | ''' 8 | import numpy as np 9 | from os.path import join 10 | 11 | def merge_params(param_list, share_shape=True): # 12 | output = {} 13 | for key in ['poses', 'shapes', 'Rh', 'Th', 'expression']: 14 | if key in param_list[0].keys(): 15 | output[key] = np.vstack([v[key] for v in param_list]) 16 | if share_shape: 17 | output['shapes'] = output['shapes'].mean(axis=0, keepdims=True) 18 | return output 19 | 20 | def select_nf(params_all, nf): 21 | output = {} 22 | for key in ['poses', 'Rh', 'Th']: 23 | output[key] = params_all[key][nf:nf+1, :] 24 | if 'expression' in params_all.keys(): 25 | output['expression'] = params_all['expression'][nf:nf+1, :] 26 | if params_all['shapes'].shape[0] == 1: 27 | output['shapes'] = params_all['shapes'] 28 | else: 29 | output['shapes'] = params_all['shapes'][nf:nf+1, :] 30 | return output 31 | 32 | def load_model(gender='neutral', use_cuda=True, model_type='smpl', skel_type='body25', device=None, model_path='data/smplx'): 33 | # prepare SMPL model 34 | # print('[Load model {}/{}]'.format(model_type, gender)) 35 | import torch 36 | if device is None: 37 | if use_cuda and torch.cuda.is_available(): 38 | device = torch.device('cuda') 39 | else: 40 | device = torch.device('cpu') 41 | from .body_model import SMPLlayer 42 | if model_type == 'smpl': 43 | if skel_type == 'body25': 44 | reg_path = join(model_path, 'J_regressor_body25.npy') 45 | elif skel_type == 'h36m': 46 | reg_path = join(model_path, 'J_regressor_h36m.npy') 47 | else: 48 | raise NotImplementedError 49 | body_model = SMPLlayer(join(model_path, 'smpl'), gender=gender, device=device, 50 | regressor_path=reg_path) 51 | elif model_type == 'smplh': 52 | body_model = SMPLlayer(join(model_path, 'smplh/SMPLH_MALE.pkl'), model_type='smplh', gender=gender, device=device, 53 | regressor_path=join(model_path, 'J_regressor_body25_smplh.txt')) 54 | elif model_type == 'smplx': 55 | body_model = SMPLlayer(join(model_path, 'smplx/SMPLX_{}.pkl'.format(gender.upper())), model_type='smplx', gender=gender, device=device, 56 | regressor_path=join(model_path, 'J_regressor_body25_smplx.txt')) 57 | elif model_type == 'manol' or model_type == 'manor': 58 | lr = {'manol': 'LEFT', 'manor': 'RIGHT'} 59 | body_model = SMPLlayer(join(model_path, 'smplh/MANO_{}.pkl'.format(lr[model_type])), model_type='mano', gender=gender, device=device, 60 | regressor_path=join(model_path, 'J_regressor_mano_{}.txt'.format(lr[model_type]))) 61 | else: 62 | body_model = None 63 | body_model.to(device) 64 | return body_model 65 | 66 | def check_keypoints(keypoints2d, WEIGHT_DEBUFF=1, min_conf=0.3): 67 | # keypoints2d: nFrames, nJoints, 3 68 | # 69 | # wrong feet 70 | # if keypoints2d.shape[-2] > 25 + 42: 71 | # keypoints2d[..., 0, 2] = 0 72 | # keypoints2d[..., [15, 16, 17, 18], -1] = 0 73 | # keypoints2d[..., [19, 20, 21, 22, 23, 24], -1] /= 2 74 | if keypoints2d.shape[-2] > 25: 75 | # set the hand keypoints 76 | keypoints2d[..., 25, :] = keypoints2d[..., 7, :] 77 | keypoints2d[..., 46, :] = keypoints2d[..., 4, :] 78 | keypoints2d[..., 25:, -1] *= WEIGHT_DEBUFF 79 | # reduce the confidence of hand and face 80 | MIN_CONF = min_conf 81 | conf = keypoints2d[..., -1] 82 | conf[conf 0: 40 | print('NaN loss value, stopping!') 41 | break 42 | 43 | if torch.isinf(loss).sum() > 0: 44 | print('Infinite loss value, stopping!') 45 | break 46 | 47 | # if all([torch.abs(var.grad.view(-1).max()).item() < self.gtol 48 | # for var in params if var.grad is not None]): 49 | # print('Small grad, stopping!') 50 | # break 51 | 52 | if iter > 0 and prev_loss is not None and self.ftol > 0: 53 | loss_rel_change = rel_change(prev_loss, loss.item()) 54 | 55 | if loss_rel_change <= self.ftol: 56 | break 57 | 58 | # if self.visualize: 59 | # vertices = smpl_render.GetVertices(**kwargs) 60 | # self.mv.update_mesh(vertices[::10], smpl_render.faces) 61 | prev_loss = loss.item() 62 | grad_require(params, False) 63 | return prev_loss 64 | 65 | def close(self): 66 | # if self.visualize: 67 | # self.mv.close_viewer() 68 | pass 69 | 70 | # class FittingLog: 71 | # if False: 72 | # from tensorboardX import SummaryWriter 73 | # swriter = SummaryWriter() 74 | # def __init__(self, log_name, useVisdom=False): 75 | # if not os.path.exists(log_name): 76 | # log_file = open(log_name, 'w') 77 | # self.index = {log_name:0} 78 | # 79 | # else: 80 | # log_file = open(log_name, 'r') 81 | # log_pre = log_file.readlines() 82 | # log_file.close() 83 | # self.index = {log_name:len(log_pre)} 84 | # log_file = open(log_name, 'a') 85 | # self.log_file = log_file 86 | # self.useVisdom = useVisdom 87 | # if useVisdom: 88 | # import visdom 89 | # self.vis = visdom.Visdom(env=os.path.realpath( 90 | # join(os.path.dirname(log_name), '..')).replace(os.sep, '_')) 91 | # elif False: 92 | # self.writer = FittingLog.swriter 93 | # self.log_name = log_name 94 | # 95 | # def step(self, loss_dict, weight_loss): 96 | # print(' '.join([key + ' %f'%(loss_dict[key].item()*weight_loss[key]) 97 | # for key in loss_dict.keys() if weight_loss[key]>0]), file=self.log_file) 98 | # loss = {key:loss_dict[key].item()*weight_loss[key] 99 | # for key in loss_dict.keys() if weight_loss[key]>0} 100 | # if self.useVisdom: 101 | # name = list(loss.keys()) 102 | # val = list(loss.values()) 103 | # x = self.index.get(self.log_name, 0) 104 | # if len(val) == 1: 105 | # y = np.array(val) 106 | # else: 107 | # y = np.array(val).reshape(-1, len(val)) 108 | # self.vis.line(Y=y,X=np.ones(y.shape)*x, 109 | # win=str(self.log_name),#unicode 110 | # opts=dict(legend=name, 111 | # title=self.log_name), 112 | # update=None if x == 0 else 'append' 113 | # ) 114 | # elif False: 115 | # self.writer.add_scalars('data/{}'.format(self.log_name), loss, self.index[self.log_name]) 116 | # self.index[self.log_name] += 1 117 | # 118 | # def log_loss(self, weight_loss): 119 | # loss = json.dumps(weight_loss, indent=4) 120 | # self.log_file.writelines(loss) 121 | # self.log_file.write('\n') 122 | # 123 | # def close(self): 124 | # self.log_file.close() 125 | 126 | 127 | def grad_require(paras, flag=False): 128 | if isinstance(paras, list): 129 | for par in paras: 130 | par.requires_grad = flag 131 | elif isinstance(paras, dict): 132 | for key, par in paras.items(): 133 | par.requires_grad = flag -------------------------------------------------------------------------------- /tools/smplx/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is 4 | # holder of all proprietary rights on this computer program. 5 | # You can only use this computer program if you have closed 6 | # a license agreement with MPG or you get the right to use the computer 7 | # program from someone who is authorized to grant you that right. 8 | # Any use of the computer program without a valid license is prohibited and 9 | # liable to prosecution. 10 | # 11 | # Copyright©2019 Max-Planck-Gesellschaft zur Förderung 12 | # der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute 13 | # for Intelligent Systems. All rights reserved. 14 | # 15 | # Contact: ps-license@tuebingen.mpg.de 16 | 17 | from .body_models import ( 18 | SMPL, 19 | create 20 | ) 21 | 22 | -------------------------------------------------------------------------------- /tools/smplx/utils.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is 4 | # holder of all proprietary rights on this computer program. 5 | # You can only use this computer program if you have closed 6 | # a license agreement with MPG or you get the right to use the computer 7 | # program from someone who is authorized to grant you that right. 8 | # Any use of the computer program without a valid license is prohibited and 9 | # liable to prosecution. 10 | # 11 | # Copyright©2019 Max-Planck-Gesellschaft zur Förderung 12 | # der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute 13 | # for Intelligent Systems. All rights reserved. 14 | # 15 | # Contact: ps-license@tuebingen.mpg.de 16 | 17 | from optparse import Option 18 | from typing import NewType, Union, Optional 19 | from dataclasses import dataclass, asdict, fields 20 | import numpy as np 21 | import torch 22 | 23 | Tensor = NewType('Tensor', torch.Tensor) 24 | Array = NewType('Array', np.ndarray) 25 | 26 | 27 | @dataclass 28 | class ModelOutput: 29 | vertices: Optional[Tensor] = None 30 | joints: Optional[Tensor] = None 31 | full_pose: Optional[Tensor] = None 32 | global_orient: Optional[Tensor] = None 33 | transl: Optional[Tensor] = None 34 | v_shaped: Optional[Tensor] = None 35 | 36 | def __getitem__(self, key): 37 | return getattr(self, key) 38 | 39 | def get(self, key, default=None): 40 | return getattr(self, key, default) 41 | 42 | def __iter__(self): 43 | return self.keys() 44 | 45 | def keys(self): 46 | keys = [t.name for t in fields(self)] 47 | return iter(keys) 48 | 49 | def values(self): 50 | values = [getattr(self, t.name) for t in fields(self)] 51 | return iter(values) 52 | 53 | def items(self): 54 | data = [(t.name, getattr(self, t.name)) for t in fields(self)] 55 | return iter(data) 56 | 57 | 58 | @dataclass 59 | class SMPLOutput(ModelOutput): 60 | betas: Optional[Tensor] = None 61 | body_pose: Optional[Tensor] = None 62 | T: Optional[Tensor] = None 63 | A: Optional[Tensor] = None 64 | shape_offsets: Optional[Tensor] = None 65 | pose_offsets: Optional[Tensor] = None 66 | 67 | 68 | def find_joint_kin_chain(joint_id, kinematic_tree): 69 | kin_chain = [] 70 | curr_idx = joint_id 71 | while curr_idx != -1: 72 | kin_chain.append(curr_idx) 73 | curr_idx = kinematic_tree[curr_idx] 74 | return kin_chain 75 | 76 | 77 | def to_tensor( 78 | array: Union[Array, Tensor], dtype=torch.float32 79 | ) -> Tensor: 80 | if torch.is_tensor(array): 81 | return array 82 | else: 83 | return torch.tensor(array, dtype=dtype) 84 | 85 | 86 | class Struct(object): 87 | def __init__(self, **kwargs): 88 | for key, val in kwargs.items(): 89 | setattr(self, key, val) 90 | 91 | 92 | def to_np(array, dtype=np.float32): 93 | if 'scipy.sparse' in str(type(array)): 94 | array = array.todense() 95 | return np.array(array, dtype=dtype) 96 | 97 | 98 | def rot_mat_to_euler(rot_mats): 99 | # Calculates rotation matrix to euler angles 100 | # Careful for extreme cases of eular angles like [0.0, pi, 0.0] 101 | 102 | sy = torch.sqrt(rot_mats[:, 0, 0] * rot_mats[:, 0, 0] + 103 | rot_mats[:, 1, 0] * rot_mats[:, 1, 0]) 104 | return torch.atan2(-rot_mats[:, 2, 0], sy) 105 | -------------------------------------------------------------------------------- /tools/smplx/vertex_ids.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is 4 | # holder of all proprietary rights on this computer program. 5 | # You can only use this computer program if you have closed 6 | # a license agreement with MPG or you get the right to use the computer 7 | # program from someone who is authorized to grant you that right. 8 | # Any use of the computer program without a valid license is prohibited and 9 | # liable to prosecution. 10 | # 11 | # Copyright©2019 Max-Planck-Gesellschaft zur Förderung 12 | # der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute 13 | # for Intelligent Systems. All rights reserved. 14 | # 15 | # Contact: ps-license@tuebingen.mpg.de 16 | 17 | from __future__ import print_function 18 | from __future__ import absolute_import 19 | from __future__ import division 20 | 21 | # Joint name to vertex mapping. SMPL/SMPL-H/SMPL-X vertices that correspond to 22 | # MSCOCO and OpenPose joints 23 | vertex_ids = { 24 | 'smplh': { 25 | 'nose': 332, 26 | 'reye': 6260, 27 | 'leye': 2800, 28 | 'rear': 4071, 29 | 'lear': 583, 30 | 'rthumb': 6191, 31 | 'rindex': 5782, 32 | 'rmiddle': 5905, 33 | 'rring': 6016, 34 | 'rpinky': 6133, 35 | 'lthumb': 2746, 36 | 'lindex': 2319, 37 | 'lmiddle': 2445, 38 | 'lring': 2556, 39 | 'lpinky': 2673, 40 | 'LBigToe': 3216, 41 | 'LSmallToe': 3226, 42 | 'LHeel': 3387, 43 | 'RBigToe': 6617, 44 | 'RSmallToe': 6624, 45 | 'RHeel': 6787 46 | }, 47 | 'smplx': { 48 | 'nose': 9120, 49 | 'reye': 9929, 50 | 'leye': 9448, 51 | 'rear': 616, 52 | 'lear': 6, 53 | 'rthumb': 8079, 54 | 'rindex': 7669, 55 | 'rmiddle': 7794, 56 | 'rring': 7905, 57 | 'rpinky': 8022, 58 | 'lthumb': 5361, 59 | 'lindex': 4933, 60 | 'lmiddle': 5058, 61 | 'lring': 5169, 62 | 'lpinky': 5286, 63 | 'LBigToe': 5770, 64 | 'LSmallToe': 5780, 65 | 'LHeel': 8846, 66 | 'RBigToe': 8463, 67 | 'RSmallToe': 8474, 68 | 'RHeel': 8635 69 | }, 70 | 'mano': { 71 | 'thumb': 744, 72 | 'index': 320, 73 | 'middle': 443, 74 | 'ring': 554, 75 | 'pinky': 671, 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /tools/smplx/vertex_joint_selector.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is 4 | # holder of all proprietary rights on this computer program. 5 | # You can only use this computer program if you have closed 6 | # a license agreement with MPG or you get the right to use the computer 7 | # program from someone who is authorized to grant you that right. 8 | # Any use of the computer program without a valid license is prohibited and 9 | # liable to prosecution. 10 | # 11 | # Copyright©2019 Max-Planck-Gesellschaft zur Förderung 12 | # der Wissenschaften e.V. (MPG). acting on behalf of its Max Planck Institute 13 | # for Intelligent Systems. All rights reserved. 14 | # 15 | # Contact: ps-license@tuebingen.mpg.de 16 | 17 | from __future__ import absolute_import 18 | from __future__ import print_function 19 | from __future__ import division 20 | 21 | import numpy as np 22 | 23 | import torch 24 | import torch.nn as nn 25 | 26 | from .utils import to_tensor 27 | 28 | 29 | class VertexJointSelector(nn.Module): 30 | 31 | def __init__(self, vertex_ids=None, 32 | use_hands=True, 33 | use_feet_keypoints=True, **kwargs): 34 | super(VertexJointSelector, self).__init__() 35 | 36 | extra_joints_idxs = [] 37 | 38 | face_keyp_idxs = np.array([ 39 | vertex_ids['nose'], 40 | vertex_ids['reye'], 41 | vertex_ids['leye'], 42 | vertex_ids['rear'], 43 | vertex_ids['lear']], dtype=np.int64) 44 | 45 | extra_joints_idxs = np.concatenate([extra_joints_idxs, 46 | face_keyp_idxs]) 47 | 48 | if use_feet_keypoints: 49 | feet_keyp_idxs = np.array([vertex_ids['LBigToe'], 50 | vertex_ids['LSmallToe'], 51 | vertex_ids['LHeel'], 52 | vertex_ids['RBigToe'], 53 | vertex_ids['RSmallToe'], 54 | vertex_ids['RHeel']], dtype=np.int32) 55 | 56 | extra_joints_idxs = np.concatenate( 57 | [extra_joints_idxs, feet_keyp_idxs]) 58 | 59 | if use_hands: 60 | self.tip_names = ['thumb', 'index', 'middle', 'ring', 'pinky'] 61 | 62 | tips_idxs = [] 63 | for hand_id in ['l', 'r']: 64 | for tip_name in self.tip_names: 65 | tips_idxs.append(vertex_ids[hand_id + tip_name]) 66 | 67 | extra_joints_idxs = np.concatenate( 68 | [extra_joints_idxs, tips_idxs]) 69 | 70 | self.register_buffer('extra_joints_idxs', 71 | to_tensor(extra_joints_idxs, dtype=torch.long)) 72 | 73 | def forward(self, vertices, joints): 74 | extra_joints = torch.index_select(vertices, 1, self.extra_joints_idxs) 75 | joints = torch.cat([joints, extra_joints], dim=1) 76 | 77 | return joints 78 | -------------------------------------------------------------------------------- /tools/utils/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sunshinnnn/metacap/e836d2580abe86319f031fb2193642cba4cb37d0/tools/utils/__init__.py -------------------------------------------------------------------------------- /tools/utils/callbacks.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import shutil 4 | from tools.utils.misc import dump_config, parse_version 5 | 6 | 7 | import pytorch_lightning 8 | if parse_version(pytorch_lightning.__version__) > parse_version('1.8'): 9 | from pytorch_lightning.callbacks import Callback 10 | else: 11 | from pytorch_lightning.callbacks.base import Callback 12 | from pytorch_lightning.utilities.rank_zero import rank_zero_only, rank_zero_warn 13 | from pytorch_lightning.callbacks.progress import TQDMProgressBar 14 | 15 | 16 | class VersionedCallback(Callback): 17 | def __init__(self, save_root, version=None, use_version=True): 18 | self.save_root = save_root 19 | self._version = version 20 | self.use_version = use_version 21 | 22 | @property 23 | def version(self) -> int: 24 | """Get the experiment version. 25 | 26 | Returns: 27 | The experiment version if specified else the next version. 28 | """ 29 | if self._version is None: 30 | self._version = self._get_next_version() 31 | return self._version 32 | 33 | def _get_next_version(self): 34 | existing_versions = [] 35 | if os.path.isdir(self.save_root): 36 | for f in os.listdir(self.save_root): 37 | bn = os.path.basename(f) 38 | if bn.startswith("version_"): 39 | dir_ver = os.path.splitext(bn)[0].split("_")[1].replace("/", "") 40 | existing_versions.append(int(dir_ver)) 41 | if len(existing_versions) == 0: 42 | return 0 43 | return max(existing_versions) + 1 44 | 45 | @property 46 | def savedir(self): 47 | if not self.use_version: 48 | return self.save_root 49 | return os.path.join(self.save_root, self.version if isinstance(self.version, str) else f"version_{self.version}") 50 | 51 | 52 | class CodeSnapshotCallback(VersionedCallback): 53 | def __init__(self, save_root, version=None, use_version=True): 54 | super().__init__(save_root, version, use_version) 55 | 56 | def get_file_list(self): 57 | return [ 58 | b.decode() for b in 59 | set(subprocess.check_output('git ls-files', shell=True).splitlines()) | 60 | set(subprocess.check_output('git ls-files --others --exclude-standard', shell=True).splitlines()) 61 | ] 62 | 63 | @rank_zero_only 64 | def save_code_snapshot(self): 65 | os.makedirs(self.savedir, exist_ok=True) 66 | fileList = self.get_file_list() 67 | fileList = [ item for item in fileList if not item.split('/')[0]=='datas' ] 68 | for f in fileList: 69 | if not os.path.exists(f) or os.path.isdir(f): 70 | continue 71 | os.makedirs(os.path.join(self.savedir, os.path.dirname(f)), exist_ok=True) 72 | shutil.copyfile(f, os.path.join(self.savedir, f)) 73 | 74 | def on_fit_start(self, trainer, pl_module): 75 | try: 76 | self.save_code_snapshot() 77 | except: 78 | rank_zero_warn("Code snapshot is not saved. Please make sure you have git installed and are in a git repository.") 79 | 80 | 81 | class ConfigSnapshotCallback(VersionedCallback): 82 | def __init__(self, config, save_root, version=None, use_version=True): 83 | super().__init__(save_root, version, use_version) 84 | self.config = config 85 | 86 | @rank_zero_only 87 | def save_config_snapshot(self): 88 | os.makedirs(self.savedir, exist_ok=True) 89 | dump_config(os.path.join(self.savedir, 'parsed.yaml'), self.config) 90 | shutil.copyfile(self.config.cmd_args['config'], os.path.join(self.savedir, 'raw.yaml')) 91 | 92 | def on_fit_start(self, trainer, pl_module): 93 | self.save_config_snapshot() 94 | 95 | 96 | class CustomProgressBar(TQDMProgressBar): 97 | def get_metrics(self, *args, **kwargs): 98 | # don't show the version number 99 | items = super().get_metrics(*args, **kwargs) 100 | items.pop("v_num", None) 101 | return items 102 | -------------------------------------------------------------------------------- /tools/utils/loggers.py: -------------------------------------------------------------------------------- 1 | import re 2 | import pprint 3 | import logging 4 | 5 | from pytorch_lightning.loggers.base import LightningLoggerBase, rank_zero_experiment 6 | from pytorch_lightning.utilities.rank_zero import rank_zero_only 7 | 8 | 9 | class ConsoleLogger(LightningLoggerBase): 10 | def __init__(self, log_keys=[]): 11 | super().__init__() 12 | self.log_keys = [re.compile(k) for k in log_keys] 13 | self.dict_printer = pprint.PrettyPrinter(indent=2, compact=False).pformat 14 | 15 | def match_log_keys(self, s): 16 | return True if not self.log_keys else any(r.search(s) for r in self.log_keys) 17 | 18 | @property 19 | def name(self): 20 | return 'console' 21 | 22 | @property 23 | def version(self): 24 | return '0' 25 | 26 | @property 27 | @rank_zero_experiment 28 | def experiment(self): 29 | return logging.getLogger('pytorch_lightning') 30 | 31 | @rank_zero_only 32 | def log_hyperparams(self, params): 33 | pass 34 | 35 | @rank_zero_only 36 | def log_metrics(self, metrics, step): 37 | metrics_ = {k: v for k, v in metrics.items() if self.match_log_keys(k)} 38 | if not metrics_: 39 | return 40 | self.experiment.info(f"\nEpoch{metrics['epoch']} Step{step}\n{self.dict_printer(metrics_)}") 41 | 42 | -------------------------------------------------------------------------------- /tools/utils/mesh.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | def save_ply(fname, points, faces=None, colors=None): 4 | if faces is None and colors is None: 5 | points = points.reshape(-1,3) 6 | to_save = points 7 | return np.savetxt(fname, 8 | to_save, 9 | fmt='%.6f %.6f %.6f', 10 | comments='', 11 | header=( 12 | 'ply\nformat ascii 1.0\nelement vertex {:d}\nproperty float x\nproperty float y\nproperty float z\nend_header'.format(points.shape[0])) 13 | ) 14 | elif faces is None and not colors is None: 15 | points = points.reshape(-1,3) 16 | colors = colors.reshape(-1,3) 17 | to_save = np.concatenate([points, colors], axis=-1) 18 | return np.savetxt(fname, 19 | to_save, 20 | fmt='%.6f %.6f %.6f %d %d %d', 21 | comments='', 22 | header=( 23 | 'ply\nformat ascii 1.0\nelement vertex {:d}\nproperty float x\nproperty float y\nproperty float z\nproperty uchar red\nproperty uchar green\nproperty uchar blue\nend_header'.format( 24 | points.shape[0]))) 25 | 26 | elif not faces is None and colors is None: 27 | points = points.reshape(-1,3) 28 | faces = faces.reshape(-1,3) 29 | with open(fname,'w') as f: 30 | f.write('ply\nformat ascii 1.0\nelement vertex {:d}\nproperty float x\nproperty float y\nproperty float z\nelement face {:d}\nproperty list uchar int vertex_indices\nend_header\n'.format( 31 | points.shape[0],faces.shape[0])) 32 | for i in range(points.shape[0]): 33 | f.write('%.6f %.6f %.6f\n'%(points[i,0],points[i,1],points[i,2])) 34 | for i in range(faces.shape[0]): 35 | f.write('3 %d %d %d\n'%(faces[i,0],faces[i,1],faces[i,2])) 36 | elif not faces is None and not colors is None: 37 | points = points.reshape(-1,3) 38 | colors = colors.reshape(-1,3) 39 | faces = faces.reshape(-1,3) 40 | with open(fname,'w') as f: 41 | f.write('ply\nformat ascii 1.0\nelement vertex {:d}\nproperty float x\nproperty float y\nproperty float z\nproperty uchar red\nproperty uchar green\nproperty uchar blue\nelement face {:d}\nproperty list uchar int vertex_indices\nend_header\n'.format( 42 | points.shape[0],faces.shape[0])) 43 | for i in range(points.shape[0]): 44 | f.write('%.6f %.6f %.6f %d %d %d\n'%(points[i,0],points[i,1],points[i,2],colors[i,0],colors[i,1],colors[i,2])) 45 | for i in range(faces.shape[0]): 46 | f.write('3 %d %d %d\n'%(faces[i,0],faces[i,1],faces[i,2])) 47 | 48 | 49 | def load_ply(mesh_file): 50 | vertex_data = [] 51 | face_data = [] 52 | vertNum = -1 53 | faceNum = -1 54 | startIdx = -1 55 | with open(mesh_file,'r') as f: 56 | data = f.readlines() 57 | for idx in range(20): 58 | if data[idx][:14] == 'element vertex': 59 | vertNum = int(data[idx].split(' ')[-1]) 60 | if data[idx][:12] == 'element face': 61 | faceNum = int(data[idx].split(' ')[-1]) 62 | if data[idx] == 'end_header\n': 63 | startIdx = idx 64 | for idx in range(startIdx+1, startIdx + vertNum + 1): 65 | values = data[idx].split() 66 | v = list(map(float, values[0:3])) 67 | vertex_data.append(v) 68 | for idx in range(startIdx + vertNum + 1, len(data)): 69 | values = data[idx].split() 70 | v = list(map(int, values[1:4])) 71 | face_data.append(v) 72 | vertices = np.array(vertex_data) 73 | faces = np.array(face_data) 74 | return vertices, faces -------------------------------------------------------------------------------- /tools/utils/misc.py: -------------------------------------------------------------------------------- 1 | import os 2 | from omegaconf import OmegaConf 3 | from packaging import version 4 | 5 | 6 | # ============ Register OmegaConf Recolvers ============= # 7 | OmegaConf.register_new_resolver('calc_exp_lr_decay_rate', lambda factor, n: factor**(1./n)) 8 | OmegaConf.register_new_resolver('add', lambda a, b: a + b) 9 | OmegaConf.register_new_resolver('sub', lambda a, b: a - b) 10 | OmegaConf.register_new_resolver('mul', lambda a, b: a * b) 11 | OmegaConf.register_new_resolver('div', lambda a, b: a / b) 12 | OmegaConf.register_new_resolver('idiv', lambda a, b: a // b) 13 | OmegaConf.register_new_resolver('basename', lambda p: os.path.basename(p)) 14 | # ======================================================= # 15 | 16 | 17 | def prompt(question): 18 | inp = input(f"{question} (y/n)").lower().strip() 19 | if inp and inp == 'y': 20 | return True 21 | if inp and inp == 'n': 22 | return False 23 | return prompt(question) 24 | 25 | 26 | # def load_config(*yaml_files, cli_args=[]): 27 | # yaml_confs = [OmegaConf.load(f) for f in yaml_files] 28 | # cli_conf = OmegaConf.from_cli(cli_args) 29 | # conf = OmegaConf.merge(*yaml_confs, cli_conf) 30 | # OmegaConf.resolve(conf) 31 | # return conf 32 | 33 | 34 | def load_config(yaml_file, cli_args=[]): 35 | yaml_conf = OmegaConf.load(yaml_file) 36 | if yaml_conf.get('defaults', False): 37 | dir_name = os.path.dirname(yaml_file) 38 | defaults = [OmegaConf.load(os.path.join(dir_name, f)) for f in yaml_conf.defaults] 39 | defaults = OmegaConf.merge(*defaults) 40 | yaml_conf = OmegaConf.merge(defaults, yaml_conf) 41 | 42 | cli_conf = OmegaConf.from_cli(cli_args) 43 | conf = OmegaConf.merge(yaml_conf, cli_conf) 44 | OmegaConf.resolve(conf) 45 | return conf 46 | 47 | 48 | def config_to_primitive(config, resolve=True): 49 | return OmegaConf.to_container(config, resolve=resolve) 50 | 51 | 52 | def dump_config(path, config): 53 | with open(path, 'w') as fp: 54 | OmegaConf.save(config=config, f=fp) 55 | 56 | def get_rank(): 57 | # SLURM_PROCID can be set even if SLURM is not managing the multiprocessing, 58 | # therefore LOCAL_RANK needs to be checked first 59 | rank_keys = ("RANK", "LOCAL_RANK", "SLURM_PROCID", "JSM_NAMESPACE_RANK") 60 | for key in rank_keys: 61 | rank = os.environ.get(key) 62 | if rank is not None: 63 | return int(rank) 64 | return 0 65 | 66 | 67 | def parse_version(ver): 68 | return version.parse(ver) 69 | -------------------------------------------------------------------------------- /tools/utils/obj.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | 4 | def load_obj(filename): 5 | # Read entire file 6 | with open(filename, 'r') as f: 7 | lines = f.readlines() 8 | 9 | # load vertices 10 | vertices, texcoords = [], [] 11 | for line in lines: 12 | if len(line.split()) == 0: 13 | continue 14 | 15 | prefix = line.split()[0].lower() 16 | if prefix == 'v': 17 | vertices.append([float(v) for v in line.split()[1:]]) 18 | elif prefix == 'vt': 19 | val = [float(v) for v in line.split()[1:]] 20 | texcoords.append([val[0], 1.0 - val[1]]) 21 | 22 | uv = len(texcoords) > 0 23 | faces, tfaces = [], [] 24 | for line in lines: 25 | if len(line.split()) == 0: 26 | continue 27 | prefix = line.split()[0].lower() 28 | if prefix == 'usemtl': # Track used materials 29 | pass 30 | elif prefix == 'f': # Parse face 31 | vs = line.split()[1:] 32 | nv = len(vs) 33 | vv = vs[0].split('/') 34 | v0 = int(vv[0]) - 1 35 | if uv: 36 | t0 = int(vv[1]) - 1 if vv[1] != "" else -1 37 | for i in range(nv - 2): # Triangulate polygons 38 | vv1 = vs[i + 1].split('/') 39 | v1 = int(vv1[0]) - 1 40 | vv2 = vs[i + 2].split('/') 41 | v2 = int(vv2[0]) - 1 42 | faces.append([v0, v1, v2]) 43 | if uv: 44 | t1 = int(vv1[1]) - 1 if vv1[1] != "" else -1 45 | t2 = int(vv2[1]) - 1 if vv2[1] != "" else -1 46 | tfaces.append([t0, t1, t2]) 47 | vertices = np.array(vertices, dtype=np.float32) 48 | faces = np.array(faces, dtype=np.int64) 49 | if uv: 50 | assert len(tfaces) == len(faces) 51 | texcoords = np.array(texcoords, dtype=np.float32) 52 | tfaces = np.array(tfaces, dtype=np.int64) 53 | else: 54 | texcoords, tfaces = None, None 55 | 56 | return vertices, faces, texcoords, tfaces 57 | 58 | 59 | def write_obj(filename, v_pos, t_pos_idx, v_tex, t_tex_idx): 60 | with open(filename, "w") as f: 61 | for v in v_pos: 62 | f.write('v {} {} {} \n'.format(v[0], v[1], v[2])) 63 | 64 | if v_tex is not None: 65 | assert(len(t_pos_idx) == len(t_tex_idx)) 66 | for v in v_tex: 67 | f.write('vt {} {} \n'.format(v[0], 1.0 - v[1])) 68 | 69 | # Write faces 70 | for i in range(len(t_pos_idx)): 71 | f.write("f ") 72 | for j in range(3): 73 | f.write(' %s/%s' % (str(t_pos_idx[i][j]+1), '' if v_tex is None else str(t_tex_idx[i][j]+1))) 74 | f.write("\n") 75 | --------------------------------------------------------------------------------