├── utils ├── __init__.py ├── training_utils.py ├── eval_metric.py └── checkpoints.py ├── data └── splits │ ├── deform4d │ ├── identity_unseen.lst │ ├── identity_seen.lst │ ├── identity_all.lst │ ├── test_unseen_identities.lst │ ├── test_unseen_motions.lst │ └── test.lst │ ├── dogrec │ ├── identity_unseen.lst │ └── test_unseen_identities.lst │ ├── tosca │ ├── identity_unseen.lst │ └── test_unseen_identities.lst │ └── deformtransfer │ ├── identity_unseen.lst │ └── test_unseen_identities.lst ├── pointnet2_ops_lib ├── MANIFEST.in ├── pointnet2_ops │ ├── _version.py │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── __init__.cpython-38.pyc │ │ ├── __init__.cpython-39.pyc │ │ ├── pointnet2_utils.cpython-38.pyc │ │ └── pointnet2_modules.cpython-38.pyc │ └── _ext-src │ │ ├── include │ │ ├── ball_query.h │ │ ├── group_points.h │ │ ├── sampling.h │ │ ├── interpolate.h │ │ ├── utils.h │ │ └── cuda_utils.h │ │ └── src │ │ ├── bindings.cpp │ │ ├── ball_query.cpp │ │ ├── ball_query_gpu.cu │ │ ├── group_points.cpp │ │ ├── group_points_gpu.cu │ │ └── sampling.cpp └── setup.py ├── external ├── eigen3 │ └── Eigen │ │ ├── Eigen │ │ ├── src │ │ ├── Core │ │ │ ├── util │ │ │ │ ├── NonMPL2.h │ │ │ │ └── ReenableStupidWarnings.h │ │ │ ├── functors │ │ │ │ └── TernaryFunctors.h │ │ │ ├── DiagonalProduct.h │ │ │ ├── arch │ │ │ │ ├── AVX │ │ │ │ │ └── TypeCasting.h │ │ │ │ ├── Default │ │ │ │ │ ├── Settings.h │ │ │ │ │ └── ConjHelper.h │ │ │ │ ├── SSE │ │ │ │ │ └── TypeCasting.h │ │ │ │ ├── CUDA │ │ │ │ │ └── MathFunctions.h │ │ │ │ └── NEON │ │ │ │ │ └── MathFunctions.h │ │ │ ├── SelfCwiseBinaryOp.h │ │ │ ├── Swap.h │ │ │ └── Assign.h │ │ ├── misc │ │ │ ├── lapacke_mangling.h │ │ │ ├── RealSvd2x2.h │ │ │ ├── Kernel.h │ │ │ └── Image.h │ │ ├── SparseCore │ │ │ ├── SparseFuzzy.h │ │ │ ├── SparseRedux.h │ │ │ ├── MappedSparseMatrix.h │ │ │ ├── SparseDot.h │ │ │ └── SparseTranspose.h │ │ ├── SparseLU │ │ │ ├── SparseLU_Utils.h │ │ │ └── SparseLU_relax_snode.h │ │ ├── StlSupport │ │ │ └── details.h │ │ ├── QR │ │ │ └── HouseholderQR_LAPACKE.h │ │ └── plugins │ │ │ └── MatrixCwiseUnaryOps.h │ │ ├── Dense │ │ ├── StdList │ │ ├── StdDeque │ │ ├── StdVector │ │ ├── Householder │ │ ├── Sparse │ │ ├── Jacobi │ │ ├── QtAlignedMalloc │ │ ├── MetisSupport │ │ ├── PardisoSupport │ │ ├── SPQRSupport │ │ ├── SparseQR │ │ ├── Cholesky │ │ ├── QR │ │ ├── UmfPackSupport │ │ ├── SparseCholesky │ │ ├── LU │ │ ├── SVD │ │ ├── PaStiXSupport │ │ ├── SparseLU │ │ ├── Eigenvalues │ │ ├── CholmodSupport │ │ ├── IterativeLinearSolvers │ │ ├── Geometry │ │ ├── SuperLUSupport │ │ ├── SparseCore │ │ └── OrderingMethods ├── PyMarchingCubes │ ├── requirements.txt │ ├── marching_cubes │ │ ├── src │ │ │ ├── pyarray_symbol.h │ │ │ ├── pywrapper.h │ │ │ └── _mcubes.pyx │ │ ├── __init__.py │ │ ├── exporter.py │ │ └── numpy_smoothing.py │ ├── images │ │ ├── binary.jpg │ │ ├── smooth.jpg │ │ ├── mc_colors.jpg │ │ ├── comparison.jpeg │ │ ├── mc_super_sampling.jpg │ │ └── smoothing_overview.png │ ├── examples │ │ └── .gitignore │ ├── MANIFEST.in │ ├── .travis.yml │ ├── LICENSE │ ├── test_mcubes.py │ ├── setup.py │ ├── test_smoothing.py │ └── .gitignore └── qview │ ├── Makefile │ └── Occnet.h ├── media ├── TDNets.png └── pipeline.png ├── model ├── decoder │ ├── __init__.py │ ├── crosstransformer_decoder.py │ └── interpolation_decoder.py ├── encoder │ └── __init__.py ├── learningrate.py └── utils.py ├── preprocess ├── convert_deform4d_anime_to_mesh.sh ├── preprocess_nocorr_tosca.sh ├── preprocess_nocorr_dogrec.sh ├── others │ ├── screened_poisson.mlx │ ├── make_watertight.sh │ └── process_mesh_local.sh ├── preprocess_deform4d_seq.sh └── preprocess_deformtransfer_seq.sh ├── dataset └── __init__.py ├── environment.yaml └── config ├── dogrec ├── tail.yaml ├── head.yaml ├── behindrightfoot.yaml └── frontleftfoot.yaml ├── tosca ├── head.yaml ├── tail.yaml ├── behindrightfoot.yaml └── frontleftfoot.yaml ├── deformtransfer └── arbitrary_unseen_iden.yaml └── deform4d ├── forward.yaml ├── backward.yaml ├── arbitrary.yaml └── arbitrary_unseen_iden.yaml /utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/splits/deform4d/identity_unseen.lst: -------------------------------------------------------------------------------- 1 | bearPDD_Death1 -------------------------------------------------------------------------------- /data/splits/dogrec/identity_unseen.lst: -------------------------------------------------------------------------------- 1 | dog0_z 2 | dog2_z 3 | -------------------------------------------------------------------------------- /data/splits/dogrec/test_unseen_identities.lst: -------------------------------------------------------------------------------- 1 | dog0_z 2 | dog2_z -------------------------------------------------------------------------------- /pointnet2_ops_lib/MANIFEST.in: -------------------------------------------------------------------------------- 1 | graft pointnet2_ops/_ext-src 2 | -------------------------------------------------------------------------------- /data/splits/tosca/identity_unseen.lst: -------------------------------------------------------------------------------- 1 | cat 2 | dog 3 | horse 4 | wolf 5 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | #include "Sparse" 3 | -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/_version.py: -------------------------------------------------------------------------------- 1 | __version__ = "3.0.0" 2 | -------------------------------------------------------------------------------- /data/splits/tosca/test_unseen_identities.lst: -------------------------------------------------------------------------------- 1 | cat 2 | dog 3 | horse 4 | wolf 5 | -------------------------------------------------------------------------------- /media/TDNets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangjiapeng/NSDP/HEAD/media/TDNets.png -------------------------------------------------------------------------------- /media/pipeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangjiapeng/NSDP/HEAD/media/pipeline.png -------------------------------------------------------------------------------- /external/PyMarchingCubes/requirements.txt: -------------------------------------------------------------------------------- 1 | numpy>=1.11.3 2 | scipy>=1.0.0 3 | cython>=0.25.0 4 | -------------------------------------------------------------------------------- /external/PyMarchingCubes/marching_cubes/src/pyarray_symbol.h: -------------------------------------------------------------------------------- 1 | 2 | #define PY_ARRAY_UNIQUE_SYMBOL mcubes_PyArray_API 3 | -------------------------------------------------------------------------------- /external/PyMarchingCubes/images/binary.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangjiapeng/NSDP/HEAD/external/PyMarchingCubes/images/binary.jpg -------------------------------------------------------------------------------- /external/PyMarchingCubes/images/smooth.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangjiapeng/NSDP/HEAD/external/PyMarchingCubes/images/smooth.jpg -------------------------------------------------------------------------------- /external/PyMarchingCubes/images/mc_colors.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangjiapeng/NSDP/HEAD/external/PyMarchingCubes/images/mc_colors.jpg -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/Core/util/NonMPL2.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_MPL2_ONLY 2 | #error Including non-MPL2 code in EIGEN_MPL2_ONLY mode 3 | #endif 4 | -------------------------------------------------------------------------------- /external/PyMarchingCubes/images/comparison.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangjiapeng/NSDP/HEAD/external/PyMarchingCubes/images/comparison.jpeg -------------------------------------------------------------------------------- /external/PyMarchingCubes/images/mc_super_sampling.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangjiapeng/NSDP/HEAD/external/PyMarchingCubes/images/mc_super_sampling.jpg -------------------------------------------------------------------------------- /external/PyMarchingCubes/images/smoothing_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangjiapeng/NSDP/HEAD/external/PyMarchingCubes/images/smoothing_overview.png -------------------------------------------------------------------------------- /external/PyMarchingCubes/examples/.gitignore: -------------------------------------------------------------------------------- 1 | sphere.obj 2 | sphere_color.obj 3 | sphere_color.off 4 | sphere_tsdf_super_res.off 5 | sphere_tsdf_without_super_res.off -------------------------------------------------------------------------------- /data/splits/deformtransfer/identity_unseen.lst: -------------------------------------------------------------------------------- 1 | camel-collapse 2 | camel-gallop 3 | cat-poses 4 | elephant-gallop 5 | elephant-poses 6 | horse-gallop 7 | horse-poses 8 | lion-poses -------------------------------------------------------------------------------- /external/eigen3/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/__init__.py: -------------------------------------------------------------------------------- 1 | import pointnet2_ops.pointnet2_modules 2 | import pointnet2_ops.pointnet2_utils 3 | from pointnet2_ops._version import __version__ 4 | -------------------------------------------------------------------------------- /data/splits/deformtransfer/test_unseen_identities.lst: -------------------------------------------------------------------------------- 1 | camel-gallop 2 | cat-poses 3 | horse-gallop 4 | horse-poses 5 | lion-poses 6 | elephant-gallop 7 | elephant-poses 8 | camel-collapse -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangjiapeng/NSDP/HEAD/pointnet2_ops_lib/pointnet2_ops/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangjiapeng/NSDP/HEAD/pointnet2_ops_lib/pointnet2_ops/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangjiapeng/NSDP/HEAD/pointnet2_ops_lib/pointnet2_ops/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/__pycache__/pointnet2_utils.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangjiapeng/NSDP/HEAD/pointnet2_ops_lib/pointnet2_ops/__pycache__/pointnet2_utils.cpython-38.pyc -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/__pycache__/pointnet2_modules.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tangjiapeng/NSDP/HEAD/pointnet2_ops_lib/pointnet2_ops/__pycache__/pointnet2_modules.cpython-38.pyc -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/_ext-src/include/ball_query.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | at::Tensor ball_query(at::Tensor new_xyz, at::Tensor xyz, const float radius, 5 | const int nsample); 6 | -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/_ext-src/include/group_points.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | at::Tensor group_points(at::Tensor points, at::Tensor idx); 5 | at::Tensor group_points_grad(at::Tensor grad_out, at::Tensor idx, const int n); 6 | -------------------------------------------------------------------------------- /model/decoder/__init__.py: -------------------------------------------------------------------------------- 1 | from model.decoder.crosstransformer_decoder import CrossTransformerDecoder 2 | from model.decoder.interpolation_decoder import PointInterpDecoder 3 | 4 | 5 | decoder_dict = { 6 | 'interp': PointInterpDecoder, 7 | 'crossatten': CrossTransformerDecoder, 8 | } -------------------------------------------------------------------------------- /model/encoder/__init__.py: -------------------------------------------------------------------------------- 1 | from model.encoder.pointnetplusplus import PointNetPlusPlusEncoder 2 | from model.encoder.pointransformer import PointTransformerEncoder 3 | 4 | encoder_dict = { 5 | 'pointnet++': PointNetPlusPlusEncoder, 6 | 'pointransformer': PointTransformerEncoder, 7 | } -------------------------------------------------------------------------------- /external/PyMarchingCubes/marching_cubes/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from ._mcubes import marching_cubes, marching_cubes_func, marching_cubes_color, marching_cubes_color_func, marching_cubes_super_sampling 3 | from .exporter import export_mesh, export_obj, export_off 4 | from .smoothing import * 5 | # from .numpy_smoothing import * 6 | -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/_ext-src/include/sampling.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | at::Tensor gather_points(at::Tensor points, at::Tensor idx); 5 | at::Tensor gather_points_grad(at::Tensor grad_out, at::Tensor idx, const int n); 6 | at::Tensor furthest_point_sampling(at::Tensor points, const int nsamples); 7 | -------------------------------------------------------------------------------- /preprocess/convert_deform4d_anime_to_mesh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | in_folder="/cluster/balrog/jtang/DeformingThings4D/animals" 4 | mesh_folder="/cluster_HDD/umoja/jtang/DeformingThings4D_processed" 5 | n_proc=12 6 | in_ext='anime' 7 | out_ext='obj' 8 | 9 | python convert_deform4d_anime_to_mesh.py ${in_folder} --mesh_folder="${mesh_folder}" --n_proc=${n_proc} --in_ext=${in_ext} --out_ext=${out_ext} --overwrite -------------------------------------------------------------------------------- /dataset/__init__.py: -------------------------------------------------------------------------------- 1 | from dataset.dataset_deform4d_flow import Deform4DFlow_Dataset 2 | from dataset.dataset_deformtransfer_flow import DeformTransferFlow_Dataset 3 | from dataset.dataset_userhandle_flow import DeformUserhandle_Dataset 4 | 5 | dataset_dict = { 6 | 'deform4d': Deform4DFlow_Dataset, 7 | 'deformtransfer': DeformTransferFlow_Dataset, 8 | 'tosca': DeformUserhandle_Dataset, 9 | 'dogrec': DeformUserhandle_Dataset, 10 | } -------------------------------------------------------------------------------- /preprocess/preprocess_nocorr_tosca.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | input_mesh_dir="/cluster/balrog/jtang/TOSCA" 3 | output_data_dir="/cluster_HDD/umoja/jtang/TOSCA_dataset" 4 | max_threads=12 5 | mesh_format="off" 6 | 7 | filter_lst="../data/splits/tosca/val_unseen_identities.lst" 8 | python generate_dataset_nocorr.py --input_mesh_dir="${input_mesh_dir}" --output_data_dir="${output_data_dir}" --max_threads=${max_threads} \ 9 | --mesh_format "${mesh_format}" #--filter_lst "${filter_lst}" -------------------------------------------------------------------------------- /external/PyMarchingCubes/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include marching_cubes/*.py 2 | exclude marching_cubes/numpy_smoothing.py 3 | 4 | include marching_cubes/src/*.h 5 | include marching_cubes/src/*.cpp 6 | include marching_cubes/src/_mcubes.pyx 7 | exclude marching_cubes/src/_mcubes.cpp 8 | 9 | include examples/*.py 10 | include images/binary.jpg 11 | include images/smooth.jpg 12 | include images/smoothing.png 13 | 14 | include setup.py 15 | include README.rst 16 | include LICENSE 17 | -------------------------------------------------------------------------------- /preprocess/preprocess_nocorr_dogrec.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | input_mesh_dir="/cluster/balrog/jtang/dog_barc_recon" 3 | output_data_dir="/cluster_HDD/umoja/jtang/dogrec_dataset" 4 | max_threads=4 5 | mesh_format="obj" 6 | 7 | filter_lst="../data/splits/dogrec/test_unseen_identities.lst" 8 | python generate_dataset_nocorr.py --input_mesh_dir="${input_mesh_dir}" --output_data_dir="${output_data_dir}" --max_threads=${max_threads} \ 9 | --mesh_format "${mesh_format}" #--filter_lst "${filter_lst}" -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/_ext-src/include/interpolate.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | std::vector three_nn(at::Tensor unknowns, at::Tensor knows); 7 | at::Tensor three_interpolate(at::Tensor points, at::Tensor idx, 8 | at::Tensor weight); 9 | at::Tensor three_interpolate_grad(at::Tensor grad_out, at::Tensor idx, 10 | at::Tensor weight, const int m); 11 | -------------------------------------------------------------------------------- /environment.yaml: -------------------------------------------------------------------------------- 1 | name: nsdp 2 | channels: 3 | - conda-forge 4 | - pytorch 5 | - defaults 6 | dependencies: 7 | - cython=0.29.15 8 | - trimesh=3.6.18 9 | - open3d=0.15.2 10 | - pytorch==1.11.0 11 | - torchvision==0.12.0 12 | - cudatoolkit=11.3 13 | - python=3.8.13 14 | - pykdtree=1.3.1 15 | - tensorboard=2.7.0 16 | - future=0.18.2 17 | - numpy=1.21.3 18 | - pandas=1.3.4 19 | - pip 20 | - pip: 21 | - pymcubes==0.1.0 22 | - pyyaml 23 | - wandb -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/misc/lapacke_mangling.h: -------------------------------------------------------------------------------- 1 | #ifndef LAPACK_HEADER_INCLUDED 2 | #define LAPACK_HEADER_INCLUDED 3 | 4 | #ifndef LAPACK_GLOBAL 5 | #if defined(LAPACK_GLOBAL_PATTERN_LC) || defined(ADD_) 6 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ 7 | #elif defined(LAPACK_GLOBAL_PATTERN_UC) || defined(UPPER) 8 | #define LAPACK_GLOBAL(lcname,UCNAME) UCNAME 9 | #elif defined(LAPACK_GLOBAL_PATTERN_MC) || defined(NOCHANGE) 10 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname 11 | #else 12 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ 13 | #endif 14 | #endif 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /preprocess/others/screened_poisson.mlx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/_ext-src/src/bindings.cpp: -------------------------------------------------------------------------------- 1 | #include "ball_query.h" 2 | #include "group_points.h" 3 | #include "interpolate.h" 4 | #include "sampling.h" 5 | 6 | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { 7 | m.def("gather_points", &gather_points); 8 | m.def("gather_points_grad", &gather_points_grad); 9 | m.def("furthest_point_sampling", &furthest_point_sampling); 10 | 11 | m.def("three_nn", &three_nn); 12 | m.def("three_interpolate", &three_interpolate); 13 | m.def("three_interpolate_grad", &three_interpolate_grad); 14 | 15 | m.def("ball_query", &ball_query); 16 | 17 | m.def("group_points", &group_points); 18 | m.def("group_points_grad", &group_points_grad); 19 | } 20 | -------------------------------------------------------------------------------- /preprocess/others/make_watertight.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | input_dir="SPECIFY INPUT DIR" 3 | output_dir="SPECIFY OUTPUT DIR" 4 | 5 | echo "Input dir: ${input_dir}" 6 | echo "Output dir: ${output_dir}" 7 | 8 | mkdir -p ${output_dir} 9 | 10 | for filename in $input_dir/*.ply; do 11 | # for filename in $input_dir/*.obj; do 12 | basename=$(basename $filename) 13 | 14 | # ../../external/gaps/bin/x86_64/msh2df "${input_dir}/${basename}" tmp.grd -output_mesh "${output_dir}/${basename}" \ 15 | # -estimate_sign -spacing 0.005 -v -estimate_sign_using_normals 16 | # rm tmp.grd 17 | 18 | meshlabserver -i "${input_dir}/${basename}" -o "${output_dir}/${basename}" -s screened_poisson.mlx 19 | done 20 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/Core/functors/TernaryFunctors.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Eugene Brevdo 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TERNARY_FUNCTORS_H 11 | #define EIGEN_TERNARY_FUNCTORS_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | //---------- associative ternary functors ---------- 18 | 19 | 20 | 21 | } // end namespace internal 22 | 23 | } // end namespace Eigen 24 | 25 | #endif // EIGEN_TERNARY_FUNCTORS_H 26 | -------------------------------------------------------------------------------- /data/splits/deform4d/identity_seen.lst: -------------------------------------------------------------------------------- 1 | bear3EP_Agression 2 | bear9AK_Agression 3 | bear84Q_Agression 4 | bearVGG_Actions0 5 | bucksYJL_Death0 6 | bullMJ6_Death2 7 | canieLTT_Actions0 8 | cattleAFK_Death1 9 | deer2MB_death1 10 | deerA4K_hide 11 | deerFEL_death1 12 | deerK5L_drink 13 | deerLO1_death1 14 | deerOMG_death1 15 | deerSPL_Actions0 16 | deerVMW_hide 17 | doggieMN5_death1 18 | elephantLN0_act1 19 | elkML_Actions0 20 | foxWDFS_Actions0 21 | foxXAT_death1 22 | foxYSY_death1 23 | foxZED_Hide 24 | goatS4J6Y_death1 25 | grizzRSS_Death1 26 | hippoDG_die 27 | huskydog3T_Death0 28 | lionessHTR42_action0 29 | moose1DOG_death1 30 | moose6OK9_death1 31 | moose45D_death1 32 | pigSTK69_eat1 33 | procySTEM_Death0 34 | pumaRW_Actions0 35 | raccoonVGG_DeathOpp0 36 | zebraBM_eat 37 | rhinoDJ7S_action1 38 | sheepYZR10_idle10 39 | tigerD8H_Death0 -------------------------------------------------------------------------------- /data/splits/deform4d/identity_all.lst: -------------------------------------------------------------------------------- 1 | bear3EP_Agression 2 | bear9AK_Agression 3 | bear84Q_Agression 4 | bearPDD_Death1 5 | bearVGG_Actions0 6 | bucksYJL_Death0 7 | bullMJ6_Death2 8 | canieLTT_Actions0 9 | cattleAFK_Death1 10 | deer2MB_death1 11 | deerA4K_hide 12 | deerFEL_death1 13 | deerK5L_drink 14 | deerLO1_death1 15 | deerOMG_death1 16 | deerSPL_Actions0 17 | deerVMW_hide 18 | doggieMN5_death1 19 | elephantLN0_act1 20 | elkML_Actions0 21 | foxWDFS_Actions0 22 | foxXAT_death1 23 | foxYSY_death1 24 | foxZED_Hide 25 | goatS4J6Y_death1 26 | grizzRSS_Death1 27 | hippoDG_die 28 | huskydog3T_Death0 29 | lionessHTR42_action0 30 | moose1DOG_death1 31 | moose6OK9_death1 32 | moose45D_death1 33 | pigSTK69_eat1 34 | procySTEM_Death0 35 | pumaRW_Actions0 36 | raccoonVGG_DeathOpp0 37 | zebraBM_eat 38 | rhinoDJ7S_action1 39 | sheepYZR10_idle10 40 | tigerD8H_Death0 41 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/StdList: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Hauke Heibel 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_STDLIST_MODULE_H 11 | #define EIGEN_STDLIST_MODULE_H 12 | 13 | #include "Core" 14 | #include 15 | 16 | #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ 17 | 18 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) 19 | 20 | #else 21 | 22 | #include "src/StlSupport/StdList.h" 23 | 24 | #endif 25 | 26 | #endif // EIGEN_STDLIST_MODULE_H 27 | -------------------------------------------------------------------------------- /external/PyMarchingCubes/marching_cubes/src/pywrapper.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _PYWRAPPER_H 3 | #define _PYWRAPPER_H 4 | 5 | #include 6 | #include "pyarraymodule.h" 7 | 8 | #include 9 | 10 | PyObject* marching_cubes(PyArrayObject* arr, double isovalue); 11 | PyObject* marching_cubes_func(PyObject* lower, PyObject* upper, 12 | int numx, int numy, int numz, PyObject* f, double isovalue); 13 | 14 | 15 | PyObject* marching_cubes_color(PyArrayObject* arr_sdf, PyArrayObject* arr_color, double isovalue); 16 | PyObject* marching_cubes_color_func(PyObject* lower, PyObject* upper, 17 | int numx, int numy, int numz, PyObject* f_sdf, PyObject* f_color_r, PyObject* f_color_g, PyObject* f_color_b, double isovalue); 18 | 19 | 20 | PyObject* marching_cubes_super_sampling(PyArrayObject* arrX, PyArrayObject* arrY, PyArrayObject* arrZ, double isovalue); 21 | 22 | #endif // _PYWRAPPER_H 23 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/StdDeque: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDDEQUE_MODULE_H 12 | #define EIGEN_STDDEQUE_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdDeque.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDDEQUE_MODULE_H 28 | -------------------------------------------------------------------------------- /utils/training_utils.py: -------------------------------------------------------------------------------- 1 | import yaml 2 | try: 3 | from yaml import CLoader as Loader 4 | except ImportError: 5 | from yaml import Loader 6 | import json 7 | 8 | import string 9 | import os 10 | import random 11 | import subprocess 12 | 13 | 14 | def load_config(config_file): 15 | with open(config_file, "r") as f: 16 | config = yaml.load(f, Loader=Loader) 17 | return config 18 | 19 | def save_experiment_params(args, experiment_tag, directory): 20 | t = vars(args) 21 | params = {k: str(v) for k, v in t.items()} 22 | 23 | params["experiment_tag"] = experiment_tag 24 | for k, v in list(params.items()): 25 | if v == "": 26 | params[k] = None 27 | if hasattr(args, "config_file"): 28 | config = load_config(args.config_file) 29 | params.update(config) 30 | with open(os.path.join(directory, "params.json"), "w") as f: 31 | json.dump(params, f, indent=4) 32 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/StdVector: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDVECTOR_MODULE_H 12 | #define EIGEN_STDVECTOR_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdVector.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDVECTOR_MODULE_H 28 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED 2 | #undef EIGEN_WARNINGS_DISABLED 3 | 4 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 5 | #ifdef _MSC_VER 6 | #pragma warning( pop ) 7 | #elif defined __INTEL_COMPILER 8 | #pragma warning pop 9 | #elif defined __clang__ 10 | #pragma clang diagnostic pop 11 | #elif defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) 12 | #pragma GCC diagnostic pop 13 | #endif 14 | 15 | #if defined __NVCC__ 16 | // Don't reenable the diagnostic messages, as it turns out these messages need 17 | // to be disabled at the point of the template instantiation (i.e the user code) 18 | // otherwise they'll be triggered by nvcc. 19 | // #pragma diag_default code_is_unreachable 20 | // #pragma diag_default initialization_not_reachable 21 | // #pragma diag_default 2651 22 | // #pragma diag_default 2653 23 | #endif 24 | 25 | #endif 26 | 27 | #endif // EIGEN_WARNINGS_DISABLED 28 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/Householder: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 9 | #define EIGEN_HOUSEHOLDER_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Householder_Module Householder module 16 | * This module provides Householder transformations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "src/Householder/Householder.h" 24 | #include "src/Householder/HouseholderSequence.h" 25 | #include "src/Householder/BlockHouseholder.h" 26 | 27 | #include "src/Core/util/ReenableStupidWarnings.h" 28 | 29 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 30 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 31 | -------------------------------------------------------------------------------- /external/qview/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2020 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # Application name 16 | # 17 | 18 | NAME=qview 19 | 20 | 21 | 22 | # 23 | # Source files. 24 | # 25 | 26 | CCSRCS=$(NAME).cpp R3QuadricSet.cpp R3Quadric.cpp 27 | 28 | 29 | 30 | # 31 | # Libraries 32 | # 33 | 34 | PKG_LIBS=-lR3Graphics -lR3Shapes -lR2Shapes -lRNBasics -lfglut -ljpeg -lpng 35 | 36 | 37 | 38 | # 39 | # Include standard makefile 40 | # 41 | 42 | include ../../makefiles/Makefile.apps 43 | 44 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/Sparse: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSE_MODULE_H 9 | #define EIGEN_SPARSE_MODULE_H 10 | 11 | /** \defgroup Sparse_Module Sparse meta-module 12 | * 13 | * Meta-module including all related modules: 14 | * - \ref SparseCore_Module 15 | * - \ref OrderingMethods_Module 16 | * - \ref SparseCholesky_Module 17 | * - \ref SparseLU_Module 18 | * - \ref SparseQR_Module 19 | * - \ref IterativeLinearSolvers_Module 20 | * 21 | \code 22 | #include 23 | \endcode 24 | */ 25 | 26 | #include "SparseCore" 27 | #include "OrderingMethods" 28 | #ifndef EIGEN_MPL2_ONLY 29 | #include "SparseCholesky" 30 | #endif 31 | #include "SparseLU" 32 | #include "SparseQR" 33 | #include "IterativeLinearSolvers" 34 | 35 | #endif // EIGEN_SPARSE_MODULE_H 36 | 37 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/Jacobi: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_JACOBI_MODULE_H 9 | #define EIGEN_JACOBI_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Jacobi_Module Jacobi module 16 | * This module provides Jacobi and Givens rotations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | * 22 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 23 | * - MatrixBase::applyOnTheLeft() 24 | * - MatrixBase::applyOnTheRight(). 25 | */ 26 | 27 | #include "src/Jacobi/Jacobi.h" 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif // EIGEN_JACOBI_MODULE_H 32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 33 | 34 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/Core/DiagonalProduct.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2007-2009 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_DIAGONALPRODUCT_H 12 | #define EIGEN_DIAGONALPRODUCT_H 13 | 14 | namespace Eigen { 15 | 16 | /** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. 17 | */ 18 | template 19 | template 20 | inline const Product 21 | MatrixBase::operator*(const DiagonalBase &a_diagonal) const 22 | { 23 | return Product(derived(),a_diagonal.derived()); 24 | } 25 | 26 | } // end namespace Eigen 27 | 28 | #endif // EIGEN_DIAGONALPRODUCT_H 29 | -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/_ext-src/include/utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | #define CHECK_CUDA(x) \ 6 | do { \ 7 | AT_ASSERT(x.is_cuda(), #x " must be a CUDA tensor"); \ 8 | } while (0) 9 | 10 | #define CHECK_CONTIGUOUS(x) \ 11 | do { \ 12 | AT_ASSERT(x.is_contiguous(), #x " must be a contiguous tensor"); \ 13 | } while (0) 14 | 15 | #define CHECK_IS_INT(x) \ 16 | do { \ 17 | AT_ASSERT(x.scalar_type() == at::ScalarType::Int, \ 18 | #x " must be an int tensor"); \ 19 | } while (0) 20 | 21 | #define CHECK_IS_FLOAT(x) \ 22 | do { \ 23 | AT_ASSERT(x.scalar_type() == at::ScalarType::Float, \ 24 | #x " must be a float tensor"); \ 25 | } while (0) 26 | -------------------------------------------------------------------------------- /preprocess/preprocess_deform4d_seq.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | input_mesh_dir="/cluster_HDD/umoja/jtang/DeformingThings4D_processed/animals" 5 | output_data_dir="/cluster_HDD/umoja/jtang/DeformingThings4D_processed_dataset/animals" 6 | max_threads=12 7 | mesh_format="obj" 8 | interval=3 9 | 10 | 11 | python generate_dataset_deform4d_seq.py --input_mesh_dir="${input_mesh_dir}" --output_data_dir="${output_data_dir}" --max_threads=${max_threads} \ 12 | --mesh_format "${mesh_format}" --interval ${interval} 13 | 14 | 15 | temp_lst="../data/splits/deform4d/identity_all.lst" 16 | python generate_dataset_deform4d_spaceflow.py --input_mesh_dir="${input_mesh_dir}" --output_data_dir="${output_data_dir}" --max_threads=${max_threads} \ 17 | --mesh_format "${mesh_format}" --interval ${interval} --temp_lst "${temp_lst}" 18 | 19 | 20 | temp_lst="../data/splits/deform4d/identity_all.lst" 21 | python generate_dataset_deform4d_surfaceflow.py --input_mesh_dir="${input_mesh_dir}" --output_data_dir="${output_data_dir}" --max_threads=${max_threads} \ 22 | --mesh_format "${mesh_format}" --interval ${interval} --temp_lst "${temp_lst}" 23 | -------------------------------------------------------------------------------- /external/PyMarchingCubes/.travis.yml: -------------------------------------------------------------------------------- 1 | # vim ft=yaml 2 | 3 | # After changing this file, check it on: 4 | # http://yaml-online-parser.appspot.com/ 5 | 6 | # See doc/travis_notes.txt for some guidelines 7 | 8 | language: python 9 | 10 | matrix: 11 | include: 12 | - os: linux 13 | dist: trusty 14 | sudo: false 15 | python: '3.6' 16 | - os: linux 17 | dist: xenial 18 | sudo: required 19 | python: '3.7' 20 | 21 | # See http://docs.travis-ci.com/user/caching/#pip-cache 22 | cache: pip 23 | 24 | before_install: 25 | - sudo apt-get update 26 | - pip install --upgrade pip setuptools 27 | 28 | install: 29 | - pip install -r requirements.txt 30 | - pip install nose>=1.3.7 coverage codecov pytest>=3.0.5 pycollada 31 | - python setup.py build 32 | - python setup.py build_ext --inplace 33 | 34 | before_script: 35 | - mkdir output 36 | 37 | script: 38 | - nosetests -v --exe --with-xunit --with-coverage --cover-package=mcubes 39 | 40 | after_success: 41 | - python setup.py install 42 | - codecov # PUBLIC project 43 | # - coverage report && coverage xml 44 | # - python-codacy-coverage -r coverage.xml 45 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/QtAlignedMalloc: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_QTMALLOC_MODULE_H 9 | #define EIGEN_QTMALLOC_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | void *qMalloc(std::size_t size) 18 | { 19 | return Eigen::internal::aligned_malloc(size); 20 | } 21 | 22 | void qFree(void *ptr) 23 | { 24 | Eigen::internal::aligned_free(ptr); 25 | } 26 | 27 | void *qRealloc(void *ptr, std::size_t size) 28 | { 29 | void* newPtr = Eigen::internal::aligned_malloc(size); 30 | std::memcpy(newPtr, ptr, size); 31 | Eigen::internal::aligned_free(ptr); 32 | return newPtr; 33 | } 34 | 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif 38 | 39 | #endif // EIGEN_QTMALLOC_MODULE_H 40 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 41 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/MetisSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_METISSUPPORT_MODULE_H 9 | #define EIGEN_METISSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | 20 | /** \ingroup Support_modules 21 | * \defgroup MetisSupport_Module MetisSupport module 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). 27 | * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink 28 | */ 29 | 30 | 31 | #include "src/MetisSupport/MetisSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_METISSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /preprocess/preprocess_deformtransfer_seq.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | input_mesh_dir="/cluster/balrog/jtang/DeformationTransfer_processed" 5 | output_data_dir="/cluster_HDD/umoja/jtang/DeformationTransfer_processed_dataset" 6 | max_threads=12 7 | mesh_format="obj" 8 | 9 | 10 | filter_lst="../data/splits/deformtransfer/test_unseen_identities.lst" 11 | python generate_dataset_deformtransfer_seq.py --input_mesh_dir="${input_mesh_dir}" --output_data_dir="${output_data_dir}" --max_threads=${max_threads} \ 12 | --mesh_format "${mesh_format}" #--filter_lst "${filter_lst}" 13 | 14 | 15 | temp_lst="../data/splits/deformtransfer/identity_unseen.lst" 16 | python generate_dataset_deformtransfer_surfaceflow.py --input_mesh_dir="${input_mesh_dir}" --output_data_dir="${output_data_dir}" --max_threads=${max_threads} \ 17 | --mesh_format "${mesh_format}" --temp_lst "${temp_lst}" 18 | 19 | 20 | temp_lst="../data/splits/deformtransfer/identity_unseen.lst" 21 | python generate_dataset_deformtransfer_spaceflow.py --input_mesh_dir="${input_mesh_dir}" --output_data_dir="${output_data_dir}" --max_threads=${max_threads} \ 22 | --mesh_format "${mesh_format}" --temp_lst "${temp_lst}" 23 | -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/_ext-src/src/ball_query.cpp: -------------------------------------------------------------------------------- 1 | #include "ball_query.h" 2 | #include "utils.h" 3 | 4 | void query_ball_point_kernel_wrapper(int b, int n, int m, float radius, 5 | int nsample, const float *new_xyz, 6 | const float *xyz, int *idx); 7 | 8 | at::Tensor ball_query(at::Tensor new_xyz, at::Tensor xyz, const float radius, 9 | const int nsample) { 10 | CHECK_CONTIGUOUS(new_xyz); 11 | CHECK_CONTIGUOUS(xyz); 12 | CHECK_IS_FLOAT(new_xyz); 13 | CHECK_IS_FLOAT(xyz); 14 | 15 | if (new_xyz.is_cuda()) { 16 | CHECK_CUDA(xyz); 17 | } 18 | 19 | at::Tensor idx = 20 | torch::zeros({new_xyz.size(0), new_xyz.size(1), nsample}, 21 | at::device(new_xyz.device()).dtype(at::ScalarType::Int)); 22 | 23 | if (new_xyz.is_cuda()) { 24 | query_ball_point_kernel_wrapper(xyz.size(0), xyz.size(1), new_xyz.size(1), 25 | radius, nsample, new_xyz.data_ptr(), 26 | xyz.data_ptr(), idx.data_ptr()); 27 | } else { 28 | AT_ASSERT(false, "CPU not supported"); 29 | } 30 | 31 | return idx; 32 | } 33 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/SparseCore/SparseFuzzy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_FUZZY_H 11 | #define EIGEN_SPARSE_FUZZY_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | template 17 | bool SparseMatrixBase::isApprox(const SparseMatrixBase& other, const RealScalar &prec) const 18 | { 19 | const typename internal::nested_eval::type actualA(derived()); 20 | typename internal::conditional::type, 22 | const PlainObject>::type actualB(other.derived()); 23 | 24 | return (actualA - actualB).squaredNorm() <= prec * prec * numext::mini(actualA.squaredNorm(), actualB.squaredNorm()); 25 | } 26 | 27 | } // end namespace Eigen 28 | 29 | #endif // EIGEN_SPARSE_FUZZY_H 30 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/PardisoSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H 9 | #define EIGEN_PARDISOSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include 16 | 17 | /** \ingroup Support_modules 18 | * \defgroup PardisoSupport_Module PardisoSupport module 19 | * 20 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies. 27 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. 28 | * 29 | */ 30 | 31 | #include "src/PardisoSupport/PardisoSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/SPQRSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPQRSUPPORT_MODULE_H 9 | #define EIGEN_SPQRSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "SuiteSparseQR.hpp" 16 | 17 | /** \ingroup Support_modules 18 | * \defgroup SPQRSupport_Module SuiteSparseQR module 19 | * 20 | * This module provides an interface to the SPQR library, which is part of the suitesparse package. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). 27 | * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules 28 | * 29 | */ 30 | 31 | #include "src/CholmodSupport/CholmodSupport.h" 32 | #include "src/SPQRSupport/SuiteSparseQRSupport.h" 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /pointnet2_ops_lib/setup.py: -------------------------------------------------------------------------------- 1 | import glob 2 | import os 3 | import os.path as osp 4 | 5 | from setuptools import find_packages, setup 6 | from torch.utils.cpp_extension import BuildExtension, CUDAExtension 7 | 8 | this_dir = osp.dirname(osp.abspath(__file__)) 9 | _ext_src_root = osp.join("pointnet2_ops", "_ext-src") 10 | _ext_sources = glob.glob(osp.join(_ext_src_root, "src", "*.cpp")) + glob.glob( 11 | osp.join(_ext_src_root, "src", "*.cu") 12 | ) 13 | _ext_headers = glob.glob(osp.join(_ext_src_root, "include", "*")) 14 | 15 | requirements = ["torch>=1.4"] 16 | 17 | exec(open(osp.join("pointnet2_ops", "_version.py")).read()) 18 | 19 | os.environ["TORCH_CUDA_ARCH_LIST"] = "3.7+PTX;5.0;6.0;6.1;6.2;7.0;7.5" 20 | setup( 21 | name="pointnet2_ops", 22 | version=__version__, 23 | author="Erik Wijmans", 24 | packages=find_packages(), 25 | install_requires=requirements, 26 | ext_modules=[ 27 | CUDAExtension( 28 | name="pointnet2_ops._ext", 29 | sources=_ext_sources, 30 | extra_compile_args={ 31 | "cxx": ["-O3"], 32 | "nvcc": ["-O3", "-Xfatbin", "-compress-all"], 33 | }, 34 | include_dirs=[osp.join(this_dir, _ext_src_root, "include")], 35 | ) 36 | ], 37 | cmdclass={"build_ext": BuildExtension}, 38 | include_package_data=True, 39 | ) 40 | -------------------------------------------------------------------------------- /data/splits/deform4d/test_unseen_identities.lst: -------------------------------------------------------------------------------- 1 | bearPDD_Jumpidle 2 | bearPDD_Death1 3 | bearPDD_IdlerotateLRM 4 | bearPDD_Hitrotate180LRM 5 | bearPDD_Attack1 6 | bearPDD_trotleftRM 7 | bearPDD_Hate1 8 | bearPDD_walkbackRM 9 | bearPDD_runleftRM 10 | bearPDD_Idlerotate180LRM 11 | bearPDD_Hitrotate90LRM 12 | bearPDD_JumpbottomidledownRM 13 | bearPDD_swimrightRM 14 | bearPDD_Hitrotate90RRM 15 | bearPDD_Hide 16 | bearPDD_Attack2 17 | bearPDD_HideRotLRM 18 | bearPDD_Hithate 19 | bearPDD_IdlerotateRRM 20 | bearPDD_walkbackRightRM 21 | bearPDD_trotrightRM 22 | bearPDD_Death2 23 | bearPDD_JumprunRM 24 | bearPDD_Hitrotate45RRM 25 | bearPDD_attackwalkRM 26 | bearPDD_eat1 27 | bearPDD_Idlerotate45RRM 28 | bearPDD_Idle1 29 | bearPDD_runrightRM 30 | bearPDD_walkhurtRM 31 | bearPDD_Hitsimple 32 | bearPDD_swimleftRM 33 | bearPDD_runforwardRM 34 | bearPDD_Sleep 35 | bearPDD_HideRotRRM 36 | bearPDD_JumpforwardRM 37 | bearPDD_trotforwardRM 38 | bearPDD_walkleftRM 39 | bearPDD_runstopRM 40 | bearPDD_Drinkwater 41 | bearPDD_attackrunRM 42 | bearPDD_JumptopidledownRM 43 | bearPDD_Idlerotate90RRM 44 | bearPDD_Hitrotate45LRM 45 | bearPDD_Hitrotate180RRM 46 | bearPDD_walkrightRM 47 | bearPDD_walkforwardRM 48 | bearPDD_Idlerotate180RRM 49 | bearPDD_Idlerotate45LRM 50 | bearPDD_Idlerotate90LRM 51 | bearPDD_JumpwalkRM 52 | bearPDD_walkbackLeftRM 53 | bearPDD_JumpupRM 54 | bearPDD_Idle2 55 | bearPDD_swimforwardRM -------------------------------------------------------------------------------- /external/eigen3/Eigen/SparseQR: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSEQR_MODULE_H 9 | #define EIGEN_SPARSEQR_MODULE_H 10 | 11 | #include "SparseCore" 12 | #include "OrderingMethods" 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup SparseQR_Module SparseQR module 16 | * \brief Provides QR decomposition for sparse matrices 17 | * 18 | * This module provides a simplicial version of the left-looking Sparse QR decomposition. 19 | * The columns of the input matrix should be reordered to limit the fill-in during the 20 | * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. 21 | * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list 22 | * of built-in and external ordering methods. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | * 28 | * 29 | */ 30 | 31 | #include "OrderingMethods" 32 | #include "src/SparseCore/SparseColEtree.h" 33 | #include "src/SparseQR/SparseQR.h" 34 | 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/Cholesky: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_CHOLESKY_MODULE_H 9 | #define EIGEN_CHOLESKY_MODULE_H 10 | 11 | #include "Core" 12 | #include "Jacobi" 13 | 14 | #include "src/Core/util/DisableStupidWarnings.h" 15 | 16 | /** \defgroup Cholesky_Module Cholesky module 17 | * 18 | * 19 | * 20 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 21 | * Those decompositions are also accessible via the following methods: 22 | * - MatrixBase::llt() 23 | * - MatrixBase::ldlt() 24 | * - SelfAdjointView::llt() 25 | * - SelfAdjointView::ldlt() 26 | * 27 | * \code 28 | * #include 29 | * \endcode 30 | */ 31 | 32 | #include "src/Cholesky/LLT.h" 33 | #include "src/Cholesky/LDLT.h" 34 | #ifdef EIGEN_USE_LAPACKE 35 | #ifdef EIGEN_USE_MKL 36 | #include "mkl_lapacke.h" 37 | #else 38 | #include "src/misc/lapacke.h" 39 | #endif 40 | #include "src/Cholesky/LLT_LAPACKE.h" 41 | #endif 42 | 43 | #include "src/Core/util/ReenableStupidWarnings.h" 44 | 45 | #endif // EIGEN_CHOLESKY_MODULE_H 46 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 47 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/Core/arch/AVX/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TYPE_CASTING_AVX_H 11 | #define EIGEN_TYPE_CASTING_AVX_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | // For now we use SSE to handle integers, so we can't use AVX instructions to cast 18 | // from int to float 19 | template <> 20 | struct type_casting_traits { 21 | enum { 22 | VectorizedCast = 0, 23 | SrcCoeffRatio = 1, 24 | TgtCoeffRatio = 1 25 | }; 26 | }; 27 | 28 | template <> 29 | struct type_casting_traits { 30 | enum { 31 | VectorizedCast = 0, 32 | SrcCoeffRatio = 1, 33 | TgtCoeffRatio = 1 34 | }; 35 | }; 36 | 37 | 38 | 39 | template<> EIGEN_STRONG_INLINE Packet8i pcast(const Packet8f& a) { 40 | return _mm256_cvtps_epi32(a); 41 | } 42 | 43 | template<> EIGEN_STRONG_INLINE Packet8f pcast(const Packet8i& a) { 44 | return _mm256_cvtepi32_ps(a); 45 | } 46 | 47 | } // end namespace internal 48 | 49 | } // end namespace Eigen 50 | 51 | #endif // EIGEN_TYPE_CASTING_AVX_H 52 | -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/_ext-src/include/cuda_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef _CUDA_UTILS_H 2 | #define _CUDA_UTILS_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #define TOTAL_THREADS 512 14 | 15 | inline int opt_n_threads(int work_size) { 16 | const int pow_2 = std::log(static_cast(work_size)) / std::log(2.0); 17 | 18 | return max(min(1 << pow_2, TOTAL_THREADS), 1); 19 | } 20 | 21 | inline dim3 opt_block_config(int x, int y) { 22 | const int x_threads = opt_n_threads(x); 23 | const int y_threads = 24 | max(min(opt_n_threads(y), TOTAL_THREADS / x_threads), 1); 25 | dim3 block_config(x_threads, y_threads, 1); 26 | 27 | return block_config; 28 | } 29 | 30 | #define CUDA_CHECK_ERRORS() \ 31 | do { \ 32 | cudaError_t err = cudaGetLastError(); \ 33 | if (cudaSuccess != err) { \ 34 | fprintf(stderr, "CUDA kernel failed : %s\n%s at L:%d in %s\n", \ 35 | cudaGetErrorString(err), __PRETTY_FUNCTION__, __LINE__, \ 36 | __FILE__); \ 37 | exit(-1); \ 38 | } \ 39 | } while (0) 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/QR: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_QR_MODULE_H 9 | #define EIGEN_QR_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "Cholesky" 16 | #include "Jacobi" 17 | #include "Householder" 18 | 19 | /** \defgroup QR_Module QR module 20 | * 21 | * 22 | * 23 | * This module provides various QR decompositions 24 | * This module also provides some MatrixBase methods, including: 25 | * - MatrixBase::householderQr() 26 | * - MatrixBase::colPivHouseholderQr() 27 | * - MatrixBase::fullPivHouseholderQr() 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | */ 33 | 34 | #include "src/QR/HouseholderQR.h" 35 | #include "src/QR/FullPivHouseholderQR.h" 36 | #include "src/QR/ColPivHouseholderQR.h" 37 | #include "src/QR/CompleteOrthogonalDecomposition.h" 38 | #ifdef EIGEN_USE_LAPACKE 39 | #ifdef EIGEN_USE_MKL 40 | #include "mkl_lapacke.h" 41 | #else 42 | #include "src/misc/lapacke.h" 43 | #endif 44 | #include "src/QR/HouseholderQR_LAPACKE.h" 45 | #include "src/QR/ColPivHouseholderQR_LAPACKE.h" 46 | #endif 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_QR_MODULE_H 51 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 52 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/UmfPackSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H 9 | #define EIGEN_UMFPACKSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | /** \ingroup Support_modules 20 | * \defgroup UmfPackSupport_Module UmfPackSupport module 21 | * 22 | * This module provides an interface to the UmfPack library which is part of the suitesparse package. 23 | * It provides the following factorization class: 24 | * - class UmfPackLU: a multifrontal sequential LU factorization. 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | * 30 | * In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies. 31 | * The dependencies depend on how umfpack has been compiled. 32 | * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. 33 | * 34 | */ 35 | 36 | #include "src/UmfPackSupport/UmfPackSupport.h" 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_UMFPACKSUPPORT_MODULE_H 41 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/SparseCholesky: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2013 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSECHOLESKY_MODULE_H 11 | #define EIGEN_SPARSECHOLESKY_MODULE_H 12 | 13 | #include "SparseCore" 14 | #include "OrderingMethods" 15 | 16 | #include "src/Core/util/DisableStupidWarnings.h" 17 | 18 | /** 19 | * \defgroup SparseCholesky_Module SparseCholesky module 20 | * 21 | * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices. 22 | * Those decompositions are accessible via the following classes: 23 | * - SimplicialLLt, 24 | * - SimplicialLDLt 25 | * 26 | * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module. 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | */ 32 | 33 | #ifdef EIGEN_MPL2_ONLY 34 | #error The SparseCholesky module has nothing to offer in MPL2 only mode 35 | #endif 36 | 37 | #include "src/SparseCholesky/SimplicialCholesky.h" 38 | 39 | #ifndef EIGEN_MPL2_ONLY 40 | #include "src/SparseCholesky/SimplicialCholesky_impl.h" 41 | #endif 42 | 43 | #include "src/Core/util/ReenableStupidWarnings.h" 44 | 45 | #endif // EIGEN_SPARSECHOLESKY_MODULE_H 46 | -------------------------------------------------------------------------------- /external/PyMarchingCubes/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2015, P. M. Neila (https://github.com/pmneila/PyMCubes) 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the copyright holder nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/LU: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_LU_MODULE_H 9 | #define EIGEN_LU_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup LU_Module LU module 16 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. 17 | * This module defines the following MatrixBase methods: 18 | * - MatrixBase::inverse() 19 | * - MatrixBase::determinant() 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | 26 | #include "src/misc/Kernel.h" 27 | #include "src/misc/Image.h" 28 | #include "src/LU/FullPivLU.h" 29 | #include "src/LU/PartialPivLU.h" 30 | #ifdef EIGEN_USE_LAPACKE 31 | #ifdef EIGEN_USE_MKL 32 | #include "mkl_lapacke.h" 33 | #else 34 | #include "src/misc/lapacke.h" 35 | #endif 36 | #include "src/LU/PartialPivLU_LAPACKE.h" 37 | #endif 38 | #include "src/LU/Determinant.h" 39 | #include "src/LU/InverseImpl.h" 40 | 41 | // Use the SSE optimized version whenever possible. At the moment the 42 | // SSE version doesn't compile when AVX is enabled 43 | #if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX 44 | #include "src/LU/arch/Inverse_SSE.h" 45 | #endif 46 | 47 | #include "src/Core/util/ReenableStupidWarnings.h" 48 | 49 | #endif // EIGEN_LU_MODULE_H 50 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 51 | -------------------------------------------------------------------------------- /external/qview/Occnet.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | // Include file for Occnet Class. 15 | // // This is a stub for now. 16 | // Class definition 17 | #ifndef OCCNET_H 18 | #define OCCNET_H 19 | 20 | class OccNet { 21 | public: 22 | OccNet(void); 23 | 24 | void SetShapeEmbedding(const RNScalar* embedding); 25 | RNScalar Evaluate(const R3Point& position); 26 | 27 | virtual int ReadFile(const char* filename); 28 | 29 | private: 30 | std::vector sample_resize_fc_weights; 31 | std::vector sample_resize_fc_biases; 32 | std::vector fc1_weights; 33 | std::vector fc1_biases; 34 | std::vector fc2_weights; 35 | std::vector fc2_biases; 36 | float cbn1_running_mean; 37 | float cbn1_running_variance; 38 | float cbn2_running_mean; 39 | float cbn2_running_variance; 40 | float cbnf_running_mean; 41 | float cbnf_running_variance; 42 | std::vector final_activation_weights; 43 | std::vector final_activation_bias; 44 | }; 45 | 46 | inline void SetShapeEmbedding(const RNScalar* embedding) { return; } 47 | 48 | inline RNScalar OccNet::Evaluate(const R3Point& position) { return 0.0; } 49 | 50 | #endif // OCCNET_H 51 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/SVD: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SVD_MODULE_H 9 | #define EIGEN_SVD_MODULE_H 10 | 11 | #include "QR" 12 | #include "Householder" 13 | #include "Jacobi" 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | /** \defgroup SVD_Module SVD module 18 | * 19 | * 20 | * 21 | * This module provides SVD decomposition for matrices (both real and complex). 22 | * Two decomposition algorithms are provided: 23 | * - JacobiSVD implementing two-sided Jacobi iterations is numerically very accurate, fast for small matrices, but very slow for larger ones. 24 | * - BDCSVD implementing a recursive divide & conquer strategy on top of an upper-bidiagonalization which remains fast for large problems. 25 | * These decompositions are accessible via the respective classes and following MatrixBase methods: 26 | * - MatrixBase::jacobiSvd() 27 | * - MatrixBase::bdcSvd() 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | */ 33 | 34 | #include "src/misc/RealSvd2x2.h" 35 | #include "src/SVD/UpperBidiagonalization.h" 36 | #include "src/SVD/SVDBase.h" 37 | #include "src/SVD/JacobiSVD.h" 38 | #include "src/SVD/BDCSVD.h" 39 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) 40 | #ifdef EIGEN_USE_MKL 41 | #include "mkl_lapacke.h" 42 | #else 43 | #include "src/misc/lapacke.h" 44 | #endif 45 | #include "src/SVD/JacobiSVD_LAPACKE.h" 46 | #endif 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_SVD_MODULE_H 51 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 52 | -------------------------------------------------------------------------------- /config/dogrec/tail.yaml: -------------------------------------------------------------------------------- 1 | experiment: 2 | out_dir: /cluster_HDD/umoja/jtang/nsdp_outdir 3 | name: dogrec_userhandles 4 | 5 | data: 6 | type: 'dogrec' 7 | dataset_dir: '/cluster_HDD/umoja/jtang/dogrec_dataset' 8 | split_dir: './data/splits/' 9 | interval: 1 10 | arbitrary: true 11 | inverse: false 12 | fix_coord_system: false 13 | partial_range: 0.1 14 | noise_level: 0.0 15 | partial_shape_ratio: 1.0 16 | norm_params_file: 'orig_to_gaps.txt' 17 | surface_flow_file: 'surface_points.npz' 18 | space_flow_file: 'flow.npz' 19 | mesh_file: 'model_normalized.obj' 20 | userhandle: 21 | cliptail: false 22 | head: false 23 | tail: true 24 | frontleftfoot: false 25 | frontrightfoot: false 26 | behindleftfoot: false 27 | behindrightfoot: false 28 | xtrans: -0.15 29 | ytrans: 0.15 30 | ztrans: -0.15 31 | model: 32 | type: 'arbitrary' 33 | use_normals: false 34 | encoder: 'pointransformer' 35 | encoder_kwargs: 36 | npoints_per_layer: [5000, 500, 100] 37 | nneighbor: 16 38 | nneighbor_reduced: 10 39 | nfinal_transformers: 3 40 | d_transformer: 256 41 | d_reduced: 120 42 | full_SA: true 43 | decoder: 'crossatten' 44 | decoder_kwargs: 45 | dim_inp: 256 46 | dim: 200 47 | nneigh: 7 48 | hidden_dim: 128 49 | out_dim: 3 50 | 51 | test: 52 | iden_split: 'identity_unseen' 53 | motion_split: 'test_unseen_identities' 54 | load_mesh: true 55 | num_sampled_pairs: -1 56 | batch_size: 1 57 | generate_mesh: true 58 | mesh_folder: 'meshes' 59 | mesh_format: 'ply' 60 | generate_pointcloud: false 61 | pointcloud_folder: 'pointclouds' 62 | pointcloud_format: 'ply' 63 | weight_file: "./pretrained/arbitrary.pt" -------------------------------------------------------------------------------- /config/tosca/head.yaml: -------------------------------------------------------------------------------- 1 | experiment: 2 | out_dir: /cluster_HDD/umoja/jtang/nsdp_outdir 3 | name: tosca_userhandles 4 | 5 | data: 6 | type: 'tosca' 7 | dataset_dir: '/cluster_HDD/umoja/jtang/TOSCA_dataset' 8 | split_dir: './data/splits/' 9 | interval: 1 10 | arbitrary: true 11 | inverse: false 12 | fix_coord_system: false 13 | partial_range: 0.1 14 | noise_level: 0.0 15 | partial_shape_ratio: 1.0 16 | norm_params_file: 'orig_to_gaps.txt' 17 | surface_flow_file: 'surface_points.npz' 18 | space_flow_file: 'flow.npz' 19 | mesh_file: 'model_normalized.obj' 20 | userhandle: 21 | cliptail: false 22 | head: true 23 | tail: false 24 | frontleftfoot: false 25 | frontrightfoot: false 26 | behindleftfoot: false 27 | behindrightfoot: false 28 | xtrans: -0.15 29 | ytrans: -0.20 30 | ztrans: -0.20 31 | 32 | model: 33 | type: 'arbitrary' 34 | use_normals: false 35 | encoder: 'pointransformer' 36 | encoder_kwargs: 37 | npoints_per_layer: [5000, 500, 100] 38 | nneighbor: 16 39 | nneighbor_reduced: 10 40 | nfinal_transformers: 3 41 | d_transformer: 256 42 | d_reduced: 120 43 | full_SA: true 44 | decoder: 'crossatten' 45 | decoder_kwargs: 46 | dim_inp: 256 47 | dim: 200 48 | nneigh: 7 49 | hidden_dim: 128 50 | out_dim: 3 51 | 52 | test: 53 | iden_split: 'identity_unseen' 54 | motion_split: 'test_unseen_identities' 55 | load_mesh: true 56 | num_sampled_pairs: -1 57 | batch_size: 1 58 | generate_mesh: true 59 | mesh_folder: 'meshes' 60 | mesh_format: 'ply' 61 | generate_pointcloud: false 62 | pointcloud_folder: 'pointclouds' 63 | pointcloud_format: 'ply' 64 | weight_file: "./pretrained/arbitrary.pt" -------------------------------------------------------------------------------- /config/tosca/tail.yaml: -------------------------------------------------------------------------------- 1 | experiment: 2 | out_dir: /cluster_HDD/umoja/jtang/nsdp_outdir 3 | name: tosca_userhandles 4 | 5 | data: 6 | type: 'tosca' 7 | dataset_dir: '/cluster_HDD/umoja/jtang/TOSCA_dataset' 8 | split_dir: './data/splits/' 9 | interval: 1 10 | arbitrary: true 11 | inverse: false 12 | fix_coord_system: false 13 | partial_range: 0.1 14 | noise_level: 0.0 15 | partial_shape_ratio: 1.0 16 | norm_params_file: 'orig_to_gaps.txt' 17 | surface_flow_file: 'surface_points.npz' 18 | space_flow_file: 'flow.npz' 19 | mesh_file: 'model_normalized.obj' 20 | userhandle: 21 | cliptail: false 22 | head: false 23 | tail: true 24 | frontleftfoot: false 25 | frontrightfoot: false 26 | behindleftfoot: false 27 | behindrightfoot: false 28 | xtrans: -0.15 29 | ytrans: 0.15 30 | ztrans: -0.15 31 | 32 | model: 33 | type: 'arbitrary' 34 | use_normals: false 35 | encoder: 'pointransformer' 36 | encoder_kwargs: 37 | npoints_per_layer: [5000, 500, 100] 38 | nneighbor: 16 39 | nneighbor_reduced: 10 40 | nfinal_transformers: 3 41 | d_transformer: 256 42 | d_reduced: 120 43 | full_SA: true 44 | decoder: 'crossatten' 45 | decoder_kwargs: 46 | dim_inp: 256 47 | dim: 200 48 | nneigh: 7 49 | hidden_dim: 128 50 | out_dim: 3 51 | 52 | test: 53 | iden_split: 'identity_unseen' 54 | motion_split: 'test_unseen_identities' 55 | load_mesh: true 56 | num_sampled_pairs: -1 57 | batch_size: 1 58 | generate_mesh: true 59 | mesh_folder: 'meshes' 60 | mesh_format: 'ply' 61 | generate_pointcloud: false 62 | pointcloud_folder: 'pointclouds' 63 | pointcloud_format: 'ply' 64 | weight_file: "./pretrained/arbitrary.pt" -------------------------------------------------------------------------------- /config/dogrec/head.yaml: -------------------------------------------------------------------------------- 1 | experiment: 2 | out_dir: /cluster_HDD/umoja/jtang/nsdp_outdir 3 | name: dogrec_userhandles 4 | 5 | data: 6 | type: 'dogrec' 7 | dataset_dir: '/cluster_HDD/umoja/jtang/dogrec_dataset' 8 | split_dir: './data/splits/' 9 | interval: 1 10 | arbitrary: true 11 | inverse: false 12 | fix_coord_system: false 13 | partial_range: 0.1 14 | noise_level: 0.0 15 | partial_shape_ratio: 1.0 16 | norm_params_file: 'orig_to_gaps.txt' 17 | surface_flow_file: 'surface_points.npz' 18 | space_flow_file: 'flow.npz' 19 | mesh_file: 'model_normalized.obj' 20 | userhandle: 21 | cliptail: false 22 | head: true 23 | tail: false 24 | frontleftfoot: false 25 | frontrightfoot: false 26 | behindleftfoot: false 27 | behindrightfoot: false 28 | xtrans: -0.15 29 | ytrans: -0.20 30 | ztrans: -0.20 31 | 32 | model: 33 | type: 'arbitrary' 34 | use_normals: false 35 | encoder: 'pointransformer' 36 | encoder_kwargs: 37 | npoints_per_layer: [5000, 500, 100] 38 | nneighbor: 16 39 | nneighbor_reduced: 10 40 | nfinal_transformers: 3 41 | d_transformer: 256 42 | d_reduced: 120 43 | full_SA: true 44 | decoder: 'crossatten' 45 | decoder_kwargs: 46 | dim_inp: 256 47 | dim: 200 48 | nneigh: 7 49 | hidden_dim: 128 50 | out_dim: 3 51 | 52 | test: 53 | iden_split: 'identity_unseen' 54 | motion_split: 'test_unseen_identities' 55 | load_mesh: true 56 | num_sampled_pairs: -1 57 | batch_size: 1 58 | generate_mesh: true 59 | mesh_folder: 'meshes' 60 | mesh_format: 'ply' 61 | generate_pointcloud: false 62 | pointcloud_folder: 'pointclouds' 63 | pointcloud_format: 'ply' 64 | weight_file: "./pretrained/arbitrary.pt" -------------------------------------------------------------------------------- /config/tosca/behindrightfoot.yaml: -------------------------------------------------------------------------------- 1 | experiment: 2 | out_dir: /cluster_HDD/umoja/jtang/nsdp_outdir 3 | name: tosca_userhandles 4 | 5 | data: 6 | type: 'tosca' 7 | dataset_dir: '/cluster_HDD/umoja/jtang/TOSCA_dataset' 8 | split_dir: './data/splits/' 9 | interval: 1 10 | arbitrary: true 11 | inverse: false 12 | fix_coord_system: false 13 | partial_range: 0.1 14 | noise_level: 0.0 15 | partial_shape_ratio: 1.0 16 | norm_params_file: 'orig_to_gaps.txt' 17 | surface_flow_file: 'surface_points.npz' 18 | space_flow_file: 'flow.npz' 19 | mesh_file: 'model_normalized.obj' 20 | userhandle: 21 | cliptail: false 22 | head: false 23 | tail: false 24 | frontleftfoot: false 25 | frontrightfoot: false 26 | behindleftfoot: false 27 | behindrightfoot: true 28 | xtrans: -0.15 29 | ytrans: -0.20 30 | ztrans: 0.20 31 | 32 | model: 33 | type: 'arbitrary' 34 | use_normals: false 35 | encoder: 'pointransformer' 36 | encoder_kwargs: 37 | npoints_per_layer: [5000, 500, 100] 38 | nneighbor: 16 39 | nneighbor_reduced: 10 40 | nfinal_transformers: 3 41 | d_transformer: 256 42 | d_reduced: 120 43 | full_SA: true 44 | decoder: 'crossatten' 45 | decoder_kwargs: 46 | dim_inp: 256 47 | dim: 200 48 | nneigh: 7 49 | hidden_dim: 128 50 | out_dim: 3 51 | 52 | test: 53 | iden_split: 'identity_unseen' 54 | motion_split: 'test_unseen_identities' 55 | load_mesh: true 56 | num_sampled_pairs: -1 57 | batch_size: 1 58 | generate_mesh: true 59 | mesh_folder: 'meshes' 60 | mesh_format: 'ply' 61 | generate_pointcloud: false 62 | pointcloud_folder: 'pointclouds' 63 | pointcloud_format: 'ply' 64 | weight_file: "./pretrained/arbitrary.pt" -------------------------------------------------------------------------------- /config/tosca/frontleftfoot.yaml: -------------------------------------------------------------------------------- 1 | experiment: 2 | out_dir: /cluster_HDD/umoja/jtang/nsdp_outdir 3 | name: tosca_userhandles 4 | 5 | data: 6 | type: 'tosca' 7 | dataset_dir: '/cluster_HDD/umoja/jtang/TOSCA_dataset' 8 | split_dir: './data/splits/' 9 | interval: 1 10 | arbitrary: true 11 | inverse: false 12 | fix_coord_system: false 13 | partial_range: 0.1 14 | noise_level: 0.0 15 | partial_shape_ratio: 1.0 16 | norm_params_file: 'orig_to_gaps.txt' 17 | surface_flow_file: 'surface_points.npz' 18 | space_flow_file: 'flow.npz' 19 | mesh_file: 'model_normalized.obj' 20 | userhandle: 21 | cliptail: false 22 | head: false 23 | tail: false 24 | frontleftfoot: true 25 | frontrightfoot: false 26 | behindleftfoot: false 27 | behindrightfoot: false 28 | xtrans: 0.15 29 | ytrans: -0.20 30 | ztrans: 0.20 31 | 32 | model: 33 | type: 'arbitrary' 34 | use_normals: false 35 | encoder: 'pointransformer' 36 | encoder_kwargs: 37 | npoints_per_layer: [5000, 500, 100] 38 | nneighbor: 16 39 | nneighbor_reduced: 10 40 | nfinal_transformers: 3 41 | d_transformer: 256 42 | d_reduced: 120 43 | full_SA: true 44 | decoder: 'crossatten' 45 | decoder_kwargs: 46 | dim_inp: 256 47 | dim: 200 48 | nneigh: 7 49 | hidden_dim: 128 50 | out_dim: 3 51 | 52 | test: 53 | iden_split: 'identity_unseen' 54 | motion_split: 'test_unseen_identities' 55 | load_mesh: true 56 | num_sampled_pairs: -1 57 | batch_size: 1 58 | generate_mesh: true 59 | mesh_folder: 'meshes' 60 | mesh_format: 'ply' 61 | generate_pointcloud: false 62 | pointcloud_folder: 'pointclouds' 63 | pointcloud_format: 'ply' 64 | weight_file: "./pretrained/arbitrary.pt" -------------------------------------------------------------------------------- /config/dogrec/behindrightfoot.yaml: -------------------------------------------------------------------------------- 1 | experiment: 2 | out_dir: /cluster_HDD/umoja/jtang/nsdp_outdir 3 | name: dogrec_userhandles 4 | 5 | data: 6 | type: 'dogrec' 7 | dataset_dir: '/cluster_HDD/umoja/jtang/dogrec_dataset' 8 | split_dir: './data/splits/' 9 | interval: 1 10 | arbitrary: true 11 | inverse: false 12 | fix_coord_system: false 13 | partial_range: 0.1 14 | noise_level: 0.0 15 | partial_shape_ratio: 1.0 16 | norm_params_file: 'orig_to_gaps.txt' 17 | surface_flow_file: 'surface_points.npz' 18 | space_flow_file: 'flow.npz' 19 | mesh_file: 'model_normalized.obj' 20 | userhandle: 21 | cliptail: false 22 | head: false 23 | tail: false 24 | frontleftfoot: false 25 | frontrightfoot: false 26 | behindleftfoot: false 27 | behindrightfoot: true 28 | xtrans: -0.15 29 | ytrans: -0.20 30 | ztrans: 0.20 31 | 32 | model: 33 | type: 'arbitrary' 34 | use_normals: false 35 | encoder: 'pointransformer' 36 | encoder_kwargs: 37 | npoints_per_layer: [5000, 500, 100] 38 | nneighbor: 16 39 | nneighbor_reduced: 10 40 | nfinal_transformers: 3 41 | d_transformer: 256 42 | d_reduced: 120 43 | full_SA: true 44 | decoder: 'crossatten' 45 | decoder_kwargs: 46 | dim_inp: 256 47 | dim: 200 48 | nneigh: 7 49 | hidden_dim: 128 50 | out_dim: 3 51 | 52 | test: 53 | iden_split: 'identity_unseen' 54 | motion_split: 'test_unseen_identities' 55 | load_mesh: true 56 | num_sampled_pairs: -1 57 | batch_size: 1 58 | generate_mesh: true 59 | mesh_folder: 'meshes' 60 | mesh_format: 'ply' 61 | generate_pointcloud: false 62 | pointcloud_folder: 'pointclouds' 63 | pointcloud_format: 'ply' 64 | weight_file: "./pretrained/arbitrary.pt" -------------------------------------------------------------------------------- /config/dogrec/frontleftfoot.yaml: -------------------------------------------------------------------------------- 1 | experiment: 2 | out_dir: /cluster_HDD/umoja/jtang/nsdp_outdir 3 | name: dogrec_userhandles 4 | 5 | data: 6 | type: 'dogrec' 7 | dataset_dir: '/cluster_HDD/umoja/jtang/dogrec_dataset' 8 | split_dir: './data/splits/' 9 | interval: 1 10 | arbitrary: true 11 | inverse: false 12 | fix_coord_system: false 13 | partial_range: 0.1 14 | noise_level: 0.0 15 | partial_shape_ratio: 1.0 16 | norm_params_file: 'orig_to_gaps.txt' 17 | surface_flow_file: 'surface_points.npz' 18 | space_flow_file: 'flow.npz' 19 | mesh_file: 'model_normalized.obj' 20 | userhandle: 21 | cliptail: false 22 | head: false 23 | tail: false 24 | frontleftfoot: true 25 | frontrightfoot: false 26 | behindleftfoot: false 27 | behindrightfoot: false 28 | xtrans: 0.15 29 | ytrans: -0.20 30 | ztrans: 0.20 31 | 32 | model: 33 | type: 'arbitrary' 34 | use_normals: false 35 | encoder: 'pointransformer' 36 | encoder_kwargs: 37 | npoints_per_layer: [5000, 500, 100] 38 | nneighbor: 16 39 | nneighbor_reduced: 10 40 | nfinal_transformers: 3 41 | d_transformer: 256 42 | d_reduced: 120 43 | full_SA: true 44 | decoder: 'crossatten' 45 | decoder_kwargs: 46 | dim_inp: 256 47 | dim: 200 48 | nneigh: 7 49 | hidden_dim: 128 50 | out_dim: 3 51 | 52 | test: 53 | iden_split: 'identity_unseen' 54 | motion_split: 'test_unseen_identities' 55 | load_mesh: true 56 | num_sampled_pairs: -1 57 | batch_size: 1 58 | generate_mesh: true 59 | mesh_folder: 'meshes' 60 | mesh_format: 'ply' 61 | generate_pointcloud: false 62 | pointcloud_folder: 'pointclouds' 63 | pointcloud_format: 'ply' 64 | weight_file: "./pretrained/arbitrary.pt" -------------------------------------------------------------------------------- /external/eigen3/Eigen/PaStiXSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_PASTIXSUPPORT_MODULE_H 9 | #define EIGEN_PASTIXSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | #include 18 | } 19 | 20 | #ifdef complex 21 | #undef complex 22 | #endif 23 | 24 | /** \ingroup Support_modules 25 | * \defgroup PaStiXSupport_Module PaStiXSupport module 26 | * 27 | * This module provides an interface to the PaSTiX library. 28 | * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. 29 | * It provides the two following main factorization classes: 30 | * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. 31 | * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. 32 | * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). 33 | * 34 | * \code 35 | * #include 36 | * \endcode 37 | * 38 | * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies. 39 | * The dependencies depend on how PaSTiX has been compiled. 40 | * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. 41 | * 42 | */ 43 | 44 | #include "src/PaStiXSupport/PaStiXSupport.h" 45 | 46 | #include "src/Core/util/ReenableStupidWarnings.h" 47 | 48 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H 49 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/SparseLU: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // Copyright (C) 2012 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_SPARSELU_MODULE_H 12 | #define EIGEN_SPARSELU_MODULE_H 13 | 14 | #include "SparseCore" 15 | 16 | /** 17 | * \defgroup SparseLU_Module SparseLU module 18 | * This module defines a supernodal factorization of general sparse matrices. 19 | * The code is fully optimized for supernode-panel updates with specialized kernels. 20 | * Please, see the documentation of the SparseLU class for more details. 21 | */ 22 | 23 | // Ordering interface 24 | #include "OrderingMethods" 25 | 26 | #include "src/SparseLU/SparseLU_gemm_kernel.h" 27 | 28 | #include "src/SparseLU/SparseLU_Structs.h" 29 | #include "src/SparseLU/SparseLU_SupernodalMatrix.h" 30 | #include "src/SparseLU/SparseLUImpl.h" 31 | #include "src/SparseCore/SparseColEtree.h" 32 | #include "src/SparseLU/SparseLU_Memory.h" 33 | #include "src/SparseLU/SparseLU_heap_relax_snode.h" 34 | #include "src/SparseLU/SparseLU_relax_snode.h" 35 | #include "src/SparseLU/SparseLU_pivotL.h" 36 | #include "src/SparseLU/SparseLU_panel_dfs.h" 37 | #include "src/SparseLU/SparseLU_kernel_bmod.h" 38 | #include "src/SparseLU/SparseLU_panel_bmod.h" 39 | #include "src/SparseLU/SparseLU_column_dfs.h" 40 | #include "src/SparseLU/SparseLU_column_bmod.h" 41 | #include "src/SparseLU/SparseLU_copy_to_ucol.h" 42 | #include "src/SparseLU/SparseLU_pruneL.h" 43 | #include "src/SparseLU/SparseLU_Utils.h" 44 | #include "src/SparseLU/SparseLU.h" 45 | 46 | #endif // EIGEN_SPARSELU_MODULE_H 47 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SELFCWISEBINARYOP_H 11 | #define EIGEN_SELFCWISEBINARYOP_H 12 | 13 | namespace Eigen { 14 | 15 | // TODO generalize the scalar type of 'other' 16 | 17 | template 18 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator*=(const Scalar& other) 19 | { 20 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::mul_assign_op()); 21 | return derived(); 22 | } 23 | 24 | template 25 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase::operator+=(const Scalar& other) 26 | { 27 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::add_assign_op()); 28 | return derived(); 29 | } 30 | 31 | template 32 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase::operator-=(const Scalar& other) 33 | { 34 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::sub_assign_op()); 35 | return derived(); 36 | } 37 | 38 | template 39 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator/=(const Scalar& other) 40 | { 41 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::div_assign_op()); 42 | return derived(); 43 | } 44 | 45 | } // end namespace Eigen 46 | 47 | #endif // EIGEN_SELFCWISEBINARYOP_H 48 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/SparseCore/SparseRedux.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSEREDUX_H 11 | #define EIGEN_SPARSEREDUX_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | typename internal::traits::Scalar 17 | SparseMatrixBase::sum() const 18 | { 19 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 20 | Scalar res(0); 21 | internal::evaluator thisEval(derived()); 22 | for (Index j=0; j::InnerIterator iter(thisEval,j); iter; ++iter) 24 | res += iter.value(); 25 | return res; 26 | } 27 | 28 | template 29 | typename internal::traits >::Scalar 30 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 31 | { 32 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 33 | if(this->isCompressed()) 34 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 35 | else 36 | return Base::sum(); 37 | } 38 | 39 | template 40 | typename internal::traits >::Scalar 41 | SparseVector<_Scalar,_Options,_Index>::sum() const 42 | { 43 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 44 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 45 | } 46 | 47 | } // end namespace Eigen 48 | 49 | #endif // EIGEN_SPARSEREDUX_H 50 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/Core/arch/Default/Settings.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | 12 | /* All the parameters defined in this file can be specialized in the 13 | * architecture specific files, and/or by the user. 14 | * More to come... */ 15 | 16 | #ifndef EIGEN_DEFAULT_SETTINGS_H 17 | #define EIGEN_DEFAULT_SETTINGS_H 18 | 19 | /** Defines the maximal loop size to enable meta unrolling of loops. 20 | * Note that the value here is expressed in Eigen's own notion of "number of FLOPS", 21 | * it does not correspond to the number of iterations or the number of instructions 22 | */ 23 | #ifndef EIGEN_UNROLLING_LIMIT 24 | #define EIGEN_UNROLLING_LIMIT 100 25 | #endif 26 | 27 | /** Defines the threshold between a "small" and a "large" matrix. 28 | * This threshold is mainly used to select the proper product implementation. 29 | */ 30 | #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 31 | #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8 32 | #endif 33 | 34 | /** Defines the maximal width of the blocks used in the triangular product and solver 35 | * for vectors (level 2 blas xTRMV and xTRSV). The default is 8. 36 | */ 37 | #ifndef EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 38 | #define EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 8 39 | #endif 40 | 41 | 42 | /** Defines the default number of registers available for that architecture. 43 | * Currently it must be 8 or 16. Other values will fail. 44 | */ 45 | #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 46 | #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 8 47 | #endif 48 | 49 | #endif // EIGEN_DEFAULT_SETTINGS_H 50 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/misc/RealSvd2x2.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Benoit Jacob 5 | // Copyright (C) 2013-2016 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_REALSVD2X2_H 12 | #define EIGEN_REALSVD2X2_H 13 | 14 | namespace Eigen { 15 | 16 | namespace internal { 17 | 18 | template 19 | void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q, 20 | JacobiRotation *j_left, 21 | JacobiRotation *j_right) 22 | { 23 | using std::sqrt; 24 | using std::abs; 25 | Matrix m; 26 | m << numext::real(matrix.coeff(p,p)), numext::real(matrix.coeff(p,q)), 27 | numext::real(matrix.coeff(q,p)), numext::real(matrix.coeff(q,q)); 28 | JacobiRotation rot1; 29 | RealScalar t = m.coeff(0,0) + m.coeff(1,1); 30 | RealScalar d = m.coeff(1,0) - m.coeff(0,1); 31 | 32 | if(abs(d) < (std::numeric_limits::min)()) 33 | { 34 | rot1.s() = RealScalar(0); 35 | rot1.c() = RealScalar(1); 36 | } 37 | else 38 | { 39 | // If d!=0, then t/d cannot overflow because the magnitude of the 40 | // entries forming d are not too small compared to the ones forming t. 41 | RealScalar u = t / d; 42 | RealScalar tmp = sqrt(RealScalar(1) + numext::abs2(u)); 43 | rot1.s() = RealScalar(1) / tmp; 44 | rot1.c() = u / tmp; 45 | } 46 | m.applyOnTheLeft(0,1,rot1); 47 | j_right->makeJacobi(m,0,1); 48 | *j_left = rot1 * j_right->transpose(); 49 | } 50 | 51 | } // end namespace internal 52 | 53 | } // end namespace Eigen 54 | 55 | #endif // EIGEN_REALSVD2X2_H 56 | -------------------------------------------------------------------------------- /config/deformtransfer/arbitrary_unseen_iden.yaml: -------------------------------------------------------------------------------- 1 | experiment: 2 | out_dir: /cluster_HDD/umoja/jtang/nsdp_outdir 3 | name: deformtransfer_arbitrary 4 | 5 | data: 6 | type: 'deformtransfer' 7 | dataset_dir: '/cluster_HDD/umoja/jtang/DeformationTransfer_processed_dataset/' 8 | split_dir: './data/splits/' 9 | interval: 1 10 | arbitrary: true 11 | inverse: false 12 | fix_coord_system: true 13 | num_surf_samples: 5000 14 | num_space_samples: 5000 15 | partial_range: 0.1 16 | noise_level: 0.0 17 | partial_shape_ratio: 1.0 18 | norm_params_file: 'orig_to_gaps.txt' 19 | surface_flow_file: 'surface_points.npz' 20 | space_flow_file: 'flow.npz' 21 | mesh_file: 'mesh_orig.obj' #'model_normalized.obj' 22 | userhandle: 23 | cliptail: false 24 | head: false 25 | tail: false 26 | frontleftfoot: false 27 | frontrightfoot: false 28 | behindleftfoot: false 29 | behindrightfoot: false 30 | xtrans: 0.0 31 | ytrans: 0.0 32 | ztrans: 0.0 33 | 34 | model: 35 | type: 'arbitrary' 36 | use_normals: false 37 | encoder: 'pointransformer' 38 | encoder_kwargs: 39 | npoints_per_layer: [5000, 500, 100] 40 | nneighbor: 16 41 | nneighbor_reduced: 10 42 | nfinal_transformers: 3 43 | d_transformer: 256 44 | d_reduced: 120 45 | full_SA: true 46 | decoder: 'crossatten' 47 | decoder_kwargs: 48 | dim_inp: 256 49 | dim: 200 50 | nneigh: 7 51 | hidden_dim: 128 52 | out_dim: 3 53 | 54 | test: 55 | iden_split: 'identity_unseen' 56 | motion_split: 'test_unseen_identities' 57 | load_mesh: true 58 | num_sampled_pairs: 100 59 | batch_size: 1 60 | generate_mesh: true 61 | mesh_folder: 'meshes' 62 | mesh_format: 'ply' 63 | generate_pointcloud: true 64 | pointcloud_folder: 'pointclouds' 65 | pointcloud_format: 'ply' 66 | weight_file: "./pretrained/arbitrary.pt" -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/_ext-src/src/ball_query_gpu.cu: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "cuda_utils.h" 6 | 7 | // input: new_xyz(b, m, 3) xyz(b, n, 3) 8 | // output: idx(b, m, nsample) 9 | __global__ void query_ball_point_kernel(int b, int n, int m, float radius, 10 | int nsample, 11 | const float *__restrict__ new_xyz, 12 | const float *__restrict__ xyz, 13 | int *__restrict__ idx) { 14 | int batch_index = blockIdx.x; 15 | xyz += batch_index * n * 3; 16 | new_xyz += batch_index * m * 3; 17 | idx += m * nsample * batch_index; 18 | 19 | int index = threadIdx.x; 20 | int stride = blockDim.x; 21 | 22 | float radius2 = radius * radius; 23 | for (int j = index; j < m; j += stride) { 24 | float new_x = new_xyz[j * 3 + 0]; 25 | float new_y = new_xyz[j * 3 + 1]; 26 | float new_z = new_xyz[j * 3 + 2]; 27 | for (int k = 0, cnt = 0; k < n && cnt < nsample; ++k) { 28 | float x = xyz[k * 3 + 0]; 29 | float y = xyz[k * 3 + 1]; 30 | float z = xyz[k * 3 + 2]; 31 | float d2 = (new_x - x) * (new_x - x) + (new_y - y) * (new_y - y) + 32 | (new_z - z) * (new_z - z); 33 | if (d2 < radius2) { 34 | if (cnt == 0) { 35 | for (int l = 0; l < nsample; ++l) { 36 | idx[j * nsample + l] = k; 37 | } 38 | } 39 | idx[j * nsample + cnt] = k; 40 | ++cnt; 41 | } 42 | } 43 | } 44 | } 45 | 46 | void query_ball_point_kernel_wrapper(int b, int n, int m, float radius, 47 | int nsample, const float *new_xyz, 48 | const float *xyz, int *idx) { 49 | cudaStream_t stream = at::cuda::getCurrentCUDAStream(); 50 | query_ball_point_kernel<<>>( 51 | b, n, m, radius, nsample, new_xyz, xyz, idx); 52 | 53 | CUDA_CHECK_ERRORS(); 54 | } 55 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/Eigenvalues: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_EIGENVALUES_MODULE_H 9 | #define EIGEN_EIGENVALUES_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "Cholesky" 16 | #include "Jacobi" 17 | #include "Householder" 18 | #include "LU" 19 | #include "Geometry" 20 | 21 | /** \defgroup Eigenvalues_Module Eigenvalues module 22 | * 23 | * 24 | * 25 | * This module mainly provides various eigenvalue solvers. 26 | * This module also provides some MatrixBase methods, including: 27 | * - MatrixBase::eigenvalues(), 28 | * - MatrixBase::operatorNorm() 29 | * 30 | * \code 31 | * #include 32 | * \endcode 33 | */ 34 | 35 | #include "src/misc/RealSvd2x2.h" 36 | #include "src/Eigenvalues/Tridiagonalization.h" 37 | #include "src/Eigenvalues/RealSchur.h" 38 | #include "src/Eigenvalues/EigenSolver.h" 39 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" 40 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" 41 | #include "src/Eigenvalues/HessenbergDecomposition.h" 42 | #include "src/Eigenvalues/ComplexSchur.h" 43 | #include "src/Eigenvalues/ComplexEigenSolver.h" 44 | #include "src/Eigenvalues/RealQZ.h" 45 | #include "src/Eigenvalues/GeneralizedEigenSolver.h" 46 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" 47 | #ifdef EIGEN_USE_LAPACKE 48 | #ifdef EIGEN_USE_MKL 49 | #include "mkl_lapacke.h" 50 | #else 51 | #include "src/misc/lapacke.h" 52 | #endif 53 | #include "src/Eigenvalues/RealSchur_LAPACKE.h" 54 | #include "src/Eigenvalues/ComplexSchur_LAPACKE.h" 55 | #include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h" 56 | #endif 57 | 58 | #include "src/Core/util/ReenableStupidWarnings.h" 59 | 60 | #endif // EIGEN_EIGENVALUES_MODULE_H 61 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 62 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/CholmodSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H 9 | #define EIGEN_CHOLMODSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | /** \ingroup Support_modules 20 | * \defgroup CholmodSupport_Module CholmodSupport module 21 | * 22 | * This module provides an interface to the Cholmod library which is part of the suitesparse package. 23 | * It provides the two following main factorization classes: 24 | * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. 25 | * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). 26 | * 27 | * For the sake of completeness, this module also propose the two following classes: 28 | * - class CholmodSimplicialLLT 29 | * - class CholmodSimplicialLDLT 30 | * Note that these classes does not bring any particular advantage compared to the built-in 31 | * SimplicialLLT and SimplicialLDLT factorization classes. 32 | * 33 | * \code 34 | * #include 35 | * \endcode 36 | * 37 | * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies. 38 | * The dependencies depend on how cholmod has been compiled. 39 | * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. 40 | * 41 | */ 42 | 43 | #include "src/CholmodSupport/CholmodSupport.h" 44 | 45 | #include "src/Core/util/ReenableStupidWarnings.h" 46 | 47 | #endif // EIGEN_CHOLMODSUPPORT_MODULE_H 48 | 49 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/Core/arch/Default/ConjHelper.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Eigen, a lightweight C++ template library 3 | // for linear algebra. 4 | // 5 | // Copyright (C) 2017 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_ARCH_CONJ_HELPER_H 12 | #define EIGEN_ARCH_CONJ_HELPER_H 13 | 14 | #define EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(PACKET_CPLX, PACKET_REAL) \ 15 | template<> struct conj_helper { \ 16 | EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_REAL& x, const PACKET_CPLX& y, const PACKET_CPLX& c) const \ 17 | { return padd(c, pmul(x,y)); } \ 18 | EIGEN_STRONG_INLINE PACKET_CPLX pmul(const PACKET_REAL& x, const PACKET_CPLX& y) const \ 19 | { return PACKET_CPLX(Eigen::internal::pmul(x, y.v)); } \ 20 | }; \ 21 | \ 22 | template<> struct conj_helper { \ 23 | EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_CPLX& x, const PACKET_REAL& y, const PACKET_CPLX& c) const \ 24 | { return padd(c, pmul(x,y)); } \ 25 | EIGEN_STRONG_INLINE PACKET_CPLX pmul(const PACKET_CPLX& x, const PACKET_REAL& y) const \ 26 | { return PACKET_CPLX(Eigen::internal::pmul(x.v, y)); } \ 27 | }; 28 | 29 | #endif // EIGEN_ARCH_CONJ_HELPER_H 30 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/Core/arch/SSE/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TYPE_CASTING_SSE_H 11 | #define EIGEN_TYPE_CASTING_SSE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | #ifndef EIGEN_VECTORIZE_AVX 18 | template <> 19 | struct type_casting_traits { 20 | enum { 21 | VectorizedCast = 1, 22 | SrcCoeffRatio = 1, 23 | TgtCoeffRatio = 1 24 | }; 25 | }; 26 | 27 | template <> 28 | struct type_casting_traits { 29 | enum { 30 | VectorizedCast = 1, 31 | SrcCoeffRatio = 1, 32 | TgtCoeffRatio = 1 33 | }; 34 | }; 35 | 36 | template <> 37 | struct type_casting_traits { 38 | enum { 39 | VectorizedCast = 1, 40 | SrcCoeffRatio = 2, 41 | TgtCoeffRatio = 1 42 | }; 43 | }; 44 | 45 | template <> 46 | struct type_casting_traits { 47 | enum { 48 | VectorizedCast = 1, 49 | SrcCoeffRatio = 1, 50 | TgtCoeffRatio = 2 51 | }; 52 | }; 53 | #endif 54 | 55 | template<> EIGEN_STRONG_INLINE Packet4i pcast(const Packet4f& a) { 56 | return _mm_cvttps_epi32(a); 57 | } 58 | 59 | template<> EIGEN_STRONG_INLINE Packet4f pcast(const Packet4i& a) { 60 | return _mm_cvtepi32_ps(a); 61 | } 62 | 63 | template<> EIGEN_STRONG_INLINE Packet4f pcast(const Packet2d& a, const Packet2d& b) { 64 | return _mm_shuffle_ps(_mm_cvtpd_ps(a), _mm_cvtpd_ps(b), (1 << 2) | (1 << 6)); 65 | } 66 | 67 | template<> EIGEN_STRONG_INLINE Packet2d pcast(const Packet4f& a) { 68 | // Simply discard the second half of the input 69 | return _mm_cvtps_pd(a); 70 | } 71 | 72 | 73 | } // end namespace internal 74 | 75 | } // end namespace Eigen 76 | 77 | #endif // EIGEN_TYPE_CASTING_SSE_H 78 | -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/_ext-src/src/group_points.cpp: -------------------------------------------------------------------------------- 1 | #include "group_points.h" 2 | #include "utils.h" 3 | 4 | void group_points_kernel_wrapper(int b, int c, int n, int npoints, int nsample, 5 | const float *points, const int *idx, 6 | float *out); 7 | 8 | void group_points_grad_kernel_wrapper(int b, int c, int n, int npoints, 9 | int nsample, const float *grad_out, 10 | const int *idx, float *grad_points); 11 | 12 | at::Tensor group_points(at::Tensor points, at::Tensor idx) { 13 | CHECK_CONTIGUOUS(points); 14 | CHECK_CONTIGUOUS(idx); 15 | CHECK_IS_FLOAT(points); 16 | CHECK_IS_INT(idx); 17 | 18 | if (points.is_cuda()) { 19 | CHECK_CUDA(idx); 20 | } 21 | 22 | at::Tensor output = 23 | torch::zeros({points.size(0), points.size(1), idx.size(1), idx.size(2)}, 24 | at::device(points.device()).dtype(at::ScalarType::Float)); 25 | 26 | if (points.is_cuda()) { 27 | group_points_kernel_wrapper(points.size(0), points.size(1), points.size(2), 28 | idx.size(1), idx.size(2), 29 | points.data_ptr(), idx.data_ptr(), 30 | output.data_ptr()); 31 | } else { 32 | AT_ASSERT(false, "CPU not supported"); 33 | } 34 | 35 | return output; 36 | } 37 | 38 | at::Tensor group_points_grad(at::Tensor grad_out, at::Tensor idx, const int n) { 39 | CHECK_CONTIGUOUS(grad_out); 40 | CHECK_CONTIGUOUS(idx); 41 | CHECK_IS_FLOAT(grad_out); 42 | CHECK_IS_INT(idx); 43 | 44 | if (grad_out.is_cuda()) { 45 | CHECK_CUDA(idx); 46 | } 47 | 48 | at::Tensor output = 49 | torch::zeros({grad_out.size(0), grad_out.size(1), n}, 50 | at::device(grad_out.device()).dtype(at::ScalarType::Float)); 51 | 52 | if (grad_out.is_cuda()) { 53 | group_points_grad_kernel_wrapper( 54 | grad_out.size(0), grad_out.size(1), n, idx.size(1), idx.size(2), 55 | grad_out.data_ptr(), idx.data_ptr(), 56 | output.data_ptr()); 57 | } else { 58 | AT_ASSERT(false, "CPU not supported"); 59 | } 60 | 61 | return output; 62 | } 63 | -------------------------------------------------------------------------------- /config/deform4d/forward.yaml: -------------------------------------------------------------------------------- 1 | experiment: 2 | out_dir: /cluster_HDD/umoja/jtang/nsdp_outdir 3 | name: deform4d_forward 4 | 5 | data: 6 | type: 'deform4d' 7 | dataset_dir: '/cluster/balrog/jtang/DeformingThings4D_processed_dataset/animals' 8 | split_dir: './data/splits/' 9 | interval: 3 10 | arbitrary: false 11 | inverse: false 12 | fix_coord_system: false 13 | num_surf_samples: 5000 14 | num_space_samples: 5000 15 | partial_range: 0.1 16 | noise_level: 0.0 17 | partial_shape_ratio: 1.0 18 | norm_params_file: 'orig_to_gaps.txt' 19 | surface_flow_file: 'surface_points.npz' 20 | space_flow_file: 'flow.npz' 21 | mesh_file: 'mesh_orig.obj' #'model_normalized.obj' 22 | 23 | model: 24 | type: 'forward' 25 | use_normals: false 26 | encoder: 'pointransformer' 27 | encoder_kwargs: 28 | npoints_per_layer: [5000, 500, 100] 29 | nneighbor: 16 30 | nneighbor_reduced: 10 31 | nfinal_transformers: 3 32 | d_transformer: 256 33 | d_reduced: 120 34 | full_SA: true 35 | decoder: 'crossatten' 36 | decoder_kwargs: 37 | dim_inp: 256 38 | dim: 200 39 | nneigh: 7 40 | hidden_dim: 128 41 | out_dim: 3 42 | 43 | training: 44 | iden_split: 'identity_seen' 45 | motion_split: 'train_seen' 46 | load_mesh: false 47 | num_sampled_pairs: -1 48 | epochs: 600 49 | save_frequency: 10 50 | batch_size: 16 51 | optimizer: Adam 52 | lr: 0.0005 53 | lr_step: 200 54 | lr_decay: 0.1 55 | weight_decay: 0.0 56 | 57 | validation: 58 | iden_split: 'identity_seen' 59 | motion_split: 'test_unseen_motions' 60 | load_mesh: false 61 | num_sampled_pairs: -1 62 | frequency: 5 63 | batch_size: 16 64 | 65 | test: 66 | iden_split: 'identity_seen' 67 | motion_split: 'test_unseen_motions' 68 | load_mesh: true 69 | num_sampled_pairs: 300 70 | batch_size: 1 71 | generate_mesh: true 72 | mesh_folder: 'meshes' 73 | mesh_format: 'ply' 74 | generate_pointcloud: true 75 | pointcloud_folder: 'pointclouds' 76 | pointcloud_format: 'ply' 77 | weight_file: "./pretrained/forward.pt" 78 | 79 | logger: 80 | type: "wandb" 81 | project: "NSDP" 82 | -------------------------------------------------------------------------------- /config/deform4d/backward.yaml: -------------------------------------------------------------------------------- 1 | experiment: 2 | out_dir: /cluster_HDD/umoja/jtang/nsdp_outdir 3 | name: deform4d_backward 4 | 5 | data: 6 | type: 'deform4d' 7 | dataset_dir: '/cluster/balrog/jtang/DeformingThings4D_processed_dataset/animals' 8 | split_dir: './data/splits/' 9 | interval: 3 10 | arbitrary: false 11 | inverse: true 12 | fix_coord_system: false 13 | num_surf_samples: 5000 14 | num_space_samples: 5000 15 | partial_range: 0.1 16 | noise_level: 0.0 17 | partial_shape_ratio: 1.0 18 | norm_params_file: 'orig_to_gaps.txt' 19 | surface_flow_file: 'surface_points.npz' 20 | space_flow_file: 'flow.npz' 21 | mesh_file: 'mesh_orig.obj' #'model_normalized.obj' 22 | 23 | model: 24 | type: 'backward' 25 | use_normals: false 26 | encoder: 'pointransformer' 27 | encoder_kwargs: 28 | npoints_per_layer: [5000, 500, 100] 29 | nneighbor: 16 30 | nneighbor_reduced: 10 31 | nfinal_transformers: 3 32 | d_transformer: 256 33 | d_reduced: 120 34 | full_SA: true 35 | decoder: 'crossatten' 36 | decoder_kwargs: 37 | dim_inp: 256 38 | dim: 200 39 | nneigh: 7 40 | hidden_dim: 128 41 | out_dim: 3 42 | 43 | training: 44 | iden_split: 'identity_seen' 45 | motion_split: 'train_seen' 46 | load_mesh: false 47 | num_sampled_pairs: -1 48 | epochs: 600 49 | save_frequency: 10 50 | batch_size: 16 51 | optimizer: Adam 52 | lr: 0.0005 53 | lr_step: 200 54 | lr_decay: 0.1 55 | weight_decay: 0.0 56 | 57 | validation: 58 | iden_split: 'identity_seen' 59 | motion_split: 'test_unseen_motions' 60 | load_mesh: false 61 | num_sampled_pairs: -1 62 | frequency: 5 63 | batch_size: 16 64 | 65 | test: 66 | iden_split: 'identity_seen' 67 | motion_split: 'test_unseen_motions' 68 | load_mesh: true 69 | num_sampled_pairs: 300 70 | batch_size: 1 71 | generate_mesh: true 72 | mesh_folder: 'meshes' 73 | mesh_format: 'ply' 74 | generate_pointcloud: true 75 | pointcloud_folder: 'pointclouds' 76 | pointcloud_format: 'ply' 77 | weight_file: "./pretrained/backward.pt" 78 | 79 | logger: 80 | type: "wandb" 81 | project: "NSDP" 82 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/IterativeLinearSolvers: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 9 | #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 10 | 11 | #include "SparseCore" 12 | #include "OrderingMethods" 13 | 14 | #include "src/Core/util/DisableStupidWarnings.h" 15 | 16 | /** 17 | * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module 18 | * 19 | * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. 20 | * Those solvers are accessible via the following classes: 21 | * - ConjugateGradient for selfadjoint (hermitian) matrices, 22 | * - LeastSquaresConjugateGradient for rectangular least-square problems, 23 | * - BiCGSTAB for general square matrices. 24 | * 25 | * These iterative solvers are associated with some preconditioners: 26 | * - IdentityPreconditioner - not really useful 27 | * - DiagonalPreconditioner - also called Jacobi preconditioner, work very well on diagonal dominant matrices. 28 | * - IncompleteLUT - incomplete LU factorization with dual thresholding 29 | * 30 | * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. 31 | * 32 | \code 33 | #include 34 | \endcode 35 | */ 36 | 37 | #include "src/IterativeLinearSolvers/SolveWithGuess.h" 38 | #include "src/IterativeLinearSolvers/IterativeSolverBase.h" 39 | #include "src/IterativeLinearSolvers/BasicPreconditioners.h" 40 | #include "src/IterativeLinearSolvers/ConjugateGradient.h" 41 | #include "src/IterativeLinearSolvers/LeastSquareConjugateGradient.h" 42 | #include "src/IterativeLinearSolvers/BiCGSTAB.h" 43 | #include "src/IterativeLinearSolvers/IncompleteLUT.h" 44 | #include "src/IterativeLinearSolvers/IncompleteCholesky.h" 45 | 46 | #include "src/Core/util/ReenableStupidWarnings.h" 47 | 48 | #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 49 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/Geometry: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_GEOMETRY_MODULE_H 9 | #define EIGEN_GEOMETRY_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "SVD" 16 | #include "LU" 17 | #include 18 | 19 | /** \defgroup Geometry_Module Geometry module 20 | * 21 | * This module provides support for: 22 | * - fixed-size homogeneous transformations 23 | * - translation, scaling, 2D and 3D rotations 24 | * - \link Quaternion quaternions \endlink 25 | * - cross products (\ref MatrixBase::cross, \ref MatrixBase::cross3) 26 | * - orthognal vector generation (\ref MatrixBase::unitOrthogonal) 27 | * - some linear components: \link ParametrizedLine parametrized-lines \endlink and \link Hyperplane hyperplanes \endlink 28 | * - \link AlignedBox axis aligned bounding boxes \endlink 29 | * - \link umeyama least-square transformation fitting \endlink 30 | * 31 | * \code 32 | * #include 33 | * \endcode 34 | */ 35 | 36 | #include "src/Geometry/OrthoMethods.h" 37 | #include "src/Geometry/EulerAngles.h" 38 | 39 | #include "src/Geometry/Homogeneous.h" 40 | #include "src/Geometry/RotationBase.h" 41 | #include "src/Geometry/Rotation2D.h" 42 | #include "src/Geometry/Quaternion.h" 43 | #include "src/Geometry/AngleAxis.h" 44 | #include "src/Geometry/Transform.h" 45 | #include "src/Geometry/Translation.h" 46 | #include "src/Geometry/Scaling.h" 47 | #include "src/Geometry/Hyperplane.h" 48 | #include "src/Geometry/ParametrizedLine.h" 49 | #include "src/Geometry/AlignedBox.h" 50 | #include "src/Geometry/Umeyama.h" 51 | 52 | // Use the SSE optimized version whenever possible. At the moment the 53 | // SSE version doesn't compile when AVX is enabled 54 | #if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX 55 | #include "src/Geometry/arch/Geometry_SSE.h" 56 | #endif 57 | 58 | #include "src/Core/util/ReenableStupidWarnings.h" 59 | 60 | #endif // EIGEN_GEOMETRY_MODULE_H 61 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 62 | 63 | -------------------------------------------------------------------------------- /model/learningrate.py: -------------------------------------------------------------------------------- 1 | import os 2 | import torch 3 | import numpy as np 4 | 5 | 6 | def print_num_parameters(model): 7 | n_all_params = int(sum([np.prod(p.size()) for p in model.parameters()])) 8 | n_trainable_params = int(sum([np.prod(p.size()) for p in filter(lambda p: p.requires_grad, model.parameters())])) 9 | print(f"Number of parameters in {model.__class__.__name__}: {n_trainable_params} / {n_all_params}") 10 | 11 | 12 | class LearningRateSchedule: 13 | def get_learning_rate(self, epoch): 14 | pass 15 | 16 | 17 | class StepLearningRateSchedule(LearningRateSchedule): 18 | def __init__(self, specs): 19 | print(specs) 20 | self.initial = specs['initial'] 21 | self.interval = specs['interval'] 22 | self.factor = specs['factor'] 23 | 24 | def get_learning_rate(self, epoch): 25 | return self.initial * (self.factor ** (epoch // self.interval)) 26 | 27 | 28 | def adjust_learning_rate(lr_schedules, optimizer, epoch): 29 | if (type(lr_schedules)==list): 30 | for i, param_group in enumerate(optimizer.param_groups): 31 | param_group["lr"] = lr_schedules[i].get_learning_rate(epoch) 32 | else: 33 | for i, param_group in enumerate(optimizer.param_groups): 34 | param_group["lr"] = lr_schedules.get_learning_rate(epoch) 35 | 36 | 37 | def get_learning_rates(optimizer): 38 | lr_list = [] 39 | for param_group in optimizer.param_groups: 40 | lr_list.append(param_group['lr']) 41 | return lr_list 42 | 43 | 44 | def print_learning_rates(optimizer): 45 | lr_txt = "" 46 | for param_group in optimizer.param_groups: 47 | lr_txt += " | " + str(param_group['lr']) 48 | print(lr_txt) 49 | 50 | def weights_init(m): 51 | """ 52 | initialize the weighs of the network for Convolutional layers and batchnorm layers 53 | """ 54 | if isinstance(m, (torch.nn.modules.conv._ConvNd, torch.nn.Linear)): 55 | torch.nn.init.xavier_uniform_(m.weight) 56 | if m.bias is not None: 57 | torch.nn.init.constant_(m.bias, 0.0) 58 | elif isinstance(m, torch.nn.modules.batchnorm._BatchNorm): 59 | torch.nn.init.constant_(m.bias, 0.0) 60 | torch.nn.init.constant_(m.weight, 1.0) 61 | 62 | def clamp_gradient(model, clip): 63 | for p in model.parameters(): 64 | torch.nn.utils.clip_grad_value_(p, clip) 65 | -------------------------------------------------------------------------------- /external/PyMarchingCubes/test_mcubes.py: -------------------------------------------------------------------------------- 1 | 2 | import pytest 3 | 4 | import numpy as np 5 | from numpy.testing import assert_array_equal, assert_allclose 6 | 7 | import marching_cubes as mcubes 8 | 9 | 10 | def test_empty(): 11 | 12 | levelset = np.zeros((50, 50, 50)) 13 | vertices, triangles = mcubes.marching_cubes(levelset, 0.5) 14 | 15 | assert len(vertices) == len(triangles) == 0 16 | 17 | 18 | def test_sphere(): 19 | x, y, z = np.mgrid[:100, :100, :100] 20 | u = (x - 50)**2 + (y - 50)**2 + (z - 50)**2 - 25**2 21 | 22 | def func(x, y, z): 23 | return (x - 50)**2 + (y - 50)**2 + (z - 50)**2 - 25**2 24 | 25 | vertices1, triangles1 = mcubes.marching_cubes(u, 0.0) 26 | vertices2, triangles2 = mcubes.marching_cubes_func( 27 | (0, 0, 0), 28 | (99, 99, 99), 29 | 100, 100, 100, 30 | func, 0.0 31 | ) 32 | 33 | assert_allclose(vertices1, vertices2) 34 | assert_array_equal(triangles1, triangles2) 35 | 36 | 37 | def test_no_duplicates(): 38 | def sphere(x, y, z): 39 | return np.sqrt((x - 4)**2 + (y - 4)**2 + (z - 4)**2) - 4 40 | 41 | vertices, _ = mcubes.marching_cubes_func((2, 2, 2), (9, 9, 9), 20, 20, 20, sphere, 0) 42 | 43 | assert len(vertices) == len(np.unique(vertices, axis=0)) 44 | 45 | 46 | def test_export(): 47 | 48 | u = np.zeros((10, 10, 10)) 49 | u[2:-2, 2:-2, 2:-2] = 1.0 50 | vertices, triangles = mcubes.marching_cubes(u, 0.5) 51 | 52 | mcubes.export_obj(vertices, triangles, "output/test.obj") 53 | mcubes.export_off(vertices, triangles, "output/test.off") 54 | mcubes.export_mesh(vertices, triangles, "output/test.dae") 55 | 56 | 57 | def test_invalid_input(): 58 | 59 | def func(x, y, z): 60 | return x**2 + y**2 + z**2 - 1 61 | 62 | mcubes.marching_cubes_func((-1.5, -1.5, -1.5), (1.5, 1.5, 1.5), 10, 10, 10, func, 0) 63 | 64 | with pytest.raises(ValueError): 65 | mcubes.marching_cubes_func((0, 0, 0), (0, 0, 0), 10, 10, 10, func, 0) 66 | 67 | with pytest.raises(ValueError): 68 | mcubes.marching_cubes_func((-1.5, -1.5, -1.5), (1.5, 1.5, 1.5), 1, 10, 10, func, 0) 69 | 70 | with pytest.raises(Exception): 71 | mcubes.marching_cubes_func((-1.5, -1.5), (1.5, 1.5, 1.5), 10, 10, 10, func, 0) 72 | 73 | with pytest.raises(Exception): 74 | mcubes.marching_cubes_func((-1.5, -1.5, -1.5), (1.5, 1.5), 10, 10, 10, func, 0) 75 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/SparseLU/SparseLU_Utils.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | 11 | #ifndef EIGEN_SPARSELU_UTILS_H 12 | #define EIGEN_SPARSELU_UTILS_H 13 | 14 | namespace Eigen { 15 | namespace internal { 16 | 17 | /** 18 | * \brief Count Nonzero elements in the factors 19 | */ 20 | template 21 | void SparseLUImpl::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu) 22 | { 23 | nnzL = 0; 24 | nnzU = (glu.xusub)(n); 25 | Index nsuper = (glu.supno)(n); 26 | Index jlen; 27 | Index i, j, fsupc; 28 | if (n <= 0 ) return; 29 | // For each supernode 30 | for (i = 0; i <= nsuper; i++) 31 | { 32 | fsupc = glu.xsup(i); 33 | jlen = glu.xlsub(fsupc+1) - glu.xlsub(fsupc); 34 | 35 | for (j = fsupc; j < glu.xsup(i+1); j++) 36 | { 37 | nnzL += jlen; 38 | nnzU += j - fsupc + 1; 39 | jlen--; 40 | } 41 | } 42 | } 43 | 44 | /** 45 | * \brief Fix up the data storage lsub for L-subscripts. 46 | * 47 | * It removes the subscripts sets for structural pruning, 48 | * and applies permutation to the remaining subscripts 49 | * 50 | */ 51 | template 52 | void SparseLUImpl::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu) 53 | { 54 | Index fsupc, i, j, k, jstart; 55 | 56 | StorageIndex nextl = 0; 57 | Index nsuper = (glu.supno)(n); 58 | 59 | // For each supernode 60 | for (i = 0; i <= nsuper; i++) 61 | { 62 | fsupc = glu.xsup(i); 63 | jstart = glu.xlsub(fsupc); 64 | glu.xlsub(fsupc) = nextl; 65 | for (j = jstart; j < glu.xlsub(fsupc + 1); j++) 66 | { 67 | glu.lsub(nextl) = perm_r(glu.lsub(j)); // Now indexed into P*A 68 | nextl++; 69 | } 70 | for (k = fsupc+1; k < glu.xsup(i+1); k++) 71 | glu.xlsub(k) = nextl; // other columns in supernode i 72 | } 73 | 74 | glu.xlsub(n) = nextl; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | } // end namespace Eigen 80 | #endif // EIGEN_SPARSELU_UTILS_H 81 | -------------------------------------------------------------------------------- /external/PyMarchingCubes/marching_cubes/exporter.py: -------------------------------------------------------------------------------- 1 | 2 | import numpy as np 3 | 4 | 5 | def export_obj(vertices, triangles, filename): 6 | """ 7 | Exports a mesh in the (.obj) format. 8 | """ 9 | print('export mesh: ', vertices.shape) 10 | 11 | with open(filename, 'w') as fh: 12 | if (vertices.shape[1]==6): 13 | for v in vertices: 14 | fh.write("v {} {} {} {} {} {}\n".format(*v)) 15 | else: 16 | for v in vertices: 17 | fh.write("v {} {} {}\n".format(*v)) 18 | 19 | for f in triangles: 20 | fh.write("f {} {} {}\n".format(*(f + 1))) 21 | 22 | 23 | def export_off(vertices, triangles, filename): 24 | """ 25 | Exports a mesh in the (.off) format. 26 | """ 27 | 28 | with open(filename, 'w') as fh: 29 | if (vertices.shape[1]==6): 30 | fh.write('COFF\n') 31 | else: 32 | fh.write('OFF\n') 33 | fh.write('{} {} 0\n'.format(len(vertices), len(triangles))) 34 | 35 | if (vertices.shape[1]==6): 36 | for v in vertices: 37 | fh.write("{} {} {} {} {} {}\n".format(*v)) 38 | else: 39 | for v in vertices: 40 | fh.write("{} {} {}\n".format(*v)) 41 | 42 | for f in triangles: 43 | fh.write("3 {} {} {}\n".format(*f)) 44 | 45 | 46 | def export_mesh(vertices, triangles, filename, mesh_name="mcubes_mesh"): 47 | """ 48 | Exports a mesh in the COLLADA (.dae) format. 49 | 50 | Needs PyCollada (https://github.com/pycollada/pycollada). 51 | """ 52 | 53 | import collada 54 | 55 | mesh = collada.Collada() 56 | 57 | vert_src = collada.source.FloatSource("verts-array", vertices[:,0:3], ('X','Y','Z')) 58 | geom = collada.geometry.Geometry(mesh, "geometry0", mesh_name, [vert_src]) 59 | 60 | input_list = collada.source.InputList() 61 | input_list.addInput(0, 'VERTEX', "#verts-array") 62 | 63 | triset = geom.createTriangleSet(np.copy(triangles), input_list, "") 64 | geom.primitives.append(triset) 65 | mesh.geometries.append(geom) 66 | 67 | geomnode = collada.scene.GeometryNode(geom, []) 68 | node = collada.scene.Node(mesh_name, children=[geomnode]) 69 | 70 | myscene = collada.scene.Scene("mcubes_scene", [node]) 71 | mesh.scenes.append(myscene) 72 | mesh.scene = myscene 73 | 74 | mesh.write(filename) 75 | -------------------------------------------------------------------------------- /utils/eval_metric.py: -------------------------------------------------------------------------------- 1 | import os 2 | import numpy as np 3 | from scipy.spatial import KDTree 4 | import trimesh 5 | 6 | def compute_dist_square(vertices, vertices_gt): 7 | l2 = ((vertices - vertices_gt)**2).sum(-1) 8 | return l2.mean() 9 | 10 | 11 | def normal_consistency(normals_src, normals_tgt): 12 | normals_src = normals_src / np.linalg.norm(normals_src, axis=-1, keepdims=True) 13 | normals_tgt = normals_tgt / np.linalg.norm(normals_tgt, axis=-1, keepdims=True) 14 | 15 | normals_dot_product = (normals_tgt * normals_src).sum(axis=-1) 16 | # Handle normals that point into wrong direction gracefully 17 | # (mostly due to mehtod not caring about this in generation) 18 | normals_dot_product = np.abs(normals_dot_product) 19 | 20 | return normals_dot_product.mean() 21 | 22 | def chamfer_distance(points, points_gt): 23 | kdtree = KDTree(points_gt) 24 | compleness, idx = kdtree.query(points) 25 | kdtree = KDTree(points) 26 | accuracy, idx = kdtree.query(points_gt) 27 | chamfer_l1 = 0.5 * (accuracy.mean() + compleness.mean()) 28 | 29 | return chamfer_l1 30 | 31 | 32 | def compute_evaluation_metrics(out_dict): 33 | eval_dict = {} 34 | # convert to trimesh 35 | verts_pred = out_dict["verts_tgt_pred"].squeeze().cpu().detach().numpy() 36 | verts_gt = out_dict["verts_tgt"].squeeze().cpu().numpy() 37 | faces = out_dict["faces"].squeeze().cpu().numpy() 38 | mesh_pred = trimesh.Trimesh(verts_pred, faces, process=False) 39 | mesh_gt = trimesh.Trimesh(verts_gt, faces, process=False) 40 | 41 | # l2 42 | l2_error = compute_dist_square(verts_pred, verts_gt) 43 | eval_dict['l2'] = l2_error 44 | 45 | # normal consistency 46 | face_normals_pred = mesh_pred.face_normals.astype(np.float32) 47 | face_normals_gt = mesh_gt.face_normals.astype(np.float32) 48 | fnc = normal_consistency(face_normals_pred, face_normals_gt) 49 | eval_dict['fnc'] = fnc 50 | 51 | # CD 52 | pointcloud_size = 30000 53 | _, face_idx = mesh_pred.sample(pointcloud_size, return_index=True) 54 | alpha = np.random.dirichlet((1,)*3, pointcloud_size) 55 | v_pred = verts_pred[faces[face_idx]] 56 | points_pred = (alpha[:, :, None] * v_pred).sum(axis=1) 57 | v_gt = verts_gt[faces[face_idx]] 58 | points_gt = (alpha[:, :, None] * v_gt).sum(axis=1) 59 | chamfer_l1 = chamfer_distance(points_pred, points_gt) 60 | eval_dict['cd'] = chamfer_l1 61 | 62 | return eval_dict -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MAPPED_SPARSEMATRIX_H 11 | #define EIGEN_MAPPED_SPARSEMATRIX_H 12 | 13 | namespace Eigen { 14 | 15 | /** \deprecated Use Map > 16 | * \class MappedSparseMatrix 17 | * 18 | * \brief Sparse matrix 19 | * 20 | * \param _Scalar the scalar type, i.e. the type of the coefficients 21 | * 22 | * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme. 23 | * 24 | */ 25 | namespace internal { 26 | template 27 | struct traits > : traits > 28 | {}; 29 | } // end namespace internal 30 | 31 | template 32 | class MappedSparseMatrix 33 | : public Map > 34 | { 35 | typedef Map > Base; 36 | 37 | public: 38 | 39 | typedef typename Base::StorageIndex StorageIndex; 40 | typedef typename Base::Scalar Scalar; 41 | 42 | inline MappedSparseMatrix(Index rows, Index cols, Index nnz, StorageIndex* outerIndexPtr, StorageIndex* innerIndexPtr, Scalar* valuePtr, StorageIndex* innerNonZeroPtr = 0) 43 | : Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZeroPtr) 44 | {} 45 | 46 | /** Empty destructor */ 47 | inline ~MappedSparseMatrix() {} 48 | }; 49 | 50 | namespace internal { 51 | 52 | template 53 | struct evaluator > 54 | : evaluator > > 55 | { 56 | typedef MappedSparseMatrix<_Scalar,_Options,_StorageIndex> XprType; 57 | typedef evaluator > Base; 58 | 59 | evaluator() : Base() {} 60 | explicit evaluator(const XprType &mat) : Base(mat) {} 61 | }; 62 | 63 | } 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN_MAPPED_SPARSEMATRIX_H 68 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/SuperLUSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H 9 | #define EIGEN_SUPERLUSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #ifdef EMPTY 16 | #define EIGEN_EMPTY_WAS_ALREADY_DEFINED 17 | #endif 18 | 19 | typedef int int_t; 20 | #include 21 | #include 22 | #include 23 | 24 | // slu_util.h defines a preprocessor token named EMPTY which is really polluting, 25 | // so we remove it in favor of a SUPERLU_EMPTY token. 26 | // If EMPTY was already defined then we don't undef it. 27 | 28 | #if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) 29 | # undef EIGEN_EMPTY_WAS_ALREADY_DEFINED 30 | #elif defined(EMPTY) 31 | # undef EMPTY 32 | #endif 33 | 34 | #define SUPERLU_EMPTY (-1) 35 | 36 | namespace Eigen { struct SluMatrix; } 37 | 38 | /** \ingroup Support_modules 39 | * \defgroup SuperLUSupport_Module SuperLUSupport module 40 | * 41 | * This module provides an interface to the SuperLU library. 42 | * It provides the following factorization class: 43 | * - class SuperLU: a supernodal sequential LU factorization. 44 | * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). 45 | * 46 | * \warning This wrapper requires at least versions 4.0 of SuperLU. The 3.x versions are not supported. 47 | * 48 | * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. 49 | * 50 | * \code 51 | * #include 52 | * \endcode 53 | * 54 | * In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies. 55 | * The dependencies depend on how superlu has been compiled. 56 | * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. 57 | * 58 | */ 59 | 60 | #include "src/SuperLUSupport/SuperLUSupport.h" 61 | 62 | #include "src/Core/util/ReenableStupidWarnings.h" 63 | 64 | #endif // EIGEN_SUPERLUSUPPORT_MODULE_H 65 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/SparseCore: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSECORE_MODULE_H 9 | #define EIGEN_SPARSECORE_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | /** 22 | * \defgroup SparseCore_Module SparseCore module 23 | * 24 | * This module provides a sparse matrix representation, and basic associated matrix manipulations 25 | * and operations. 26 | * 27 | * See the \ref TutorialSparse "Sparse tutorial" 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | * 33 | * This module depends on: Core. 34 | */ 35 | 36 | #include "src/SparseCore/SparseUtil.h" 37 | #include "src/SparseCore/SparseMatrixBase.h" 38 | #include "src/SparseCore/SparseAssign.h" 39 | #include "src/SparseCore/CompressedStorage.h" 40 | #include "src/SparseCore/AmbiVector.h" 41 | #include "src/SparseCore/SparseCompressedBase.h" 42 | #include "src/SparseCore/SparseMatrix.h" 43 | #include "src/SparseCore/SparseMap.h" 44 | #include "src/SparseCore/MappedSparseMatrix.h" 45 | #include "src/SparseCore/SparseVector.h" 46 | #include "src/SparseCore/SparseRef.h" 47 | #include "src/SparseCore/SparseCwiseUnaryOp.h" 48 | #include "src/SparseCore/SparseCwiseBinaryOp.h" 49 | #include "src/SparseCore/SparseTranspose.h" 50 | #include "src/SparseCore/SparseBlock.h" 51 | #include "src/SparseCore/SparseDot.h" 52 | #include "src/SparseCore/SparseRedux.h" 53 | #include "src/SparseCore/SparseView.h" 54 | #include "src/SparseCore/SparseDiagonalProduct.h" 55 | #include "src/SparseCore/ConservativeSparseSparseProduct.h" 56 | #include "src/SparseCore/SparseSparseProductWithPruning.h" 57 | #include "src/SparseCore/SparseProduct.h" 58 | #include "src/SparseCore/SparseDenseProduct.h" 59 | #include "src/SparseCore/SparseSelfAdjointView.h" 60 | #include "src/SparseCore/SparseTriangularView.h" 61 | #include "src/SparseCore/TriangularSolver.h" 62 | #include "src/SparseCore/SparsePermutation.h" 63 | #include "src/SparseCore/SparseFuzzy.h" 64 | #include "src/SparseCore/SparseSolverBase.h" 65 | 66 | #include "src/Core/util/ReenableStupidWarnings.h" 67 | 68 | #endif // EIGEN_SPARSECORE_MODULE_H 69 | 70 | -------------------------------------------------------------------------------- /utils/checkpoints.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import logging 3 | import os 4 | import sys 5 | import numpy as np 6 | import torch 7 | 8 | def load_checkpoints(model, optimizer, experiment_directory, args, device): 9 | model_files = [ 10 | f for f in os.listdir(experiment_directory) 11 | if f.startswith("model_") 12 | ] 13 | if len(model_files) == 0: 14 | return 15 | ids = [int(f[6:]) for f in model_files] 16 | max_id = max(ids) 17 | model_path = os.path.join( 18 | experiment_directory, "model_{:05d}" 19 | ).format(max_id) 20 | opt_path = os.path.join( 21 | experiment_directory, "opt_{:05d}" 22 | ).format(max_id) 23 | if not (os.path.exists(model_path) and os.path.exists(opt_path)): 24 | return 25 | 26 | print("Loading model checkpoint from {}".format(model_path)) 27 | model.load_state_dict(torch.load(model_path, map_location=device)) 28 | print("Loading optimizer checkpoint from {}".format(opt_path)) 29 | optimizer.load_state_dict( 30 | torch.load(opt_path, map_location=device) 31 | ) 32 | args.continue_from_epoch = max_id+1 33 | 34 | 35 | def save_checkpoints(epoch, model, optimizer, experiment_directory): 36 | torch.save( 37 | model.state_dict(), 38 | os.path.join(experiment_directory, "model_{:05d}").format(epoch) 39 | ) 40 | torch.save( 41 | optimizer.state_dict(), 42 | os.path.join(experiment_directory, "opt_{:05d}").format(epoch) 43 | ) 44 | 45 | 46 | 47 | 48 | def load_best_checkpoints(model, experiment_directory, args, device): 49 | model_files = [ 50 | f for f in os.listdir(experiment_directory) 51 | if f.startswith("modelbest_") 52 | ] 53 | if len(model_files) == 0: 54 | return 55 | ids = [f[10:] for f in model_files] 56 | last_id = sorted(ids)[-1] 57 | epoch, val_loss = int(last_id[0:5]), float(last_id[6:]) 58 | 59 | model_path = os.path.join( 60 | experiment_directory, "modelbest_{:05d}_{:03f}" 61 | ).format(epoch, val_loss) 62 | if not os.path.exists(model_path): 63 | return 64 | 65 | print("Loading model checkpoint from {}".format(model_path)) 66 | model.load_state_dict(torch.load(model_path, map_location=device)) 67 | args.continue_from_epoch = epoch+1 68 | args.best_val_loss = val_loss 69 | 70 | def save_best_checkpoints(epoch, model, experiment_directory, val_loss): 71 | torch.save( 72 | model.state_dict(), 73 | os.path.join(experiment_directory, "modelbest_{:05d}_{:03f}").format(epoch, val_loss) 74 | ) -------------------------------------------------------------------------------- /model/decoder/crosstransformer_decoder.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import torch.nn as nn 3 | import torch.nn.functional as F 4 | from model.decoder.blocks import CrossTransformerBlock, ResnetBlockFC 5 | 6 | class CrossTransformerDecoder(nn.Module): 7 | """ 8 | AIR-Net decoder 9 | 10 | Attributes: 11 | dim_inp int: dimensionality of encoding (global and local latent vectors) 12 | dim int: internal dimensionality 13 | nneigh int: number of nearest anchor points to draw information from 14 | hidden_dim int: hidden dimensionality of final feed-forward network 15 | n_blocks int: number of blocks in feed forward network 16 | 17 | Default values: 18 | dim_inp: 256 19 | dim: 200 20 | nneigh: 7 21 | hidden_dim: 128 22 | out_dim: 3 23 | """ 24 | def __init__(self, dim_inp, dim, nneigh=7, hidden_dim=64, n_blocks=5, out_dim=1): 25 | super().__init__() 26 | self.dim = dim 27 | self.n_blocks = n_blocks 28 | 29 | self.ct1 = CrossTransformerBlock(dim_inp, dim, nneigh=nneigh) 30 | 31 | self.init_enc = nn.Linear(dim, hidden_dim) 32 | 33 | self.blocks = nn.ModuleList([ 34 | ResnetBlockFC(hidden_dim) for i in range(n_blocks) 35 | ]) 36 | 37 | self.fc_c = nn.ModuleList([ 38 | nn.Linear(dim, hidden_dim) for i in range(n_blocks) 39 | ]) 40 | 41 | self.fc_out = nn.Linear(hidden_dim, out_dim) 42 | 43 | self.actvn = F.relu 44 | 45 | def forward(self, xyz_q, encoding): 46 | """ 47 | TODO update commont to include encoding dict 48 | :param xyz_q [B x n_queries x 3]: queried 3D coordinates 49 | :param lat_rep [B x dim_inp]: global latent vectors 50 | :param xyz [B x n_anchors x 3]: anchor positions 51 | :param feats [B x n_anchros x dim_inp]: local latent vectors 52 | :return: occ [B x n_queries x 3]: deformation vector prediction 53 | """ 54 | 55 | lat_rep = encoding['z'] 56 | xyz = encoding['anchors'] 57 | feats = encoding['anchor_feats'] 58 | 59 | # lobal_field: 60 | # lat_rep = self.fc_glob(lat_rep).unsqueeze(1).repeat(1, xyz_q.shape[1], 1) 61 | # net = self.fc_p(xyz_q) 62 | lat_rep = self.ct1(xyz_q, lat_rep, xyz, feats) 63 | net = self.init_enc(lat_rep) 64 | 65 | for i in range(self.n_blocks): 66 | net = net + self.fc_c[i](lat_rep) 67 | net = self.blocks[i](net) 68 | 69 | occ = self.fc_out(self.actvn(net)) 70 | return occ -------------------------------------------------------------------------------- /config/deform4d/arbitrary.yaml: -------------------------------------------------------------------------------- 1 | experiment: 2 | out_dir: /cluster_HDD/umoja/jtang/nsdp_outdir 3 | name: deform4d_arbitrary 4 | 5 | data: 6 | type: 'deform4d' 7 | dataset_dir: '/cluster/balrog/jtang/DeformingThings4D_processed_dataset/animals' 8 | split_dir: './data/splits/' 9 | interval: 3 10 | arbitrary: true 11 | inverse: false 12 | fix_coord_system: false 13 | num_surf_samples: 5000 14 | num_space_samples: 5000 15 | partial_range: 0.1 16 | noise_level: 0.0 17 | partial_shape_ratio: 1.0 18 | norm_params_file: 'orig_to_gaps.txt' 19 | surface_flow_file: 'surface_points.npz' 20 | space_flow_file: 'flow.npz' 21 | mesh_file: 'mesh_orig.obj' #'model_normalized.obj' 22 | userhandle: 23 | cliptail: false 24 | head: false 25 | tail: false 26 | frontleftfoot: false 27 | frontrightfoot: false 28 | behindleftfoot: false 29 | behindrightfoot: false 30 | xtrans: 0.0 31 | ytrans: 0.0 32 | ztrans: 0.0 33 | 34 | model: 35 | type: 'arbitrary' 36 | use_normals: false 37 | encoder: 'pointransformer' 38 | encoder_kwargs: 39 | npoints_per_layer: [5000, 500, 100] 40 | nneighbor: 16 41 | nneighbor_reduced: 10 42 | nfinal_transformers: 3 43 | d_transformer: 256 44 | d_reduced: 120 45 | full_SA: true 46 | decoder: 'crossatten' 47 | decoder_kwargs: 48 | dim_inp: 256 49 | dim: 200 50 | nneigh: 7 51 | hidden_dim: 128 52 | out_dim: 3 53 | 54 | training: 55 | iden_split: 'identity_seen' 56 | motion_split: 'train_seen' 57 | load_mesh: false 58 | num_sampled_pairs: 36000 59 | epochs: 100 60 | save_frequency: 10 61 | batch_size: 8 62 | optimizer: Adam 63 | lr: 0.00005 64 | lr_step: 50 65 | lr_decay: 0.1 66 | weight_decay: 0.0 67 | weight_forward_file: "./pretrained/forward.pt" 68 | weight_backward_file: "./pretrained/backward.pt" 69 | 70 | validation: 71 | iden_split: 'identity_seen' 72 | motion_split: 'test_unseen_motions' 73 | load_mesh: false 74 | num_sampled_pairs: 300 75 | frequency: 1 76 | batch_size: 8 77 | 78 | test: 79 | iden_split: "identity_seen" 80 | motion_split: "test_unseen_motions" 81 | load_mesh: true 82 | num_sampled_pairs: 300 83 | batch_size: 1 84 | generate_mesh: true 85 | mesh_folder: 'meshes' 86 | mesh_format: 'ply' 87 | generate_pointcloud: true 88 | pointcloud_folder: 'pointclouds' 89 | pointcloud_format: 'ply' 90 | weight_file: "./pretrained/arbitrary.pt" 91 | 92 | logger: 93 | type: "wandb" 94 | project: "NSDP" 95 | -------------------------------------------------------------------------------- /config/deform4d/arbitrary_unseen_iden.yaml: -------------------------------------------------------------------------------- 1 | experiment: 2 | out_dir: /cluster_HDD/umoja/jtang/nsdp_outdir 3 | name: deform4d_arbitrary 4 | 5 | data: 6 | type: 'deform4d' 7 | dataset_dir: '/cluster/balrog/jtang/DeformingThings4D_processed_dataset/animals' 8 | split_dir: './data/splits/' 9 | interval: 3 10 | arbitrary: true 11 | inverse: false 12 | fix_coord_system: false 13 | num_surf_samples: 5000 14 | num_space_samples: 5000 15 | partial_range: 0.1 16 | noise_level: 0.0 17 | partial_shape_ratio: 1.0 18 | norm_params_file: 'orig_to_gaps.txt' 19 | surface_flow_file: 'surface_points.npz' 20 | space_flow_file: 'flow.npz' 21 | mesh_file: 'mesh_orig.obj' #'model_normalized.obj' 22 | userhandle: 23 | cliptail: false 24 | head: false 25 | tail: false 26 | frontleftfoot: false 27 | frontrightfoot: false 28 | behindleftfoot: false 29 | behindrightfoot: false 30 | xtrans: 0.0 31 | ytrans: 0.0 32 | ztrans: 0.0 33 | 34 | model: 35 | type: 'arbitrary' 36 | use_normals: false 37 | encoder: 'pointransformer' 38 | encoder_kwargs: 39 | npoints_per_layer: [5000, 500, 100] 40 | nneighbor: 16 41 | nneighbor_reduced: 10 42 | nfinal_transformers: 3 43 | d_transformer: 256 44 | d_reduced: 120 45 | full_SA: true 46 | decoder: 'crossatten' 47 | decoder_kwargs: 48 | dim_inp: 256 49 | dim: 200 50 | nneigh: 7 51 | hidden_dim: 128 52 | out_dim: 3 53 | 54 | training: 55 | iden_split: 'identity_seen' 56 | motion_split: 'train_seen' 57 | load_mesh: false 58 | num_sampled_pairs: 36000 59 | epochs: 100 60 | save_frequency: 10 61 | batch_size: 8 62 | optimizer: Adam 63 | lr: 0.00005 64 | lr_step: 50 65 | lr_decay: 0.1 66 | weight_decay: 0.0 67 | weight_forward_file: "./pretrained/forward.pt" 68 | weight_backward_file: "./pretrained/backward.pt" 69 | 70 | validation: 71 | iden_split: "identity_unseen" 72 | motion_split: "test_unseen_identities" 73 | load_mesh: false 74 | num_sampled_pairs: 300 75 | frequency: 1 76 | batch_size: 8 77 | 78 | test: 79 | iden_split: "identity_unseen" 80 | motion_split: "test_unseen_identities" 81 | load_mesh: true 82 | num_sampled_pairs: 300 83 | batch_size: 1 84 | generate_mesh: true 85 | mesh_folder: 'meshes' 86 | mesh_format: 'ply' 87 | generate_pointcloud: true 88 | pointcloud_folder: 'pointclouds' 89 | pointcloud_format: 'ply' 90 | weight_file: "./pretrained/arbitrary.pt" 91 | 92 | logger: 93 | type: "wandb" 94 | project: "NSDP" 95 | -------------------------------------------------------------------------------- /data/splits/deform4d/test_unseen_motions.lst: -------------------------------------------------------------------------------- 1 | bear3EP_Lie 2 | foxWDFS_Swim2 3 | procySTEM_Turn8 4 | foxWDFS_Damaged3 5 | pumaRW_Attacks0 6 | deerOMG_lie 7 | raccoonVGG_Dodge0 8 | foxYSY_Agression 9 | deerA4K_RunforwardRM 10 | deerSPL_Fall0 11 | tigerD8H_Jump2 12 | tigerD8H_Attacks3 13 | tigerD8H_Run0 14 | pumaRW_Sleep0 15 | bear9AK_HideRotR 16 | foxWDFS_Idles4 17 | deerSPL_Sleep2 18 | moose45D_RotateRightRM 19 | pumaRW_Attacks4 20 | raccoonVGG_Actions3 21 | huskydog3T_WalkBack1 22 | deerA4K_Idle1 23 | bear3EP_Hitfront 24 | zebraBM_eat 25 | canieLTT_Sleep5 26 | bear3EP_CrouchbaclLRM 27 | bucksYJL_Actions1 28 | foxWDFS_Damaged4 29 | rhinoDJ7S_action1 30 | moose45D_AttackTrotRM 31 | pumaRW_Sleep3 32 | foxWDFS_Walk0 33 | bear9AK_WalkhuntedRM 34 | deerFEL_Attack3 35 | raccoonVGG_Climb7 36 | foxZED_HiderotR 37 | huskydog3T_Turn0 38 | elkML_Swim0 39 | foxWDFS_Swim8 40 | moose45D_WalkhuntedRM 41 | moose45D_RotateR180RM 42 | deer2MB_SwimRotLeftRM 43 | tigerD8H_Idles2 44 | bear3EP_WalkhuntedRM 45 | deerSPL_Swim10 46 | bear3EP_Agression 47 | foxYSY_SwimidleRM 48 | deer2MB_TrotleftRM 49 | foxYSY_death1 50 | bearVGG_Swim11 51 | foxXAT_Rotate180L 52 | pumaRW_Idles1 53 | foxWDFS_Sleep4 54 | tigerD8H_Swim11 55 | bear9AK_RunstopRM 56 | bear3EP_WalkleftRM 57 | procySTEM_WalkBack4 58 | deerOMG_LandingRM 59 | raccoonVGG_Fall3 60 | raccoonVGG_Trot2 61 | procySTEM_Climb9 62 | elkML_Sleep3 63 | moose6OK9_Idle2 64 | foxYSY_Crouchbackleft 65 | elkML_Fall0 66 | canieLTT_Damaged1 67 | moose1DOG_TrotleftRM 68 | huskydog3T_Run0 69 | deerSPL_Swim8 70 | foxYSY_SwimforwardRM 71 | bearVGG_Idle0 72 | moose1DOG_JumpLandingRM 73 | bear3EP_Hitback 74 | pumaRW_Sleep1 75 | bear9AK_CrouchforwardRM 76 | moose6OK9_WalkbackLRM 77 | deerFEL_TrotforwardRM 78 | foxWDFS_Jump0 79 | elkML_Swim2 80 | foxXAT_HiderotL 81 | elkML_Fall2 82 | bear3EP_CrouchbaclRRM 83 | foxXAT_runrightRM 84 | lionessHTR42_action4 85 | bearVGG_WalkBack2 86 | pumaRW_Damaged5 87 | deer2MB_RunleftRM 88 | canieLTT_Trot0 89 | foxYSY_Jump 90 | deer2MB_Jumpdown 91 | deer2MB_death2 92 | deer2MB_JumpRunRM 93 | moose1DOG_Attack3 94 | deerLO1_lie 95 | bear9AK_TrotforwardRM 96 | canieLTT_CombatIdle0 97 | tigerD8H_Swim9 98 | elkML_Swim9 99 | foxZED_SwimbackRM 100 | procySTEM_Sneak4 101 | foxYSY_eat1 102 | moose6OK9_Jumpdown 103 | moose6OK9_Attack3 104 | canieLTT_Actions0 105 | foxWDFS_Actions0 106 | raccoonVGG_Climb3 107 | pumaRW_Trot1 108 | elkML_WalkBack0 109 | foxYSY_Attack2 110 | bear3EP_Landing 111 | bear9AK_CrouchleftRM 112 | deerOMG_TrotforwardRM 113 | deerOMG_sleep 114 | bear9AK_Idle2 115 | tigerD8H_WalkBack2 116 | deerK5L_SwimIdle 117 | bear9AK_HideRotL 118 | lionessHTR42_action3 119 | bear3EP_WalkrightRM 120 | tigerD8H_Swim2 121 | deerFEL_RotateRight180RM 122 | deerVMW_hide -------------------------------------------------------------------------------- /external/eigen3/Eigen/OrderingMethods: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_ORDERINGMETHODS_MODULE_H 9 | #define EIGEN_ORDERINGMETHODS_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** 16 | * \defgroup OrderingMethods_Module OrderingMethods module 17 | * 18 | * This module is currently for internal use only 19 | * 20 | * It defines various built-in and external ordering methods for sparse matrices. 21 | * They are typically used to reduce the number of elements during 22 | * the sparse matrix decomposition (LLT, LU, QR). 23 | * Precisely, in a preprocessing step, a permutation matrix P is computed using 24 | * those ordering methods and applied to the columns of the matrix. 25 | * Using for instance the sparse Cholesky decomposition, it is expected that 26 | * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A). 27 | * 28 | * 29 | * Usage : 30 | * \code 31 | * #include 32 | * \endcode 33 | * 34 | * A simple usage is as a template parameter in the sparse decomposition classes : 35 | * 36 | * \code 37 | * SparseLU > solver; 38 | * \endcode 39 | * 40 | * \code 41 | * SparseQR > solver; 42 | * \endcode 43 | * 44 | * It is possible as well to call directly a particular ordering method for your own purpose, 45 | * \code 46 | * AMDOrdering ordering; 47 | * PermutationMatrix perm; 48 | * SparseMatrix A; 49 | * //Fill the matrix ... 50 | * 51 | * ordering(A, perm); // Call AMD 52 | * \endcode 53 | * 54 | * \note Some of these methods (like AMD or METIS), need the sparsity pattern 55 | * of the input matrix to be symmetric. When the matrix is structurally unsymmetric, 56 | * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method. 57 | * If your matrix is already symmetric (at leat in structure), you can avoid that 58 | * by calling the method with a SelfAdjointView type. 59 | * 60 | * \code 61 | * // Call the ordering on the pattern of the lower triangular matrix A 62 | * ordering(A.selfadjointView(), perm); 63 | * \endcode 64 | */ 65 | 66 | #ifndef EIGEN_MPL2_ONLY 67 | #include "src/OrderingMethods/Amd.h" 68 | #endif 69 | 70 | #include "src/OrderingMethods/Ordering.h" 71 | #include "src/Core/util/ReenableStupidWarnings.h" 72 | 73 | #endif // EIGEN_ORDERINGMETHODS_MODULE_H 74 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/Core/arch/CUDA/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MATH_FUNCTIONS_CUDA_H 11 | #define EIGEN_MATH_FUNCTIONS_CUDA_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | // Make sure this is only available when targeting a GPU: we don't want to 18 | // introduce conflicts between these packet_traits definitions and the ones 19 | // we'll use on the host side (SSE, AVX, ...) 20 | #if defined(__CUDACC__) && defined(EIGEN_USE_GPU) 21 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 22 | float4 plog(const float4& a) 23 | { 24 | return make_float4(logf(a.x), logf(a.y), logf(a.z), logf(a.w)); 25 | } 26 | 27 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 28 | double2 plog(const double2& a) 29 | { 30 | using ::log; 31 | return make_double2(log(a.x), log(a.y)); 32 | } 33 | 34 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 35 | float4 plog1p(const float4& a) 36 | { 37 | return make_float4(log1pf(a.x), log1pf(a.y), log1pf(a.z), log1pf(a.w)); 38 | } 39 | 40 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 41 | double2 plog1p(const double2& a) 42 | { 43 | return make_double2(log1p(a.x), log1p(a.y)); 44 | } 45 | 46 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 47 | float4 pexp(const float4& a) 48 | { 49 | return make_float4(expf(a.x), expf(a.y), expf(a.z), expf(a.w)); 50 | } 51 | 52 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 53 | double2 pexp(const double2& a) 54 | { 55 | using ::exp; 56 | return make_double2(exp(a.x), exp(a.y)); 57 | } 58 | 59 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 60 | float4 psqrt(const float4& a) 61 | { 62 | return make_float4(sqrtf(a.x), sqrtf(a.y), sqrtf(a.z), sqrtf(a.w)); 63 | } 64 | 65 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 66 | double2 psqrt(const double2& a) 67 | { 68 | using ::sqrt; 69 | return make_double2(sqrt(a.x), sqrt(a.y)); 70 | } 71 | 72 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 73 | float4 prsqrt(const float4& a) 74 | { 75 | return make_float4(rsqrtf(a.x), rsqrtf(a.y), rsqrtf(a.z), rsqrtf(a.w)); 76 | } 77 | 78 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 79 | double2 prsqrt(const double2& a) 80 | { 81 | return make_double2(rsqrt(a.x), rsqrt(a.y)); 82 | } 83 | 84 | 85 | #endif 86 | 87 | } // end namespace internal 88 | 89 | } // end namespace Eigen 90 | 91 | #endif // EIGEN_MATH_FUNCTIONS_CUDA_H 92 | -------------------------------------------------------------------------------- /model/decoder/interpolation_decoder.py: -------------------------------------------------------------------------------- 1 | 2 | import torch 3 | import torch.nn as nn 4 | import torch.nn.functional as F 5 | from model.decoder.blocks import ResnetBlockFC 6 | 7 | 8 | class PointInterpDecoder(nn.Module): 9 | """ 10 | Decoder based in interpolation features between local latent vectors. 11 | Gaussian Kernel regression is used for the interpolation of features. 12 | Coda adapted from https://github.com/autonomousvision/convolutional_occupancy_networks 13 | 14 | Attributes: 15 | dim_inp: input dimensionality 16 | hidden_dim: dimensionality for feed-forward network 17 | n_blocks: number of blocks in feed worward network 18 | var (float): variance for gaussian kernel 19 | 20 | Default Values: 21 | dim_inp: 256 22 | dim: 200 23 | hidden_dim: 128, 24 | out_dim: 3 25 | """ 26 | def __init__(self, dim_inp, dim, out_dim=3, hidden_dim=50, n_blocks=5): 27 | super().__init__() 28 | self.n_blocks = n_blocks 29 | 30 | self.fc0 = nn.Linear(dim_inp, dim) 31 | 32 | self.fc1 = nn.Linear(dim, hidden_dim) 33 | 34 | 35 | self.blocks = nn.ModuleList([ 36 | ResnetBlockFC(hidden_dim) for i in range(n_blocks) 37 | ]) 38 | 39 | self.fc_c = nn.ModuleList([ 40 | nn.Linear(dim, hidden_dim) for i in range(n_blocks) 41 | ]) 42 | 43 | self.fc_out = nn.Linear(hidden_dim, out_dim) 44 | 45 | self.actvn = F.relu 46 | 47 | self.var = 0.2**2 48 | 49 | 50 | def sample_point_feature(self, q, p, fea): 51 | # q: B x M x 3 52 | # p: B x N x 3 53 | # fea: B x N x c_dim 54 | # p, fea = c 55 | 56 | # distance betweeen each query point to the point cloud 57 | dist = -((p.unsqueeze(1).expand(-1, q.size(1), -1, -1) - q.unsqueeze(2)).norm(dim=3) + 10e-6) ** 2 58 | weight = (dist / self.var).exp() # Guassian kernel 59 | 60 | # weight normalization 61 | weight = weight / weight.sum(dim=2).unsqueeze(-1) 62 | 63 | c_out = weight @ fea # B x M x c_dim 64 | 65 | return c_out 66 | 67 | 68 | def forward(self, xyz_q, encoding): 69 | """ 70 | :param xyz_q [B x n_quries x 3]: queried 3D positions 71 | :param xyz [B x n_anchors x 3]: anchor positions 72 | :param feats [B x n_anchors x dim_inp]: anchor features 73 | :return: occ [B x n_queries x 3]: deformation predictions 74 | """ 75 | 76 | xyz = encoding['anchors'] 77 | feats = encoding['anchor_feats'] 78 | 79 | lat_rep = self.fc0(self.sample_point_feature(xyz_q, xyz, feats)) 80 | 81 | net = self.fc1(F.relu(lat_rep)) 82 | 83 | for i in range(self.n_blocks): 84 | net = net + self.fc_c[i](lat_rep) 85 | net = self.blocks[i](net) 86 | 87 | occ = self.fc_out(self.actvn(net)) 88 | return occ 89 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/Core/Swap.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2006-2008 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SWAP_H 11 | #define EIGEN_SWAP_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | // Overload default assignPacket behavior for swapping them 18 | template 19 | class generic_dense_assignment_kernel, Specialized> 20 | : public generic_dense_assignment_kernel, BuiltIn> 21 | { 22 | protected: 23 | typedef generic_dense_assignment_kernel, BuiltIn> Base; 24 | using Base::m_dst; 25 | using Base::m_src; 26 | using Base::m_functor; 27 | 28 | public: 29 | typedef typename Base::Scalar Scalar; 30 | typedef typename Base::DstXprType DstXprType; 31 | typedef swap_assign_op Functor; 32 | 33 | EIGEN_DEVICE_FUNC generic_dense_assignment_kernel(DstEvaluatorTypeT &dst, const SrcEvaluatorTypeT &src, const Functor &func, DstXprType& dstExpr) 34 | : Base(dst, src, func, dstExpr) 35 | {} 36 | 37 | template 38 | void assignPacket(Index row, Index col) 39 | { 40 | PacketType tmp = m_src.template packet(row,col); 41 | const_cast(m_src).template writePacket(row,col, m_dst.template packet(row,col)); 42 | m_dst.template writePacket(row,col,tmp); 43 | } 44 | 45 | template 46 | void assignPacket(Index index) 47 | { 48 | PacketType tmp = m_src.template packet(index); 49 | const_cast(m_src).template writePacket(index, m_dst.template packet(index)); 50 | m_dst.template writePacket(index,tmp); 51 | } 52 | 53 | // TODO find a simple way not to have to copy/paste this function from generic_dense_assignment_kernel, by simple I mean no CRTP (Gael) 54 | template 55 | void assignPacketByOuterInner(Index outer, Index inner) 56 | { 57 | Index row = Base::rowIndexByOuterInner(outer, inner); 58 | Index col = Base::colIndexByOuterInner(outer, inner); 59 | assignPacket(row, col); 60 | } 61 | }; 62 | 63 | } // namespace internal 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN_SWAP_H 68 | -------------------------------------------------------------------------------- /external/PyMarchingCubes/setup.py: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | import sys, os 3 | sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) 4 | 5 | from setuptools import setup 6 | 7 | from setuptools.extension import Extension 8 | 9 | 10 | class lazy_cythonize(list): 11 | """ 12 | Lazy evaluate extension definition, to allow correct requirements install. 13 | """ 14 | 15 | def __init__(self, callback): 16 | super(lazy_cythonize, self).__init__() 17 | self._list, self.callback = None, callback 18 | 19 | def c_list(self): 20 | if self._list is None: 21 | self._list = self.callback() 22 | 23 | return self._list 24 | 25 | def __iter__(self): 26 | for e in self.c_list(): 27 | yield e 28 | 29 | def __getitem__(self, ii): 30 | return self.c_list()[ii] 31 | 32 | def __len__(self): 33 | return len(self.c_list()) 34 | 35 | 36 | def extensions(): 37 | 38 | from Cython.Build import cythonize 39 | import numpy 40 | 41 | numpy_include_dir = numpy.get_include() 42 | eigen_include_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'eigen3')) 43 | 44 | marching_cubes_module = Extension( 45 | "marching_cubes._mcubes", 46 | [ 47 | "marching_cubes/src/_mcubes.pyx", 48 | "marching_cubes/src/pywrapper.cpp", 49 | "marching_cubes/src/marchingcubes.cpp" 50 | ], 51 | language="c++", 52 | extra_compile_args=['-std=c++11', '-Wall'], 53 | include_dirs=[numpy_include_dir, eigen_include_dir], 54 | depends=[ 55 | "marching_cubes/src/marchingcubes.h", 56 | "marching_cubes/src/pyarray_symbol.h", 57 | "marching_cubes/src/pyarraymodule.h", 58 | "marching_cubes/src/pywrapper.h" 59 | ], 60 | ) 61 | 62 | return cythonize([marching_cubes_module]) 63 | 64 | setup( 65 | name="PyMarchingCubes", 66 | version="0.0.2", 67 | description="Marching cubes for Python", 68 | author="Justus Thies (PyMCubes: Pablo Márquez Neila)", 69 | url="https://github.com/JustusThies/PyMarchingCubes", 70 | license="BSD 3-clause", 71 | long_description=""" 72 | Marching cubes for Python 73 | """, 74 | classifiers=[ 75 | "Development Status :: 5 - Production/Stable", 76 | "Environment :: Console", 77 | "Intended Audience :: Developers", 78 | "Intended Audience :: Science/Research", 79 | "License :: OSI Approved :: BSD License", 80 | "Natural Language :: English", 81 | "Operating System :: OS Independent", 82 | "Programming Language :: C++", 83 | "Programming Language :: Python", 84 | "Topic :: Multimedia :: Graphics :: 3D Modeling", 85 | "Topic :: Scientific/Engineering :: Image Recognition", 86 | ], 87 | packages=["marching_cubes"], 88 | ext_modules=lazy_cythonize(extensions), 89 | requires=['numpy', 'Cython', 'PyCollada'], 90 | setup_requires=['numpy', 'Cython'] 91 | ) 92 | -------------------------------------------------------------------------------- /external/PyMarchingCubes/marching_cubes/src/_mcubes.pyx: -------------------------------------------------------------------------------- 1 | 2 | # distutils: language = c++ 3 | # cython: embedsignature = True 4 | 5 | # from libcpp.vector cimport vector 6 | import numpy as np 7 | 8 | # Define PY_ARRAY_UNIQUE_SYMBOL 9 | cdef extern from "pyarray_symbol.h": 10 | pass 11 | 12 | cimport numpy as np 13 | 14 | np.import_array() 15 | 16 | cdef extern from "pywrapper.h": 17 | cdef object c_marching_cubes "marching_cubes"(np.ndarray, double) except + 18 | cdef object c_marching_cubes_func "marching_cubes_func"(tuple, tuple, int, int, int, object, double) except + 19 | cdef object c_marching_cubes_color "marching_cubes_color"(np.ndarray, np.ndarray, double) except + 20 | cdef object c_marching_cubes_color_func "marching_cubes_color_func"(tuple, tuple, int, int, int, object, object, object, object, double) except + 21 | cdef object c_marching_cubes_super_sampling "marching_cubes_super_sampling"(np.ndarray, np.ndarray, np.ndarray, double) except + 22 | 23 | def marching_cubes(np.ndarray volume, float isovalue): 24 | 25 | verts, faces = c_marching_cubes(volume, isovalue) 26 | verts.shape = (-1, 3) 27 | faces.shape = (-1, 3) 28 | return verts, faces 29 | 30 | def marching_cubes_super_sampling(np.ndarray volumeX, np.ndarray volumeY, np.ndarray volumeZ, float isovalue): 31 | 32 | verts, faces = c_marching_cubes_super_sampling(volumeX, volumeY, volumeZ, isovalue) 33 | verts.shape = (-1, 3) 34 | faces.shape = (-1, 3) 35 | return verts, faces 36 | 37 | def marching_cubes_func(tuple lower, tuple upper, int numx, int numy, int numz, object f, double isovalue): 38 | 39 | if any(l_i >= u_i for l_i, u_i in zip(lower, upper)): 40 | raise ValueError("lower coordinates cannot be larger than upper coordinates") 41 | 42 | if numx < 2 or numy < 2 or numz < 2: 43 | raise ValueError("numx, numy, numz cannot be smaller than 2") 44 | 45 | verts, faces = c_marching_cubes_func(lower, upper, numx, numy, numz, f, isovalue) 46 | verts.shape = (-1, 3) 47 | faces.shape = (-1, 3) 48 | return verts, faces 49 | 50 | 51 | 52 | def marching_cubes_color(np.ndarray volume_sdf, np.ndarray volume_color, float isovalue): 53 | 54 | verts, faces = c_marching_cubes_color(volume_sdf, volume_color, isovalue) 55 | verts.shape = (-1, 6) 56 | faces.shape = (-1, 3) 57 | return verts, faces 58 | 59 | def marching_cubes_color_func(tuple lower, tuple upper, int numx, int numy, int numz, object f_sdf, object f_color_r, object f_color_g, object f_color_b, double isovalue): 60 | 61 | if any(l_i >= u_i for l_i, u_i in zip(lower, upper)): 62 | raise ValueError("lower coordinates cannot be larger than upper coordinates") 63 | 64 | if numx < 2 or numy < 2 or numz < 2: 65 | raise ValueError("numx, numy, numz cannot be smaller than 2") 66 | 67 | verts, faces = c_marching_cubes_color_func(lower, upper, numx, numy, numz, f_sdf, f_color_r, f_color_g, f_color_b, isovalue) 68 | verts.shape = (-1, 6) 69 | faces.shape = (-1, 3) 70 | return verts, faces 71 | 72 | 73 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/misc/Kernel.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_KERNEL_H 11 | #define EIGEN_MISC_KERNEL_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class kernel_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix< 25 | typename MatrixType::Scalar, 26 | MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix" 27 | // is the number of cols of the original matrix 28 | // so that the product "matrix * kernel = zero" makes sense 29 | Dynamic, // we don't know at compile-time the dimension of the kernel 30 | MatrixType::Options, 31 | MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter 32 | MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space, 33 | // whose dimension is the number of columns of the original matrix 34 | > ReturnType; 35 | }; 36 | 37 | template struct kernel_retval_base 38 | : public ReturnByValue > 39 | { 40 | typedef _DecompositionType DecompositionType; 41 | typedef ReturnByValue Base; 42 | 43 | explicit kernel_retval_base(const DecompositionType& dec) 44 | : m_dec(dec), 45 | m_rank(dec.rank()), 46 | m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank) 47 | {} 48 | 49 | inline Index rows() const { return m_dec.cols(); } 50 | inline Index cols() const { return m_cols; } 51 | inline Index rank() const { return m_rank; } 52 | inline const DecompositionType& dec() const { return m_dec; } 53 | 54 | template inline void evalTo(Dest& dst) const 55 | { 56 | static_cast*>(this)->evalTo(dst); 57 | } 58 | 59 | protected: 60 | const DecompositionType& m_dec; 61 | Index m_rank, m_cols; 62 | }; 63 | 64 | } // end namespace internal 65 | 66 | #define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \ 67 | typedef typename DecompositionType::MatrixType MatrixType; \ 68 | typedef typename MatrixType::Scalar Scalar; \ 69 | typedef typename MatrixType::RealScalar RealScalar; \ 70 | typedef Eigen::internal::kernel_retval_base Base; \ 71 | using Base::dec; \ 72 | using Base::rank; \ 73 | using Base::rows; \ 74 | using Base::cols; \ 75 | kernel_retval(const DecompositionType& dec) : Base(dec) {} 76 | 77 | } // end namespace Eigen 78 | 79 | #endif // EIGEN_MISC_KERNEL_H 80 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/Core/Assign.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2007 Michael Olbrich 5 | // Copyright (C) 2006-2010 Benoit Jacob 6 | // Copyright (C) 2008 Gael Guennebaud 7 | // 8 | // This Source Code Form is subject to the terms of the Mozilla 9 | // Public License v. 2.0. If a copy of the MPL was not distributed 10 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 11 | 12 | #ifndef EIGEN_ASSIGN_H 13 | #define EIGEN_ASSIGN_H 14 | 15 | namespace Eigen { 16 | 17 | template 18 | template 19 | EIGEN_STRONG_INLINE Derived& DenseBase 20 | ::lazyAssign(const DenseBase& other) 21 | { 22 | enum{ 23 | SameType = internal::is_same::value 24 | }; 25 | 26 | EIGEN_STATIC_ASSERT_LVALUE(Derived) 27 | EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived) 28 | EIGEN_STATIC_ASSERT(SameType,YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 29 | 30 | eigen_assert(rows() == other.rows() && cols() == other.cols()); 31 | internal::call_assignment_no_alias(derived(),other.derived()); 32 | 33 | return derived(); 34 | } 35 | 36 | template 37 | template 38 | EIGEN_DEVICE_FUNC 39 | EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) 40 | { 41 | internal::call_assignment(derived(), other.derived()); 42 | return derived(); 43 | } 44 | 45 | template 46 | EIGEN_DEVICE_FUNC 47 | EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) 48 | { 49 | internal::call_assignment(derived(), other.derived()); 50 | return derived(); 51 | } 52 | 53 | template 54 | EIGEN_DEVICE_FUNC 55 | EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const MatrixBase& other) 56 | { 57 | internal::call_assignment(derived(), other.derived()); 58 | return derived(); 59 | } 60 | 61 | template 62 | template 63 | EIGEN_DEVICE_FUNC 64 | EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const DenseBase& other) 65 | { 66 | internal::call_assignment(derived(), other.derived()); 67 | return derived(); 68 | } 69 | 70 | template 71 | template 72 | EIGEN_DEVICE_FUNC 73 | EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const EigenBase& other) 74 | { 75 | internal::call_assignment(derived(), other.derived()); 76 | return derived(); 77 | } 78 | 79 | template 80 | template 81 | EIGEN_DEVICE_FUNC 82 | EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const ReturnByValue& other) 83 | { 84 | other.derived().evalTo(derived()); 85 | return derived(); 86 | } 87 | 88 | } // end namespace Eigen 89 | 90 | #endif // EIGEN_ASSIGN_H 91 | -------------------------------------------------------------------------------- /external/PyMarchingCubes/marching_cubes/numpy_smoothing.py: -------------------------------------------------------------------------------- 1 | 2 | import numpy as np 3 | from scipy import ndimage as ndi 4 | 5 | __all__ = [ 6 | 'numpy_smooth', 7 | ] 8 | 9 | FILTER = np.array([1, -2, 1], dtype=np.float_) 10 | 11 | JACOBI_R_2D = np.array([ 12 | [0, 0, 1, 0, 0], 13 | [0, 0, -4, 0, 0], 14 | [1, -4, 0, -4, 1], 15 | [0, 0, -4, 0, 0], 16 | [0, 0, 1, 0, 0] 17 | ], dtype=np.float_) 18 | JACOBI_D_2D = 1/12 19 | 20 | JACOBI_R_3D = np.array([ 21 | [[0, 0, 0, 0, 0], 22 | [0, 0, 0, 0, 0], 23 | [0, 0, 1, 0, 0], 24 | [0, 0, 0, 0, 0], 25 | [0, 0, 0, 0, 0]], 26 | [[0, 0, 0, 0, 0], 27 | [0, 0, 0, 0, 0], 28 | [0, 0, -4, 0, 0], 29 | [0, 0, 0, 0, 0], 30 | [0, 0, 0, 0, 0]], 31 | [[0, 0, 1, 0, 0], 32 | [0, 0, -4, 0, 0], 33 | [1, -4, 0, -4, 1], 34 | [0, 0, -4, 0, 0], 35 | [0, 0, 1, 0, 0]], 36 | [[0, 0, 0, 0, 0], 37 | [0, 0, 0, 0, 0], 38 | [0, 0, -4, 0, 0], 39 | [0, 0, 0, 0, 0], 40 | [0, 0, 0, 0, 0]], 41 | [[0, 0, 0, 0, 0], 42 | [0, 0, 0, 0, 0], 43 | [0, 0, 1, 0, 0], 44 | [0, 0, 0, 0, 0], 45 | [0, 0, 0, 0, 0]] 46 | ], dtype=np.float_) 47 | 48 | JACOBI_D_3D = 1/18 49 | 50 | 51 | def signed_distance_function(binary_arr: np.ndarray) -> np.ndarray: 52 | 53 | arr = np.where(binary_arr > 0, 1.0, 0.0) 54 | dist_func = ndi.distance_transform_edt 55 | distance = np.where( 56 | binary_arr, 57 | dist_func(arr) - 0.5, 58 | -dist_func(1 - arr) + 0.5 59 | ) 60 | return distance 61 | 62 | 63 | def energy(arr: np.ndarray) -> np.ndarray: 64 | 65 | darr2 = [ndi.convolve1d(arr, FILTER, axis=i)**2 for i in range(arr.ndim)] 66 | return np.sum(darr2) / 2 67 | 68 | 69 | def solve_jacobi( 70 | arr: np.ndarray, 71 | lower_bound: np.ndarray, 72 | upper_bound: np.ndarray, 73 | max_iters: int = 500, 74 | jacobi_weight: float = 0.5 75 | ) -> np.ndarray: 76 | 77 | jacobi_d = JACOBI_D_2D if arr.ndim == 2 else JACOBI_D_3D 78 | jacobi_r = JACOBI_R_2D if arr.ndim == 2 else JACOBI_R_3D 79 | 80 | for it in range(max_iters): 81 | # energy_it = torch.sum(diff_energy(arr) * arr[2:-2, 2:-2, 2:-2]) / 2 82 | energy_it = energy(arr) 83 | print("Energy in iteration {}: {:.4g}".format(it, energy_it)) 84 | 85 | r_arr = ndi.convolve(arr, jacobi_r, mode='nearest') 86 | arr_1 = - jacobi_d * r_arr 87 | arr = jacobi_weight * arr_1 + (1 - jacobi_weight) * arr 88 | 89 | arr = np.maximum(arr, lower_bound) 90 | arr = np.minimum(arr, upper_bound) 91 | 92 | return arr 93 | 94 | 95 | def numpy_smooth(binary_array: np.ndarray, max_iters: int = 500) -> np.ndarray: 96 | 97 | arr = signed_distance_function(binary_array) 98 | 99 | upper_bound = np.where(arr < 0, arr, np.inf) 100 | lower_bound = np.where(arr > 0, arr, -np.inf) 101 | 102 | upper_bound[np.abs(upper_bound) < 1] = 0 103 | lower_bound[np.abs(lower_bound) < 1] = 0 104 | 105 | return solve_jacobi(arr, lower_bound, upper_bound, max_iters) 106 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/StlSupport/details.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STL_DETAILS_H 12 | #define EIGEN_STL_DETAILS_H 13 | 14 | #ifndef EIGEN_ALIGNED_ALLOCATOR 15 | #define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator 16 | #endif 17 | 18 | namespace Eigen { 19 | 20 | // This one is needed to prevent reimplementing the whole std::vector. 21 | template 22 | class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR 23 | { 24 | public: 25 | typedef std::size_t size_type; 26 | typedef std::ptrdiff_t difference_type; 27 | typedef T* pointer; 28 | typedef const T* const_pointer; 29 | typedef T& reference; 30 | typedef const T& const_reference; 31 | typedef T value_type; 32 | 33 | template 34 | struct rebind 35 | { 36 | typedef aligned_allocator_indirection other; 37 | }; 38 | 39 | aligned_allocator_indirection() {} 40 | aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR() {} 41 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 42 | template 43 | aligned_allocator_indirection(const aligned_allocator_indirection& ) {} 44 | template 45 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 46 | ~aligned_allocator_indirection() {} 47 | }; 48 | 49 | #if EIGEN_COMP_MSVC 50 | 51 | // sometimes, MSVC detects, at compile time, that the argument x 52 | // in std::vector::resize(size_t s,T x) won't be aligned and generate an error 53 | // even if this function is never called. Whence this little wrapper. 54 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \ 55 | typename Eigen::internal::conditional< \ 56 | Eigen::internal::is_arithmetic::value, \ 57 | T, \ 58 | Eigen::internal::workaround_msvc_stl_support \ 59 | >::type 60 | 61 | namespace internal { 62 | template struct workaround_msvc_stl_support : public T 63 | { 64 | inline workaround_msvc_stl_support() : T() {} 65 | inline workaround_msvc_stl_support(const T& other) : T(other) {} 66 | inline operator T& () { return *static_cast(this); } 67 | inline operator const T& () const { return *static_cast(this); } 68 | template 69 | inline T& operator=(const OtherT& other) 70 | { T::operator=(other); return *this; } 71 | inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other) 72 | { T::operator=(other); return *this; } 73 | }; 74 | } 75 | 76 | #else 77 | 78 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T 79 | 80 | #endif 81 | 82 | } 83 | 84 | #endif // EIGEN_STL_DETAILS_H 85 | -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/_ext-src/src/group_points_gpu.cu: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "cuda_utils.h" 5 | 6 | // input: points(b, c, n) idx(b, npoints, nsample) 7 | // output: out(b, c, npoints, nsample) 8 | __global__ void group_points_kernel(int b, int c, int n, int npoints, 9 | int nsample, 10 | const float *__restrict__ points, 11 | const int *__restrict__ idx, 12 | float *__restrict__ out) { 13 | int batch_index = blockIdx.x; 14 | points += batch_index * n * c; 15 | idx += batch_index * npoints * nsample; 16 | out += batch_index * npoints * nsample * c; 17 | 18 | const int index = threadIdx.y * blockDim.x + threadIdx.x; 19 | const int stride = blockDim.y * blockDim.x; 20 | for (int i = index; i < c * npoints; i += stride) { 21 | const int l = i / npoints; 22 | const int j = i % npoints; 23 | for (int k = 0; k < nsample; ++k) { 24 | int ii = idx[j * nsample + k]; 25 | out[(l * npoints + j) * nsample + k] = points[l * n + ii]; 26 | } 27 | } 28 | } 29 | 30 | void group_points_kernel_wrapper(int b, int c, int n, int npoints, int nsample, 31 | const float *points, const int *idx, 32 | float *out) { 33 | cudaStream_t stream = at::cuda::getCurrentCUDAStream(); 34 | 35 | group_points_kernel<<>>( 36 | b, c, n, npoints, nsample, points, idx, out); 37 | 38 | CUDA_CHECK_ERRORS(); 39 | } 40 | 41 | // input: grad_out(b, c, npoints, nsample), idx(b, npoints, nsample) 42 | // output: grad_points(b, c, n) 43 | __global__ void group_points_grad_kernel(int b, int c, int n, int npoints, 44 | int nsample, 45 | const float *__restrict__ grad_out, 46 | const int *__restrict__ idx, 47 | float *__restrict__ grad_points) { 48 | int batch_index = blockIdx.x; 49 | grad_out += batch_index * npoints * nsample * c; 50 | idx += batch_index * npoints * nsample; 51 | grad_points += batch_index * n * c; 52 | 53 | const int index = threadIdx.y * blockDim.x + threadIdx.x; 54 | const int stride = blockDim.y * blockDim.x; 55 | for (int i = index; i < c * npoints; i += stride) { 56 | const int l = i / npoints; 57 | const int j = i % npoints; 58 | for (int k = 0; k < nsample; ++k) { 59 | int ii = idx[j * nsample + k]; 60 | atomicAdd(grad_points + l * n + ii, 61 | grad_out[(l * npoints + j) * nsample + k]); 62 | } 63 | } 64 | } 65 | 66 | void group_points_grad_kernel_wrapper(int b, int c, int n, int npoints, 67 | int nsample, const float *grad_out, 68 | const int *idx, float *grad_points) { 69 | cudaStream_t stream = at::cuda::getCurrentCUDAStream(); 70 | 71 | group_points_grad_kernel<<>>( 72 | b, c, n, npoints, nsample, grad_out, idx, grad_points); 73 | 74 | CUDA_CHECK_ERRORS(); 75 | } 76 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/Core/arch/NEON/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | /* The sin, cos, exp, and log functions of this file come from 9 | * Julien Pommier's sse math library: http://gruntthepeon.free.fr/ssemath/ 10 | */ 11 | 12 | #ifndef EIGEN_MATH_FUNCTIONS_NEON_H 13 | #define EIGEN_MATH_FUNCTIONS_NEON_H 14 | 15 | namespace Eigen { 16 | 17 | namespace internal { 18 | 19 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 20 | Packet4f pexp(const Packet4f& _x) 21 | { 22 | Packet4f x = _x; 23 | Packet4f tmp, fx; 24 | 25 | _EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f); 26 | _EIGEN_DECLARE_CONST_Packet4f(half, 0.5f); 27 | _EIGEN_DECLARE_CONST_Packet4i(0x7f, 0x7f); 28 | _EIGEN_DECLARE_CONST_Packet4f(exp_hi, 88.3762626647950f); 29 | _EIGEN_DECLARE_CONST_Packet4f(exp_lo, -88.3762626647949f); 30 | _EIGEN_DECLARE_CONST_Packet4f(cephes_LOG2EF, 1.44269504088896341f); 31 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_C1, 0.693359375f); 32 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_C2, -2.12194440e-4f); 33 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p0, 1.9875691500E-4f); 34 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p1, 1.3981999507E-3f); 35 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p2, 8.3334519073E-3f); 36 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p3, 4.1665795894E-2f); 37 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p4, 1.6666665459E-1f); 38 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p5, 5.0000001201E-1f); 39 | 40 | x = vminq_f32(x, p4f_exp_hi); 41 | x = vmaxq_f32(x, p4f_exp_lo); 42 | 43 | /* express exp(x) as exp(g + n*log(2)) */ 44 | fx = vmlaq_f32(p4f_half, x, p4f_cephes_LOG2EF); 45 | 46 | /* perform a floorf */ 47 | tmp = vcvtq_f32_s32(vcvtq_s32_f32(fx)); 48 | 49 | /* if greater, substract 1 */ 50 | Packet4ui mask = vcgtq_f32(tmp, fx); 51 | mask = vandq_u32(mask, vreinterpretq_u32_f32(p4f_1)); 52 | 53 | fx = vsubq_f32(tmp, vreinterpretq_f32_u32(mask)); 54 | 55 | tmp = vmulq_f32(fx, p4f_cephes_exp_C1); 56 | Packet4f z = vmulq_f32(fx, p4f_cephes_exp_C2); 57 | x = vsubq_f32(x, tmp); 58 | x = vsubq_f32(x, z); 59 | 60 | Packet4f y = vmulq_f32(p4f_cephes_exp_p0, x); 61 | z = vmulq_f32(x, x); 62 | y = vaddq_f32(y, p4f_cephes_exp_p1); 63 | y = vmulq_f32(y, x); 64 | y = vaddq_f32(y, p4f_cephes_exp_p2); 65 | y = vmulq_f32(y, x); 66 | y = vaddq_f32(y, p4f_cephes_exp_p3); 67 | y = vmulq_f32(y, x); 68 | y = vaddq_f32(y, p4f_cephes_exp_p4); 69 | y = vmulq_f32(y, x); 70 | y = vaddq_f32(y, p4f_cephes_exp_p5); 71 | 72 | y = vmulq_f32(y, z); 73 | y = vaddq_f32(y, x); 74 | y = vaddq_f32(y, p4f_1); 75 | 76 | /* build 2^n */ 77 | int32x4_t mm; 78 | mm = vcvtq_s32_f32(fx); 79 | mm = vaddq_s32(mm, p4i_0x7f); 80 | mm = vshlq_n_s32(mm, 23); 81 | Packet4f pow2n = vreinterpretq_f32_s32(mm); 82 | 83 | y = vmulq_f32(y, pow2n); 84 | return y; 85 | } 86 | 87 | } // end namespace internal 88 | 89 | } // end namespace Eigen 90 | 91 | #endif // EIGEN_MATH_FUNCTIONS_NEON_H 92 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/SparseLU/SparseLU_relax_snode.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | /* This file is a modified version of heap_relax_snode.c file in SuperLU 11 | * -- SuperLU routine (version 3.0) -- 12 | * Univ. of California Berkeley, Xerox Palo Alto Research Center, 13 | * and Lawrence Berkeley National Lab. 14 | * October 15, 2003 15 | * 16 | * Copyright (c) 1994 by Xerox Corporation. All rights reserved. 17 | * 18 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY 19 | * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 20 | * 21 | * Permission is hereby granted to use or copy this program for any 22 | * purpose, provided the above notices are retained on all copies. 23 | * Permission to modify the code and to distribute modified code is 24 | * granted, provided the above notices are retained, and a notice that 25 | * the code was modified is included with the above copyright notice. 26 | */ 27 | 28 | #ifndef SPARSELU_RELAX_SNODE_H 29 | #define SPARSELU_RELAX_SNODE_H 30 | 31 | namespace Eigen { 32 | 33 | namespace internal { 34 | 35 | /** 36 | * \brief Identify the initial relaxed supernodes 37 | * 38 | * This routine is applied to a column elimination tree. 39 | * It assumes that the matrix has been reordered according to the postorder of the etree 40 | * \param n the number of columns 41 | * \param et elimination tree 42 | * \param relax_columns Maximum number of columns allowed in a relaxed snode 43 | * \param descendants Number of descendants of each node in the etree 44 | * \param relax_end last column in a supernode 45 | */ 46 | template 47 | void SparseLUImpl::relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end) 48 | { 49 | 50 | // compute the number of descendants of each node in the etree 51 | Index parent; 52 | relax_end.setConstant(emptyIdxLU); 53 | descendants.setZero(); 54 | for (Index j = 0; j < n; j++) 55 | { 56 | parent = et(j); 57 | if (parent != n) // not the dummy root 58 | descendants(parent) += descendants(j) + 1; 59 | } 60 | // Identify the relaxed supernodes by postorder traversal of the etree 61 | Index snode_start; // beginning of a snode 62 | for (Index j = 0; j < n; ) 63 | { 64 | parent = et(j); 65 | snode_start = j; 66 | while ( parent != n && descendants(parent) < relax_columns ) 67 | { 68 | j = parent; 69 | parent = et(j); 70 | } 71 | // Found a supernode in postordered etree, j is the last column 72 | relax_end(snode_start) = StorageIndex(j); // Record last column 73 | j++; 74 | // Search for a new leaf 75 | while (descendants(j) != 0 && j < n) j++; 76 | } // End postorder traversal of the etree 77 | 78 | } 79 | 80 | } // end namespace internal 81 | 82 | } // end namespace Eigen 83 | #endif 84 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/misc/Image.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_IMAGE_H 11 | #define EIGEN_MISC_IMAGE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class image_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix< 25 | typename MatrixType::Scalar, 26 | MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose 27 | // dimension is the number of rows of the original matrix 28 | Dynamic, // we don't know at compile time the dimension of the image (the rank) 29 | MatrixType::Options, 30 | MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original matrix, 31 | MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns. 32 | > ReturnType; 33 | }; 34 | 35 | template struct image_retval_base 36 | : public ReturnByValue > 37 | { 38 | typedef _DecompositionType DecompositionType; 39 | typedef typename DecompositionType::MatrixType MatrixType; 40 | typedef ReturnByValue Base; 41 | 42 | image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix) 43 | : m_dec(dec), m_rank(dec.rank()), 44 | m_cols(m_rank == 0 ? 1 : m_rank), 45 | m_originalMatrix(originalMatrix) 46 | {} 47 | 48 | inline Index rows() const { return m_dec.rows(); } 49 | inline Index cols() const { return m_cols; } 50 | inline Index rank() const { return m_rank; } 51 | inline const DecompositionType& dec() const { return m_dec; } 52 | inline const MatrixType& originalMatrix() const { return m_originalMatrix; } 53 | 54 | template inline void evalTo(Dest& dst) const 55 | { 56 | static_cast*>(this)->evalTo(dst); 57 | } 58 | 59 | protected: 60 | const DecompositionType& m_dec; 61 | Index m_rank, m_cols; 62 | const MatrixType& m_originalMatrix; 63 | }; 64 | 65 | } // end namespace internal 66 | 67 | #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \ 68 | typedef typename DecompositionType::MatrixType MatrixType; \ 69 | typedef typename MatrixType::Scalar Scalar; \ 70 | typedef typename MatrixType::RealScalar RealScalar; \ 71 | typedef Eigen::internal::image_retval_base Base; \ 72 | using Base::dec; \ 73 | using Base::originalMatrix; \ 74 | using Base::rank; \ 75 | using Base::rows; \ 76 | using Base::cols; \ 77 | image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \ 78 | : Base(dec, originalMatrix) {} 79 | 80 | } // end namespace Eigen 81 | 82 | #endif // EIGEN_MISC_IMAGE_H 83 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/QR/HouseholderQR_LAPACKE.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Intel Corporation. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of Intel Corporation nor the names of its contributors may 13 | be used to endorse or promote products derived from this software without 14 | specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | ******************************************************************************** 28 | * Content : Eigen bindings to LAPACKe 29 | * Householder QR decomposition of a matrix w/o pivoting based on 30 | * LAPACKE_?geqrf function. 31 | ******************************************************************************** 32 | */ 33 | 34 | #ifndef EIGEN_QR_LAPACKE_H 35 | #define EIGEN_QR_LAPACKE_H 36 | 37 | namespace Eigen { 38 | 39 | namespace internal { 40 | 41 | /** \internal Specialization for the data types supported by LAPACKe */ 42 | 43 | #define EIGEN_LAPACKE_QR_NOPIV(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX) \ 44 | template \ 45 | struct householder_qr_inplace_blocked \ 46 | { \ 47 | static void run(MatrixQR& mat, HCoeffs& hCoeffs, Index = 32, \ 48 | typename MatrixQR::Scalar* = 0) \ 49 | { \ 50 | lapack_int m = (lapack_int) mat.rows(); \ 51 | lapack_int n = (lapack_int) mat.cols(); \ 52 | lapack_int lda = (lapack_int) mat.outerStride(); \ 53 | lapack_int matrix_order = (MatrixQR::IsRowMajor) ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ 54 | LAPACKE_##LAPACKE_PREFIX##geqrf( matrix_order, m, n, (LAPACKE_TYPE*)mat.data(), lda, (LAPACKE_TYPE*)hCoeffs.data()); \ 55 | hCoeffs.adjointInPlace(); \ 56 | } \ 57 | }; 58 | 59 | EIGEN_LAPACKE_QR_NOPIV(double, double, d) 60 | EIGEN_LAPACKE_QR_NOPIV(float, float, s) 61 | EIGEN_LAPACKE_QR_NOPIV(dcomplex, lapack_complex_double, z) 62 | EIGEN_LAPACKE_QR_NOPIV(scomplex, lapack_complex_float, c) 63 | 64 | } // end namespace internal 65 | 66 | } // end namespace Eigen 67 | 68 | #endif // EIGEN_QR_LAPACKE_H 69 | -------------------------------------------------------------------------------- /pointnet2_ops_lib/pointnet2_ops/_ext-src/src/sampling.cpp: -------------------------------------------------------------------------------- 1 | #include "sampling.h" 2 | #include "utils.h" 3 | 4 | void gather_points_kernel_wrapper(int b, int c, int n, int npoints, 5 | const float *points, const int *idx, 6 | float *out); 7 | void gather_points_grad_kernel_wrapper(int b, int c, int n, int npoints, 8 | const float *grad_out, const int *idx, 9 | float *grad_points); 10 | 11 | void furthest_point_sampling_kernel_wrapper(int b, int n, int m, 12 | const float *dataset, float *temp, 13 | int *idxs); 14 | 15 | at::Tensor gather_points(at::Tensor points, at::Tensor idx) { 16 | CHECK_CONTIGUOUS(points); 17 | CHECK_CONTIGUOUS(idx); 18 | CHECK_IS_FLOAT(points); 19 | CHECK_IS_INT(idx); 20 | 21 | if (points.is_cuda()) { 22 | CHECK_CUDA(idx); 23 | } 24 | 25 | at::Tensor output = 26 | torch::zeros({points.size(0), points.size(1), idx.size(1)}, 27 | at::device(points.device()).dtype(at::ScalarType::Float)); 28 | 29 | if (points.is_cuda()) { 30 | gather_points_kernel_wrapper(points.size(0), points.size(1), points.size(2), 31 | idx.size(1), points.data_ptr(), 32 | idx.data_ptr(), output.data_ptr()); 33 | } else { 34 | AT_ASSERT(false, "CPU not supported"); 35 | } 36 | 37 | return output; 38 | } 39 | 40 | at::Tensor gather_points_grad(at::Tensor grad_out, at::Tensor idx, 41 | const int n) { 42 | CHECK_CONTIGUOUS(grad_out); 43 | CHECK_CONTIGUOUS(idx); 44 | CHECK_IS_FLOAT(grad_out); 45 | CHECK_IS_INT(idx); 46 | 47 | if (grad_out.is_cuda()) { 48 | CHECK_CUDA(idx); 49 | } 50 | 51 | at::Tensor output = 52 | torch::zeros({grad_out.size(0), grad_out.size(1), n}, 53 | at::device(grad_out.device()).dtype(at::ScalarType::Float)); 54 | 55 | if (grad_out.is_cuda()) { 56 | gather_points_grad_kernel_wrapper(grad_out.size(0), grad_out.size(1), n, 57 | idx.size(1), grad_out.data_ptr(), 58 | idx.data_ptr(), 59 | output.data_ptr()); 60 | } else { 61 | AT_ASSERT(false, "CPU not supported"); 62 | } 63 | 64 | return output; 65 | } 66 | at::Tensor furthest_point_sampling(at::Tensor points, const int nsamples) { 67 | CHECK_CONTIGUOUS(points); 68 | CHECK_IS_FLOAT(points); 69 | 70 | at::Tensor output = 71 | torch::zeros({points.size(0), nsamples}, 72 | at::device(points.device()).dtype(at::ScalarType::Int)); 73 | 74 | at::Tensor tmp = 75 | torch::full({points.size(0), points.size(1)}, 1e10, 76 | at::device(points.device()).dtype(at::ScalarType::Float)); 77 | 78 | if (points.is_cuda()) { 79 | furthest_point_sampling_kernel_wrapper( 80 | points.size(0), points.size(1), nsamples, points.data_ptr(), 81 | tmp.data_ptr(), output.data_ptr()); 82 | } else { 83 | AT_ASSERT(false, "CPU not supported"); 84 | } 85 | 86 | return output; 87 | } 88 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | // This file is included into the body of the base classes supporting matrix specific coefficient-wise functions. 12 | // This include MatrixBase and SparseMatrixBase. 13 | 14 | 15 | typedef CwiseUnaryOp, const Derived> CwiseAbsReturnType; 16 | typedef CwiseUnaryOp, const Derived> CwiseAbs2ReturnType; 17 | typedef CwiseUnaryOp, const Derived> CwiseSqrtReturnType; 18 | typedef CwiseUnaryOp, const Derived> CwiseSignReturnType; 19 | typedef CwiseUnaryOp, const Derived> CwiseInverseReturnType; 20 | 21 | /// \returns an expression of the coefficient-wise absolute value of \c *this 22 | /// 23 | /// Example: \include MatrixBase_cwiseAbs.cpp 24 | /// Output: \verbinclude MatrixBase_cwiseAbs.out 25 | /// 26 | EIGEN_DOC_UNARY_ADDONS(cwiseAbs,absolute value) 27 | /// 28 | /// \sa cwiseAbs2() 29 | /// 30 | EIGEN_DEVICE_FUNC 31 | EIGEN_STRONG_INLINE const CwiseAbsReturnType 32 | cwiseAbs() const { return CwiseAbsReturnType(derived()); } 33 | 34 | /// \returns an expression of the coefficient-wise squared absolute value of \c *this 35 | /// 36 | /// Example: \include MatrixBase_cwiseAbs2.cpp 37 | /// Output: \verbinclude MatrixBase_cwiseAbs2.out 38 | /// 39 | EIGEN_DOC_UNARY_ADDONS(cwiseAbs2,squared absolute value) 40 | /// 41 | /// \sa cwiseAbs() 42 | /// 43 | EIGEN_DEVICE_FUNC 44 | EIGEN_STRONG_INLINE const CwiseAbs2ReturnType 45 | cwiseAbs2() const { return CwiseAbs2ReturnType(derived()); } 46 | 47 | /// \returns an expression of the coefficient-wise square root of *this. 48 | /// 49 | /// Example: \include MatrixBase_cwiseSqrt.cpp 50 | /// Output: \verbinclude MatrixBase_cwiseSqrt.out 51 | /// 52 | EIGEN_DOC_UNARY_ADDONS(cwiseSqrt,square-root) 53 | /// 54 | /// \sa cwisePow(), cwiseSquare() 55 | /// 56 | EIGEN_DEVICE_FUNC 57 | inline const CwiseSqrtReturnType 58 | cwiseSqrt() const { return CwiseSqrtReturnType(derived()); } 59 | 60 | /// \returns an expression of the coefficient-wise signum of *this. 61 | /// 62 | /// Example: \include MatrixBase_cwiseSign.cpp 63 | /// Output: \verbinclude MatrixBase_cwiseSign.out 64 | /// 65 | EIGEN_DOC_UNARY_ADDONS(cwiseSign,sign function) 66 | /// 67 | EIGEN_DEVICE_FUNC 68 | inline const CwiseSignReturnType 69 | cwiseSign() const { return CwiseSignReturnType(derived()); } 70 | 71 | 72 | /// \returns an expression of the coefficient-wise inverse of *this. 73 | /// 74 | /// Example: \include MatrixBase_cwiseInverse.cpp 75 | /// Output: \verbinclude MatrixBase_cwiseInverse.out 76 | /// 77 | EIGEN_DOC_UNARY_ADDONS(cwiseInverse,inverse) 78 | /// 79 | /// \sa cwiseProduct() 80 | /// 81 | EIGEN_DEVICE_FUNC 82 | inline const CwiseInverseReturnType 83 | cwiseInverse() const { return CwiseInverseReturnType(derived()); } 84 | 85 | 86 | -------------------------------------------------------------------------------- /preprocess/others/process_mesh_local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2020 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -e 17 | 18 | mesh_in=$1 19 | outdir=$2 20 | external_root=$3 21 | 22 | make_watertight=false 23 | 24 | gaps=${external_root}/gaps/bin/x86_64/ 25 | 26 | # On macos osmesa is not used, on linux it is: 27 | if [[ $(uname -s) == Darwin* ]] 28 | then 29 | mesa="" 30 | else 31 | mesa="-mesa" 32 | fi 33 | 34 | mkdir -p $outdir || true 35 | 36 | mesh_orig=${outdir}/mesh_orig.${mesh_in##*.} 37 | cp $mesh_in $mesh_orig 38 | 39 | # Step -1) Compute watertight mesh. 40 | if [ "$make_watertight" = true ] ; then 41 | mesh_watertight=${outdir}/model_watertight.ply 42 | tmp_grid="${outdir}/tmp.grd" 43 | 44 | # ${gaps}/msh2df $mesh_orig $tmp_grid -output_mesh $mesh_watertight \ 45 | # -estimate_sign -spacing 0.005 -v 46 | 47 | ${gaps}/msh2df $mesh_orig $tmp_grid -output_mesh $mesh_watertight \ 48 | -estimate_sign -spacing 0.005 -v -estimate_sign_using_normals 49 | 50 | rm $tmp_grid 51 | 52 | else 53 | mesh_watertight=$mesh_orig 54 | fi 55 | 56 | # Step 0) Normalize the mesh before applying all other operations. 57 | mesh=${outdir}/model_normalized.obj 58 | 59 | # ${gaps}/msh2msh $mesh_watertight $mesh -scale_by_pca -translate_by_centroid \ 60 | # -scale 0\.25 -debug_matrix ${outdir}/orig_to_gaps.txt 61 | 62 | ${gaps}/msh2msh $mesh_watertight $mesh -scale_by_pca -translate_by_centroid \ 63 | -scale 0\.35 -debug_matrix ${outdir}/orig_to_gaps.txt 64 | 65 | # 66 | # we skip the sdf and surface point sampling of single frame, as we focus on temporal deformation 67 | # and the shape is given as the input, we don't need to predict the shape 68 | # 69 | # # Step 1) Generate the coarse inside/outside grid: 70 | # ${gaps}/msh2df $mesh ${outdir}/coarse_grid.grd -bbox -0\.7 -0\.7 -0\.7 0\.7 \ 71 | # 0\.7 0\.7 -border 0 -spacing 0\.022 -estimate_sign -v 72 | 73 | # # Step 2) Generate the near surface points: 74 | # ${gaps}/msh2pts $mesh ${outdir}/nss_points.sdf -near_surface -max_distance \ 75 | # 0\.04 -num_points 100000 -v # -curvature_exponent 0 76 | 77 | # # Step 3) Generate the uniform points: 78 | # ${gaps}/msh2pts $mesh ${outdir}/uniform_points.sdf -uniform_in_bbox -bbox \ 79 | # -0\.7 -0\.7 -0\.7 0\.7 0\.7 0\.7 -npoints 100000 80 | 81 | # # Step 4) Generate the random surface points: 82 | # ${gaps}/msh2pts $mesh ${outdir}/surface_points.pts -random_surface_points -num_points 100000 83 | 84 | 85 | # The original mesh is no longer needed on disk; we have the transformation, 86 | # so if we need it we can load the normalized mesh and transform it to the oringinal frame. 87 | # rm $mesh_orig 88 | 89 | # The normalized mesh is no longer needed on disk; we have the transformation, 90 | # so if we need it we can load the original mesh and transform it to the 91 | # normalized frame. 92 | #rm $mesh -------------------------------------------------------------------------------- /model/utils.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import torch.nn as nn 3 | import torch.nn.functional as functional 4 | import torch.nn.functional as F 5 | import numpy as np 6 | import math 7 | 8 | def compute_l2_error(points_pred, points_gt): 9 | # l2-distance error 10 | loss = torch.mean(torch.sub(points_pred, points_gt).pow(2).sum(dim=2)/2.0) 11 | return loss.sum(-1).mean() 12 | 13 | def fibonacci_sphere(samples=1): 14 | ''' 15 | Code from https://stackoverflow.com/questions/9600801/evenly-distributing-n-points-on-a-sphere 16 | Args: 17 | samples: number of samples 18 | 19 | Returns: 20 | Points evenly distributed on the unit sphere 21 | ''' 22 | points = [] 23 | phi = math.pi * (3. - math.sqrt(5.)) # golden angle in radians 24 | 25 | for i in range(samples): 26 | y = 1 - (i / float(samples - 1)) * 2 # y goes from 1 to -1 27 | radius = math.sqrt(1 - y * y) # radius at y 28 | 29 | theta = phi * i # golden angle increment 30 | 31 | x = math.cos(theta) * radius 32 | z = math.sin(theta) * radius 33 | 34 | points.append(np.array([x, y, z])) 35 | 36 | return np.stack(points, axis=0) 37 | 38 | 39 | def square_distance(src, dst): 40 | """ 41 | Code from: https://github.com/qq456cvb/Point-Transformers/blob/master/pointnet_util.py 42 | 43 | Calculate Euclid distance between each two points. 44 | src^T * dst = xn * xm + yn * ym + zn * zm; 45 | sum(src^2, dim=-1) = xn*xn + yn*yn + zn*zn; 46 | sum(dst^2, dim=-1) = xm*xm + ym*ym + zm*zm; 47 | dist = (xn - xm)^2 + (yn - ym)^2 + (zn - zm)^2 48 | = sum(src**2,dim=-1)+sum(dst**2,dim=-1)-2*src^T*dst 49 | Input: 50 | src: source points, [B, N, C] 51 | dst: target points, [B, M, C] 52 | Output: 53 | dist: per-point square distance, [B, N, M] 54 | """ 55 | return torch.sum((src[:, :, None] - dst[:, None]) ** 2, dim=-1) 56 | 57 | 58 | def index_points(points, idx): 59 | """ 60 | Code from: https://github.com/qq456cvb/Point-Transformers/blob/master/pointnet_util.py 61 | Input: 62 | points: input points data, [B, N, C] 63 | idx: sample index data, [B, S, [K]] 64 | Return: 65 | new_points:, indexed points data, [B, S, [K], C] 66 | """ 67 | raw_size = idx.size() 68 | idx = idx.reshape(raw_size[0], -1) 69 | res = torch.gather(points, 1, idx[..., None].expand(-1, -1, points.size(-1))) 70 | return res.reshape(*raw_size, -1) 71 | 72 | 73 | def farthest_point_sample(xyz, npoint): 74 | """ 75 | Input: 76 | xyz: pointcloud data, [B, N, 3] 77 | npoint: number of samples 78 | Return: 79 | centroids: sampled pointcloud index, [B, npoint] 80 | """ 81 | device = xyz.device 82 | B, N, C = xyz.shape 83 | centroids = torch.zeros(B, npoint, dtype=torch.long).to(device) 84 | distance = torch.ones(B, N).to(device) * 1e10 85 | farthest = torch.randint(0, N, (B,), dtype=torch.long).to(device) 86 | batch_indices = torch.arange(B, dtype=torch.long).to(device) 87 | for i in range(npoint): 88 | centroids[:, i] = farthest 89 | centroid = xyz[batch_indices, farthest, :].view(B, 1, 3) 90 | dist = torch.sum((xyz - centroid) ** 2, -1) 91 | mask = dist < distance 92 | distance[mask] = dist[mask] 93 | farthest = torch.max(distance, -1)[1] 94 | return centroids -------------------------------------------------------------------------------- /external/PyMarchingCubes/test_smoothing.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | import pytest 4 | 5 | import numpy as np 6 | 7 | import marching_cubes as mcubes 8 | 9 | 10 | def test_sphere(): 11 | 12 | # Create sphere with radius 25 centered at (50, 50, 50) 13 | x, y, z = np.mgrid[:100, :100, :100] 14 | levelset = np.sqrt((x - 50)**2 + (y - 50)**2 + (z - 50)**2) - 25 15 | 16 | # vertices, triangles = mcubes.marching_cubes(levelset, 0) 17 | # mcubes.export_obj(vertices, triangles, 'sphere1.obj') 18 | 19 | binary_levelset = levelset > 0 20 | smoothed_levelset = mcubes.smooth( 21 | binary_levelset, 22 | method='constrained', 23 | max_iters=500, 24 | rel_tol=1e-4 25 | ) 26 | 27 | vertices, _ = mcubes.marching_cubes(smoothed_levelset, 0.0) 28 | 29 | # Check all vertices have same distance to (50, 50, 50) 30 | dist = np.sqrt(np.sum((vertices - [50, 50, 50])**2, axis=1)) 31 | 32 | assert dist.min() > 24.5 and dist.max() < 25.5 33 | assert np.all(np.abs(smoothed_levelset - levelset) < 1) 34 | assert np.all((smoothed_levelset > 0) == binary_levelset) 35 | 36 | 37 | def test_gaussian_smoothing(): 38 | 39 | # Create sphere with radius 25 centered at (50, 50, 50) 40 | x, y, z = np.mgrid[:100, :100, :100] 41 | levelset = np.sqrt((x - 50)**2 + (y - 50)**2 + (z - 50)**2) - 25 42 | 43 | binary_levelset = levelset > 0 44 | smoothed_levelset = mcubes.smooth( 45 | binary_levelset, 46 | method='gaussian', 47 | sigma=3 48 | ) 49 | 50 | vertices, _ = mcubes.marching_cubes(smoothed_levelset, 0.0) 51 | 52 | # Check all vertices have same distance to (50, 50, 50) 53 | dist = np.sqrt(np.sum((vertices - [50, 50, 50])**2, axis=1)) 54 | assert dist.min() > 24 and dist.max() < 25 55 | 56 | 57 | def test_wrong_ndim(): 58 | 59 | binary_levelset = np.random.uniform(size=(10)) < 0.5 60 | 61 | with pytest.raises(ValueError): 62 | mcubes.smooth( 63 | binary_levelset, 64 | method='constrained', 65 | max_iters=500, 66 | rel_tol=1e-4 67 | ) 68 | 69 | binary_levelset = np.random.uniform(size=(10, 10, 10, 10)) < 0.5 70 | 71 | with pytest.raises(ValueError): 72 | mcubes.smooth( 73 | binary_levelset, 74 | method='constrained', 75 | max_iters=500, 76 | rel_tol=1e-4 77 | ) 78 | 79 | 80 | def test_wrong_method(): 81 | 82 | with pytest.raises(ValueError): 83 | mcubes.smooth( 84 | np.zeros((10, 10), dtype=np.bool_), 85 | method='wrong', 86 | max_iters=500, 87 | rel_tol=1e-4 88 | ) 89 | 90 | 91 | def test_circle(): 92 | 93 | x, y = np.mgrid[:100, :100] 94 | levelset = np.sqrt((x - 50)**2 + (y - 50)**2) - 25 95 | binary_levelset = levelset > 0 96 | 97 | smoothed_levelset = mcubes.smooth( 98 | binary_levelset, 99 | max_iters=500, 100 | rel_tol=1e-4 101 | ) 102 | 103 | assert np.all(np.abs(smoothed_levelset - levelset) < 1) 104 | assert np.all((smoothed_levelset > 0) == binary_levelset) 105 | 106 | 107 | # if __name__ == '__main__': 108 | # # logging.basicConfig(level=logging.DEBUG) 109 | # test_circle() 110 | # test_sphere() 111 | # test_large_sphere() 112 | -------------------------------------------------------------------------------- /external/PyMarchingCubes/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.dae 3 | _mcubes.cpp 4 | *.py[cod] 5 | .vscode 6 | .mypy_cache 7 | 8 | .vscode 9 | 10 | # Created by https://www.gitignore.io/api/osx,linux,python 11 | # Edit at https://www.gitignore.io/?templates=osx,linux,python 12 | 13 | ### Linux ### 14 | *~ 15 | 16 | # temporary files which can be created if a process still has a handle open of a deleted file 17 | .fuse_hidden* 18 | 19 | # KDE directory preferences 20 | .directory 21 | 22 | # Linux trash folder which might appear on any partition or disk 23 | .Trash-* 24 | 25 | # .nfs files are created when an open file is removed but is still being accessed 26 | .nfs* 27 | 28 | ### OSX ### 29 | # General 30 | .DS_Store 31 | .AppleDouble 32 | .LSOverride 33 | 34 | # Icon must end with two \r 35 | Icon 36 | 37 | # Thumbnails 38 | ._* 39 | 40 | # Files that might appear in the root of a volume 41 | .DocumentRevisions-V100 42 | .fseventsd 43 | .Spotlight-V100 44 | .TemporaryItems 45 | .Trashes 46 | .VolumeIcon.icns 47 | .com.apple.timemachine.donotpresent 48 | 49 | # Directories potentially created on remote AFP share 50 | .AppleDB 51 | .AppleDesktop 52 | Network Trash Folder 53 | Temporary Items 54 | .apdisk 55 | 56 | ### Python ### 57 | # Byte-compiled / optimized / DLL files 58 | __pycache__/ 59 | *.py[cod] 60 | *$py.class 61 | 62 | # C extensions 63 | *.so 64 | 65 | # Distribution / packaging 66 | .Python 67 | build/ 68 | develop-eggs/ 69 | dist/ 70 | downloads/ 71 | eggs/ 72 | .eggs/ 73 | lib/ 74 | lib64/ 75 | parts/ 76 | sdist/ 77 | var/ 78 | wheels/ 79 | pip-wheel-metadata/ 80 | share/python-wheels/ 81 | *.egg-info/ 82 | .installed.cfg 83 | *.egg 84 | MANIFEST 85 | 86 | # PyInstaller 87 | # Usually these files are written by a python script from a template 88 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 89 | *.manifest 90 | *.spec 91 | 92 | # Installer logs 93 | pip-log.txt 94 | pip-delete-this-directory.txt 95 | 96 | # Unit test / coverage reports 97 | htmlcov/ 98 | .tox/ 99 | .nox/ 100 | .coverage 101 | .coverage.* 102 | .cache 103 | nosetests.xml 104 | coverage.xml 105 | *.cover 106 | .hypothesis/ 107 | .pytest_cache/ 108 | 109 | # Translations 110 | *.mo 111 | *.pot 112 | 113 | # Scrapy stuff: 114 | .scrapy 115 | 116 | # Sphinx documentation 117 | docs/_build/ 118 | 119 | # PyBuilder 120 | target/ 121 | 122 | # pyenv 123 | .python-version 124 | 125 | # pipenv 126 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 127 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 128 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 129 | # install all needed dependencies. 130 | #Pipfile.lock 131 | 132 | # celery beat schedule file 133 | celerybeat-schedule 134 | 135 | # SageMath parsed files 136 | *.sage.py 137 | 138 | # Spyder project settings 139 | .spyderproject 140 | .spyproject 141 | 142 | # Rope project settings 143 | .ropeproject 144 | 145 | # Mr Developer 146 | .mr.developer.cfg 147 | .project 148 | .pydevproject 149 | 150 | # mkdocs documentation 151 | /site 152 | 153 | # mypy 154 | .mypy_cache/ 155 | .dmypy.json 156 | dmypy.json 157 | 158 | # Pyre type checker 159 | .pyre/ 160 | 161 | # End of https://www.gitignore.io/api/osx,linux,python 162 | -------------------------------------------------------------------------------- /data/splits/deform4d/test.lst: -------------------------------------------------------------------------------- 1 | tigerD8H_Walk0 2 | deerFEL_TrotleftRM 3 | foxYSY_SwimBackrightRM 4 | elkML_Actions2 5 | deerSPL_DeathOpp2 6 | procySTEM_Idle9 7 | moose1DOG_Idle1 8 | deerSPL_Idle5 9 | raccoonVGG_Sneak0 10 | deerOMG_FlyRM 11 | doggieMN5_Agression 12 | moose6OK9_WalkbackRM 13 | bear84Q_FlyIP 14 | procySTEM_Attacks1 15 | canieLTT_FallEdgeForward1 16 | moose45D_JumpRunRM 17 | bear84Q_Death1 18 | bucksYJL_Sleep5 19 | moose6OK9_WalkbackLRM 20 | bucksYJL_Swim9 21 | moose45D_hiderotLeft 22 | grizzRSS_Walk2 23 | procySTEM_SleepLieSeat2 24 | grizzRSS_Fall3 25 | foxWDFS_Sleep3 26 | elkML_Death1 27 | procySTEM_Climb5 28 | foxWDFS_Attacks1 29 | deerFEL_eat1 30 | foxWDFS_Swim11 31 | deerA4K_hide 32 | bearPDD_Hide 33 | doggieMN5_TrotleftRM 34 | procySTEM_Swim12 35 | bear84Q_AttackrunRM 36 | foxYSY_walkbackRM 37 | doggieMN5_walkrightRM 38 | foxWDFS_Damaged4 39 | bearPDD_Death2 40 | canieLTT_Attacks1 41 | bear9AK_Hitback 42 | procySTEM_Actions0 43 | bear84Q_Landing 44 | procySTEM_GetHitRight2 45 | bear84Q_TrotleftRM 46 | deerFEL_SwimIdle 47 | foxYSY_runrightRM 48 | foxYSY_runstopRM 49 | pumaRW_Swim13 50 | bucksYJL_Attack4 51 | procySTEM_Idle4 52 | raccoonVGG_Fall2 53 | deerLO1_FlyRM 54 | pumaRW_Trot0 55 | foxXAT_TrotleftRM 56 | bear3EP_attack1 57 | huskydog3T_Actions3 58 | doggieMN5_Attack2 59 | grizzRSS_Idle4 60 | bearPDD_attackwalkRM 61 | deerA4K_WalkforwardRM 62 | pumaRW_Walk0 63 | bear3EP_TrotrightRM 64 | bucksYJL_Sleep1 65 | moose1DOG_JumpFlyIP 66 | sheepYZR10_idle13 67 | foxYSY_HiderotL 68 | moose1DOG_WalkbackRM 69 | deerLO1_WalkbackRRM 70 | lionessHTR42_action1 71 | bear9AK_Idle2 72 | bearPDD_Hithate 73 | canieLTT_Sleep5 74 | raccoonVGG_DeathOpp1 75 | foxYSY_AttacktrotRM 76 | pumaRW_Turn1 77 | foxWDFS_Walk2 78 | deerOMG_hitback 79 | moose6OK9_JumpTrotRM 80 | bear9AK_CrouchbaclRRM 81 | deerFEL_TrotrightRM 82 | raccoonVGG_GetHitLeft0 83 | bearPDD_Death1 84 | deerK5L_RotateRightRM 85 | bear9AK_Death2 86 | procySTEM_SleepLieSeat4 87 | bear3EP_WalkbackLRM 88 | deerFEL_Idle3 89 | canieLTT_Sleep1 90 | bear3EP_AttacktrotRM 91 | raccoonVGG_Attacks2 92 | bear3EP_FlyRM 93 | canieLTT_Actions1 94 | foxWDFS_Idles3 95 | elkML_Walk4 96 | huskydog3T_Idles5 97 | bearVGG_DeathOpp1 98 | foxYSY_walkleftRM 99 | bear3EP_CrouchbaclRRM 100 | deerOMG_WalkbackRRM 101 | moose45D_hide 102 | elkML_Walk2 103 | deerLO1_WalkRightRM 104 | bear84Q_Idle3 105 | raccoonVGG_Dodge10 106 | bucksYJL_Trot2 107 | moose1DOG_Idle2 108 | bear3EP_HideRotR 109 | moose1DOG_RotateL90RM 110 | moose6OK9_SwimleftRM 111 | foxYSY_AttackrunRM 112 | procySTEM_Attacks3 113 | deerA4K_Idle1 114 | bear3EP_Drink 115 | deerK5L_Jump 116 | bear3EP_SwimIdleRM 117 | foxZED_walkleftRM 118 | deerK5L_RotateRight90RM 119 | deerFEL_death1 120 | bearPDD_Hitrotate45RRM 121 | bear84Q_SwimforwardRM 122 | doggieMN5_Attack1 123 | grizzRSS_Trot2 124 | canieLTT_Sleep6 125 | bear9AK_RunleftRM 126 | deerA4K_Attack1 127 | procySTEM_Walk12 128 | raccoonVGG_Swim16 129 | hippoDG_bite 130 | foxZED_TrotrightRM 131 | deerOMG_RotateRightRM 132 | tigerD8H_Swim17 133 | deerOMG_Attack3 134 | foxWDFS_Walk1 135 | raccoonVGG_Dodge4 136 | deer2MB_RotateRightRM 137 | pumaRW_Turn3 138 | doggieMN5_runleftRM 139 | deerK5L_SwimforwardRM 140 | bear9AK_SwimRotLRM 141 | bear9AK_FlyRM 142 | tigerD8H_Sleep7 143 | bear3EP_HideRotL 144 | elkML_Trot0 145 | deer2MB_death1 146 | bear9AK_SwimIdleRM 147 | moose45D_SwimleftRM 148 | bearPDD_JumprunRM 149 | tigerD8H_WalkBack1 -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/SparseCore/SparseDot.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_DOT_H 11 | #define EIGEN_SPARSE_DOT_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | template 17 | typename internal::traits::Scalar 18 | SparseMatrixBase::dot(const MatrixBase& other) const 19 | { 20 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 21 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 22 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 23 | EIGEN_STATIC_ASSERT((internal::is_same::value), 24 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 25 | 26 | eigen_assert(size() == other.size()); 27 | eigen_assert(other.size()>0 && "you are using a non initialized vector"); 28 | 29 | internal::evaluator thisEval(derived()); 30 | typename internal::evaluator::InnerIterator i(thisEval, 0); 31 | Scalar res(0); 32 | while (i) 33 | { 34 | res += numext::conj(i.value()) * other.coeff(i.index()); 35 | ++i; 36 | } 37 | return res; 38 | } 39 | 40 | template 41 | template 42 | typename internal::traits::Scalar 43 | SparseMatrixBase::dot(const SparseMatrixBase& other) const 44 | { 45 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 46 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 47 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 48 | EIGEN_STATIC_ASSERT((internal::is_same::value), 49 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 50 | 51 | eigen_assert(size() == other.size()); 52 | 53 | internal::evaluator thisEval(derived()); 54 | typename internal::evaluator::InnerIterator i(thisEval, 0); 55 | 56 | internal::evaluator otherEval(other.derived()); 57 | typename internal::evaluator::InnerIterator j(otherEval, 0); 58 | 59 | Scalar res(0); 60 | while (i && j) 61 | { 62 | if (i.index()==j.index()) 63 | { 64 | res += numext::conj(i.value()) * j.value(); 65 | ++i; ++j; 66 | } 67 | else if (i.index() 76 | inline typename NumTraits::Scalar>::Real 77 | SparseMatrixBase::squaredNorm() const 78 | { 79 | return numext::real((*this).cwiseAbs2().sum()); 80 | } 81 | 82 | template 83 | inline typename NumTraits::Scalar>::Real 84 | SparseMatrixBase::norm() const 85 | { 86 | using std::sqrt; 87 | return sqrt(squaredNorm()); 88 | } 89 | 90 | template 91 | inline typename NumTraits::Scalar>::Real 92 | SparseMatrixBase::blueNorm() const 93 | { 94 | return internal::blueNorm_impl(*this); 95 | } 96 | } // end namespace Eigen 97 | 98 | #endif // EIGEN_SPARSE_DOT_H 99 | -------------------------------------------------------------------------------- /external/eigen3/Eigen/src/SparseCore/SparseTranspose.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2015 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSETRANSPOSE_H 11 | #define EIGEN_SPARSETRANSPOSE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | template 17 | class SparseTransposeImpl 18 | : public SparseMatrixBase > 19 | {}; 20 | 21 | template 22 | class SparseTransposeImpl 23 | : public SparseCompressedBase > 24 | { 25 | typedef SparseCompressedBase > Base; 26 | public: 27 | using Base::derived; 28 | typedef typename Base::Scalar Scalar; 29 | typedef typename Base::StorageIndex StorageIndex; 30 | 31 | inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); } 32 | 33 | inline const Scalar* valuePtr() const { return derived().nestedExpression().valuePtr(); } 34 | inline const StorageIndex* innerIndexPtr() const { return derived().nestedExpression().innerIndexPtr(); } 35 | inline const StorageIndex* outerIndexPtr() const { return derived().nestedExpression().outerIndexPtr(); } 36 | inline const StorageIndex* innerNonZeroPtr() const { return derived().nestedExpression().innerNonZeroPtr(); } 37 | 38 | inline Scalar* valuePtr() { return derived().nestedExpression().valuePtr(); } 39 | inline StorageIndex* innerIndexPtr() { return derived().nestedExpression().innerIndexPtr(); } 40 | inline StorageIndex* outerIndexPtr() { return derived().nestedExpression().outerIndexPtr(); } 41 | inline StorageIndex* innerNonZeroPtr() { return derived().nestedExpression().innerNonZeroPtr(); } 42 | }; 43 | } 44 | 45 | template class TransposeImpl 46 | : public internal::SparseTransposeImpl 47 | { 48 | protected: 49 | typedef internal::SparseTransposeImpl Base; 50 | }; 51 | 52 | namespace internal { 53 | 54 | template 55 | struct unary_evaluator, IteratorBased> 56 | : public evaluator_base > 57 | { 58 | typedef typename evaluator::InnerIterator EvalIterator; 59 | public: 60 | typedef Transpose XprType; 61 | 62 | inline Index nonZerosEstimate() const { 63 | return m_argImpl.nonZerosEstimate(); 64 | } 65 | 66 | class InnerIterator : public EvalIterator 67 | { 68 | public: 69 | EIGEN_STRONG_INLINE InnerIterator(const unary_evaluator& unaryOp, Index outer) 70 | : EvalIterator(unaryOp.m_argImpl,outer) 71 | {} 72 | 73 | Index row() const { return EvalIterator::col(); } 74 | Index col() const { return EvalIterator::row(); } 75 | }; 76 | 77 | enum { 78 | CoeffReadCost = evaluator::CoeffReadCost, 79 | Flags = XprType::Flags 80 | }; 81 | 82 | explicit unary_evaluator(const XprType& op) :m_argImpl(op.nestedExpression()) {} 83 | 84 | protected: 85 | evaluator m_argImpl; 86 | }; 87 | 88 | } // end namespace internal 89 | 90 | } // end namespace Eigen 91 | 92 | #endif // EIGEN_SPARSETRANSPOSE_H 93 | --------------------------------------------------------------------------------