Repository: openxrlab/xrnerf
Branch: main
Commit: f8020561b91b
Files: 2000
Total size: 15.8 MB
Directory structure:
gitextract_oeikmd9e/
├── .github/
│ └── workflows/
│ ├── build.yml
│ └── lint.yml
├── .gitignore
├── .pre-commit-config.yaml
├── LICENSE
├── README.md
├── README_CN.md
├── configs/
│ ├── __init__.py
│ ├── _base_/
│ │ └── models/
│ │ └── nerf.py
│ ├── animatable_nerf/
│ │ ├── an_h36m_s11_novel_pose.py
│ │ ├── an_h36m_s11_train_pose.py
│ │ ├── an_h36m_s1_novel_pose.py
│ │ ├── an_h36m_s1_train_pose.py
│ │ ├── an_h36m_s5_novel_pose.py
│ │ ├── an_h36m_s5_train_pose.py
│ │ ├── an_h36m_s6_novel_pose.py
│ │ ├── an_h36m_s6_train_pose.py
│ │ ├── an_h36m_s7_novel_pose.py
│ │ ├── an_h36m_s7_train_pose.py
│ │ ├── an_h36m_s8_novel_pose.py
│ │ ├── an_h36m_s8_train_pose.py
│ │ ├── an_h36m_s9_novel_pose.py
│ │ ├── an_h36m_s9_render_train_pose.py
│ │ ├── an_h36m_s9_train_pose.py
│ │ ├── an_zjumocap_313_novel_pose.py
│ │ └── an_zjumocap_313_train_pose.py
│ ├── bungeenerf/
│ │ └── bungeenerf_multiscale_google.py
│ ├── gnr/
│ │ └── gnr_genebody.py
│ ├── instant_ngp/
│ │ └── nerf_blender_local01.py
│ ├── kilonerf/
│ │ ├── kilonerf_distill_BlendedMVS_base01.py
│ │ ├── kilonerf_distill_Synthetic_NeRF_base01.py
│ │ ├── kilonerf_finetune_BlendedMVS_base01.py
│ │ ├── kilonerf_finetune_Synthetic_NeRF_base01.py
│ │ ├── kilonerf_pretrain_BlendedMVS_base01.py
│ │ └── kilonerf_pretrain_Synthetic_NeRF_base01.py
│ ├── mipnerf/
│ │ ├── mipnerf_blender.py
│ │ └── mipnerf_multiscale.py
│ ├── nerf/
│ │ ├── nerf_blender_base01.py
│ │ └── nerf_llff_base01.py
│ └── neuralbody/
│ ├── nb_zjumocap_313.py
│ ├── nb_zjumocap_315.py
│ ├── nb_zjumocap_377.py
│ ├── nb_zjumocap_386.py
│ ├── nb_zjumocap_387.py
│ ├── nb_zjumocap_390.py
│ ├── nb_zjumocap_392.py
│ ├── nb_zjumocap_393.py
│ ├── nb_zjumocap_394.py
│ └── nb_zjumocap_render_313.py
├── docker/
│ ├── Dockerfile
│ ├── DockerfileCN
│ ├── daemon.json
│ └── sources.list
├── docs/
│ ├── en/
│ │ ├── CONTRIBUTING.md
│ │ ├── additional_licenses.md
│ │ ├── apis.md
│ │ ├── benchmark.md
│ │ ├── dataset_preparation.md
│ │ ├── faq.md
│ │ ├── get_started.md
│ │ ├── installation.md
│ │ └── tutorials/
│ │ ├── config.md
│ │ ├── data_pipeline.md
│ │ └── model.md
│ └── zh_cn/
│ ├── apis.md
│ ├── dataset_preparation.md
│ ├── get_started.md
│ ├── installation.md
│ └── tutorials/
│ ├── config.md
│ ├── data_pipeline.md
│ └── model.md
├── extensions/
│ ├── mesh_grid/
│ │ ├── README.md
│ │ ├── __init__.py
│ │ ├── matrix.h
│ │ ├── mesh_grid.cpp
│ │ ├── mesh_grid_kernel.cu
│ │ ├── mesh_grid_searcher.py
│ │ ├── render.cpp
│ │ ├── render.cu
│ │ ├── render.h
│ │ ├── setup.py
│ │ ├── surface_inside.cpp
│ │ └── test_mesh_grid.py
│ └── ngp_raymarch/
│ ├── README.md
│ ├── include/
│ │ ├── op_include/
│ │ │ ├── eigen/
│ │ │ │ ├── .gitignore
│ │ │ │ ├── .gitlab/
│ │ │ │ │ ├── issue_templates/
│ │ │ │ │ │ ├── Bug Report.md
│ │ │ │ │ │ └── Feature Request.md
│ │ │ │ │ └── merge_request_templates/
│ │ │ │ │ └── Merge Request Template.md
│ │ │ │ ├── .gitlab-ci.yml
│ │ │ │ ├── .hgeol
│ │ │ │ ├── COPYING.APACHE
│ │ │ │ ├── COPYING.BSD
│ │ │ │ ├── COPYING.GPL
│ │ │ │ ├── COPYING.LGPL
│ │ │ │ ├── COPYING.MINPACK
│ │ │ │ ├── COPYING.MPL2
│ │ │ │ ├── COPYING.README
│ │ │ │ ├── CTestConfig.cmake
│ │ │ │ ├── CTestCustom.cmake.in
│ │ │ │ ├── Eigen/
│ │ │ │ │ ├── Cholesky
│ │ │ │ │ ├── CholmodSupport
│ │ │ │ │ ├── Core
│ │ │ │ │ ├── Dense
│ │ │ │ │ ├── Eigen
│ │ │ │ │ ├── Eigenvalues
│ │ │ │ │ ├── Geometry
│ │ │ │ │ ├── Householder
│ │ │ │ │ ├── IterativeLinearSolvers
│ │ │ │ │ ├── Jacobi
│ │ │ │ │ ├── KLUSupport
│ │ │ │ │ ├── LU
│ │ │ │ │ ├── MetisSupport
│ │ │ │ │ ├── OrderingMethods
│ │ │ │ │ ├── PaStiXSupport
│ │ │ │ │ ├── PardisoSupport
│ │ │ │ │ ├── QR
│ │ │ │ │ ├── QtAlignedMalloc
│ │ │ │ │ ├── SPQRSupport
│ │ │ │ │ ├── SVD
│ │ │ │ │ ├── Sparse
│ │ │ │ │ ├── SparseCholesky
│ │ │ │ │ ├── SparseCore
│ │ │ │ │ ├── SparseLU
│ │ │ │ │ ├── SparseQR
│ │ │ │ │ ├── StdDeque
│ │ │ │ │ ├── StdList
│ │ │ │ │ ├── StdVector
│ │ │ │ │ ├── SuperLUSupport
│ │ │ │ │ ├── UmfPackSupport
│ │ │ │ │ └── src/
│ │ │ │ │ ├── Cholesky/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── LDLT.h
│ │ │ │ │ │ ├── LLT.h
│ │ │ │ │ │ └── LLT_LAPACKE.h
│ │ │ │ │ ├── CholmodSupport/
│ │ │ │ │ │ ├── CholmodSupport.h
│ │ │ │ │ │ └── InternalHeaderCheck.h
│ │ │ │ │ ├── Core/
│ │ │ │ │ │ ├── ArithmeticSequence.h
│ │ │ │ │ │ ├── Array.h
│ │ │ │ │ │ ├── ArrayBase.h
│ │ │ │ │ │ ├── ArrayWrapper.h
│ │ │ │ │ │ ├── Assign.h
│ │ │ │ │ │ ├── AssignEvaluator.h
│ │ │ │ │ │ ├── Assign_MKL.h
│ │ │ │ │ │ ├── BandMatrix.h
│ │ │ │ │ │ ├── Block.h
│ │ │ │ │ │ ├── BooleanRedux.h
│ │ │ │ │ │ ├── CommaInitializer.h
│ │ │ │ │ │ ├── ConditionEstimator.h
│ │ │ │ │ │ ├── CoreEvaluators.h
│ │ │ │ │ │ ├── CoreIterators.h
│ │ │ │ │ │ ├── CwiseBinaryOp.h
│ │ │ │ │ │ ├── CwiseNullaryOp.h
│ │ │ │ │ │ ├── CwiseTernaryOp.h
│ │ │ │ │ │ ├── CwiseUnaryOp.h
│ │ │ │ │ │ ├── CwiseUnaryView.h
│ │ │ │ │ │ ├── DenseBase.h
│ │ │ │ │ │ ├── DenseCoeffsBase.h
│ │ │ │ │ │ ├── DenseStorage.h
│ │ │ │ │ │ ├── Diagonal.h
│ │ │ │ │ │ ├── DiagonalMatrix.h
│ │ │ │ │ │ ├── DiagonalProduct.h
│ │ │ │ │ │ ├── Dot.h
│ │ │ │ │ │ ├── EigenBase.h
│ │ │ │ │ │ ├── ForceAlignedAccess.h
│ │ │ │ │ │ ├── Fuzzy.h
│ │ │ │ │ │ ├── GeneralProduct.h
│ │ │ │ │ │ ├── GenericPacketMath.h
│ │ │ │ │ │ ├── GlobalFunctions.h
│ │ │ │ │ │ ├── IO.h
│ │ │ │ │ │ ├── IndexedView.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── Inverse.h
│ │ │ │ │ │ ├── Map.h
│ │ │ │ │ │ ├── MapBase.h
│ │ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ │ ├── MathFunctionsImpl.h
│ │ │ │ │ │ ├── Matrix.h
│ │ │ │ │ │ ├── MatrixBase.h
│ │ │ │ │ │ ├── NestByValue.h
│ │ │ │ │ │ ├── NoAlias.h
│ │ │ │ │ │ ├── NumTraits.h
│ │ │ │ │ │ ├── PartialReduxEvaluator.h
│ │ │ │ │ │ ├── PermutationMatrix.h
│ │ │ │ │ │ ├── PlainObjectBase.h
│ │ │ │ │ │ ├── Product.h
│ │ │ │ │ │ ├── ProductEvaluators.h
│ │ │ │ │ │ ├── Random.h
│ │ │ │ │ │ ├── Redux.h
│ │ │ │ │ │ ├── Ref.h
│ │ │ │ │ │ ├── Replicate.h
│ │ │ │ │ │ ├── Reshaped.h
│ │ │ │ │ │ ├── ReturnByValue.h
│ │ │ │ │ │ ├── Reverse.h
│ │ │ │ │ │ ├── Select.h
│ │ │ │ │ │ ├── SelfAdjointView.h
│ │ │ │ │ │ ├── SelfCwiseBinaryOp.h
│ │ │ │ │ │ ├── Solve.h
│ │ │ │ │ │ ├── SolveTriangular.h
│ │ │ │ │ │ ├── SolverBase.h
│ │ │ │ │ │ ├── StableNorm.h
│ │ │ │ │ │ ├── StlIterators.h
│ │ │ │ │ │ ├── Stride.h
│ │ │ │ │ │ ├── Swap.h
│ │ │ │ │ │ ├── Transpose.h
│ │ │ │ │ │ ├── Transpositions.h
│ │ │ │ │ │ ├── TriangularMatrix.h
│ │ │ │ │ │ ├── VectorBlock.h
│ │ │ │ │ │ ├── VectorwiseOp.h
│ │ │ │ │ │ ├── Visitor.h
│ │ │ │ │ │ ├── arch/
│ │ │ │ │ │ │ ├── AVX/
│ │ │ │ │ │ │ │ ├── Complex.h
│ │ │ │ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ │ │ │ ├── PacketMath.h
│ │ │ │ │ │ │ │ └── TypeCasting.h
│ │ │ │ │ │ │ ├── AVX512/
│ │ │ │ │ │ │ │ ├── Complex.h
│ │ │ │ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ │ │ │ ├── PacketMath.h
│ │ │ │ │ │ │ │ └── TypeCasting.h
│ │ │ │ │ │ │ ├── AltiVec/
│ │ │ │ │ │ │ │ ├── Complex.h
│ │ │ │ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ │ │ │ ├── MatrixProduct.h
│ │ │ │ │ │ │ │ ├── MatrixProductCommon.h
│ │ │ │ │ │ │ │ ├── MatrixProductMMA.h
│ │ │ │ │ │ │ │ └── PacketMath.h
│ │ │ │ │ │ │ ├── Default/
│ │ │ │ │ │ │ │ ├── BFloat16.h
│ │ │ │ │ │ │ │ ├── ConjHelper.h
│ │ │ │ │ │ │ │ ├── GenericPacketMathFunctions.h
│ │ │ │ │ │ │ │ ├── GenericPacketMathFunctionsFwd.h
│ │ │ │ │ │ │ │ ├── Half.h
│ │ │ │ │ │ │ │ ├── Settings.h
│ │ │ │ │ │ │ │ └── TypeCasting.h
│ │ │ │ │ │ │ ├── GPU/
│ │ │ │ │ │ │ │ ├── Complex.h
│ │ │ │ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ │ │ │ ├── PacketMath.h
│ │ │ │ │ │ │ │ ├── Tuple.h
│ │ │ │ │ │ │ │ └── TypeCasting.h
│ │ │ │ │ │ │ ├── HIP/
│ │ │ │ │ │ │ │ └── hcc/
│ │ │ │ │ │ │ │ └── math_constants.h
│ │ │ │ │ │ │ ├── MSA/
│ │ │ │ │ │ │ │ ├── Complex.h
│ │ │ │ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ │ │ │ └── PacketMath.h
│ │ │ │ │ │ │ ├── NEON/
│ │ │ │ │ │ │ │ ├── Complex.h
│ │ │ │ │ │ │ │ ├── GeneralBlockPanelKernel.h
│ │ │ │ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ │ │ │ ├── PacketMath.h
│ │ │ │ │ │ │ │ ├── TypeCasting.h
│ │ │ │ │ │ │ │ └── UnaryFunctors.h
│ │ │ │ │ │ │ ├── SSE/
│ │ │ │ │ │ │ │ ├── Complex.h
│ │ │ │ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ │ │ │ ├── PacketMath.h
│ │ │ │ │ │ │ │ └── TypeCasting.h
│ │ │ │ │ │ │ ├── SVE/
│ │ │ │ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ │ │ │ ├── PacketMath.h
│ │ │ │ │ │ │ │ └── TypeCasting.h
│ │ │ │ │ │ │ ├── SYCL/
│ │ │ │ │ │ │ │ ├── InteropHeaders.h
│ │ │ │ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ │ │ │ ├── PacketMath.h
│ │ │ │ │ │ │ │ ├── SyclMemoryModel.h
│ │ │ │ │ │ │ │ └── TypeCasting.h
│ │ │ │ │ │ │ └── ZVector/
│ │ │ │ │ │ │ ├── Complex.h
│ │ │ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ │ │ └── PacketMath.h
│ │ │ │ │ │ ├── functors/
│ │ │ │ │ │ │ ├── AssignmentFunctors.h
│ │ │ │ │ │ │ ├── BinaryFunctors.h
│ │ │ │ │ │ │ ├── NullaryFunctors.h
│ │ │ │ │ │ │ ├── StlFunctors.h
│ │ │ │ │ │ │ ├── TernaryFunctors.h
│ │ │ │ │ │ │ └── UnaryFunctors.h
│ │ │ │ │ │ ├── products/
│ │ │ │ │ │ │ ├── GeneralBlockPanelKernel.h
│ │ │ │ │ │ │ ├── GeneralMatrixMatrix.h
│ │ │ │ │ │ │ ├── GeneralMatrixMatrixTriangular.h
│ │ │ │ │ │ │ ├── GeneralMatrixMatrixTriangular_BLAS.h
│ │ │ │ │ │ │ ├── GeneralMatrixMatrix_BLAS.h
│ │ │ │ │ │ │ ├── GeneralMatrixVector.h
│ │ │ │ │ │ │ ├── GeneralMatrixVector_BLAS.h
│ │ │ │ │ │ │ ├── Parallelizer.h
│ │ │ │ │ │ │ ├── SelfadjointMatrixMatrix.h
│ │ │ │ │ │ │ ├── SelfadjointMatrixMatrix_BLAS.h
│ │ │ │ │ │ │ ├── SelfadjointMatrixVector.h
│ │ │ │ │ │ │ ├── SelfadjointMatrixVector_BLAS.h
│ │ │ │ │ │ │ ├── SelfadjointProduct.h
│ │ │ │ │ │ │ ├── SelfadjointRank2Update.h
│ │ │ │ │ │ │ ├── TriangularMatrixMatrix.h
│ │ │ │ │ │ │ ├── TriangularMatrixMatrix_BLAS.h
│ │ │ │ │ │ │ ├── TriangularMatrixVector.h
│ │ │ │ │ │ │ ├── TriangularMatrixVector_BLAS.h
│ │ │ │ │ │ │ ├── TriangularSolverMatrix.h
│ │ │ │ │ │ │ ├── TriangularSolverMatrix_BLAS.h
│ │ │ │ │ │ │ └── TriangularSolverVector.h
│ │ │ │ │ │ └── util/
│ │ │ │ │ │ ├── BlasUtil.h
│ │ │ │ │ │ ├── ConfigureVectorization.h
│ │ │ │ │ │ ├── Constants.h
│ │ │ │ │ │ ├── DisableStupidWarnings.h
│ │ │ │ │ │ ├── ForwardDeclarations.h
│ │ │ │ │ │ ├── IndexedViewHelper.h
│ │ │ │ │ │ ├── IntegralConstant.h
│ │ │ │ │ │ ├── MKL_support.h
│ │ │ │ │ │ ├── Macros.h
│ │ │ │ │ │ ├── Memory.h
│ │ │ │ │ │ ├── Meta.h
│ │ │ │ │ │ ├── NonMPL2.h
│ │ │ │ │ │ ├── ReenableStupidWarnings.h
│ │ │ │ │ │ ├── ReshapedHelper.h
│ │ │ │ │ │ ├── Serializer.h
│ │ │ │ │ │ ├── StaticAssert.h
│ │ │ │ │ │ ├── SymbolicIndex.h
│ │ │ │ │ │ └── XprHelper.h
│ │ │ │ │ ├── Eigenvalues/
│ │ │ │ │ │ ├── ComplexEigenSolver.h
│ │ │ │ │ │ ├── ComplexSchur.h
│ │ │ │ │ │ ├── ComplexSchur_LAPACKE.h
│ │ │ │ │ │ ├── EigenSolver.h
│ │ │ │ │ │ ├── GeneralizedEigenSolver.h
│ │ │ │ │ │ ├── GeneralizedSelfAdjointEigenSolver.h
│ │ │ │ │ │ ├── HessenbergDecomposition.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── MatrixBaseEigenvalues.h
│ │ │ │ │ │ ├── RealQZ.h
│ │ │ │ │ │ ├── RealSchur.h
│ │ │ │ │ │ ├── RealSchur_LAPACKE.h
│ │ │ │ │ │ ├── SelfAdjointEigenSolver.h
│ │ │ │ │ │ ├── SelfAdjointEigenSolver_LAPACKE.h
│ │ │ │ │ │ └── Tridiagonalization.h
│ │ │ │ │ ├── Geometry/
│ │ │ │ │ │ ├── AlignedBox.h
│ │ │ │ │ │ ├── AngleAxis.h
│ │ │ │ │ │ ├── EulerAngles.h
│ │ │ │ │ │ ├── Homogeneous.h
│ │ │ │ │ │ ├── Hyperplane.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── OrthoMethods.h
│ │ │ │ │ │ ├── ParametrizedLine.h
│ │ │ │ │ │ ├── Quaternion.h
│ │ │ │ │ │ ├── Rotation2D.h
│ │ │ │ │ │ ├── RotationBase.h
│ │ │ │ │ │ ├── Scaling.h
│ │ │ │ │ │ ├── Transform.h
│ │ │ │ │ │ ├── Translation.h
│ │ │ │ │ │ ├── Umeyama.h
│ │ │ │ │ │ └── arch/
│ │ │ │ │ │ └── Geometry_SIMD.h
│ │ │ │ │ ├── Householder/
│ │ │ │ │ │ ├── BlockHouseholder.h
│ │ │ │ │ │ ├── Householder.h
│ │ │ │ │ │ ├── HouseholderSequence.h
│ │ │ │ │ │ └── InternalHeaderCheck.h
│ │ │ │ │ ├── IterativeLinearSolvers/
│ │ │ │ │ │ ├── BasicPreconditioners.h
│ │ │ │ │ │ ├── BiCGSTAB.h
│ │ │ │ │ │ ├── ConjugateGradient.h
│ │ │ │ │ │ ├── IncompleteCholesky.h
│ │ │ │ │ │ ├── IncompleteLUT.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── IterativeSolverBase.h
│ │ │ │ │ │ ├── LeastSquareConjugateGradient.h
│ │ │ │ │ │ └── SolveWithGuess.h
│ │ │ │ │ ├── Jacobi/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── Jacobi.h
│ │ │ │ │ ├── KLUSupport/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── KLUSupport.h
│ │ │ │ │ ├── LU/
│ │ │ │ │ │ ├── Determinant.h
│ │ │ │ │ │ ├── FullPivLU.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── InverseImpl.h
│ │ │ │ │ │ ├── PartialPivLU.h
│ │ │ │ │ │ ├── PartialPivLU_LAPACKE.h
│ │ │ │ │ │ └── arch/
│ │ │ │ │ │ └── InverseSize4.h
│ │ │ │ │ ├── MetisSupport/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── MetisSupport.h
│ │ │ │ │ ├── OrderingMethods/
│ │ │ │ │ │ ├── Amd.h
│ │ │ │ │ │ ├── Eigen_Colamd.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── Ordering.h
│ │ │ │ │ ├── PaStiXSupport/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── PaStiXSupport.h
│ │ │ │ │ ├── PardisoSupport/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── PardisoSupport.h
│ │ │ │ │ ├── QR/
│ │ │ │ │ │ ├── ColPivHouseholderQR.h
│ │ │ │ │ │ ├── ColPivHouseholderQR_LAPACKE.h
│ │ │ │ │ │ ├── CompleteOrthogonalDecomposition.h
│ │ │ │ │ │ ├── FullPivHouseholderQR.h
│ │ │ │ │ │ ├── HouseholderQR.h
│ │ │ │ │ │ ├── HouseholderQR_LAPACKE.h
│ │ │ │ │ │ └── InternalHeaderCheck.h
│ │ │ │ │ ├── SPQRSupport/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── SuiteSparseQRSupport.h
│ │ │ │ │ ├── SVD/
│ │ │ │ │ │ ├── BDCSVD.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── JacobiSVD.h
│ │ │ │ │ │ ├── JacobiSVD_LAPACKE.h
│ │ │ │ │ │ ├── SVDBase.h
│ │ │ │ │ │ └── UpperBidiagonalization.h
│ │ │ │ │ ├── SparseCholesky/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── SimplicialCholesky.h
│ │ │ │ │ │ └── SimplicialCholesky_impl.h
│ │ │ │ │ ├── SparseCore/
│ │ │ │ │ │ ├── AmbiVector.h
│ │ │ │ │ │ ├── CompressedStorage.h
│ │ │ │ │ │ ├── ConservativeSparseSparseProduct.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── MappedSparseMatrix.h
│ │ │ │ │ │ ├── SparseAssign.h
│ │ │ │ │ │ ├── SparseBlock.h
│ │ │ │ │ │ ├── SparseColEtree.h
│ │ │ │ │ │ ├── SparseCompressedBase.h
│ │ │ │ │ │ ├── SparseCwiseBinaryOp.h
│ │ │ │ │ │ ├── SparseCwiseUnaryOp.h
│ │ │ │ │ │ ├── SparseDenseProduct.h
│ │ │ │ │ │ ├── SparseDiagonalProduct.h
│ │ │ │ │ │ ├── SparseDot.h
│ │ │ │ │ │ ├── SparseFuzzy.h
│ │ │ │ │ │ ├── SparseMap.h
│ │ │ │ │ │ ├── SparseMatrix.h
│ │ │ │ │ │ ├── SparseMatrixBase.h
│ │ │ │ │ │ ├── SparsePermutation.h
│ │ │ │ │ │ ├── SparseProduct.h
│ │ │ │ │ │ ├── SparseRedux.h
│ │ │ │ │ │ ├── SparseRef.h
│ │ │ │ │ │ ├── SparseSelfAdjointView.h
│ │ │ │ │ │ ├── SparseSolverBase.h
│ │ │ │ │ │ ├── SparseSparseProductWithPruning.h
│ │ │ │ │ │ ├── SparseTranspose.h
│ │ │ │ │ │ ├── SparseTriangularView.h
│ │ │ │ │ │ ├── SparseUtil.h
│ │ │ │ │ │ ├── SparseVector.h
│ │ │ │ │ │ ├── SparseView.h
│ │ │ │ │ │ └── TriangularSolver.h
│ │ │ │ │ ├── SparseLU/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── SparseLU.h
│ │ │ │ │ │ ├── SparseLUImpl.h
│ │ │ │ │ │ ├── SparseLU_Memory.h
│ │ │ │ │ │ ├── SparseLU_Structs.h
│ │ │ │ │ │ ├── SparseLU_SupernodalMatrix.h
│ │ │ │ │ │ ├── SparseLU_Utils.h
│ │ │ │ │ │ ├── SparseLU_column_bmod.h
│ │ │ │ │ │ ├── SparseLU_column_dfs.h
│ │ │ │ │ │ ├── SparseLU_copy_to_ucol.h
│ │ │ │ │ │ ├── SparseLU_gemm_kernel.h
│ │ │ │ │ │ ├── SparseLU_heap_relax_snode.h
│ │ │ │ │ │ ├── SparseLU_kernel_bmod.h
│ │ │ │ │ │ ├── SparseLU_panel_bmod.h
│ │ │ │ │ │ ├── SparseLU_panel_dfs.h
│ │ │ │ │ │ ├── SparseLU_pivotL.h
│ │ │ │ │ │ ├── SparseLU_pruneL.h
│ │ │ │ │ │ └── SparseLU_relax_snode.h
│ │ │ │ │ ├── SparseQR/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── SparseQR.h
│ │ │ │ │ ├── StlSupport/
│ │ │ │ │ │ ├── StdDeque.h
│ │ │ │ │ │ ├── StdList.h
│ │ │ │ │ │ ├── StdVector.h
│ │ │ │ │ │ └── details.h
│ │ │ │ │ ├── SuperLUSupport/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── SuperLUSupport.h
│ │ │ │ │ ├── UmfPackSupport/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── UmfPackSupport.h
│ │ │ │ │ ├── misc/
│ │ │ │ │ │ ├── Image.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── Kernel.h
│ │ │ │ │ │ ├── RealSvd2x2.h
│ │ │ │ │ │ ├── blas.h
│ │ │ │ │ │ ├── lapack.h
│ │ │ │ │ │ ├── lapacke.h
│ │ │ │ │ │ └── lapacke_mangling.h
│ │ │ │ │ └── plugins/
│ │ │ │ │ ├── ArrayCwiseBinaryOps.h
│ │ │ │ │ ├── ArrayCwiseUnaryOps.h
│ │ │ │ │ ├── BlockMethods.h
│ │ │ │ │ ├── CommonCwiseBinaryOps.h
│ │ │ │ │ ├── CommonCwiseUnaryOps.h
│ │ │ │ │ ├── IndexedViewMethods.h
│ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ ├── MatrixCwiseBinaryOps.h
│ │ │ │ │ ├── MatrixCwiseUnaryOps.h
│ │ │ │ │ └── ReshapedMethods.h
│ │ │ │ ├── INSTALL
│ │ │ │ ├── README.md
│ │ │ │ ├── bench/
│ │ │ │ │ ├── BenchSparseUtil.h
│ │ │ │ │ ├── BenchTimer.h
│ │ │ │ │ ├── BenchUtil.h
│ │ │ │ │ ├── analyze-blocking-sizes.cpp
│ │ │ │ │ ├── basicbench.cxxlist
│ │ │ │ │ ├── basicbenchmark.cpp
│ │ │ │ │ ├── basicbenchmark.h
│ │ │ │ │ ├── benchBlasGemm.cpp
│ │ │ │ │ ├── benchCholesky.cpp
│ │ │ │ │ ├── benchEigenSolver.cpp
│ │ │ │ │ ├── benchFFT.cpp
│ │ │ │ │ ├── benchGeometry.cpp
│ │ │ │ │ ├── benchVecAdd.cpp
│ │ │ │ │ ├── bench_gemm.cpp
│ │ │ │ │ ├── bench_move_semantics.cpp
│ │ │ │ │ ├── bench_multi_compilers.sh
│ │ │ │ │ ├── bench_norm.cpp
│ │ │ │ │ ├── bench_reverse.cpp
│ │ │ │ │ ├── bench_sum.cpp
│ │ │ │ │ ├── bench_unrolling
│ │ │ │ │ ├── benchmark-blocking-sizes.cpp
│ │ │ │ │ ├── benchmark.cpp
│ │ │ │ │ ├── benchmarkSlice.cpp
│ │ │ │ │ ├── benchmarkX.cpp
│ │ │ │ │ ├── benchmarkXcwise.cpp
│ │ │ │ │ ├── benchmark_suite
│ │ │ │ │ ├── btl/
│ │ │ │ │ │ ├── COPYING
│ │ │ │ │ │ ├── README
│ │ │ │ │ │ ├── actions/
│ │ │ │ │ │ │ ├── action_aat_product.hh
│ │ │ │ │ │ │ ├── action_ata_product.hh
│ │ │ │ │ │ │ ├── action_atv_product.hh
│ │ │ │ │ │ │ ├── action_axpby.hh
│ │ │ │ │ │ │ ├── action_axpy.hh
│ │ │ │ │ │ │ ├── action_cholesky.hh
│ │ │ │ │ │ │ ├── action_ger.hh
│ │ │ │ │ │ │ ├── action_hessenberg.hh
│ │ │ │ │ │ │ ├── action_lu_decomp.hh
│ │ │ │ │ │ │ ├── action_lu_solve.hh
│ │ │ │ │ │ │ ├── action_matrix_matrix_product.hh
│ │ │ │ │ │ │ ├── action_matrix_matrix_product_bis.hh
│ │ │ │ │ │ │ ├── action_matrix_vector_product.hh
│ │ │ │ │ │ │ ├── action_partial_lu.hh
│ │ │ │ │ │ │ ├── action_rot.hh
│ │ │ │ │ │ │ ├── action_symv.hh
│ │ │ │ │ │ │ ├── action_syr2.hh
│ │ │ │ │ │ │ ├── action_trisolve.hh
│ │ │ │ │ │ │ ├── action_trisolve_matrix.hh
│ │ │ │ │ │ │ ├── action_trmm.hh
│ │ │ │ │ │ │ └── basic_actions.hh
│ │ │ │ │ │ ├── cmake/
│ │ │ │ │ │ │ ├── FindACML.cmake
│ │ │ │ │ │ │ ├── FindATLAS.cmake
│ │ │ │ │ │ │ ├── FindBLAZE.cmake
│ │ │ │ │ │ │ ├── FindBlitz.cmake
│ │ │ │ │ │ │ ├── FindCBLAS.cmake
│ │ │ │ │ │ │ ├── FindGMM.cmake
│ │ │ │ │ │ │ ├── FindMKL.cmake
│ │ │ │ │ │ │ ├── FindMTL4.cmake
│ │ │ │ │ │ │ ├── FindOPENBLAS.cmake
│ │ │ │ │ │ │ ├── FindPackageHandleStandardArgs.cmake
│ │ │ │ │ │ │ ├── FindTvmet.cmake
│ │ │ │ │ │ │ └── MacroOptionalAddSubdirectory.cmake
│ │ │ │ │ │ ├── generic_bench/
│ │ │ │ │ │ │ ├── bench.hh
│ │ │ │ │ │ │ ├── bench_parameter.hh
│ │ │ │ │ │ │ ├── btl.hh
│ │ │ │ │ │ │ ├── init/
│ │ │ │ │ │ │ │ ├── init_function.hh
│ │ │ │ │ │ │ │ ├── init_matrix.hh
│ │ │ │ │ │ │ │ └── init_vector.hh
│ │ │ │ │ │ │ ├── static/
│ │ │ │ │ │ │ │ ├── bench_static.hh
│ │ │ │ │ │ │ │ ├── intel_bench_fixed_size.hh
│ │ │ │ │ │ │ │ └── static_size_generator.hh
│ │ │ │ │ │ │ ├── timers/
│ │ │ │ │ │ │ │ ├── STL_perf_analyzer.hh
│ │ │ │ │ │ │ │ ├── STL_timer.hh
│ │ │ │ │ │ │ │ ├── mixed_perf_analyzer.hh
│ │ │ │ │ │ │ │ ├── portable_perf_analyzer.hh
│ │ │ │ │ │ │ │ ├── portable_perf_analyzer_old.hh
│ │ │ │ │ │ │ │ ├── portable_timer.hh
│ │ │ │ │ │ │ │ ├── x86_perf_analyzer.hh
│ │ │ │ │ │ │ │ └── x86_timer.hh
│ │ │ │ │ │ │ └── utils/
│ │ │ │ │ │ │ ├── size_lin_log.hh
│ │ │ │ │ │ │ ├── size_log.hh
│ │ │ │ │ │ │ ├── utilities.h
│ │ │ │ │ │ │ └── xy_file.hh
│ │ │ │ │ │ └── libs/
│ │ │ │ │ │ ├── BLAS/
│ │ │ │ │ │ │ ├── blas.h
│ │ │ │ │ │ │ ├── blas_interface.hh
│ │ │ │ │ │ │ ├── blas_interface_impl.hh
│ │ │ │ │ │ │ ├── c_interface_base.h
│ │ │ │ │ │ │ └── main.cpp
│ │ │ │ │ │ ├── STL/
│ │ │ │ │ │ │ ├── STL_interface.hh
│ │ │ │ │ │ │ └── main.cpp
│ │ │ │ │ │ ├── blaze/
│ │ │ │ │ │ │ ├── blaze_interface.hh
│ │ │ │ │ │ │ └── main.cpp
│ │ │ │ │ │ ├── blitz/
│ │ │ │ │ │ │ ├── blitz_LU_solve_interface.hh
│ │ │ │ │ │ │ ├── blitz_interface.hh
│ │ │ │ │ │ │ ├── btl_blitz.cpp
│ │ │ │ │ │ │ ├── btl_tiny_blitz.cpp
│ │ │ │ │ │ │ └── tiny_blitz_interface.hh
│ │ │ │ │ │ ├── eigen2/
│ │ │ │ │ │ │ ├── btl_tiny_eigen2.cpp
│ │ │ │ │ │ │ ├── eigen2_interface.hh
│ │ │ │ │ │ │ ├── main_adv.cpp
│ │ │ │ │ │ │ ├── main_linear.cpp
│ │ │ │ │ │ │ ├── main_matmat.cpp
│ │ │ │ │ │ │ └── main_vecmat.cpp
│ │ │ │ │ │ ├── eigen3/
│ │ │ │ │ │ │ ├── btl_tiny_eigen3.cpp
│ │ │ │ │ │ │ ├── eigen3_interface.hh
│ │ │ │ │ │ │ ├── main_adv.cpp
│ │ │ │ │ │ │ ├── main_linear.cpp
│ │ │ │ │ │ │ ├── main_matmat.cpp
│ │ │ │ │ │ │ └── main_vecmat.cpp
│ │ │ │ │ │ ├── gmm/
│ │ │ │ │ │ │ ├── gmm_LU_solve_interface.hh
│ │ │ │ │ │ │ ├── gmm_interface.hh
│ │ │ │ │ │ │ └── main.cpp
│ │ │ │ │ │ ├── mtl4/
│ │ │ │ │ │ │ ├── .kdbgrc.main
│ │ │ │ │ │ │ ├── main.cpp
│ │ │ │ │ │ │ ├── mtl4_LU_solve_interface.hh
│ │ │ │ │ │ │ └── mtl4_interface.hh
│ │ │ │ │ │ ├── tensors/
│ │ │ │ │ │ │ ├── main_linear.cpp
│ │ │ │ │ │ │ ├── main_matmat.cpp
│ │ │ │ │ │ │ ├── main_vecmat.cpp
│ │ │ │ │ │ │ └── tensor_interface.hh
│ │ │ │ │ │ ├── tvmet/
│ │ │ │ │ │ │ ├── main.cpp
│ │ │ │ │ │ │ └── tvmet_interface.hh
│ │ │ │ │ │ └── ublas/
│ │ │ │ │ │ ├── main.cpp
│ │ │ │ │ │ └── ublas_interface.hh
│ │ │ │ │ ├── check_cache_queries.cpp
│ │ │ │ │ ├── dense_solvers.cpp
│ │ │ │ │ ├── eig33.cpp
│ │ │ │ │ ├── geometry.cpp
│ │ │ │ │ ├── perf_monitoring/
│ │ │ │ │ │ ├── gemm.cpp
│ │ │ │ │ │ ├── gemm_common.h
│ │ │ │ │ │ ├── gemv.cpp
│ │ │ │ │ │ ├── gemv_common.h
│ │ │ │ │ │ ├── gemvt.cpp
│ │ │ │ │ │ ├── lazy_gemm.cpp
│ │ │ │ │ │ ├── llt.cpp
│ │ │ │ │ │ ├── make_plot.sh
│ │ │ │ │ │ ├── resources/
│ │ │ │ │ │ │ ├── chart_footer.html
│ │ │ │ │ │ │ ├── chart_header.html
│ │ │ │ │ │ │ ├── footer.html
│ │ │ │ │ │ │ ├── header.html
│ │ │ │ │ │ │ ├── s1.js
│ │ │ │ │ │ │ └── s2.js
│ │ │ │ │ │ ├── run.sh
│ │ │ │ │ │ ├── runall.sh
│ │ │ │ │ │ ├── trmv_lo.cpp
│ │ │ │ │ │ ├── trmv_lot.cpp
│ │ │ │ │ │ ├── trmv_up.cpp
│ │ │ │ │ │ └── trmv_upt.cpp
│ │ │ │ │ ├── product_threshold.cpp
│ │ │ │ │ ├── quat_slerp.cpp
│ │ │ │ │ ├── quatmul.cpp
│ │ │ │ │ ├── sparse_cholesky.cpp
│ │ │ │ │ ├── sparse_dense_product.cpp
│ │ │ │ │ ├── sparse_lu.cpp
│ │ │ │ │ ├── sparse_product.cpp
│ │ │ │ │ ├── sparse_randomsetter.cpp
│ │ │ │ │ ├── sparse_setter.cpp
│ │ │ │ │ ├── sparse_transpose.cpp
│ │ │ │ │ ├── sparse_trisolver.cpp
│ │ │ │ │ ├── spbench/
│ │ │ │ │ │ ├── sp_solver.cpp
│ │ │ │ │ │ ├── spbench.dtd
│ │ │ │ │ │ ├── spbenchsolver.cpp
│ │ │ │ │ │ ├── spbenchsolver.h
│ │ │ │ │ │ ├── spbenchstyle.h
│ │ │ │ │ │ └── test_sparseLU.cpp
│ │ │ │ │ ├── spmv.cpp
│ │ │ │ │ ├── tensors/
│ │ │ │ │ │ ├── README
│ │ │ │ │ │ ├── benchmark.h
│ │ │ │ │ │ ├── benchmark_main.cc
│ │ │ │ │ │ ├── contraction_benchmarks_cpu.cc
│ │ │ │ │ │ ├── eigen_sycl_bench.sh
│ │ │ │ │ │ ├── eigen_sycl_bench_contract.sh
│ │ │ │ │ │ ├── tensor_benchmarks.h
│ │ │ │ │ │ ├── tensor_benchmarks_cpu.cc
│ │ │ │ │ │ ├── tensor_benchmarks_fp16_gpu.cu
│ │ │ │ │ │ ├── tensor_benchmarks_gpu.cu
│ │ │ │ │ │ ├── tensor_benchmarks_sycl.cc
│ │ │ │ │ │ └── tensor_contract_sycl_bench.cc
│ │ │ │ │ └── vdw_new.cpp
│ │ │ │ ├── blas/
│ │ │ │ │ ├── BandTriangularSolver.h
│ │ │ │ │ ├── GeneralRank1Update.h
│ │ │ │ │ ├── PackedSelfadjointProduct.h
│ │ │ │ │ ├── PackedTriangularMatrixVector.h
│ │ │ │ │ ├── PackedTriangularSolverVector.h
│ │ │ │ │ ├── Rank2Update.h
│ │ │ │ │ ├── common.h
│ │ │ │ │ ├── complex_double.cpp
│ │ │ │ │ ├── complex_single.cpp
│ │ │ │ │ ├── double.cpp
│ │ │ │ │ ├── f2c/
│ │ │ │ │ │ ├── chbmv.c
│ │ │ │ │ │ ├── chpmv.c
│ │ │ │ │ │ ├── complexdots.c
│ │ │ │ │ │ ├── ctbmv.c
│ │ │ │ │ │ ├── d_cnjg.c
│ │ │ │ │ │ ├── datatypes.h
│ │ │ │ │ │ ├── drotm.c
│ │ │ │ │ │ ├── drotmg.c
│ │ │ │ │ │ ├── dsbmv.c
│ │ │ │ │ │ ├── dspmv.c
│ │ │ │ │ │ ├── dtbmv.c
│ │ │ │ │ │ ├── lsame.c
│ │ │ │ │ │ ├── r_cnjg.c
│ │ │ │ │ │ ├── srotm.c
│ │ │ │ │ │ ├── srotmg.c
│ │ │ │ │ │ ├── ssbmv.c
│ │ │ │ │ │ ├── sspmv.c
│ │ │ │ │ │ ├── stbmv.c
│ │ │ │ │ │ ├── zhbmv.c
│ │ │ │ │ │ ├── zhpmv.c
│ │ │ │ │ │ └── ztbmv.c
│ │ │ │ │ ├── fortran/
│ │ │ │ │ │ └── complexdots.f
│ │ │ │ │ ├── level1_cplx_impl.h
│ │ │ │ │ ├── level1_impl.h
│ │ │ │ │ ├── level1_real_impl.h
│ │ │ │ │ ├── level2_cplx_impl.h
│ │ │ │ │ ├── level2_impl.h
│ │ │ │ │ ├── level2_real_impl.h
│ │ │ │ │ ├── level3_impl.h
│ │ │ │ │ ├── single.cpp
│ │ │ │ │ ├── testing/
│ │ │ │ │ │ ├── cblat1.f
│ │ │ │ │ │ ├── cblat2.f
│ │ │ │ │ │ ├── cblat3.f
│ │ │ │ │ │ ├── dblat1.f
│ │ │ │ │ │ ├── dblat2.f
│ │ │ │ │ │ ├── dblat3.f
│ │ │ │ │ │ ├── runblastest.sh
│ │ │ │ │ │ ├── sblat1.f
│ │ │ │ │ │ ├── sblat2.f
│ │ │ │ │ │ ├── sblat3.f
│ │ │ │ │ │ ├── zblat1.f
│ │ │ │ │ │ ├── zblat2.f
│ │ │ │ │ │ └── zblat3.f
│ │ │ │ │ └── xerbla.cpp
│ │ │ │ ├── ci/
│ │ │ │ │ ├── CTest2JUnit.xsl
│ │ │ │ │ ├── README.md
│ │ │ │ │ ├── smoketests.gitlab-ci.yml
│ │ │ │ │ └── test.gitlab-ci.yml
│ │ │ │ ├── cmake/
│ │ │ │ │ ├── ComputeCppCompilerChecks.cmake
│ │ │ │ │ ├── ComputeCppIRMap.cmake
│ │ │ │ │ ├── Eigen3Config.cmake.in
│ │ │ │ │ ├── EigenConfigureTesting.cmake
│ │ │ │ │ ├── EigenSmokeTestList.cmake
│ │ │ │ │ ├── EigenTesting.cmake
│ │ │ │ │ ├── EigenUninstall.cmake
│ │ │ │ │ ├── FindAdolc.cmake
│ │ │ │ │ ├── FindBLAS.cmake
│ │ │ │ │ ├── FindBLASEXT.cmake
│ │ │ │ │ ├── FindCHOLMOD.cmake
│ │ │ │ │ ├── FindComputeCpp.cmake
│ │ │ │ │ ├── FindFFTW.cmake
│ │ │ │ │ ├── FindGLEW.cmake
│ │ │ │ │ ├── FindGMP.cmake
│ │ │ │ │ ├── FindGSL.cmake
│ │ │ │ │ ├── FindGoogleHash.cmake
│ │ │ │ │ ├── FindHWLOC.cmake
│ │ │ │ │ ├── FindKLU.cmake
│ │ │ │ │ ├── FindLAPACK.cmake
│ │ │ │ │ ├── FindMPFR.cmake
│ │ │ │ │ ├── FindMPREAL.cmake
│ │ │ │ │ ├── FindMetis.cmake
│ │ │ │ │ ├── FindPASTIX.cmake
│ │ │ │ │ ├── FindPTSCOTCH.cmake
│ │ │ │ │ ├── FindSCOTCH.cmake
│ │ │ │ │ ├── FindSPQR.cmake
│ │ │ │ │ ├── FindStandardMathLibrary.cmake
│ │ │ │ │ ├── FindSuperLU.cmake
│ │ │ │ │ ├── FindTriSYCL.cmake
│ │ │ │ │ ├── FindUMFPACK.cmake
│ │ │ │ │ └── RegexUtils.cmake
│ │ │ │ ├── debug/
│ │ │ │ │ ├── gdb/
│ │ │ │ │ │ ├── __init__.py
│ │ │ │ │ │ └── printers.py
│ │ │ │ │ ├── lldb/
│ │ │ │ │ │ └── eigenlldb.py
│ │ │ │ │ └── msvc/
│ │ │ │ │ └── eigen.natvis
│ │ │ │ ├── demos/
│ │ │ │ │ ├── mandelbrot/
│ │ │ │ │ │ ├── README
│ │ │ │ │ │ ├── mandelbrot.cpp
│ │ │ │ │ │ └── mandelbrot.h
│ │ │ │ │ ├── mix_eigen_and_c/
│ │ │ │ │ │ ├── README
│ │ │ │ │ │ ├── binary_library.cpp
│ │ │ │ │ │ ├── binary_library.h
│ │ │ │ │ │ └── example.c
│ │ │ │ │ └── opengl/
│ │ │ │ │ ├── README
│ │ │ │ │ ├── camera.cpp
│ │ │ │ │ ├── camera.h
│ │ │ │ │ ├── gpuhelper.cpp
│ │ │ │ │ ├── gpuhelper.h
│ │ │ │ │ ├── icosphere.cpp
│ │ │ │ │ ├── icosphere.h
│ │ │ │ │ ├── quaternion_demo.cpp
│ │ │ │ │ ├── quaternion_demo.h
│ │ │ │ │ ├── trackball.cpp
│ │ │ │ │ └── trackball.h
│ │ │ │ ├── doc/
│ │ │ │ │ ├── B01_Experimental.dox
│ │ │ │ │ ├── ClassHierarchy.dox
│ │ │ │ │ ├── CoeffwiseMathFunctionsTable.dox
│ │ │ │ │ ├── CustomizingEigen_CustomScalar.dox
│ │ │ │ │ ├── CustomizingEigen_InheritingMatrix.dox
│ │ │ │ │ ├── CustomizingEigen_NullaryExpr.dox
│ │ │ │ │ ├── CustomizingEigen_Plugins.dox
│ │ │ │ │ ├── DenseDecompositionBenchmark.dox
│ │ │ │ │ ├── Doxyfile.in
│ │ │ │ │ ├── FixedSizeVectorizable.dox
│ │ │ │ │ ├── FunctionsTakingEigenTypes.dox
│ │ │ │ │ ├── HiPerformance.dox
│ │ │ │ │ ├── InplaceDecomposition.dox
│ │ │ │ │ ├── InsideEigenExample.dox
│ │ │ │ │ ├── LeastSquares.dox
│ │ │ │ │ ├── Manual.dox
│ │ │ │ │ ├── MatrixfreeSolverExample.dox
│ │ │ │ │ ├── NewExpressionType.dox
│ │ │ │ │ ├── Overview.dox
│ │ │ │ │ ├── PassingByValue.dox
│ │ │ │ │ ├── Pitfalls.dox
│ │ │ │ │ ├── PreprocessorDirectives.dox
│ │ │ │ │ ├── QuickReference.dox
│ │ │ │ │ ├── QuickStartGuide.dox
│ │ │ │ │ ├── SparseLinearSystems.dox
│ │ │ │ │ ├── SparseQuickReference.dox
│ │ │ │ │ ├── StlContainers.dox
│ │ │ │ │ ├── StorageOrders.dox
│ │ │ │ │ ├── StructHavingEigenMembers.dox
│ │ │ │ │ ├── TemplateKeyword.dox
│ │ │ │ │ ├── TopicAliasing.dox
│ │ │ │ │ ├── TopicAssertions.dox
│ │ │ │ │ ├── TopicCMakeGuide.dox
│ │ │ │ │ ├── TopicEigenExpressionTemplates.dox
│ │ │ │ │ ├── TopicLazyEvaluation.dox
│ │ │ │ │ ├── TopicLinearAlgebraDecompositions.dox
│ │ │ │ │ ├── TopicMultithreading.dox
│ │ │ │ │ ├── TopicResizing.dox
│ │ │ │ │ ├── TopicScalarTypes.dox
│ │ │ │ │ ├── TopicVectorization.dox
│ │ │ │ │ ├── TutorialAdvancedInitialization.dox
│ │ │ │ │ ├── TutorialArrayClass.dox
│ │ │ │ │ ├── TutorialBlockOperations.dox
│ │ │ │ │ ├── TutorialGeometry.dox
│ │ │ │ │ ├── TutorialLinearAlgebra.dox
│ │ │ │ │ ├── TutorialMapClass.dox
│ │ │ │ │ ├── TutorialMatrixArithmetic.dox
│ │ │ │ │ ├── TutorialMatrixClass.dox
│ │ │ │ │ ├── TutorialReductionsVisitorsBroadcasting.dox
│ │ │ │ │ ├── TutorialReshape.dox
│ │ │ │ │ ├── TutorialSTL.dox
│ │ │ │ │ ├── TutorialSlicingIndexing.dox
│ │ │ │ │ ├── TutorialSparse.dox
│ │ │ │ │ ├── TutorialSparse_example_details.dox
│ │ │ │ │ ├── UnalignedArrayAssert.dox
│ │ │ │ │ ├── UsingBlasLapackBackends.dox
│ │ │ │ │ ├── UsingIntelMKL.dox
│ │ │ │ │ ├── UsingNVCC.dox
│ │ │ │ │ ├── WrongStackAlignment.dox
│ │ │ │ │ ├── eigen_navtree_hacks.js
│ │ │ │ │ ├── eigendoxy.css
│ │ │ │ │ ├── eigendoxy_footer.html.in
│ │ │ │ │ ├── eigendoxy_header.html.in
│ │ │ │ │ ├── eigendoxy_layout.xml.in
│ │ │ │ │ ├── eigendoxy_tabs.css
│ │ │ │ │ ├── examples/
│ │ │ │ │ │ ├── .krazy
│ │ │ │ │ │ ├── CustomizingEigen_Inheritance.cpp
│ │ │ │ │ │ ├── Cwise_erf.cpp
│ │ │ │ │ │ ├── Cwise_erfc.cpp
│ │ │ │ │ │ ├── Cwise_lgamma.cpp
│ │ │ │ │ │ ├── DenseBase_middleCols_int.cpp
│ │ │ │ │ │ ├── DenseBase_middleRows_int.cpp
│ │ │ │ │ │ ├── DenseBase_template_int_middleCols.cpp
│ │ │ │ │ │ ├── DenseBase_template_int_middleRows.cpp
│ │ │ │ │ │ ├── QuickStart_example.cpp
│ │ │ │ │ │ ├── QuickStart_example2_dynamic.cpp
│ │ │ │ │ │ ├── QuickStart_example2_fixed.cpp
│ │ │ │ │ │ ├── TemplateKeyword_flexible.cpp
│ │ │ │ │ │ ├── TemplateKeyword_simple.cpp
│ │ │ │ │ │ ├── TutorialInplaceLU.cpp
│ │ │ │ │ │ ├── TutorialLinAlgComputeTwice.cpp
│ │ │ │ │ │ ├── TutorialLinAlgExComputeSolveError.cpp
│ │ │ │ │ │ ├── TutorialLinAlgExSolveColPivHouseholderQR.cpp
│ │ │ │ │ │ ├── TutorialLinAlgExSolveLDLT.cpp
│ │ │ │ │ │ ├── TutorialLinAlgInverseDeterminant.cpp
│ │ │ │ │ │ ├── TutorialLinAlgRankRevealing.cpp
│ │ │ │ │ │ ├── TutorialLinAlgSVDSolve.cpp
│ │ │ │ │ │ ├── TutorialLinAlgSelfAdjointEigenSolver.cpp
│ │ │ │ │ │ ├── TutorialLinAlgSetThreshold.cpp
│ │ │ │ │ │ ├── Tutorial_ArrayClass_accessors.cpp
│ │ │ │ │ │ ├── Tutorial_ArrayClass_addition.cpp
│ │ │ │ │ │ ├── Tutorial_ArrayClass_cwise_other.cpp
│ │ │ │ │ │ ├── Tutorial_ArrayClass_interop.cpp
│ │ │ │ │ │ ├── Tutorial_ArrayClass_interop_matrix.cpp
│ │ │ │ │ │ ├── Tutorial_ArrayClass_mult.cpp
│ │ │ │ │ │ ├── Tutorial_BlockOperations_block_assignment.cpp
│ │ │ │ │ │ ├── Tutorial_BlockOperations_colrow.cpp
│ │ │ │ │ │ ├── Tutorial_BlockOperations_corner.cpp
│ │ │ │ │ │ ├── Tutorial_BlockOperations_print_block.cpp
│ │ │ │ │ │ ├── Tutorial_BlockOperations_vector.cpp
│ │ │ │ │ │ ├── Tutorial_PartialLU_solve.cpp
│ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp
│ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp
│ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp
│ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp
│ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp
│ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp
│ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp
│ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp
│ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp
│ │ │ │ │ │ ├── Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp
│ │ │ │ │ │ ├── Tutorial_simple_example_dynamic_size.cpp
│ │ │ │ │ │ ├── Tutorial_simple_example_fixed_size.cpp
│ │ │ │ │ │ ├── class_Block.cpp
│ │ │ │ │ │ ├── class_CwiseBinaryOp.cpp
│ │ │ │ │ │ ├── class_CwiseUnaryOp.cpp
│ │ │ │ │ │ ├── class_CwiseUnaryOp_ptrfun.cpp
│ │ │ │ │ │ ├── class_FixedBlock.cpp
│ │ │ │ │ │ ├── class_FixedReshaped.cpp
│ │ │ │ │ │ ├── class_FixedVectorBlock.cpp
│ │ │ │ │ │ ├── class_Reshaped.cpp
│ │ │ │ │ │ ├── class_VectorBlock.cpp
│ │ │ │ │ │ ├── function_taking_eigenbase.cpp
│ │ │ │ │ │ ├── function_taking_ref.cpp
│ │ │ │ │ │ ├── make_circulant.cpp
│ │ │ │ │ │ ├── make_circulant.cpp.entry
│ │ │ │ │ │ ├── make_circulant.cpp.evaluator
│ │ │ │ │ │ ├── make_circulant.cpp.expression
│ │ │ │ │ │ ├── make_circulant.cpp.main
│ │ │ │ │ │ ├── make_circulant.cpp.preamble
│ │ │ │ │ │ ├── make_circulant.cpp.traits
│ │ │ │ │ │ ├── make_circulant2.cpp
│ │ │ │ │ │ ├── matrixfree_cg.cpp
│ │ │ │ │ │ ├── nullary_indexing.cpp
│ │ │ │ │ │ ├── tut_arithmetic_add_sub.cpp
│ │ │ │ │ │ ├── tut_arithmetic_dot_cross.cpp
│ │ │ │ │ │ ├── tut_arithmetic_matrix_mul.cpp
│ │ │ │ │ │ ├── tut_arithmetic_redux_basic.cpp
│ │ │ │ │ │ ├── tut_arithmetic_scalar_mul_div.cpp
│ │ │ │ │ │ ├── tut_matrix_coefficient_accessors.cpp
│ │ │ │ │ │ ├── tut_matrix_resize.cpp
│ │ │ │ │ │ └── tut_matrix_resize_fixed_size.cpp
│ │ │ │ │ ├── snippets/
│ │ │ │ │ │ ├── .krazy
│ │ │ │ │ │ ├── AngleAxis_mimic_euler.cpp
│ │ │ │ │ │ ├── Array_initializer_list_23_cxx11.cpp
│ │ │ │ │ │ ├── Array_initializer_list_vector_cxx11.cpp
│ │ │ │ │ │ ├── Array_variadic_ctor_cxx11.cpp
│ │ │ │ │ │ ├── BiCGSTAB_simple.cpp
│ │ │ │ │ │ ├── BiCGSTAB_step_by_step.cpp
│ │ │ │ │ │ ├── ColPivHouseholderQR_solve.cpp
│ │ │ │ │ │ ├── ComplexEigenSolver_compute.cpp
│ │ │ │ │ │ ├── ComplexEigenSolver_eigenvalues.cpp
│ │ │ │ │ │ ├── ComplexEigenSolver_eigenvectors.cpp
│ │ │ │ │ │ ├── ComplexSchur_compute.cpp
│ │ │ │ │ │ ├── ComplexSchur_matrixT.cpp
│ │ │ │ │ │ ├── ComplexSchur_matrixU.cpp
│ │ │ │ │ │ ├── Cwise_abs.cpp
│ │ │ │ │ │ ├── Cwise_abs2.cpp
│ │ │ │ │ │ ├── Cwise_acos.cpp
│ │ │ │ │ │ ├── Cwise_arg.cpp
│ │ │ │ │ │ ├── Cwise_array_power_array.cpp
│ │ │ │ │ │ ├── Cwise_asin.cpp
│ │ │ │ │ │ ├── Cwise_atan.cpp
│ │ │ │ │ │ ├── Cwise_boolean_and.cpp
│ │ │ │ │ │ ├── Cwise_boolean_not.cpp
│ │ │ │ │ │ ├── Cwise_boolean_or.cpp
│ │ │ │ │ │ ├── Cwise_boolean_xor.cpp
│ │ │ │ │ │ ├── Cwise_ceil.cpp
│ │ │ │ │ │ ├── Cwise_cos.cpp
│ │ │ │ │ │ ├── Cwise_cosh.cpp
│ │ │ │ │ │ ├── Cwise_cube.cpp
│ │ │ │ │ │ ├── Cwise_equal_equal.cpp
│ │ │ │ │ │ ├── Cwise_exp.cpp
│ │ │ │ │ │ ├── Cwise_floor.cpp
│ │ │ │ │ │ ├── Cwise_greater.cpp
│ │ │ │ │ │ ├── Cwise_greater_equal.cpp
│ │ │ │ │ │ ├── Cwise_inverse.cpp
│ │ │ │ │ │ ├── Cwise_isFinite.cpp
│ │ │ │ │ │ ├── Cwise_isInf.cpp
│ │ │ │ │ │ ├── Cwise_isNaN.cpp
│ │ │ │ │ │ ├── Cwise_less.cpp
│ │ │ │ │ │ ├── Cwise_less_equal.cpp
│ │ │ │ │ │ ├── Cwise_log.cpp
│ │ │ │ │ │ ├── Cwise_log10.cpp
│ │ │ │ │ │ ├── Cwise_max.cpp
│ │ │ │ │ │ ├── Cwise_min.cpp
│ │ │ │ │ │ ├── Cwise_minus.cpp
│ │ │ │ │ │ ├── Cwise_minus_equal.cpp
│ │ │ │ │ │ ├── Cwise_not_equal.cpp
│ │ │ │ │ │ ├── Cwise_plus.cpp
│ │ │ │ │ │ ├── Cwise_plus_equal.cpp
│ │ │ │ │ │ ├── Cwise_pow.cpp
│ │ │ │ │ │ ├── Cwise_product.cpp
│ │ │ │ │ │ ├── Cwise_quotient.cpp
│ │ │ │ │ │ ├── Cwise_rint.cpp
│ │ │ │ │ │ ├── Cwise_round.cpp
│ │ │ │ │ │ ├── Cwise_scalar_power_array.cpp
│ │ │ │ │ │ ├── Cwise_sign.cpp
│ │ │ │ │ │ ├── Cwise_sin.cpp
│ │ │ │ │ │ ├── Cwise_sinh.cpp
│ │ │ │ │ │ ├── Cwise_slash_equal.cpp
│ │ │ │ │ │ ├── Cwise_sqrt.cpp
│ │ │ │ │ │ ├── Cwise_square.cpp
│ │ │ │ │ │ ├── Cwise_tan.cpp
│ │ │ │ │ │ ├── Cwise_tanh.cpp
│ │ │ │ │ │ ├── Cwise_times_equal.cpp
│ │ │ │ │ │ ├── DenseBase_LinSpaced.cpp
│ │ │ │ │ │ ├── DenseBase_LinSpacedInt.cpp
│ │ │ │ │ │ ├── DenseBase_LinSpaced_seq_deprecated.cpp
│ │ │ │ │ │ ├── DenseBase_setLinSpaced.cpp
│ │ │ │ │ │ ├── DirectionWise_hnormalized.cpp
│ │ │ │ │ │ ├── DirectionWise_replicate.cpp
│ │ │ │ │ │ ├── DirectionWise_replicate_int.cpp
│ │ │ │ │ │ ├── EigenSolver_EigenSolver_MatrixType.cpp
│ │ │ │ │ │ ├── EigenSolver_compute.cpp
│ │ │ │ │ │ ├── EigenSolver_eigenvalues.cpp
│ │ │ │ │ │ ├── EigenSolver_eigenvectors.cpp
│ │ │ │ │ │ ├── EigenSolver_pseudoEigenvectors.cpp
│ │ │ │ │ │ ├── FullPivHouseholderQR_solve.cpp
│ │ │ │ │ │ ├── FullPivLU_image.cpp
│ │ │ │ │ │ ├── FullPivLU_kernel.cpp
│ │ │ │ │ │ ├── FullPivLU_solve.cpp
│ │ │ │ │ │ ├── GeneralizedEigenSolver.cpp
│ │ │ │ │ │ ├── HessenbergDecomposition_compute.cpp
│ │ │ │ │ │ ├── HessenbergDecomposition_matrixH.cpp
│ │ │ │ │ │ ├── HessenbergDecomposition_packedMatrix.cpp
│ │ │ │ │ │ ├── HouseholderQR_householderQ.cpp
│ │ │ │ │ │ ├── HouseholderQR_solve.cpp
│ │ │ │ │ │ ├── HouseholderSequence_HouseholderSequence.cpp
│ │ │ │ │ │ ├── IOFormat.cpp
│ │ │ │ │ │ ├── JacobiSVD_basic.cpp
│ │ │ │ │ │ ├── Jacobi_makeGivens.cpp
│ │ │ │ │ │ ├── Jacobi_makeJacobi.cpp
│ │ │ │ │ │ ├── LLT_example.cpp
│ │ │ │ │ │ ├── LLT_solve.cpp
│ │ │ │ │ │ ├── LeastSquaresNormalEquations.cpp
│ │ │ │ │ │ ├── LeastSquaresQR.cpp
│ │ │ │ │ │ ├── Map_general_stride.cpp
│ │ │ │ │ │ ├── Map_inner_stride.cpp
│ │ │ │ │ │ ├── Map_outer_stride.cpp
│ │ │ │ │ │ ├── Map_placement_new.cpp
│ │ │ │ │ │ ├── Map_simple.cpp
│ │ │ │ │ │ ├── MatrixBase_adjoint.cpp
│ │ │ │ │ │ ├── MatrixBase_all.cpp
│ │ │ │ │ │ ├── MatrixBase_applyOnTheLeft.cpp
│ │ │ │ │ │ ├── MatrixBase_applyOnTheRight.cpp
│ │ │ │ │ │ ├── MatrixBase_array.cpp
│ │ │ │ │ │ ├── MatrixBase_array_const.cpp
│ │ │ │ │ │ ├── MatrixBase_asDiagonal.cpp
│ │ │ │ │ │ ├── MatrixBase_block_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_block_int_int_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_bottomLeftCorner_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_bottomRightCorner_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_bottomRows_int.cpp
│ │ │ │ │ │ ├── MatrixBase_cast.cpp
│ │ │ │ │ │ ├── MatrixBase_col.cpp
│ │ │ │ │ │ ├── MatrixBase_colwise.cpp
│ │ │ │ │ │ ├── MatrixBase_colwise_iterator_cxx11.cpp
│ │ │ │ │ │ ├── MatrixBase_computeInverseAndDetWithCheck.cpp
│ │ │ │ │ │ ├── MatrixBase_computeInverseWithCheck.cpp
│ │ │ │ │ │ ├── MatrixBase_cwiseAbs.cpp
│ │ │ │ │ │ ├── MatrixBase_cwiseAbs2.cpp
│ │ │ │ │ │ ├── MatrixBase_cwiseArg.cpp
│ │ │ │ │ │ ├── MatrixBase_cwiseEqual.cpp
│ │ │ │ │ │ ├── MatrixBase_cwiseInverse.cpp
│ │ │ │ │ │ ├── MatrixBase_cwiseMax.cpp
│ │ │ │ │ │ ├── MatrixBase_cwiseMin.cpp
│ │ │ │ │ │ ├── MatrixBase_cwiseNotEqual.cpp
│ │ │ │ │ │ ├── MatrixBase_cwiseProduct.cpp
│ │ │ │ │ │ ├── MatrixBase_cwiseQuotient.cpp
│ │ │ │ │ │ ├── MatrixBase_cwiseSign.cpp
│ │ │ │ │ │ ├── MatrixBase_cwiseSqrt.cpp
│ │ │ │ │ │ ├── MatrixBase_diagonal.cpp
│ │ │ │ │ │ ├── MatrixBase_diagonal_int.cpp
│ │ │ │ │ │ ├── MatrixBase_diagonal_template_int.cpp
│ │ │ │ │ │ ├── MatrixBase_eigenvalues.cpp
│ │ │ │ │ │ ├── MatrixBase_end_int.cpp
│ │ │ │ │ │ ├── MatrixBase_eval.cpp
│ │ │ │ │ │ ├── MatrixBase_fixedBlock_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_hnormalized.cpp
│ │ │ │ │ │ ├── MatrixBase_homogeneous.cpp
│ │ │ │ │ │ ├── MatrixBase_identity.cpp
│ │ │ │ │ │ ├── MatrixBase_identity_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_inverse.cpp
│ │ │ │ │ │ ├── MatrixBase_isDiagonal.cpp
│ │ │ │ │ │ ├── MatrixBase_isIdentity.cpp
│ │ │ │ │ │ ├── MatrixBase_isOnes.cpp
│ │ │ │ │ │ ├── MatrixBase_isOrthogonal.cpp
│ │ │ │ │ │ ├── MatrixBase_isUnitary.cpp
│ │ │ │ │ │ ├── MatrixBase_isZero.cpp
│ │ │ │ │ │ ├── MatrixBase_leftCols_int.cpp
│ │ │ │ │ │ ├── MatrixBase_noalias.cpp
│ │ │ │ │ │ ├── MatrixBase_ones.cpp
│ │ │ │ │ │ ├── MatrixBase_ones_int.cpp
│ │ │ │ │ │ ├── MatrixBase_ones_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_operatorNorm.cpp
│ │ │ │ │ │ ├── MatrixBase_prod.cpp
│ │ │ │ │ │ ├── MatrixBase_random.cpp
│ │ │ │ │ │ ├── MatrixBase_random_int.cpp
│ │ │ │ │ │ ├── MatrixBase_random_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_replicate.cpp
│ │ │ │ │ │ ├── MatrixBase_replicate_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_reshaped_auto.cpp
│ │ │ │ │ │ ├── MatrixBase_reshaped_fixed.cpp
│ │ │ │ │ │ ├── MatrixBase_reshaped_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_reshaped_to_vector.cpp
│ │ │ │ │ │ ├── MatrixBase_reverse.cpp
│ │ │ │ │ │ ├── MatrixBase_rightCols_int.cpp
│ │ │ │ │ │ ├── MatrixBase_row.cpp
│ │ │ │ │ │ ├── MatrixBase_rowwise.cpp
│ │ │ │ │ │ ├── MatrixBase_segment_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_select.cpp
│ │ │ │ │ │ ├── MatrixBase_selfadjointView.cpp
│ │ │ │ │ │ ├── MatrixBase_set.cpp
│ │ │ │ │ │ ├── MatrixBase_setIdentity.cpp
│ │ │ │ │ │ ├── MatrixBase_setOnes.cpp
│ │ │ │ │ │ ├── MatrixBase_setRandom.cpp
│ │ │ │ │ │ ├── MatrixBase_setZero.cpp
│ │ │ │ │ │ ├── MatrixBase_start_int.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_bottomRows.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_end.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_int_block_int_int_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_int_bottomLeftCorner.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_int_bottomLeftCorner_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_int_bottomRightCorner.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_int_bottomRightCorner_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_int_topLeftCorner.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_int_topLeftCorner_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_int_topRightCorner.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_int_topRightCorner_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_leftCols.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_rightCols.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_segment.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_start.cpp
│ │ │ │ │ │ ├── MatrixBase_template_int_topRows.cpp
│ │ │ │ │ │ ├── MatrixBase_topLeftCorner_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_topRightCorner_int_int.cpp
│ │ │ │ │ │ ├── MatrixBase_topRows_int.cpp
│ │ │ │ │ │ ├── MatrixBase_transpose.cpp
│ │ │ │ │ │ ├── MatrixBase_triangularView.cpp
│ │ │ │ │ │ ├── MatrixBase_zero.cpp
│ │ │ │ │ │ ├── MatrixBase_zero_int.cpp
│ │ │ │ │ │ ├── MatrixBase_zero_int_int.cpp
│ │ │ │ │ │ ├── Matrix_Map_stride.cpp
│ │ │ │ │ │ ├── Matrix_initializer_list_23_cxx11.cpp
│ │ │ │ │ │ ├── Matrix_initializer_list_vector_cxx11.cpp
│ │ │ │ │ │ ├── Matrix_resize_NoChange_int.cpp
│ │ │ │ │ │ ├── Matrix_resize_int.cpp
│ │ │ │ │ │ ├── Matrix_resize_int_NoChange.cpp
│ │ │ │ │ │ ├── Matrix_resize_int_int.cpp
│ │ │ │ │ │ ├── Matrix_setConstant_int.cpp
│ │ │ │ │ │ ├── Matrix_setConstant_int_int.cpp
│ │ │ │ │ │ ├── Matrix_setIdentity_int_int.cpp
│ │ │ │ │ │ ├── Matrix_setOnes_int.cpp
│ │ │ │ │ │ ├── Matrix_setOnes_int_int.cpp
│ │ │ │ │ │ ├── Matrix_setRandom_int.cpp
│ │ │ │ │ │ ├── Matrix_setRandom_int_int.cpp
│ │ │ │ │ │ ├── Matrix_setZero_int.cpp
│ │ │ │ │ │ ├── Matrix_setZero_int_int.cpp
│ │ │ │ │ │ ├── Matrix_variadic_ctor_cxx11.cpp
│ │ │ │ │ │ ├── PartialPivLU_solve.cpp
│ │ │ │ │ │ ├── PartialRedux_count.cpp
│ │ │ │ │ │ ├── PartialRedux_maxCoeff.cpp
│ │ │ │ │ │ ├── PartialRedux_minCoeff.cpp
│ │ │ │ │ │ ├── PartialRedux_norm.cpp
│ │ │ │ │ │ ├── PartialRedux_prod.cpp
│ │ │ │ │ │ ├── PartialRedux_squaredNorm.cpp
│ │ │ │ │ │ ├── PartialRedux_sum.cpp
│ │ │ │ │ │ ├── RealQZ_compute.cpp
│ │ │ │ │ │ ├── RealSchur_RealSchur_MatrixType.cpp
│ │ │ │ │ │ ├── RealSchur_compute.cpp
│ │ │ │ │ │ ├── SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp
│ │ │ │ │ │ ├── SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp
│ │ │ │ │ │ ├── SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp
│ │ │ │ │ │ ├── SelfAdjointEigenSolver_compute_MatrixType.cpp
│ │ │ │ │ │ ├── SelfAdjointEigenSolver_compute_MatrixType2.cpp
│ │ │ │ │ │ ├── SelfAdjointEigenSolver_eigenvalues.cpp
│ │ │ │ │ │ ├── SelfAdjointEigenSolver_eigenvectors.cpp
│ │ │ │ │ │ ├── SelfAdjointEigenSolver_operatorInverseSqrt.cpp
│ │ │ │ │ │ ├── SelfAdjointEigenSolver_operatorSqrt.cpp
│ │ │ │ │ │ ├── SelfAdjointView_eigenvalues.cpp
│ │ │ │ │ │ ├── SelfAdjointView_operatorNorm.cpp
│ │ │ │ │ │ ├── Slicing_arrayexpr.cpp
│ │ │ │ │ │ ├── Slicing_custom_padding_cxx11.cpp
│ │ │ │ │ │ ├── Slicing_rawarray_cxx11.cpp
│ │ │ │ │ │ ├── Slicing_stdvector_cxx11.cpp
│ │ │ │ │ │ ├── SparseMatrix_coeffs.cpp
│ │ │ │ │ │ ├── TopicAliasing_block.cpp
│ │ │ │ │ │ ├── TopicAliasing_block_correct.cpp
│ │ │ │ │ │ ├── TopicAliasing_cwise.cpp
│ │ │ │ │ │ ├── TopicAliasing_mult1.cpp
│ │ │ │ │ │ ├── TopicAliasing_mult2.cpp
│ │ │ │ │ │ ├── TopicAliasing_mult3.cpp
│ │ │ │ │ │ ├── TopicAliasing_mult4.cpp
│ │ │ │ │ │ ├── TopicAliasing_mult5.cpp
│ │ │ │ │ │ ├── TopicStorageOrders_example.cpp
│ │ │ │ │ │ ├── Triangular_solve.cpp
│ │ │ │ │ │ ├── Tridiagonalization_Tridiagonalization_MatrixType.cpp
│ │ │ │ │ │ ├── Tridiagonalization_compute.cpp
│ │ │ │ │ │ ├── Tridiagonalization_decomposeInPlace.cpp
│ │ │ │ │ │ ├── Tridiagonalization_diagonal.cpp
│ │ │ │ │ │ ├── Tridiagonalization_householderCoefficients.cpp
│ │ │ │ │ │ ├── Tridiagonalization_packedMatrix.cpp
│ │ │ │ │ │ ├── Tutorial_AdvancedInitialization_Block.cpp
│ │ │ │ │ │ ├── Tutorial_AdvancedInitialization_CommaTemporary.cpp
│ │ │ │ │ │ ├── Tutorial_AdvancedInitialization_Join.cpp
│ │ │ │ │ │ ├── Tutorial_AdvancedInitialization_LinSpaced.cpp
│ │ │ │ │ │ ├── Tutorial_AdvancedInitialization_ThreeWays.cpp
│ │ │ │ │ │ ├── Tutorial_AdvancedInitialization_Zero.cpp
│ │ │ │ │ │ ├── Tutorial_Map_rowmajor.cpp
│ │ │ │ │ │ ├── Tutorial_Map_using.cpp
│ │ │ │ │ │ ├── Tutorial_ReshapeMat2Mat.cpp
│ │ │ │ │ │ ├── Tutorial_ReshapeMat2Vec.cpp
│ │ │ │ │ │ ├── Tutorial_SlicingCol.cpp
│ │ │ │ │ │ ├── Tutorial_SlicingVec.cpp
│ │ │ │ │ │ ├── Tutorial_commainit_01.cpp
│ │ │ │ │ │ ├── Tutorial_commainit_01b.cpp
│ │ │ │ │ │ ├── Tutorial_commainit_02.cpp
│ │ │ │ │ │ ├── Tutorial_range_for_loop_1d_cxx11.cpp
│ │ │ │ │ │ ├── Tutorial_range_for_loop_2d_cxx11.cpp
│ │ │ │ │ │ ├── Tutorial_reshaped_vs_resize_1.cpp
│ │ │ │ │ │ ├── Tutorial_reshaped_vs_resize_2.cpp
│ │ │ │ │ │ ├── Tutorial_solve_matrix_inverse.cpp
│ │ │ │ │ │ ├── Tutorial_solve_multiple_rhs.cpp
│ │ │ │ │ │ ├── Tutorial_solve_reuse_decomposition.cpp
│ │ │ │ │ │ ├── Tutorial_solve_singular.cpp
│ │ │ │ │ │ ├── Tutorial_solve_triangular.cpp
│ │ │ │ │ │ ├── Tutorial_solve_triangular_inplace.cpp
│ │ │ │ │ │ ├── Tutorial_std_sort.cpp
│ │ │ │ │ │ ├── Tutorial_std_sort_rows_cxx11.cpp
│ │ │ │ │ │ ├── VectorwiseOp_homogeneous.cpp
│ │ │ │ │ │ ├── Vectorwise_reverse.cpp
│ │ │ │ │ │ ├── class_FullPivLU.cpp
│ │ │ │ │ │ ├── compile_snippet.cpp.in
│ │ │ │ │ │ ├── tut_arithmetic_redux_minmax.cpp
│ │ │ │ │ │ ├── tut_arithmetic_transpose_aliasing.cpp
│ │ │ │ │ │ ├── tut_arithmetic_transpose_conjugate.cpp
│ │ │ │ │ │ ├── tut_arithmetic_transpose_inplace.cpp
│ │ │ │ │ │ └── tut_matrix_assignment_resizing.cpp
│ │ │ │ │ ├── special_examples/
│ │ │ │ │ │ ├── Tutorial_sparse_example.cpp
│ │ │ │ │ │ ├── Tutorial_sparse_example_details.cpp
│ │ │ │ │ │ └── random_cpp11.cpp
│ │ │ │ │ └── tutorial.cpp
│ │ │ │ ├── eigen3.pc.in
│ │ │ │ ├── failtest/
│ │ │ │ │ ├── bdcsvd_int.cpp
│ │ │ │ │ ├── block_nonconst_ctor_on_const_xpr_0.cpp
│ │ │ │ │ ├── block_nonconst_ctor_on_const_xpr_1.cpp
│ │ │ │ │ ├── block_nonconst_ctor_on_const_xpr_2.cpp
│ │ │ │ │ ├── block_on_const_type_actually_const_0.cpp
│ │ │ │ │ ├── block_on_const_type_actually_const_1.cpp
│ │ │ │ │ ├── colpivqr_int.cpp
│ │ │ │ │ ├── const_qualified_block_method_retval_0.cpp
│ │ │ │ │ ├── const_qualified_block_method_retval_1.cpp
│ │ │ │ │ ├── const_qualified_diagonal_method_retval.cpp
│ │ │ │ │ ├── const_qualified_transpose_method_retval.cpp
│ │ │ │ │ ├── cwiseunaryview_nonconst_ctor_on_const_xpr.cpp
│ │ │ │ │ ├── cwiseunaryview_on_const_type_actually_const.cpp
│ │ │ │ │ ├── diagonal_nonconst_ctor_on_const_xpr.cpp
│ │ │ │ │ ├── diagonal_on_const_type_actually_const.cpp
│ │ │ │ │ ├── eigensolver_cplx.cpp
│ │ │ │ │ ├── eigensolver_int.cpp
│ │ │ │ │ ├── failtest_sanity_check.cpp
│ │ │ │ │ ├── fullpivlu_int.cpp
│ │ │ │ │ ├── fullpivqr_int.cpp
│ │ │ │ │ ├── initializer_list_1.cpp
│ │ │ │ │ ├── initializer_list_2.cpp
│ │ │ │ │ ├── jacobisvd_int.cpp
│ │ │ │ │ ├── ldlt_int.cpp
│ │ │ │ │ ├── llt_int.cpp
│ │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_0.cpp
│ │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_1.cpp
│ │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_2.cpp
│ │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_3.cpp
│ │ │ │ │ ├── map_nonconst_ctor_on_const_ptr_4.cpp
│ │ │ │ │ ├── map_on_const_type_actually_const_0.cpp
│ │ │ │ │ ├── map_on_const_type_actually_const_1.cpp
│ │ │ │ │ ├── partialpivlu_int.cpp
│ │ │ │ │ ├── qr_int.cpp
│ │ │ │ │ ├── ref_1.cpp
│ │ │ │ │ ├── ref_2.cpp
│ │ │ │ │ ├── ref_3.cpp
│ │ │ │ │ ├── ref_4.cpp
│ │ │ │ │ ├── ref_5.cpp
│ │ │ │ │ ├── selfadjointview_nonconst_ctor_on_const_xpr.cpp
│ │ │ │ │ ├── selfadjointview_on_const_type_actually_const.cpp
│ │ │ │ │ ├── sparse_ref_1.cpp
│ │ │ │ │ ├── sparse_ref_2.cpp
│ │ │ │ │ ├── sparse_ref_3.cpp
│ │ │ │ │ ├── sparse_ref_4.cpp
│ │ │ │ │ ├── sparse_ref_5.cpp
│ │ │ │ │ ├── sparse_storage_mismatch.cpp
│ │ │ │ │ ├── swap_1.cpp
│ │ │ │ │ ├── swap_2.cpp
│ │ │ │ │ ├── ternary_1.cpp
│ │ │ │ │ ├── ternary_2.cpp
│ │ │ │ │ ├── transpose_nonconst_ctor_on_const_xpr.cpp
│ │ │ │ │ ├── transpose_on_const_type_actually_const.cpp
│ │ │ │ │ ├── triangularview_nonconst_ctor_on_const_xpr.cpp
│ │ │ │ │ └── triangularview_on_const_type_actually_const.cpp
│ │ │ │ ├── lapack/
│ │ │ │ │ ├── cholesky.cpp
│ │ │ │ │ ├── clacgv.f
│ │ │ │ │ ├── cladiv.f
│ │ │ │ │ ├── clarf.f
│ │ │ │ │ ├── clarfb.f
│ │ │ │ │ ├── clarfg.f
│ │ │ │ │ ├── clarft.f
│ │ │ │ │ ├── complex_double.cpp
│ │ │ │ │ ├── complex_single.cpp
│ │ │ │ │ ├── dladiv.f
│ │ │ │ │ ├── dlamch.f
│ │ │ │ │ ├── dlapy2.f
│ │ │ │ │ ├── dlapy3.f
│ │ │ │ │ ├── dlarf.f
│ │ │ │ │ ├── dlarfb.f
│ │ │ │ │ ├── dlarfg.f
│ │ │ │ │ ├── dlarft.f
│ │ │ │ │ ├── double.cpp
│ │ │ │ │ ├── dsecnd_NONE.f
│ │ │ │ │ ├── eigenvalues.cpp
│ │ │ │ │ ├── ilaclc.f
│ │ │ │ │ ├── ilaclr.f
│ │ │ │ │ ├── iladlc.f
│ │ │ │ │ ├── iladlr.f
│ │ │ │ │ ├── ilaslc.f
│ │ │ │ │ ├── ilaslr.f
│ │ │ │ │ ├── ilazlc.f
│ │ │ │ │ ├── ilazlr.f
│ │ │ │ │ ├── lapack_common.h
│ │ │ │ │ ├── lu.cpp
│ │ │ │ │ ├── second_NONE.f
│ │ │ │ │ ├── single.cpp
│ │ │ │ │ ├── sladiv.f
│ │ │ │ │ ├── slamch.f
│ │ │ │ │ ├── slapy2.f
│ │ │ │ │ ├── slapy3.f
│ │ │ │ │ ├── slarf.f
│ │ │ │ │ ├── slarfb.f
│ │ │ │ │ ├── slarfg.f
│ │ │ │ │ ├── slarft.f
│ │ │ │ │ ├── svd.cpp
│ │ │ │ │ ├── zlacgv.f
│ │ │ │ │ ├── zladiv.f
│ │ │ │ │ ├── zlarf.f
│ │ │ │ │ ├── zlarfb.f
│ │ │ │ │ ├── zlarfg.f
│ │ │ │ │ └── zlarft.f
│ │ │ │ ├── scripts/
│ │ │ │ │ ├── cdashtesting.cmake.in
│ │ │ │ │ ├── check.in
│ │ │ │ │ ├── debug.in
│ │ │ │ │ ├── eigen_gen_credits.cpp
│ │ │ │ │ ├── eigen_gen_docs
│ │ │ │ │ ├── eigen_gen_split_test_help.cmake
│ │ │ │ │ ├── eigen_monitor_perf.sh
│ │ │ │ │ ├── release.in
│ │ │ │ │ └── relicense.py
│ │ │ │ ├── signature_of_eigen3_matrix_library
│ │ │ │ ├── test/
│ │ │ │ │ ├── AnnoyingScalar.h
│ │ │ │ │ ├── MovableScalar.h
│ │ │ │ │ ├── OffByOneScalar.h
│ │ │ │ │ ├── SafeScalar.h
│ │ │ │ │ ├── adjoint.cpp
│ │ │ │ │ ├── array_cwise.cpp
│ │ │ │ │ ├── array_for_matrix.cpp
│ │ │ │ │ ├── array_of_string.cpp
│ │ │ │ │ ├── array_replicate.cpp
│ │ │ │ │ ├── array_reverse.cpp
│ │ │ │ │ ├── bandmatrix.cpp
│ │ │ │ │ ├── basicstuff.cpp
│ │ │ │ │ ├── bdcsvd.cpp
│ │ │ │ │ ├── bfloat16_float.cpp
│ │ │ │ │ ├── bicgstab.cpp
│ │ │ │ │ ├── blasutil.cpp
│ │ │ │ │ ├── block.cpp
│ │ │ │ │ ├── boostmultiprec.cpp
│ │ │ │ │ ├── bug1213.cpp
│ │ │ │ │ ├── bug1213.h
│ │ │ │ │ ├── bug1213_main.cpp
│ │ │ │ │ ├── cholesky.cpp
│ │ │ │ │ ├── cholmod_support.cpp
│ │ │ │ │ ├── commainitializer.cpp
│ │ │ │ │ ├── conjugate_gradient.cpp
│ │ │ │ │ ├── conservative_resize.cpp
│ │ │ │ │ ├── constructor.cpp
│ │ │ │ │ ├── corners.cpp
│ │ │ │ │ ├── ctorleak.cpp
│ │ │ │ │ ├── denseLM.cpp
│ │ │ │ │ ├── dense_storage.cpp
│ │ │ │ │ ├── determinant.cpp
│ │ │ │ │ ├── diagonal.cpp
│ │ │ │ │ ├── diagonal_matrix_variadic_ctor.cpp
│ │ │ │ │ ├── diagonalmatrices.cpp
│ │ │ │ │ ├── dontalign.cpp
│ │ │ │ │ ├── dynalloc.cpp
│ │ │ │ │ ├── eigen2support.cpp
│ │ │ │ │ ├── eigensolver_complex.cpp
│ │ │ │ │ ├── eigensolver_generalized_real.cpp
│ │ │ │ │ ├── eigensolver_generic.cpp
│ │ │ │ │ ├── eigensolver_selfadjoint.cpp
│ │ │ │ │ ├── evaluator_common.h
│ │ │ │ │ ├── evaluators.cpp
│ │ │ │ │ ├── exceptions.cpp
│ │ │ │ │ ├── fastmath.cpp
│ │ │ │ │ ├── first_aligned.cpp
│ │ │ │ │ ├── geo_alignedbox.cpp
│ │ │ │ │ ├── geo_eulerangles.cpp
│ │ │ │ │ ├── geo_homogeneous.cpp
│ │ │ │ │ ├── geo_hyperplane.cpp
│ │ │ │ │ ├── geo_orthomethods.cpp
│ │ │ │ │ ├── geo_parametrizedline.cpp
│ │ │ │ │ ├── geo_quaternion.cpp
│ │ │ │ │ ├── geo_transformations.cpp
│ │ │ │ │ ├── gpu_basic.cu
│ │ │ │ │ ├── gpu_common.h
│ │ │ │ │ ├── gpu_example.cu
│ │ │ │ │ ├── gpu_test_helper.h
│ │ │ │ │ ├── half_float.cpp
│ │ │ │ │ ├── hessenberg.cpp
│ │ │ │ │ ├── householder.cpp
│ │ │ │ │ ├── incomplete_cholesky.cpp
│ │ │ │ │ ├── indexed_view.cpp
│ │ │ │ │ ├── initializer_list_construction.cpp
│ │ │ │ │ ├── inplace_decomposition.cpp
│ │ │ │ │ ├── integer_types.cpp
│ │ │ │ │ ├── inverse.cpp
│ │ │ │ │ ├── io.cpp
│ │ │ │ │ ├── is_same_dense.cpp
│ │ │ │ │ ├── jacobi.cpp
│ │ │ │ │ ├── jacobisvd.cpp
│ │ │ │ │ ├── klu_support.cpp
│ │ │ │ │ ├── linearstructure.cpp
│ │ │ │ │ ├── lscg.cpp
│ │ │ │ │ ├── lu.cpp
│ │ │ │ │ ├── main.h
│ │ │ │ │ ├── mapped_matrix.cpp
│ │ │ │ │ ├── mapstaticmethods.cpp
│ │ │ │ │ ├── mapstride.cpp
│ │ │ │ │ ├── meta.cpp
│ │ │ │ │ ├── metis_support.cpp
│ │ │ │ │ ├── miscmatrices.cpp
│ │ │ │ │ ├── mixingtypes.cpp
│ │ │ │ │ ├── mpl2only.cpp
│ │ │ │ │ ├── nestbyvalue.cpp
│ │ │ │ │ ├── nesting_ops.cpp
│ │ │ │ │ ├── nomalloc.cpp
│ │ │ │ │ ├── nullary.cpp
│ │ │ │ │ ├── num_dimensions.cpp
│ │ │ │ │ ├── numext.cpp
│ │ │ │ │ ├── packetmath.cpp
│ │ │ │ │ ├── packetmath_test_shared.h
│ │ │ │ │ ├── pardiso_support.cpp
│ │ │ │ │ ├── pastix_support.cpp
│ │ │ │ │ ├── permutationmatrices.cpp
│ │ │ │ │ ├── prec_inverse_4x4.cpp
│ │ │ │ │ ├── product.h
│ │ │ │ │ ├── product_extra.cpp
│ │ │ │ │ ├── product_large.cpp
│ │ │ │ │ ├── product_mmtr.cpp
│ │ │ │ │ ├── product_notemporary.cpp
│ │ │ │ │ ├── product_selfadjoint.cpp
│ │ │ │ │ ├── product_small.cpp
│ │ │ │ │ ├── product_symm.cpp
│ │ │ │ │ ├── product_syrk.cpp
│ │ │ │ │ ├── product_trmm.cpp
│ │ │ │ │ ├── product_trmv.cpp
│ │ │ │ │ ├── product_trsolve.cpp
│ │ │ │ │ ├── qr.cpp
│ │ │ │ │ ├── qr_colpivoting.cpp
│ │ │ │ │ ├── qr_fullpivoting.cpp
│ │ │ │ │ ├── qtvector.cpp
│ │ │ │ │ ├── rand.cpp
│ │ │ │ │ ├── random_matrix.cpp
│ │ │ │ │ ├── random_matrix_helper.h
│ │ │ │ │ ├── random_without_cast_overflow.h
│ │ │ │ │ ├── real_qz.cpp
│ │ │ │ │ ├── redux.cpp
│ │ │ │ │ ├── ref.cpp
│ │ │ │ │ ├── reshape.cpp
│ │ │ │ │ ├── resize.cpp
│ │ │ │ │ ├── rvalue_types.cpp
│ │ │ │ │ ├── schur_complex.cpp
│ │ │ │ │ ├── schur_real.cpp
│ │ │ │ │ ├── selfadjoint.cpp
│ │ │ │ │ ├── serializer.cpp
│ │ │ │ │ ├── simplicial_cholesky.cpp
│ │ │ │ │ ├── sizeof.cpp
│ │ │ │ │ ├── sizeoverflow.cpp
│ │ │ │ │ ├── smallvectors.cpp
│ │ │ │ │ ├── solverbase.h
│ │ │ │ │ ├── sparse.h
│ │ │ │ │ ├── sparseLM.cpp
│ │ │ │ │ ├── sparse_basic.cpp
│ │ │ │ │ ├── sparse_block.cpp
│ │ │ │ │ ├── sparse_permutations.cpp
│ │ │ │ │ ├── sparse_product.cpp
│ │ │ │ │ ├── sparse_ref.cpp
│ │ │ │ │ ├── sparse_solver.h
│ │ │ │ │ ├── sparse_solvers.cpp
│ │ │ │ │ ├── sparse_vector.cpp
│ │ │ │ │ ├── sparselu.cpp
│ │ │ │ │ ├── sparseqr.cpp
│ │ │ │ │ ├── special_numbers.cpp
│ │ │ │ │ ├── split_test_helper.h
│ │ │ │ │ ├── spqr_support.cpp
│ │ │ │ │ ├── stable_norm.cpp
│ │ │ │ │ ├── stddeque.cpp
│ │ │ │ │ ├── stddeque_overload.cpp
│ │ │ │ │ ├── stdlist.cpp
│ │ │ │ │ ├── stdlist_overload.cpp
│ │ │ │ │ ├── stdvector.cpp
│ │ │ │ │ ├── stdvector_overload.cpp
│ │ │ │ │ ├── stl_iterators.cpp
│ │ │ │ │ ├── superlu_support.cpp
│ │ │ │ │ ├── svd_common.h
│ │ │ │ │ ├── svd_fill.h
│ │ │ │ │ ├── swap.cpp
│ │ │ │ │ ├── symbolic_index.cpp
│ │ │ │ │ ├── triangular.cpp
│ │ │ │ │ ├── tuple_test.cpp
│ │ │ │ │ ├── type_alias.cpp
│ │ │ │ │ ├── umeyama.cpp
│ │ │ │ │ ├── umfpack_support.cpp
│ │ │ │ │ ├── unalignedcount.cpp
│ │ │ │ │ ├── upperbidiagonalization.cpp
│ │ │ │ │ ├── vectorization_logic.cpp
│ │ │ │ │ ├── vectorwiseop.cpp
│ │ │ │ │ ├── visitor.cpp
│ │ │ │ │ └── zerosized.cpp
│ │ │ │ └── unsupported/
│ │ │ │ ├── Eigen/
│ │ │ │ │ ├── AdolcForward
│ │ │ │ │ ├── AlignedVector3
│ │ │ │ │ ├── ArpackSupport
│ │ │ │ │ ├── AutoDiff
│ │ │ │ │ ├── BVH
│ │ │ │ │ ├── CXX11/
│ │ │ │ │ │ ├── Tensor
│ │ │ │ │ │ ├── TensorSymmetry
│ │ │ │ │ │ ├── ThreadPool
│ │ │ │ │ │ └── src/
│ │ │ │ │ │ ├── Tensor/
│ │ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ │ ├── README.md
│ │ │ │ │ │ │ ├── Tensor.h
│ │ │ │ │ │ │ ├── TensorArgMax.h
│ │ │ │ │ │ │ ├── TensorAssign.h
│ │ │ │ │ │ │ ├── TensorBase.h
│ │ │ │ │ │ │ ├── TensorBlock.h
│ │ │ │ │ │ │ ├── TensorBroadcasting.h
│ │ │ │ │ │ │ ├── TensorChipping.h
│ │ │ │ │ │ │ ├── TensorConcatenation.h
│ │ │ │ │ │ │ ├── TensorContraction.h
│ │ │ │ │ │ │ ├── TensorContractionBlocking.h
│ │ │ │ │ │ │ ├── TensorContractionCuda.h
│ │ │ │ │ │ │ ├── TensorContractionGpu.h
│ │ │ │ │ │ │ ├── TensorContractionMapper.h
│ │ │ │ │ │ │ ├── TensorContractionSycl.h
│ │ │ │ │ │ │ ├── TensorContractionThreadPool.h
│ │ │ │ │ │ │ ├── TensorConversion.h
│ │ │ │ │ │ │ ├── TensorConvolution.h
│ │ │ │ │ │ │ ├── TensorConvolutionSycl.h
│ │ │ │ │ │ │ ├── TensorCostModel.h
│ │ │ │ │ │ │ ├── TensorCustomOp.h
│ │ │ │ │ │ │ ├── TensorDevice.h
│ │ │ │ │ │ │ ├── TensorDeviceCuda.h
│ │ │ │ │ │ │ ├── TensorDeviceDefault.h
│ │ │ │ │ │ │ ├── TensorDeviceGpu.h
│ │ │ │ │ │ │ ├── TensorDeviceSycl.h
│ │ │ │ │ │ │ ├── TensorDeviceThreadPool.h
│ │ │ │ │ │ │ ├── TensorDimensionList.h
│ │ │ │ │ │ │ ├── TensorDimensions.h
│ │ │ │ │ │ │ ├── TensorEvalTo.h
│ │ │ │ │ │ │ ├── TensorEvaluator.h
│ │ │ │ │ │ │ ├── TensorExecutor.h
│ │ │ │ │ │ │ ├── TensorExpr.h
│ │ │ │ │ │ │ ├── TensorFFT.h
│ │ │ │ │ │ │ ├── TensorFixedSize.h
│ │ │ │ │ │ │ ├── TensorForcedEval.h
│ │ │ │ │ │ │ ├── TensorForwardDeclarations.h
│ │ │ │ │ │ │ ├── TensorFunctors.h
│ │ │ │ │ │ │ ├── TensorGenerator.h
│ │ │ │ │ │ │ ├── TensorGlobalFunctions.h
│ │ │ │ │ │ │ ├── TensorGpuHipCudaDefines.h
│ │ │ │ │ │ │ ├── TensorGpuHipCudaUndefines.h
│ │ │ │ │ │ │ ├── TensorIO.h
│ │ │ │ │ │ │ ├── TensorImagePatch.h
│ │ │ │ │ │ │ ├── TensorIndexList.h
│ │ │ │ │ │ │ ├── TensorInflation.h
│ │ │ │ │ │ │ ├── TensorInitializer.h
│ │ │ │ │ │ │ ├── TensorIntDiv.h
│ │ │ │ │ │ │ ├── TensorLayoutSwap.h
│ │ │ │ │ │ │ ├── TensorMacros.h
│ │ │ │ │ │ │ ├── TensorMap.h
│ │ │ │ │ │ │ ├── TensorMeta.h
│ │ │ │ │ │ │ ├── TensorMorphing.h
│ │ │ │ │ │ │ ├── TensorPadding.h
│ │ │ │ │ │ │ ├── TensorPatch.h
│ │ │ │ │ │ │ ├── TensorRandom.h
│ │ │ │ │ │ │ ├── TensorReduction.h
│ │ │ │ │ │ │ ├── TensorReductionGpu.h
│ │ │ │ │ │ │ ├── TensorReductionSycl.h
│ │ │ │ │ │ │ ├── TensorRef.h
│ │ │ │ │ │ │ ├── TensorReverse.h
│ │ │ │ │ │ │ ├── TensorScan.h
│ │ │ │ │ │ │ ├── TensorScanSycl.h
│ │ │ │ │ │ │ ├── TensorShuffling.h
│ │ │ │ │ │ │ ├── TensorStorage.h
│ │ │ │ │ │ │ ├── TensorStriding.h
│ │ │ │ │ │ │ ├── TensorTrace.h
│ │ │ │ │ │ │ ├── TensorTraits.h
│ │ │ │ │ │ │ ├── TensorUInt128.h
│ │ │ │ │ │ │ └── TensorVolumePatch.h
│ │ │ │ │ │ ├── TensorSymmetry/
│ │ │ │ │ │ │ ├── DynamicSymmetry.h
│ │ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ │ ├── StaticSymmetry.h
│ │ │ │ │ │ │ ├── Symmetry.h
│ │ │ │ │ │ │ └── util/
│ │ │ │ │ │ │ └── TemplateGroupTheory.h
│ │ │ │ │ │ ├── ThreadPool/
│ │ │ │ │ │ │ ├── Barrier.h
│ │ │ │ │ │ │ ├── EventCount.h
│ │ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ │ ├── NonBlockingThreadPool.h
│ │ │ │ │ │ │ ├── RunQueue.h
│ │ │ │ │ │ │ ├── ThreadCancel.h
│ │ │ │ │ │ │ ├── ThreadEnvironment.h
│ │ │ │ │ │ │ ├── ThreadLocal.h
│ │ │ │ │ │ │ ├── ThreadPoolInterface.h
│ │ │ │ │ │ │ └── ThreadYield.h
│ │ │ │ │ │ └── util/
│ │ │ │ │ │ ├── CXX11Meta.h
│ │ │ │ │ │ ├── CXX11Workarounds.h
│ │ │ │ │ │ ├── EmulateArray.h
│ │ │ │ │ │ └── MaxSizeVector.h
│ │ │ │ │ ├── EulerAngles
│ │ │ │ │ ├── FFT
│ │ │ │ │ ├── IterativeSolvers
│ │ │ │ │ ├── KroneckerProduct
│ │ │ │ │ ├── LevenbergMarquardt
│ │ │ │ │ ├── MPRealSupport
│ │ │ │ │ ├── MatrixFunctions
│ │ │ │ │ ├── MoreVectorization
│ │ │ │ │ ├── NonLinearOptimization
│ │ │ │ │ ├── NumericalDiff
│ │ │ │ │ ├── OpenGLSupport
│ │ │ │ │ ├── Polynomials
│ │ │ │ │ ├── Skyline
│ │ │ │ │ ├── SparseExtra
│ │ │ │ │ ├── SpecialFunctions
│ │ │ │ │ ├── Splines
│ │ │ │ │ └── src/
│ │ │ │ │ ├── AutoDiff/
│ │ │ │ │ │ ├── AutoDiffJacobian.h
│ │ │ │ │ │ ├── AutoDiffScalar.h
│ │ │ │ │ │ ├── AutoDiffVector.h
│ │ │ │ │ │ └── InternalHeaderCheck.h
│ │ │ │ │ ├── BVH/
│ │ │ │ │ │ ├── BVAlgorithms.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── KdBVH.h
│ │ │ │ │ ├── Eigenvalues/
│ │ │ │ │ │ ├── ArpackSelfAdjointEigenSolver.h
│ │ │ │ │ │ └── InternalHeaderCheck.h
│ │ │ │ │ ├── EulerAngles/
│ │ │ │ │ │ ├── EulerAngles.h
│ │ │ │ │ │ ├── EulerSystem.h
│ │ │ │ │ │ └── InternalHeaderCheck.h
│ │ │ │ │ ├── FFT/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── ei_fftw_impl.h
│ │ │ │ │ │ └── ei_kissfft_impl.h
│ │ │ │ │ ├── IterativeSolvers/
│ │ │ │ │ │ ├── ConstrainedConjGrad.h
│ │ │ │ │ │ ├── DGMRES.h
│ │ │ │ │ │ ├── GMRES.h
│ │ │ │ │ │ ├── IDRS.h
│ │ │ │ │ │ ├── IncompleteLU.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── IterationController.h
│ │ │ │ │ │ ├── MINRES.h
│ │ │ │ │ │ └── Scaling.h
│ │ │ │ │ ├── KroneckerProduct/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── KroneckerTensorProduct.h
│ │ │ │ │ ├── LevenbergMarquardt/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── LMcovar.h
│ │ │ │ │ │ ├── LMonestep.h
│ │ │ │ │ │ ├── LMpar.h
│ │ │ │ │ │ ├── LMqrsolv.h
│ │ │ │ │ │ └── LevenbergMarquardt.h
│ │ │ │ │ ├── MatrixFunctions/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── MatrixExponential.h
│ │ │ │ │ │ ├── MatrixFunction.h
│ │ │ │ │ │ ├── MatrixLogarithm.h
│ │ │ │ │ │ ├── MatrixPower.h
│ │ │ │ │ │ ├── MatrixSquareRoot.h
│ │ │ │ │ │ └── StemFunction.h
│ │ │ │ │ ├── MoreVectorization/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── MathFunctions.h
│ │ │ │ │ ├── NonLinearOptimization/
│ │ │ │ │ │ ├── HybridNonLinearSolver.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── LevenbergMarquardt.h
│ │ │ │ │ │ ├── chkder.h
│ │ │ │ │ │ ├── covar.h
│ │ │ │ │ │ ├── dogleg.h
│ │ │ │ │ │ ├── fdjac1.h
│ │ │ │ │ │ ├── lmpar.h
│ │ │ │ │ │ ├── qrsolv.h
│ │ │ │ │ │ ├── r1mpyq.h
│ │ │ │ │ │ ├── r1updt.h
│ │ │ │ │ │ └── rwupdt.h
│ │ │ │ │ ├── NumericalDiff/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ └── NumericalDiff.h
│ │ │ │ │ ├── Polynomials/
│ │ │ │ │ │ ├── Companion.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── PolynomialSolver.h
│ │ │ │ │ │ └── PolynomialUtils.h
│ │ │ │ │ ├── Skyline/
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── SkylineInplaceLU.h
│ │ │ │ │ │ ├── SkylineMatrix.h
│ │ │ │ │ │ ├── SkylineMatrixBase.h
│ │ │ │ │ │ ├── SkylineProduct.h
│ │ │ │ │ │ ├── SkylineStorage.h
│ │ │ │ │ │ └── SkylineUtil.h
│ │ │ │ │ ├── SparseExtra/
│ │ │ │ │ │ ├── BlockSparseMatrix.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── MarketIO.h
│ │ │ │ │ │ ├── MatrixMarketIterator.h
│ │ │ │ │ │ └── RandomSetter.h
│ │ │ │ │ ├── SpecialFunctions/
│ │ │ │ │ │ ├── BesselFunctionsArrayAPI.h
│ │ │ │ │ │ ├── BesselFunctionsBFloat16.h
│ │ │ │ │ │ ├── BesselFunctionsFunctors.h
│ │ │ │ │ │ ├── BesselFunctionsHalf.h
│ │ │ │ │ │ ├── BesselFunctionsImpl.h
│ │ │ │ │ │ ├── BesselFunctionsPacketMath.h
│ │ │ │ │ │ ├── HipVectorCompatibility.h
│ │ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ │ ├── SpecialFunctionsArrayAPI.h
│ │ │ │ │ │ ├── SpecialFunctionsBFloat16.h
│ │ │ │ │ │ ├── SpecialFunctionsFunctors.h
│ │ │ │ │ │ ├── SpecialFunctionsHalf.h
│ │ │ │ │ │ ├── SpecialFunctionsImpl.h
│ │ │ │ │ │ ├── SpecialFunctionsPacketMath.h
│ │ │ │ │ │ └── arch/
│ │ │ │ │ │ ├── AVX/
│ │ │ │ │ │ │ ├── BesselFunctions.h
│ │ │ │ │ │ │ └── SpecialFunctions.h
│ │ │ │ │ │ ├── AVX512/
│ │ │ │ │ │ │ ├── BesselFunctions.h
│ │ │ │ │ │ │ └── SpecialFunctions.h
│ │ │ │ │ │ ├── GPU/
│ │ │ │ │ │ │ └── SpecialFunctions.h
│ │ │ │ │ │ └── NEON/
│ │ │ │ │ │ ├── BesselFunctions.h
│ │ │ │ │ │ └── SpecialFunctions.h
│ │ │ │ │ └── Splines/
│ │ │ │ │ ├── InternalHeaderCheck.h
│ │ │ │ │ ├── Spline.h
│ │ │ │ │ ├── SplineFitting.h
│ │ │ │ │ └── SplineFwd.h
│ │ │ │ ├── bench/
│ │ │ │ │ └── bench_svd.cpp
│ │ │ │ ├── doc/
│ │ │ │ │ ├── Overview.dox
│ │ │ │ │ ├── SYCL.dox
│ │ │ │ │ ├── eigendoxy_layout.xml.in
│ │ │ │ │ └── examples/
│ │ │ │ │ ├── BVH_Example.cpp
│ │ │ │ │ ├── EulerAngles.cpp
│ │ │ │ │ ├── FFT.cpp
│ │ │ │ │ ├── MatrixExponential.cpp
│ │ │ │ │ ├── MatrixFunction.cpp
│ │ │ │ │ ├── MatrixLogarithm.cpp
│ │ │ │ │ ├── MatrixPower.cpp
│ │ │ │ │ ├── MatrixPower_optimal.cpp
│ │ │ │ │ ├── MatrixSine.cpp
│ │ │ │ │ ├── MatrixSinh.cpp
│ │ │ │ │ ├── MatrixSquareRoot.cpp
│ │ │ │ │ ├── PolynomialSolver1.cpp
│ │ │ │ │ ├── PolynomialUtils1.cpp
│ │ │ │ │ └── SYCL/
│ │ │ │ │ └── CwiseMul.cpp
│ │ │ │ └── test/
│ │ │ │ ├── BVH.cpp
│ │ │ │ ├── EulerAngles.cpp
│ │ │ │ ├── FFT.cpp
│ │ │ │ ├── FFTW.cpp
│ │ │ │ ├── NonLinearOptimization.cpp
│ │ │ │ ├── NumericalDiff.cpp
│ │ │ │ ├── alignedvector3.cpp
│ │ │ │ ├── autodiff.cpp
│ │ │ │ ├── autodiff_scalar.cpp
│ │ │ │ ├── bessel_functions.cpp
│ │ │ │ ├── cxx11_eventcount.cpp
│ │ │ │ ├── cxx11_maxsizevector.cpp
│ │ │ │ ├── cxx11_meta.cpp
│ │ │ │ ├── cxx11_non_blocking_thread_pool.cpp
│ │ │ │ ├── cxx11_runqueue.cpp
│ │ │ │ ├── cxx11_tensor_argmax.cpp
│ │ │ │ ├── cxx11_tensor_argmax_gpu.cu
│ │ │ │ ├── cxx11_tensor_argmax_sycl.cpp
│ │ │ │ ├── cxx11_tensor_assign.cpp
│ │ │ │ ├── cxx11_tensor_block_access.cpp
│ │ │ │ ├── cxx11_tensor_block_eval.cpp
│ │ │ │ ├── cxx11_tensor_block_io.cpp
│ │ │ │ ├── cxx11_tensor_broadcast_sycl.cpp
│ │ │ │ ├── cxx11_tensor_broadcasting.cpp
│ │ │ │ ├── cxx11_tensor_builtins_sycl.cpp
│ │ │ │ ├── cxx11_tensor_cast_float16_gpu.cu
│ │ │ │ ├── cxx11_tensor_casts.cpp
│ │ │ │ ├── cxx11_tensor_chipping.cpp
│ │ │ │ ├── cxx11_tensor_chipping_sycl.cpp
│ │ │ │ ├── cxx11_tensor_comparisons.cpp
│ │ │ │ ├── cxx11_tensor_complex_cwise_ops_gpu.cu
│ │ │ │ ├── cxx11_tensor_complex_gpu.cu
│ │ │ │ ├── cxx11_tensor_concatenation.cpp
│ │ │ │ ├── cxx11_tensor_concatenation_sycl.cpp
│ │ │ │ ├── cxx11_tensor_const.cpp
│ │ │ │ ├── cxx11_tensor_contract_gpu.cu
│ │ │ │ ├── cxx11_tensor_contract_sycl.cpp
│ │ │ │ ├── cxx11_tensor_contraction.cpp
│ │ │ │ ├── cxx11_tensor_convolution.cpp
│ │ │ │ ├── cxx11_tensor_convolution_sycl.cpp
│ │ │ │ ├── cxx11_tensor_custom_index.cpp
│ │ │ │ ├── cxx11_tensor_custom_op.cpp
│ │ │ │ ├── cxx11_tensor_custom_op_sycl.cpp
│ │ │ │ ├── cxx11_tensor_device.cu
│ │ │ │ ├── cxx11_tensor_device_sycl.cpp
│ │ │ │ ├── cxx11_tensor_dimension.cpp
│ │ │ │ ├── cxx11_tensor_empty.cpp
│ │ │ │ ├── cxx11_tensor_executor.cpp
│ │ │ │ ├── cxx11_tensor_expr.cpp
│ │ │ │ ├── cxx11_tensor_fft.cpp
│ │ │ │ ├── cxx11_tensor_fixed_size.cpp
│ │ │ │ ├── cxx11_tensor_forced_eval.cpp
│ │ │ │ ├── cxx11_tensor_forced_eval_sycl.cpp
│ │ │ │ ├── cxx11_tensor_generator.cpp
│ │ │ │ ├── cxx11_tensor_generator_sycl.cpp
│ │ │ │ ├── cxx11_tensor_gpu.cu
│ │ │ │ ├── cxx11_tensor_ifft.cpp
│ │ │ │ ├── cxx11_tensor_image_op_sycl.cpp
│ │ │ │ ├── cxx11_tensor_image_patch.cpp
│ │ │ │ ├── cxx11_tensor_image_patch_sycl.cpp
│ │ │ │ ├── cxx11_tensor_index_list.cpp
│ │ │ │ ├── cxx11_tensor_inflation.cpp
│ │ │ │ ├── cxx11_tensor_inflation_sycl.cpp
│ │ │ │ ├── cxx11_tensor_intdiv.cpp
│ │ │ │ ├── cxx11_tensor_io.cpp
│ │ │ │ ├── cxx11_tensor_layout_swap.cpp
│ │ │ │ ├── cxx11_tensor_layout_swap_sycl.cpp
│ │ │ │ ├── cxx11_tensor_lvalue.cpp
│ │ │ │ ├── cxx11_tensor_map.cpp
│ │ │ │ ├── cxx11_tensor_math.cpp
│ │ │ │ ├── cxx11_tensor_math_sycl.cpp
│ │ │ │ ├── cxx11_tensor_mixed_indices.cpp
│ │ │ │ ├── cxx11_tensor_morphing.cpp
│ │ │ │ ├── cxx11_tensor_morphing_sycl.cpp
│ │ │ │ ├── cxx11_tensor_move.cpp
│ │ │ │ ├── cxx11_tensor_notification.cpp
│ │ │ │ ├── cxx11_tensor_of_bfloat16_gpu.cu
│ │ │ │ ├── cxx11_tensor_of_complex.cpp
│ │ │ │ ├── cxx11_tensor_of_const_values.cpp
│ │ │ │ ├── cxx11_tensor_of_float16_gpu.cu
│ │ │ │ ├── cxx11_tensor_of_strings.cpp
│ │ │ │ ├── cxx11_tensor_padding.cpp
│ │ │ │ ├── cxx11_tensor_padding_sycl.cpp
│ │ │ │ ├── cxx11_tensor_patch.cpp
│ │ │ │ ├── cxx11_tensor_patch_sycl.cpp
│ │ │ │ ├── cxx11_tensor_random.cpp
│ │ │ │ ├── cxx11_tensor_random_gpu.cu
│ │ │ │ ├── cxx11_tensor_random_sycl.cpp
│ │ │ │ ├── cxx11_tensor_reduction.cpp
│ │ │ │ ├── cxx11_tensor_reduction_gpu.cu
│ │ │ │ ├── cxx11_tensor_reduction_sycl.cpp
│ │ │ │ ├── cxx11_tensor_ref.cpp
│ │ │ │ ├── cxx11_tensor_reverse.cpp
│ │ │ │ ├── cxx11_tensor_reverse_sycl.cpp
│ │ │ │ ├── cxx11_tensor_roundings.cpp
│ │ │ │ ├── cxx11_tensor_scan.cpp
│ │ │ │ ├── cxx11_tensor_scan_gpu.cu
│ │ │ │ ├── cxx11_tensor_scan_sycl.cpp
│ │ │ │ ├── cxx11_tensor_shuffling.cpp
│ │ │ │ ├── cxx11_tensor_shuffling_sycl.cpp
│ │ │ │ ├── cxx11_tensor_simple.cpp
│ │ │ │ ├── cxx11_tensor_striding.cpp
│ │ │ │ ├── cxx11_tensor_striding_sycl.cpp
│ │ │ │ ├── cxx11_tensor_sugar.cpp
│ │ │ │ ├── cxx11_tensor_sycl.cpp
│ │ │ │ ├── cxx11_tensor_symmetry.cpp
│ │ │ │ ├── cxx11_tensor_thread_local.cpp
│ │ │ │ ├── cxx11_tensor_thread_pool.cpp
│ │ │ │ ├── cxx11_tensor_trace.cpp
│ │ │ │ ├── cxx11_tensor_uint128.cpp
│ │ │ │ ├── cxx11_tensor_volume_patch.cpp
│ │ │ │ ├── cxx11_tensor_volume_patch_sycl.cpp
│ │ │ │ ├── dgmres.cpp
│ │ │ │ ├── forward_adolc.cpp
│ │ │ │ ├── gmres.cpp
│ │ │ │ ├── idrs.cpp
│ │ │ │ ├── kronecker_product.cpp
│ │ │ │ ├── levenberg_marquardt.cpp
│ │ │ │ ├── matrix_exponential.cpp
│ │ │ │ ├── matrix_function.cpp
│ │ │ │ ├── matrix_functions.h
│ │ │ │ ├── matrix_power.cpp
│ │ │ │ ├── matrix_square_root.cpp
│ │ │ │ ├── minres.cpp
│ │ │ │ ├── mpreal_support.cpp
│ │ │ │ ├── openglsupport.cpp
│ │ │ │ ├── polynomialsolver.cpp
│ │ │ │ ├── polynomialutils.cpp
│ │ │ │ ├── sparse_extra.cpp
│ │ │ │ ├── special_functions.cpp
│ │ │ │ ├── special_packetmath.cpp
│ │ │ │ └── splines.cpp
│ │ │ └── pcg32/
│ │ │ └── pcg32.h
│ │ ├── pybind_api.h
│ │ ├── ray_sampler_header.h
│ │ └── raymarch_shared.h
│ ├── setup.py
│ └── src/
│ ├── calc_rgb.cu
│ ├── compacted_coord.cu
│ ├── ema_grid_samples_nerf.cu
│ ├── generate_grid_samples_nerf_nonuniform.cu
│ ├── mark_untrained_density_grid.cu
│ ├── pybind_api.cu
│ ├── ray_sampler.cu
│ ├── splat_grid_samples_nerf_max_nearest_neighbor.cu
│ └── update_bitfield.cu
├── requirements.txt
├── run_nerf.py
├── setup.py
├── test/
│ ├── apis/
│ │ └── test_helper.py
│ ├── datasets/
│ │ ├── data/
│ │ │ └── nerf_synthetic/
│ │ │ └── lego/
│ │ │ ├── transforms_test.json
│ │ │ ├── transforms_train.json
│ │ │ └── transforms_val.json
│ │ ├── test_dataset.py
│ │ ├── test_load.py
│ │ └── test_pipeline.py
│ └── models/
│ ├── animatable_nerf/
│ │ ├── test_an_network.py
│ │ ├── test_an_render.py
│ │ ├── test_deform_mlps.py
│ │ └── test_human_mlps.py
│ ├── gnr/
│ │ ├── test_gnr_mlps.py
│ │ └── test_gnr_network.py
│ ├── hashnerf/
│ │ └── test_hashnerf_network.py
│ ├── mipnerf/
│ │ └── test_mipnerf_network.py
│ ├── nerf/
│ │ ├── test_nerf_embedder.py
│ │ ├── test_nerf_mlps.py
│ │ ├── test_nerf_network.py
│ │ └── test_nerf_render.py
│ └── neuralbody/
│ ├── test_nb_embedder.py
│ ├── test_nb_mlps.py
│ ├── test_nb_network.py
│ └── test_nb_render.py
├── tools/
│ └── convert_blender_data.py
├── train.sh
├── train_mvs.sh
└── xrnerf/
├── core/
│ ├── __init__.py
│ ├── apis/
│ │ ├── __init__.py
│ │ ├── api.py
│ │ ├── helper.py
│ │ ├── test.py
│ │ └── train.py
│ ├── hooks/
│ │ ├── __init__.py
│ │ ├── build_occupancy_tree_hook.py
│ │ ├── distill_cycle_hook.py
│ │ ├── hash_hook.py
│ │ ├── save_distill_results_hook.py
│ │ ├── test_hooks.py
│ │ ├── train_hooks.py
│ │ ├── utils.py
│ │ └── validation_hooks.py
│ └── runner/
│ ├── __init__.py
│ ├── base.py
│ ├── bungeenerf_runner.py
│ └── kilonerf_runner.py
├── datasets/
│ ├── __init__.py
│ ├── aninerf_dataset.py
│ ├── base.py
│ ├── builder.py
│ ├── bungee_dataset.py
│ ├── genebody_dataset.py
│ ├── hashnerf_dataset.py
│ ├── kilonerf_dataset.py
│ ├── kilonerf_node_dataset.py
│ ├── load_data/
│ │ ├── __init__.py
│ │ ├── get_rays.py
│ │ ├── load.py
│ │ ├── load_LINEMOD.py
│ │ ├── load_blender.py
│ │ ├── load_deepvoxels.py
│ │ ├── load_llff.py
│ │ ├── load_multiscale.py
│ │ ├── load_multiscale_google.py
│ │ └── load_nsvf_dataset.py
│ ├── mip_multiscale_dataset.py
│ ├── neuralbody_dataset.py
│ ├── pipelines/
│ │ ├── __init__.py
│ │ ├── augment.py
│ │ ├── compose.py
│ │ ├── create.py
│ │ └── transforms.py
│ ├── samplers/
│ │ ├── __init__.py
│ │ └── distributed_sampler.py
│ ├── scene_dataset.py
│ └── utils/
│ ├── __init__.py
│ ├── aninerf.py
│ ├── flatten.py
│ ├── genebody.py
│ ├── hashnerf.py
│ └── novel_view.py
├── models/
│ ├── __init__.py
│ ├── builder.py
│ ├── embedders/
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── bungee_embedder.py
│ │ ├── gnr_embedder.py
│ │ ├── kilonerf_fourier_embedder.py
│ │ ├── mipnerf_embedder.py
│ │ └── neuralbody_embedder.py
│ ├── mlps/
│ │ ├── __init__.py
│ │ ├── aninerf_mlp.py
│ │ ├── base.py
│ │ ├── bungeenerf_mlp.py
│ │ ├── gnr_mlp.py
│ │ ├── hashnerf_mlp.py
│ │ ├── kilonerf_mlp.py
│ │ ├── kilonerf_multinet.py
│ │ ├── multi_modules.py
│ │ ├── nb_mlp.py
│ │ └── nerf_mlp.py
│ ├── networks/
│ │ ├── __init__.py
│ │ ├── aninerf.py
│ │ ├── base.py
│ │ ├── bungeenerf.py
│ │ ├── gnr.py
│ │ ├── hashnerf.py
│ │ ├── kilonerf.py
│ │ ├── mipnerf.py
│ │ ├── nerf.py
│ │ ├── neuralbody.py
│ │ ├── student_nerf.py
│ │ └── utils/
│ │ ├── __init__.py
│ │ ├── aninerf.py
│ │ ├── batching.py
│ │ ├── gnr.py
│ │ ├── hierarchical_sample.py
│ │ ├── metrics.py
│ │ ├── mip.py
│ │ └── transforms.py
│ ├── renders/
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── bungeenerf_render.py
│ │ ├── gnr_render.py
│ │ ├── hashnerf_render.py
│ │ ├── kilonerf_simple_render.py
│ │ ├── mipnerf_render.py
│ │ └── nerf_render.py
│ └── samplers/
│ ├── __init__.py
│ ├── ngp_grid_sampler.py
│ └── utils/
│ ├── __init__.py
│ ├── compacted_coords.py
│ ├── ema_grid_samples_nerf.py
│ ├── generate_grid_samples_nerf_nonuniform.py
│ ├── mark_untrained_density_grid.py
│ ├── rays_sampler.py
│ ├── splat_grid_samples_nerf_max_nearest_neighbor.py
│ └── update_bitfield.py
└── utils/
├── __init__.py
├── data_helper.py
└── logger.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/build.yml
================================================
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: build
on:
push: # 触发条件之一为push到main分支,若改动仅存在于docs目录,或README.md文件,则忽略,避免触发。
branches:
- main
- alpha_test
paths-ignore:
- 'README.md'
- 'README_CN.md'
- 'docs/**'
pull_request: # 触发条件之一为该commit属于某个PR,忽略条件同上。
paths-ignore:
- 'README.md'
- 'README_CN.md'
- 'docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_test:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install Env
run: |
pip install coverage pytest
pip install torch==1.10.0
# pip install lpips trimesh smplx -i https://pypi.tuna.tsinghua.edu.cn/simple
# pip install torch numpy mmcv -i https://pypi.tuna.tsinghua.edu.cn/simple
# pip install opencv-python>=3 yapf imageio scikit-image -i https://pypi.tuna.tsinghua.edu.cn/simple
coverage run --source xrnerf/models -m pytest -s test/models
coverage xml
coverage report -m
- name: Upload coverage to Codecov # 上传覆盖率报告
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
================================================
FILE: .github/workflows/lint.yml
================================================
name: lint
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install pre-commit hook
run: |
sudo apt-add-repository ppa:brightbox/ruby-ng -y
sudo apt-get update
sudo apt-get install -y ruby2.7
pip install pre-commit
pre-commit install
- name: Linting
run: pre-commit run --files xrnerf/*
- name: Check docstring coverage
run: |
pip install interrogate
interrogate -vinmMI --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" -f 60 xrnerf/core
================================================
FILE: .gitignore
================================================
/__pycache__/
/data/
/scripts/
/work_dirs/
/build/
sftp-config.json
push.sh
*.pyc
*.log
*.egg
*.egg-info
*.so
*.o
*.mp4
/data/
.coverage
/.pytest_cache/
================================================
FILE: .pre-commit-config.yaml
================================================
exclude: ^tests/data/
repos:
- repo: https://github.com/pycqa/flake8.git
rev: 3.8.3
hooks:
- id: flake8
- repo: https://github.com/LOTEAT/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.30.0
hooks:
- id: yapf
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
hooks:
- id: trailing-whitespace
- id: check-yaml
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: double-quote-string-fixer
- id: check-merge-conflict
- id: fix-encoding-pragma
args: ["--remove"]
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/myint/docformatter
rev: v1.3.1
hooks:
- id: docformatter
args: ["--in-place", "--wrap-descriptions", "79"]
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
args: ["--skip", "*.ipynb,tools/data/hvu/label_map.json", "-L", "te,nd,thre,Gool,gool"]
- repo: https://github.com/open-mmlab/pre-commit-hooks
rev: v0.2.0 # Use the ref you want to point at
hooks:
- id: check-algo-readme
- id: check-copyright
args: ["mmaction", "tests", "demo", "tools"] # these directories will be checked
================================================
FILE: LICENSE
================================================
Copyright 2022 XRNerf Authors. All rights reserved.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2022 XRNerf Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
# XRNeRF
[](https://github.com/openxrlab/xrnerf/actions) [](https://github.com/openxrlab/xrnerf/blob/main/LICENSE)
## Introduction
English | [简体中文](README_CN.md)
XRNeRF is an open-source PyTorch-based codebase for Neural Radiance Field (NeRF). It is a part of the [OpenXRLab](https://github.com/orgs/openxrlab/repositories) project.
https://user-images.githubusercontent.com/24294293/187131048-5977c929-e136-4328-ad1f-7da8e7a566ff.mp4
This page provides basic tutorials about the usage of XRNeRF.
For installation instructions, please see [installation.md](docs/en/installation.md).
- [XRNeRF](#xrnerf)
- [Introduction](#introduction)
- [Benchmark](#benchmark)
- [Datasets](#datasets)
- [Installation](#installation)
- [Build a Model](#build-a-model)
- [Basic Concepts](#basic-concepts)
- [Write a new network](#write-a-new-network)
- [Train a Model](#train-a-model)
- [Iteration Controls](#iteration-controls)
- [Train](#train)
- [Test](#test)
- [Tutorials](#tutorials)
- [Other Documents](#other-documents)
- [Citation](#citation)
- [License](#license)
- [Contributing](#contributing)
- [Acknowledgement](#acknowledgement)
- [Projects in OpenXRLab](#projects-in-openxrlab)
## Benchmark
More details can be found in [benchmark.md](docs/en/benchmark.md).
Supported scene-NeRF methods:
(click to collapse)
- [X] [NeRF](https://www.matthewtancik.com/nerf) (ECCV'2020)
- [X] [Mip-NeRF](https://jonbarron.info/mipnerf/) (ICCV'2021)
- [X] [KiloNeRF](https://arxiv.org/abs/2103.13744) (ICCV'2021)
- [X] [Instant NGP](https://nvlabs.github.io/instant-ngp/) (SIGGRAPH'2022)
- [X] [BungeeNeRF](https://city-super.github.io/citynerf/) (ECCV'2022)
Supported human-NeRF methods:
(click to collapse)
- [X] [NeuralBody](https://zju3dv.github.io/neuralbody) (CVPR'2021)
- [X] [AniNeRF](https://zju3dv.github.io/animatable_nerf/) (ICCV'2021)
- [X] [GNR](https://generalizable-neural-performer.github.io/)
Wanna see more methods supported? Post method you want see in XRNeRF on our [wishlist](https://github.com/openxrlab/xrnerf/discussions/11).
## Datasets
It is recommended to symlink the dataset root to `$PROJECT/data`.
If your folder structure is different, you may need to change the corresponding paths in config files.
```
xrnerf
├── xrnerf
├── docs
├── configs
├── test
├── extensions
├── data
│ ├── nerf_llff_data
│ ├── nerf_synthetic
│ ├── multiscale
│ ├── multiscale_google
│ ├── ...
```
For more information on data preparation, please see [dataset_preparation.md](docs/en/dataset_preparation.md)
## Installation
We provide detailed [installation tutorial](docs/en/installation.md) for XRNeRF, users can install from scratch or use provided [dockerfile](docker/Dockerfile).
It is recommended to start by creating a docker image:
```shell
docker build -f ./docker/Dockerfile --rm -t xrnerf .
```
For more information, please follow our [installation tutorial](docs/en/installation.md).
## Build a Model
### Basic Concepts
In XRNeRF, model components are basically categorized as 4 types.
- network: the whole nerf model pipeline, usually contains a embedder, mlp and render.
- embedder: convert point-position and viewdirection data into embedded data, embedder can be function only or with trainable paramters.
- mlp: use the output of embedder as input, and output raw data (the rgb and density value at sampled position) for render, usually contains FC layers.
- render: receive mlp's raw data, output the rgb value at a pixel.
Following some basic pipelines (e.g., `NerfNetwork`), the model structure
can be customized through config files with no pains.
### Write a new network
To write a new nerf network, you need to inherit from `BaseNerfNetwork`,
which defines the following abstract methods.
- `train_step()`: forward method of the training mode.
- `val_step()`: forward method of the testing mode.
[NerfNetwork](xrnerf/models/networks/nerf.py) is a good example which show how to do that.
To be specific, if we want to implement some new components, there are several things to do.
1. create a new file in `xrnerf/models/networks/my_networks.py`.
```python
from ..builder import NETWORKS
from .nerf import NerfNetwork
@NETWORKS.register_module()
class MyNerfNetwork(NerfNetwork):
def __init__(self, cfg, mlp=None, mlp_fine=None, render=None):
super().__init__(cfg, mlp, mlp_fine, render)
def forward(self, data):
....
def train_step(self, data, optimizer, **kwargs):
....
def val_step(self, data, optimizer=None, **kwargs):
....
```
2. Import the module in `xrnerf/models/networks/__init__.py`
```python
from .my_networks import MyNerfNetwork
```
3. modify the [config file](configs/nerf/nerf_blender_base01.py) from
```python
model = dict(
type='NerfNetwork',
....
```
to
```python
model = dict(
type='MyNerfNetwork',
....
```
To implement some new components for embedder/mlp/render, procedure is similar to above.
* To write a new nerf embedder, you need to inherit from `nn.Module` or `BaseEmbedder`, and define the `forward` method. [BaseEmbedder](xrnerf/models/embedders/base.py) is a good example.
* To write a new nerf mlp, you need to inherit from `nn.Module` or `BaseMLP`, and define the `forward` method. [NerfMLP](xrnerf/models/mlps/nerf_mlp.py) is a good example.
* To write a new nerf render, you need to inherit from `nn.Module` or `BaseRender`, and define the `forward` method. [NerfRender](xrnerf/models/renders/nerf_render.py) is a good example.
## Train a Model
### Iteration Controls
XRNeRF use `mmcv.runner.IterBasedRunner` to control training, and `mmcv.runner.EpochBasedRunner` to for test mode.
In training mode, the `max_iters` in config file decide how many iters.
In test mode, `max_iters` is forced to change to 1, which represents only 1 epoch to test.
### Train
```shell
python run_nerf.py --config configs/nerf/nerf_blender_base01.py --dataname lego
```
Arguments are:
- `--config`: config file path.
- `--dataname`: select which data under dataset directory.
### Test
We have provided model ``iter_200000.pth`` for test, download from [here](https://drive.google.com/file/d/147wRy3TFlRVrZdWqAgHNak7s6jiMZA1-/view?usp=sharing)
```shell
python run_nerf.py --config configs/nerf/nerf_blender_base01.py --dataname lego --test_only --load_from iter_200000.pth
```
Arguments are:
- `--config`: config file path.
- `--dataname`: select which data under dataset directory.
- `--test_only`: influence on whole testset once.
- `--load_from`: load which checkpoint to test, this will overwrite the original `load_from` in config file to for convenience.
## Tutorials
Currently, we provide some tutorials for users to
* [learn about configs](docs/en/tutorials/config.md)
* [customize data pipelines](docs/en/tutorials/data_pipeline.md)
* [model definition](docs/en/tutorials/model.md)
## Other Documents
Except for that,The document also includes the following
* [api](docs/en/api.md)
* [dataset](docs/en/dataset_preparation.md)
* [installation](docs/en/installation.md)
* [benchmark](docs/en/benchmark.md)
* [FAQ](docs/en/faq.md)
## Citation
If you find this project useful in your research, please consider cite:
```bibtex
@misc{xrnerf,
title={OpenXRLab Neural Radiance Field Toolbox and Benchmark},
author={XRNeRF Contributors},
howpublished = {\url{https://github.com/openxrlab/xrnerf}},
year={2022}
}
```
## License
The license of our codebase is [Apache-2.0](LICENSE). Note that this license only applies to code in our library, the dependencies of which are separate and individually licensed. We would like to pay tribute to open-source implementations to which we rely on. Please be aware that using the content of dependencies may affect the license of our codebase. Some supported methods may carry [additional licenses](docs/en/additional_licenses.md).
## Contributing
We appreciate all contributions to improve XRNeRF. Please refer to [CONTRIBUTING.md](docs/en/CONTRIBUTING.md) for the contributing guideline.
## Acknowledgement
XRNeRF is an open source project that is contributed by researchers and engineers from both the academia and the industry.
We appreciate all the contributors who implement their methods or add new features, as well as users who give valuable feedbacks.
We wish that the framework and benchmark could serve the growing research community by providing a flexible framework to reimplement existing methods and develop their own new models.
## Projects in OpenXRLab
- [XRPrimer](https://github.com/openxrlab/xrprimer): OpenXRLab foundational library for XR-related algorithms.
- [XRSLAM](https://github.com/openxrlab/xrslam): OpenXRLab Visual-inertial SLAM Toolbox and Benchmark.
- [XRSfM](https://github.com/openxrlab/xrsfm): OpenXRLab Structure-from-Motion Toolbox and Benchmark.
- [XRLocalization](https://github.com/openxrlab/xrlocalization): OpenXRLab Visual Localization Toolbox and Server.
- [XRMoCap](https://github.com/openxrlab/xrmocap): OpenXRLab Multi-view Motion Capture Toolbox and Benchmark.
- [XRMoGen](https://github.com/openxrlab/xrmogen): OpenXRLab Human Motion Generation Toolbox and Benchmark.
- [XRNeRF](https://github.com/openxrlab/xrnerf): OpenXRLab Neural Radiance Field (NeRF) Toolbox and Benchmark.
================================================
FILE: README_CN.md
================================================
# XRNeRF
[](https://github.com/openxrlab/xrnerf/actions) [](https://github.com/openxrlab/xrnerf/blob/main/LICENSE)
## 简介
简体中文 | [English](README.md)
本文档提供 XRNeRF 相关用法的基本教程。对于安装说明,请参阅 [安装指南](docs/zh_cn/installation.md)。
- [XRNeRF](#xrnerf)
- [简介](#简介)
- [基准](#基准)
- [数据集](#数据集)
- [安装](#安装)
- [创建模型](#创建模型)
- [基本概念](#基本概念)
- [自定义一个新模型](#自定义一个新模型)
- [训练](#训练)
- [迭代次数控制](#迭代次数控制)
- [训练命令](#训练命令)
- [测试](#测试)
- [详细教程](#详细教程)
- [引用](#引用)
- [参与贡献](#参与贡献)
- [致谢](#致谢)
- [OpenXRLab中的其他项目](#openxrlab中的其他项目)
## 基准
更多细节可查看 [benchmark.md](docs/en/benchmark.md).
支持的场景类神经渲染方法如下:
(click to collapse)
- [X] [NeRF](https://www.matthewtancik.com/nerf) (ECCV'2020)
- [X] [Mip-NeRF](https://jonbarron.info/mipnerf/) (ICCV'2021)
- [X] [KiloNeRF](https://arxiv.org/abs/2103.13744) (ICCV'2021)
- [X] [Instant NGP](https://nvlabs.github.io/instant-ngp/) (SIGGRAPH'2022)
- [X] [BungeeNeRF](https://city-super.github.io/citynerf/) (ECCV'2022)
支持的人体类神经渲染方法如下:
(click to collapse)
- [X] [NeuralBody](https://zju3dv.github.io/neuralbody) (CVPR'2021)
- [X] [AniNeRF](https://zju3dv.github.io/animatable_nerf/) (ICCV'2021)
- [X] [GNR](https://generalizable-neural-performer.github.io/)
如果期望在XRNeRF中看到新的NeRF方法,可以张贴在[愿望清单](https://github.com/openxrlab/xrnerf/discussions/11),我们会根据社区投票意见来安排下一步的计划。
## 数据集
我们推荐把数据集放在`项目目录/data`下面,否则可能需要修改config中的内容
```
xrnerf
├── xrnerf
├── docs
├── configs
├── test
├── extensions
├── data
│ ├── nerf_llff_data
│ ├── nerf_synthetic
│ ├── multiscale
│ ├── multiscale_google
│ ├── ...
```
请参阅 [数据集准备](docs/zh_cn/dataset_preparation.md) 获取数据集准备的相关信息。
## 安装
安装方法详见[教程](docs/zh_cn/installation.md), 我们还提供了[docker镜像文件](docker/DockerfileCN)作为另一种环境安装方式。
## 创建模型
### 基本概念
在XRNeRF中,模型被分为4个部分
- embedder: 输入点的位置和视角,输出embedded特征数据,embedder可能是纯函数型的,或者带有可学习参数的
- mlp: 使用embedder的输出作为输入,输出原始的点数据(采样点的rgb值和密度值)送给render, 一般由多层感知机组成
- render: 获取mlp的输出数据,沿着射线上的点进行积分等操作,输出图像上一个像素点的rgb值
- network: 将以上三个部分组织起来,同时也是与mmcv的runner进行交互的部分,控制了训练时的loss计算和验证时的指标计算
对于上述所有模型而言,输入都是一个字典类型的`data`。模型使用字典`data`中的内容来创建新的键值对,并加入`data`。以[origin nerf](configs/nerf/nerf_blender_base01.py)为例,最开始的`data`应该包含`pts`(尺寸为 n_rays, n_pts, 3) and `viewdirs`(尺寸为 n_rays, n_pts, 3).
### 自定义一个新模型
如果要自定义一个network,需要继承`BaseNerfNetwork`,其中定义了两个抽象方法
- `train_step()`: training 模式下的推理和计算loss的函数.
- `val_step()`: testing 模式下的推理函数.
[NerfNetwork](xrnerf/models/networks/nerf.py) 是一个很好的例子
具体而言,如果想要实现一个具有新feature的nerf方法,有以下几步需要做
1. 创建一个新文件如 `xrnerf/models/networks/my_networks.py`.
```python
from ..builder import NETWORKS
from .nerf import NerfNetwork
@NETWORKS.register_module()
class MyNerfNetwork(NerfNetwork):
def __init__(self, cfg, mlp=None, mlp_fine=None, render=None):
super().__init__(cfg, mlp, mlp_fine, render)
def forward(self, data):
....
def train_step(self, data, optimizer, **kwargs):
....
def val_step(self, data, optimizer=None, **kwargs):
....
```
2. 修改 `xrnerf/models/networks/__init__.py` 文件
```python
from .my_networks import MyNerfNetwork
```
3. 修改配置文件[config file](configs/nerf/nerf_blender_base01.py)
原来
```python
model = dict(
type='NerfNetwork',
....
```
现在
```python
model = dict(
type='MyNerfNetwork',
....
```
同样的,要实现embedder/mlp/render的新功能,步骤与上述类似
* 要定义一个新的embedder, 需要继承`nn.Module` 或者 `BaseEmbedder`, 并定义 `forward` 方法. [BaseEmbedder](xrnerf/models/embedders/base.py) 是个很好的例子
* 要定义一个新的mlp, 需要继承 `nn.Module` 或者 `BaseMLP`, 并定义 `forward` 方法. [NerfMLP](xrnerf/models/mlps/nerf_mlp.py) 可供参考
* 要定义一个新的render, 需要继承 `nn.Module` 或者 `BaseRender`, 并定义 `forward` 方法. [NerfRender](xrnerf/models/renders/nerf_render.py) 可供参考
## 训练
### 迭代次数控制
XRnerf 使用 `mmcv.runner.IterBasedRunner` 来控制训练, 并用 `mmcv.runner.EpochBasedRunner` 来测试.
训练时, 配置文件的 `max_iters` 表示最多训练多少次.
测试时, `max_iters` 被强制改为1, 表示进行一次完整的epoch.
### 训练命令
```shell
python run_nerf.py --config configs/nerf/nerf_blender_base01.py --dataname lego
```
参数为:
- `--config`: 配置文件位置
- `--dataname`: 使用数据集下的哪个数据来训练
### 测试
```shell
python run_nerf.py --config configs/nerf/nerf_blender_base01.py --dataname lego --test_only --load_from iter_200000.pth
```
参数为:
- `--config`: 配置文件位置
- `--dataname`: 使用数据集下的哪个数据
- `--test_only`: 切换为测试模式
- `--load_from`: 重载覆盖掉原来配置文件里的 `load_from`, 在某些情况下为了方便而使用
## 详细教程
目前, XRNeRF 提供以下几种更详细的教程
* [如何编写配置文件](docs/zh_cn/tutorials/config.md)
* [数据处理流程](docs/zh_cn/tutorials/data_pipeline.md)
* [模型定义](docs/zh_cn/tutorials/model.md)
除此以外,文档还包括以下内容
* [api介绍](docs/zh_cn/api.md)
* [数据集准备](docs/zh_cn/dataset_preparation.md)
* [安装](docs/zh_cn/installation.md)
* [benchmark](docs/en/benchmark.md)
* [常见问题](docs/en/faq.md)
## 引用
```bibtex
@misc{xrnerf,
title={OpenXRLab Neural Radiance Field Toolbox and Benchmark},
author={XRNeRF Contributors},
howpublished = {\url{https://github.com/openxrlab/xrnerf}},
year={2022}
}
```
## 参与贡献
我们非常欢迎用户对于 XRNeRF 做出的任何贡献,可以参考 [贡献指南](docs/en/CONTRIBUTING.md) 文件了解更多细节
## 致谢
XRNeRF 是一款由不同学校和公司共同贡献的开源项目。我们感谢所有为项目提供算法复现和新功能支持的贡献者,以及提供宝贵反馈的用户。
我们希望该工具箱和基准测试可以为社区提供灵活的代码工具,供用户复现现有算法并开发自己的新模型,从而不断为开源社区提供贡献。
## OpenXRLab中的其他项目
- [XRPrimer](https://github.com/openxrlab/xrprimer): OpenXRLab foundational library for XR-related algorithms.
- [XRSLAM](https://github.com/openxrlab/xrslam): OpenXRLab Visual-inertial SLAM Toolbox and Benchmark.
- [XRSfM](https://github.com/openxrlab/xrsfm): OpenXRLab Structure-from-Motion Toolbox and Benchmark.
- [XRLocalization](https://github.com/openxrlab/xrlocalization): OpenXRLab Visual Localization Toolbox and Server.
- [XRMoCap](https://github.com/openxrlab/xrmocap): OpenXRLab Multi-view Motion Capture Toolbox and Benchmark.
- [XRMoGen](https://github.com/openxrlab/xrmogen): OpenXRLab Human Motion Generation Toolbox and Benchmark.
- [XRNeRF](https://github.com/openxrlab/xrnerf): OpenXRLab Neural Radiance Field (NeRF) Toolbox and Benchmark.
================================================
FILE: configs/__init__.py
================================================
import importlib
def load_configs(name):
modellib = importlib.import_module(name)
# print(configs.hmr_configs)
return modellib
# load_configs("train_configs")
================================================
FILE: configs/_base_/models/nerf.py
================================================
# # model settings
# model = dict(
# type='nerf',
# i_embed=0, # set 0 for default positional encoding, -1 for none
# multires=10, # log2 of max freq for positional encoding (3D location)
# multires_views=4, # log2 of max freq for positional encoding (2D direction)
# use_viewdirs=True, # use full 5D input instead of 3D
# N_importance=0, # number of additional fine samples per ray
# netdepth=8, # layers in network
# netwidth=256, # channels per layer
# netdepth_fine=8, # layers in fine network
# netwidth_fine=256, # channels per layer in fine network
# netchunk=1024*64, # number of pts sent through network in parallel, decrease if running out of memory
# )
================================================
FILE: configs/animatable_nerf/an_h36m_s11_novel_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'novel_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir_pattern = './work_dirs/animatable_nerf/h36m_s11_{}/' # noqa
work_dir = './work_dirs/animatable_nerf/h36m_s11_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
os.system('mkdir -p {}'.format(work_dir))
load_from = os.path.join(work_dir, 'latest.pth')
if not os.path.exists(load_from):
ckpt_path = os.path.join(work_dir_pattern.format('train_pose'),
'latest.pth')
os.system('cp {} {}'.format(ckpt_path, work_dir))
num_train_pose = 200
num_novel_pose = 82
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S11/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
novel_pose_frame=[
num_train_pose * frame_interval,
(num_train_pose + num_novel_pose) * frame_interval
],
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_h36m_s11_train_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'train_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/animatable_nerf/h36m_s11_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_pose = 200
num_novel_pose = 82
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S11/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_h36m_s1_novel_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'novel_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir_pattern = './work_dirs/animatable_nerf/h36m_s1_{}/' # noqa
work_dir = './work_dirs/animatable_nerf/h36m_s1_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
os.system('mkdir -p {}'.format(work_dir))
load_from = os.path.join(work_dir, 'latest.pth')
if not os.path.exists(load_from):
ckpt_path = os.path.join(work_dir_pattern.format('train_pose'),
'latest.pth')
os.system('cp {} {}'.format(ckpt_path, work_dir))
num_train_pose = 150
num_novel_pose = 49
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S1/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
novel_pose_frame=[
num_train_pose * frame_interval,
(num_train_pose + num_novel_pose) * frame_interval
],
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_h36m_s1_train_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'train_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/animatable_nerf/h36m_s1_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_pose = 150
num_novel_pose = 49
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S1/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_h36m_s5_novel_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'novel_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir_pattern = './work_dirs/animatable_nerf/h36m_s5_{}/' # noqa
work_dir = './work_dirs/animatable_nerf/h36m_s5_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
os.system('mkdir -p {}'.format(work_dir))
load_from = os.path.join(work_dir, 'latest.pth')
if not os.path.exists(load_from):
ckpt_path = os.path.join(work_dir_pattern.format('train_pose'),
'latest.pth')
os.system('cp {} {}'.format(ckpt_path, work_dir))
num_train_pose = 250
num_novel_pose = 127
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S5/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
novel_pose_frame=[
num_train_pose * frame_interval,
(num_train_pose + num_novel_pose) * frame_interval
],
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_h36m_s5_train_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'train_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/animatable_nerf/h36m_s5_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_pose = 250
num_novel_pose = 127
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S5/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_h36m_s6_novel_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'novel_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir_pattern = './work_dirs/animatable_nerf/h36m_s6_{}/' # noqa
work_dir = './work_dirs/animatable_nerf/h36m_s6_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
os.system('mkdir -p {}'.format(work_dir))
load_from = os.path.join(work_dir, 'latest.pth')
if not os.path.exists(load_from):
ckpt_path = os.path.join(work_dir_pattern.format('train_pose'),
'latest.pth')
os.system('cp {} {}'.format(ckpt_path, work_dir))
num_train_pose = 150
num_novel_pose = 83
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S6/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
novel_pose_frame=[
num_train_pose * frame_interval,
(num_train_pose + num_novel_pose) * frame_interval
],
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_h36m_s6_train_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'train_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/animatable_nerf/h36m_s6_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_pose = 150
num_novel_pose = 83
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S6/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_h36m_s7_novel_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'novel_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir_pattern = './work_dirs/animatable_nerf/h36m_s7_{}/' # noqa
work_dir = './work_dirs/animatable_nerf/h36m_s7_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
os.system('mkdir -p {}'.format(work_dir))
load_from = os.path.join(work_dir, 'latest.pth')
if not os.path.exists(load_from):
ckpt_path = os.path.join(work_dir_pattern.format('train_pose'),
'latest.pth')
os.system('cp {} {}'.format(ckpt_path, work_dir))
num_train_pose = 300
num_novel_pose = 200
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S7/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
novel_pose_frame=[
num_train_pose * frame_interval,
(num_train_pose + num_novel_pose) * frame_interval
],
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_h36m_s7_train_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'train_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/animatable_nerf/h36m_s7_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_pose = 300
num_novel_pose = 200
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S7/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_h36m_s8_novel_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'novel_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir_pattern = './work_dirs/animatable_nerf/h36m_s8_{}/' # noqa
work_dir = './work_dirs/animatable_nerf/h36m_s8_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
os.system('mkdir -p {}'.format(work_dir))
load_from = os.path.join(work_dir, 'latest.pth')
if not os.path.exists(load_from):
ckpt_path = os.path.join(work_dir_pattern.format('train_pose'),
'latest.pth')
os.system('cp {} {}'.format(ckpt_path, work_dir))
num_train_pose = 250
num_novel_pose = 87
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S8/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
novel_pose_frame=[
num_train_pose * frame_interval,
(num_train_pose + num_novel_pose) * frame_interval
],
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_h36m_s8_train_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'train_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/animatable_nerf/h36m_s8_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_pose = 250
num_novel_pose = 87
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S8/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_h36m_s9_novel_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'novel_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir_pattern = './work_dirs/animatable_nerf/h36m_s1_{}/' # noqa
work_dir = './work_dirs/animatable_nerf/h36m_s9_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
os.system('mkdir -p {}'.format(work_dir))
load_from = os.path.join(work_dir, 'latest.pth')
if not os.path.exists(load_from):
ckpt_path = os.path.join(work_dir_pattern.format('train_pose'),
'latest.pth')
os.system('cp {} {}'.format(ckpt_path, work_dir))
num_train_pose = 260
num_novel_pose = 133
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S9/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
novel_pose_frame=[
num_train_pose * frame_interval,
(num_train_pose + num_novel_pose) * frame_interval
],
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_h36m_s9_render_train_pose.py
================================================
_base_ = ['an_h36m_s9_train_pose.py']
from configs.animatable_nerf.an_h36m_s9_train_pose import *
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='NBSaveSpiralHook', params=dict()),
]
ratio = 1.
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S9/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=ratio, # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
frame_idx_to_smpl_idx = lambda x: x
frame_idx_to_latent_idx = lambda x: x
valdata_cfg = basedata_cfg.copy()
valdata_cfg.update(
dict(mode='render',
num_render_views=50,
frame_idx=0,
frame_idx_to_smpl_idx=frame_idx_to_smpl_idx,
frame_idx_to_latent_idx=frame_idx_to_latent_idx,
render_H=int(1000 * ratio),
render_W=int(1000 * ratio),
ratio=ratio))
test_pipeline = [
dict(
type='LoadCamAndSmplParam',
enable=True,
), # 读取相机和Smpl参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True,
sel_rgb=False), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints', 'spiral_poses', 'K'
]),
]
data.update(
dict(test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
), ))
================================================
FILE: configs/animatable_nerf/an_h36m_s9_train_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'train_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/animatable_nerf/h36m_s9_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_pose = 260
num_novel_pose = 133
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 5
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/h36m/S9/Posing',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=1., # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 1, 2],
test_view=[3],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/animatable_nerf/an_zjumocap_313_novel_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'novel_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir_pattern = './work_dirs/animatable_nerf/zjumocap_313_{}/' # noqa
work_dir = work_dir_pattern.format(phase)
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
os.system('mkdir -p {}'.format(work_dir))
load_from = os.path.join(work_dir, 'latest.pth')
if not os.path.exists(load_from):
ckpt_path = os.path.join(work_dir_pattern.format('train_pose'),
'latest.pth')
os.system('cp {} {}'.format(ckpt_path, work_dir))
num_train_pose = 60
num_novel_pose = 1000
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x).split('_')[4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x).split('_')[4]) - 1
frame_interval = 1
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/zju_mocap/CoreView_313',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=0.5, # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 6, 12, 18],
test_view=[1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
novel_pose_frame=[
num_train_pose * frame_interval,
(num_train_pose + num_novel_pose) * frame_interval
],
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/animatable_nerf/an_zjumocap_313_train_pose.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'animatable_nerf'
phase = 'train_pose'
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/animatable_nerf/zjumocap_313_{}/'.format(phase) # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_pose = 60
num_novel_pose = 1000
model = dict(
type='AniNeRFNetwork',
cfg=dict(
chunk=1024 * 4, # mainly work for val
phase=phase,
tpose_human=dict(
type='TPoseHuman',
density_mlp=dict(
type='AN_DensityMLP',
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
color_mlp=dict(
type='AN_ColorMLP',
num_train_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
6, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
deform_field=dict(
type='DeformField',
smpl_threshold=0.05,
phase=phase,
bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_train_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
novel_pose_bw_mlp=dict(
type='AN_BlendWeightMLP',
num_pose=num_novel_pose,
embedder=dict(
type='BaseEmbedder',
i_embed=
0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x).split('_')[4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x).split('_')[4]) - 1
frame_interval = 1
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/zju_mocap/CoreView_313',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=0.5, # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 6, 12, 18],
test_view=[1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20],
num_train_pose=num_train_pose,
training_frame=[0, num_train_pose * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
phase=phase,
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='CalculateSkelTransf',
enable=True,
), # 计算骨架变换矩阵
dict(
type='AninerfIdxConversion',
enable=True,
), # 变换latent index
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams', 'parents', 'joints'
]),
]
data = dict(train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='AniNeRFDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='AniNeRFDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
))
================================================
FILE: configs/bungeenerf/bungeenerf_multiscale_google.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'bungeenerf' # [nerf, kilo_nerf, mip_nerf, bungeenerf]
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
max_iters = 200000
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=500, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=5,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 500), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='SaveSpiralHook',
params=dict(save_folder='visualizations/spiral')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='BungeeNerfTrainRunner')
test_runner = dict(type='BungeeNerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
stage = 0 # current stage for training
work_dir = './work_dirs/bungeenerf/#DATANAME#/stage_%d/' % stage
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'mutiscale_google'
no_batching = True # only take random rays from 1 image at a time
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = False # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 2 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 65 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
model = dict(
type='BungeeNerfNetwork',
cfg=dict(
phase='train', # 'train' or 'test'
ray_shape='cone', # The shape of cast rays ('cone' or 'cylinder').
resample_padding=0.01, # Dirichlet/alpha "padding" on the histogram.
N_importance=65, # number of additional fine samples per ray
is_perturb=is_perturb,
chunk=1024 * 32, # mainly work for val
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
mlp=dict( # coarse model
type='BungeeNerfMLP',
cur_stage=stage, # resblock nums
netwidth=256, # channels per layer
netchunk=1024 * 64, # number of pts sent through network in parallel;
embedder=dict(
type='BungeeEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
),
),
render=dict( # render model
type='BungeeNerfRender',
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
),
)
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/multiscale_google/#DATANAME#',
white_bkgd=white_bkgd,
factor=3,
N_rand_per_sampler=N_rand_per_sampler,
mode='train',
cur_stage=stage,
holdout=16,
is_batching=True, # True for blender, False for llff
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
testdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
testdata_cfg.update(dict(mode='test', testskip=0))
train_pipeline = [
dict(
type='BungeeBatchSample',
enable=True,
N_rand=N_rand_per_sampler,
),
dict(type='DeleteUseless', keys=['rays_rgb', 'idx']),
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'scale_code'],
),
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(type='BungeeGetBounds', enable=True),
dict(type='BungeeGetZvals',
enable=True,
lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='DeleteUseless', enable=True,
keys=['pose', 'iter_n']), # 删除pose 其实求完ray就不再需要了
]
test_pipeline = [
dict(
type='ToTensor',
enable=True,
keys=['pose'],
),
dict(
type='GetRays',
include_radius=True,
enable=True,
),
dict(type='FlattenRays', include_radius=True,
enable=True), # 原来是(H, W, ..) 变成(H*W, ...) 记录下原来的尺寸
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(type='BungeeGetBounds', enable=True),
dict(type='BungeeGetZvals',
enable=True,
lindisp=lindisp,
N_samples=N_samples), # 同上train_pipeline
dict(type='PerturbZvals', enable=False), # 测试集不扰动
dict(type='DeleteUseless', enable=True,
keys=['pose']), # 删除pose 其实求完ray就不再需要了
]
data = dict(
train_loader=dict(batch_size=1, num_workers=4),
train=dict(
type='BungeeDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='BungeeDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='BungeeDataset',
cfg=testdata_cfg,
pipeline=test_pipeline, # same pipeline as validation
),
)
================================================
FILE: configs/gnr/gnr_genebody.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'gnr'
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=1,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/gnr/' # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = False # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 256 # number of coarse samples per ray
use_feat_sr = False
# resume_from = os.path.join(work_dir, 'latest.pth')
# load_from = os.path.join(work_dir, 'latest.pth')
model = dict(
type='GnrNetwork',
cfg=dict(
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
use_viewdirs=use_viewdirs,
projection_mode='perspective',
is_perturb=is_perturb,
use_feat_sr=False,
use_smpl_sdf=True,
use_t_pose=True,
use_smpl_depth=True,
use_attention=True,
ddp=False,
chunk=524288, # mainly work for val
num_views=4,
image_filter=dict(type='HGFilter',
opt=dict(norm='group',
num_stack=4,
num_hourglass=2,
skip_hourglass=True,
hg_down='ave_pool',
hourglass_dim=256)),
sr_filter=dict(type='SRFilters', order=2, out_ch=256),
nerf=dict(type='GNRMLP',
opt=dict(
input_ch_feat=64 if use_feat_sr else 256,
smpl_type='smplx',
use_smpl_sdf=True,
use_t_pose=True,
use_nml=True,
use_attention=True,
weighted_pool=True,
use_sh=True,
use_viewdirs=True,
use_occlusion=True,
use_smpl_depth=True,
use_occlusion_net=True,
angle_diff=False,
use_bn=False,
skips=[2, 4, 6],
num_views=4,
)),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
nerf_renderer=dict( # render model
type='GnrRenderer',
opt=dict(model=None,
N_samples=256,
ddp=False,
train_encoder=False,
projection_mode='perspective',
loadSize=512,
num_views=4,
N_rand=1024,
N_grid=512,
use_nml=True,
use_attention=True,
debug=False,
use_vgg=False,
use_smpl_sdf=True,
use_t_pose=True,
use_smpl_depth=True,
regularization=False,
angle_diff=False,
use_occlusion=True,
use_occlusion_net=True,
use_vh_free=False,
use_white_bkgd=False,
chunk=524288,
N_rand_infer=4096,
use_vh=True,
laplacian=5,
vh_overhead=1),
),
train_encoder=False))
basedata_cfg = dict(dataset_type=dataset_type,
dataroot='path/to/GeneBodyDataset',
eval_skip=1,
train_skip=1,
loadSize=512,
num_views=4,
use_smpl_sdf=True,
use_t_pose=True,
smpl_type='smplx',
t_pose_path='path/to/smpl_t_pose',
use_smpl_depth=True,
use_white_bkgd=False,
random_multiview=False)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
data = dict(
train_loader=dict(batch_size=1, num_workers=6),
train=dict(type='GeneBodyDataset',
opt=traindata_cfg,
phase='train',
pipeline=[]),
val_loader=dict(batch_size=1, num_workers=6),
val=dict(type='GeneBodyDataset', opt=valdata_cfg, phase='val',
pipeline=[]),
test_loader=dict(batch_size=1, num_workers=6),
test=dict(type='GeneBodyDataset',
opt=valdata_cfg,
phase='test',
pipeline=[]),
)
================================================
FILE: configs/instant_ngp/nerf_blender_local01.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
# [nerf, kilo_nerf, mip_nerf]
method = 'nerf'
# optimizer
optimizer = dict(type='Adam',
lr=1e-2,
betas=(0.9, 0.99),
eps=1e-15,
weight_decay=1e-6)
optimizer_config = dict(grad_clip=None)
max_iters = 50000
lr_config = dict(policy='step', step=10000, gamma=0.2, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
custom_hooks = [dict(type='EMAHook', momentum=0.05)]
log_level = 'INFO'
log_config = dict(interval=500,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 500), ('val', 1)]
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='OccupationHook', params=dict()),
dict(type='PassIterHook', params=dict()),
dict(type='PassDatasetHook',
params=dict(),
variables=dict(dataset='trainset')),
dict(type='ModifyBatchsizeHook', params=dict()),
dict(type='PassSamplerIterHook', params=dict()),
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='PassDatasetHook',
params=dict(),
variables=dict(dataset='testset')),
dict(type='HashSaveSpiralHook',
params=dict(save_folder='visualizations/spirals', ),
variables=dict(cfg='cfg')),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1)
work_dir = './work_dirs/instant_ngp/nerf_#DATANAME#_base01/'
timestamp = datetime.now().strftime('%d-%b-%H-%M')
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
load_alpha = True
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 4096 # how many N_rand in get_item() function
# lindisp = False # sampling linearly in disparity rather than depth
# resume_from = os.path.join(work_dir, 'latest.pth')
# load_from = os.path.join(work_dir, 'latest.pth')
model = dict(
type='HashNerfNetwork',
cfg=dict(
phase='train', # 'train' or 'test'
chunk=4096, # mainly work for val
bs_data='rays_o',
),
mlp=dict( # coarse model
type='HashNerfMLP',
bound=1,
embedder_pos=dict(n_input_dims=3,
encoding_config=dict(
otype='HashGrid',
n_levels=16,
n_features_per_level=2,
log2_hashmap_size=19,
base_resolution=16,
interpolation='Linear',
)),
embedder_dir=dict(n_input_dims=3,
encoding_config=dict(
otype='SphericalHarmonics',
degree=4,
)),
density_net=dict(n_input_dims=32,
n_output_dims=16,
network_config=dict(
otype='FullyFusedMLP',
activation='ReLU',
output_activation='None',
n_neurons=64,
num_layers=1,
)),
color_net=dict(
# n_input_dims=32, # embedder_dir's out + density_net's out
n_output_dims=3,
network_config=dict(
otype='FullyFusedMLP',
activation='ReLU',
output_activation='None',
n_neurons=64,
num_layers=2,
)),
),
sampler=dict(
type='NGPGridSampler',
update_grid_freq=16,
update_block_size=5000000,
n_rays_per_batch=N_rand_per_sampler,
cone_angle_constant=0.00390625,
near_distance=0.2,
target_batch_size=1 << 18,
rgb_activation=2,
density_activation=3,
),
render=dict(
type='HashNerfRender',
bg_color=[0, 0, 0],
),
)
basedata_cfg = dict(
dataset_type=dataset_type,
N_rand_per_sampler=N_rand_per_sampler,
datadir='data/nerf_synthetic/#DATANAME#',
half_res=False, # load blender synthetic data at 400x400 or 800x800
testskip=1,
white_bkgd=white_bkgd,
load_alpha=load_alpha,
is_batching=True, # True for hashnerf
mode='train',
val_n=10,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
testdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val', ))
testdata_cfg.update(dict(mode='test', testskip=100))
train_pipeline = [
dict(type='HashBatchSample', N_rand=N_rand_per_sampler),
dict(type='RandomBGColor'),
dict(type='DeleteUseless', keys=['rays_rgb', 'iter_n', 'idx']),
]
test_pipeline = [
dict(
type='HashGetRays',
enable=True,
),
dict(type='FlattenRays', enable=True),
dict(
type='HashSetImgids',
enable=True,
),
# dict(
# type='RandomBGColor',
# enable=True,
# ),
dict(type='DeleteUseless', enable=True, keys=['pose', 'idx']),
]
data = dict(
# num_workers>0 lead to low psnr ?
train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='HashNerfDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='HashNerfDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='HashNerfDataset',
cfg=testdata_cfg,
pipeline=test_pipeline, # same pipeline as validation
),
)
================================================
FILE: configs/kilonerf/kilonerf_distill_BlendedMVS_base01.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'kilo_nerf' # [nerf, kilo_nerf, mip_nerf]
model_type = 'multi_network' #[single_network, multi_network]
phase = 'distill' # [pretrain, distill, finetune]
resolution_table = dict(
Character=[8, 16, 8],
Fountain=[14, 16, 14],
Jade=[16, 14, 16],
Statues=[12, 14, 16],
)
# optimizer
optimizer = dict(type='Adam', lr=0.001)
optimizer_config = dict(grad_clip=None)
max_iters = 150000
# max_iters = 50000 # Character only needs 50000 iterations, other scenes need 150000 iterations
lr_config = None
checkpoint_config = None
log_level = 'INFO'
log_config = dict(interval=500,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 500), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SaveDistillResultsHook',
params=dict(),
variables=dict(cfg='cfg', trainset='trainset')),
dict(type='DistllCycleHook', params=dict(), variables=dict(cfg='cfg')),
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
# runner
train_runner = dict(type='KiloNerfDistillTrainRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/kilonerfs/BlendedMVS_#DATANAME#_base01/distill'
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'nsvf'
datadir = 'data/nsvf/BlendedMVS/#DATANAME#'
max_num_networks = 512
num_networks = max_num_networks
outputs = 'color_and_density'
alpha_distance = 0.0211
convert_density_to_alpha = True
quantile_se = 0.99
skip_final = True
tree_type = 'kdtree_longest'
test_error_metric = 'quantile_se'
equal_split_metric = 'mse'
max_error = 100000
train_batch_size = 128
# resume_from = os.path.join(work_dir, 'latest.pth')
# load_from = os.path.join(work_dir, 'latest.pth')
model = dict(
type='StudentNerfNetwork',
cfg=dict(
outputs=outputs,
test_batch_size=512,
query_batch_size=80000,
),
pretrained_kwargs=dict(
config='./configs/kilonerfs/kilonerf_pretrain_BlendedMVS_base01.py',
checkpoint=
'./work_dirs/kilonerfs/BlendedMVS_#DATANAME#_base01/pretrain/latest.pth'
),
multi_network=dict( # multi network
type='KiloNerfMultiNetwork',
num_networks=max_num_networks,
alpha_rgb_initalization=
'pass_actual_nonlinearity', # in multi network model init
bias_initialization_method='standard', # in multi network model init
direction_layer_size=32, # in multi network model init
hidden_layer_size=32, # in multi network model init
late_feed_direction=True, # in multi network model init
network_rng_seed=8078673, # in multi network model init
nonlinearity_initalization=
'pass_actual_nonlinearity', # in multi network model init
num_hidden_layers=2, # in multi network model init
num_output_channels=4,
refeed_position_index=None, # in multi network model init
use_same_initialization_for_all_networks=
True, # in multi network model init
weight_initialization_method=
'kaiming_uniform', # in multi network model init
embedder=dict(
type='KiloNerfFourierEmbedder',
num_networks=max_num_networks, # num of networks, will be changed
input_ch=3,
multires=
10, # num_frequencies, log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # num_frequencies_direction, this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
),
),
render=dict( # render model
type='KiloNerfSimpleRender',
alpha_distance=alpha_distance,
convert_density_to_alpha=convert_density_to_alpha,
),
)
basedata_cfg = dict(
dataset_type=dataset_type,
datadir=datadir,
mode='train',
batch_index=0,
work_dir=work_dir,
num_examples_per_network=1000000,
max_num_networks=max_num_networks,
train_batch_size=train_batch_size,
outputs=outputs,
is_batching=False,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val', num_examples_per_network=20000))
train_pipeline = [
dict(
type='ExampleSample',
enable=True,
train_batch_size=train_batch_size,
),
dict(
type='ToTensor',
enable=True,
keys=['domain_mins', 'domain_maxs'],
),
dict(type='DeleteUseless', enable=True, keys=[
'all_examples'
]), # delete batch_examples after getting batch_inputs and batch_targets
]
test_pipeline = [
dict(
type='ToTensor',
enable=True,
keys=['domain_mins', 'domain_maxs'],
),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=4),
train=dict(
type='KiloNerfNodeDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='KiloNerfNodeDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/kilonerf/kilonerf_distill_Synthetic_NeRF_base01.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'kilo_nerf' # [nerf, kilo_nerf, mip_nerf]
model_type = 'multi_network' #[single_network, multi_network]
phase = 'distill' # [pretrain, distill, finetune]
resolution_table = dict(Chair=[13, 13, 16],
Drums=[16, 13, 12],
Ficus=[8, 11, 16],
Hotdog=[16, 16, 6],
Lego=[9, 16, 10],
Materials=[16, 14, 5],
Mic=[16, 16, 15],
Ship=[16, 16, 9])
# optimizer
optimizer = dict(type='Adam', lr=0.001)
optimizer_config = dict(grad_clip=None)
# max_iters = 150000
max_iters = 50000 # Hotdog only needs 50000 iterations, other scenes need 150000 iterations
lr_config = None
checkpoint_config = None
log_level = 'INFO'
log_config = dict(interval=500,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 500), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SaveDistillResultsHook',
params=dict(),
variables=dict(cfg='cfg', trainset='trainset')),
dict(type='DistllCycleHook', params=dict(), variables=dict(cfg='cfg')),
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
# runner
train_runner = dict(type='KiloNerfDistillTrainRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/kilonerfs/Synthetic_NeRF_#DATANAME#_base01/distill'
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'nsvf'
datadir = 'data/nsvf/Synthetic_NeRF/#DATANAME#'
max_num_networks = 512
num_networks = max_num_networks
outputs = 'color_and_density'
alpha_distance = 0.0211
convert_density_to_alpha = True
quantile_se = 0.99
skip_final = True
tree_type = 'kdtree_longest'
test_error_metric = 'quantile_se'
equal_split_metric = 'mse'
max_error = 100000
train_batch_size = 128
# resume_from = os.path.join(work_dir, 'latest.pth')
# load_from = os.path.join(work_dir, 'latest.pth')
model = dict(
type='StudentNerfNetwork',
cfg=dict(
outputs=outputs,
test_batch_size=512,
query_batch_size=80000,
),
pretrained_kwargs=dict(
config='./configs/kilonerfs/kilonerf_pretrain_Synthetic_NeRF_base01.py',
checkpoint=
'./work_dirs/kilonerfs/Synthetic_NeRF_#DATANAME#_base01/pretrain/latest.pth'
),
multi_network=dict( # multi network
type='KiloNerfMultiNetwork',
num_networks=max_num_networks,
alpha_rgb_initalization=
'pass_actual_nonlinearity', # in multi network model init
bias_initialization_method='standard', # in multi network model init
direction_layer_size=32, # in multi network model init
hidden_layer_size=32, # in multi network model init
late_feed_direction=True, # in multi network model init
network_rng_seed=8078673, # in multi network model init
nonlinearity_initalization=
'pass_actual_nonlinearity', # in multi network model init
num_hidden_layers=2, # in multi network model init
num_output_channels=4,
refeed_position_index=None, # in multi network model init
use_same_initialization_for_all_networks=
True, # in multi network model init
weight_initialization_method=
'kaiming_uniform', # in multi network model init
embedder=dict(
type='KiloNerfFourierEmbedder',
num_networks=max_num_networks, # num of networks, will be changed
input_ch=3,
multires=
10, # num_frequencies, log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # num_frequencies_direction, this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
),
),
render=dict( # render model
type='KiloNerfSimpleRender',
alpha_distance=alpha_distance,
convert_density_to_alpha=convert_density_to_alpha,
),
)
basedata_cfg = dict(
dataset_type=dataset_type,
datadir=datadir,
mode='train',
batch_index=0,
work_dir=work_dir,
num_examples_per_network=1000000,
max_num_networks=max_num_networks,
train_batch_size=train_batch_size,
outputs=outputs,
is_batching=False,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val', num_examples_per_network=20000))
train_pipeline = [
dict(
type='ExampleSample',
enable=True,
train_batch_size=train_batch_size,
),
dict(
type='ToTensor',
enable=True,
keys=['domain_mins', 'domain_maxs'],
),
dict(type='DeleteUseless', enable=True, keys=[
'all_examples'
]), # delete batch_examples after getting batch_inputs and batch_targets
]
test_pipeline = [
dict(
type='ToTensor',
enable=True,
keys=['domain_mins', 'domain_maxs'],
),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=4),
train=dict(
type='KiloNerfNodeDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='KiloNerfNodeDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/kilonerf/kilonerf_finetune_BlendedMVS_base01.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'kilo_nerf' # [nerf, kilo_nerf, mip_nerf]
model_type = 'multi_network' #[single_network, multi_network]
phase = 'finetune' # [pretrain, distill, finetune]
resolution_table = dict(
Character=[128, 256, 128],
Fountain=[224, 256, 224],
Jade=[256, 224, 256],
Statues=[192, 224, 256],
)
# optimizer
optimizer = dict(type='Adam', lr=0.001, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
max_iters = 1000000
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=50000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 50000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='SaveSpiralHook',
params=dict(save_folder='visualizations/spiral')),
dict(type='CalElapsedTimeHook', params=dict()),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='KiloNerfTrainRunner')
test_runner = dict(type='KiloNerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/kilonerfs/BlendedMVS_#DATANAME#_base01/finetune'
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'nsvf'
datadir = 'data/nsvf/BlendedMVS/#DATANAME#'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (Fountain and Jade have black background, set white_bkgd=False)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 8192 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 384 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
# load_from = os.path.join(work_dir, 'latest.pth')
occupancy_checkpoint = './work_dirs/kilonerfs/BlendedMVS_#DATANAME#_base01/pretrain_occupancy/occupancy.pth'
distilled_config = './configs/kilonerfs/kilonerf_distill_BlendedMVS_base01.py'
distilled_checkpoint = './work_dirs/kilonerfs/BlendedMVS_#DATANAME#_base01/distill/checkpoint.pth'
model = dict(
type='KiloNerfNetwork',
cfg=dict(
phase='train', # 'train' or 'test'
N_importance=0, # number of additional fine samples per ray
is_perturb=is_perturb,
chunk=40000, # chunk_size, mainly work for val
l2_regularization_lambda=1.0e-06,
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
mlp=dict( # multi_network model
type='KiloNerfMLP',
distilled_config=distilled_config,
distilled_checkpoint=distilled_checkpoint,
occupancy_checkpoint=occupancy_checkpoint,
embedder=dict(
type='KiloNerfFourierEmbedder',
num_networks=1, # num_networks, teacher nerf network only have 1
input_ch=3,
multires=
10, # num_frequencies, log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # num_frequencies_direction, this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
),
),
mlp_fine=None,
render=dict( # render model
type='NerfRender',
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
),
)
basedata_cfg = dict(
dataset_type=dataset_type,
datadir=datadir,
half_res=False, # load nsvf synthetic data at 800x800
testskip=
8, # will load 1/N images from test/val sets, useful for large datasets like deepvoxels
white_bkgd=white_bkgd,
is_batching=False,
render_test=True,
mode='train',
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
testdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
testdata_cfg.update(dict(mode='test', testskip=1))
train_pipeline = [
dict(type='Sample'),
dict(type='DeleteUseless', keys=['images', 'poses', 'i_data', 'idx']),
dict(
type='ToTensor',
enable=True,
keys=['pose', 'target_s'],
),
dict(
type='GetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='SelectRays',
enable=True,
sel_n=N_rand_per_sampler,
precrop_iters=0,
precrop_frac=0.5), # 抽取N个射线
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless', enable=True,
keys=['pose', 'iter_n']), # 删除pose 其实求完ray就不再需要了
]
test_pipeline = [
dict(
type='ToTensor',
enable=True,
keys=['pose'],
),
dict(
type='KilonerfGetRays',
enable=True,
expand_origin=True,
),
dict(type='FlattenRays',
enable=True), # 原来是(H, W, ..) 变成(H*W, ...) 记录下原来的尺寸
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # 同上train_pipeline
dict(type='PerturbZvals', enable=False), # 测试集不扰动
dict(type='GetPts', enable=True),
dict(type='DeleteUseless', enable=True,
keys=['pose']), # 删除pose 其实求完ray就不再需要了
]
data = dict(
train_loader=dict(batch_size=1, num_workers=4),
train=dict(
type='KiloNerfDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='KiloNerfDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='KiloNerfDataset',
cfg=testdata_cfg,
pipeline=test_pipeline, # same pipeline as validation
),
)
================================================
FILE: configs/kilonerf/kilonerf_finetune_Synthetic_NeRF_base01.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'kilo_nerf' # [nerf, kilo_nerf, mip_nerf]
model_type = 'multi_network' #[single_network, multi_network]
phase = 'finetune' # [pretrain, distill, finetune]
resolution_table = dict(Chair=[208, 208, 256],
Drums=[256, 208, 192],
Ficus=[128, 176, 256],
Hotdog=[256, 256, 96],
Lego=[144, 256, 160],
Materials=[256, 224, 80],
Mic=[256, 256, 240],
Ship=[256, 256, 144])
# optimizer
optimizer = dict(type='Adam', lr=0.001, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
max_iters = 1000000
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=50000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', max_iters), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='SaveSpiralHook',
params=dict(save_folder='visualizations/spiral')),
dict(type='CalElapsedTimeHook', params=dict()),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='KiloNerfTrainRunner')
test_runner = dict(type='KiloNerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/kilonerfs/Synthetic_NeRF_#DATANAME#_base01/finetune'
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'nsvf'
datadir = 'data/nsvf/Synthetic_NeRF/#DATANAME#'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = True # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 8192 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 384 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
# load_from = os.path.join(work_dir, 'latest.pth')
occupancy_checkpoint = './work_dirs/kilonerfs/Synthetic_NeRF_#DATANAME#_base01/pretrain_occupancy/occupancy.pth'
distilled_config = './configs/kilonerfs/kilonerf_distill_Synthetic_NeRF_base01.py'
distilled_checkpoint = './work_dirs/kilonerfs/Synthetic_NeRF_#DATANAME#_base01/distill/checkpoint.pth'
model = dict(
type='KiloNerfNetwork',
cfg=dict(
phase='train', # 'train' or 'test'
N_importance=0, # number of additional fine samples per ray
is_perturb=is_perturb,
chunk=40000, # chunk_size, mainly work for val
l2_regularization_lambda=1.0e-06,
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
mlp=dict( # multi_network model
type='KiloNerfMLP',
distilled_config=distilled_config,
distilled_checkpoint=distilled_checkpoint,
occupancy_checkpoint=occupancy_checkpoint,
embedder=dict(
type='KiloNerfFourierEmbedder',
num_networks=1, # num_networks, teacher nerf network only have 1
input_ch=3,
multires=
10, # num_frequencies, log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # num_frequencies_direction, this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
),
),
mlp_fine=None,
render=dict( # render model
type='NerfRender',
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
),
)
basedata_cfg = dict(
dataset_type=dataset_type,
datadir=datadir,
half_res=False, # load nsvf synthetic data at 800x800
testskip=
8, # will load 1/N images from test/val sets, useful for large datasets like deepvoxels
white_bkgd=white_bkgd,
is_batching=False,
render_test=True,
mode='train',
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
testdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
testdata_cfg.update(dict(mode='test', testskip=1))
train_pipeline = [
dict(type='Sample'),
dict(type='DeleteUseless', keys=['images', 'poses', 'i_data', 'idx']),
dict(
type='ToTensor',
enable=True,
keys=['pose', 'target_s'],
),
dict(
type='GetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='SelectRays',
enable=True,
sel_n=N_rand_per_sampler,
precrop_iters=0,
precrop_frac=0.5), # 抽取N个射线
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless', enable=True,
keys=['pose', 'iter_n']), # 删除pose 其实求完ray就不再需要了
]
test_pipeline = [
dict(
type='ToTensor',
enable=True,
keys=['pose'],
),
dict(
type='KilonerfGetRays',
enable=True,
expand_origin=True,
),
dict(type='FlattenRays',
enable=True), # 原来是(H, W, ..) 变成(H*W, ...) 记录下原来的尺寸
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # 同上train_pipeline
dict(type='PerturbZvals', enable=False), # 测试集不扰动
dict(type='GetPts', enable=True),
dict(type='DeleteUseless', enable=True,
keys=['pose']), # 删除pose 其实求完ray就不再需要了
]
data = dict(
train_loader=dict(batch_size=1, num_workers=4),
train=dict(
type='KiloNerfDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='KiloNerfDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='KiloNerfDataset',
cfg=testdata_cfg,
pipeline=test_pipeline, # same pipeline as validation
),
)
================================================
FILE: configs/kilonerf/kilonerf_pretrain_BlendedMVS_base01.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'kilo_nerf' # [nerf, kilo_nerf, mip_nerf]
model_type = 'single_network' #[single_network, multi_network]
phase = 'pretrain' # [pretrain, distill, finetune]
resolution_table = dict(
Character=[128, 256, 128],
Fountain=[224, 256, 224],
Jade=[256, 224, 256],
Statues=[192, 224, 256],
)
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
max_iters = 600000
# max_iters = 100000 # Character only needs 100000 iterations, other scenes need 600000 iterations
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=50000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 50000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='SaveSpiralHook',
params=dict(save_folder='visualizations/spiral')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
dict(type='CalElapsedTimeHook', params=dict()),
dict(type='BuildOccupancyTreeHook',
params=dict(),
variables=dict(cfg='cfg'))
]
# runner
train_runner = dict(type='KiloNerfTrainRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/kilonerfs/BlendedMVS_#DATANAME#_base01/pretrain'
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'nsvf'
datadir = 'data/nsvf/BlendedMVS/#DATANAME#'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = True # set to render synthetic data on a white bkgd (Fountain and Jade have black background, set white_bkgd=False)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 384 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
# load_from = os.path.join(work_dir, 'latest.pth')
build_occupancy_tree_config = dict(
subsample_resolution=[3, 3, 3],
threshold=10,
voxel_batch_size=16384,
work_dir=
'./work_dirs/kilonerfs/BlendedMVS_#DATANAME#_base01/pretrain_occupancy')
model = dict(
type='NerfNetwork',
cfg=dict(
phase='train', # 'train' or 'test'
N_importance=0, # number of additional fine samples per ray
is_perturb=is_perturb,
chunk=16384, # chunk_size, mainly work for val
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
mlp=dict( # coarse model
type='NerfMLP',
skips=[4],
netdepth=8, # layers in network
netwidth=256, # channels per layer
netchunk=1024 * 64, # number of pts sent through network in parallel;
output_ch=4, # 5 if cfg.N_importance>0 else 4
use_viewdirs=use_viewdirs,
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
),
),
mlp_fine=None,
render=dict( # render model
type='NerfRender',
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
),
)
basedata_cfg = dict(
dataset_type=dataset_type,
datadir=datadir,
half_res=False, # load nsvf synthetic data at 800x800
testskip=
8, # will load 1/N images from test/val sets, useful for large datasets like deepvoxels
white_bkgd=white_bkgd,
is_batching=False,
render_test=True,
mode='train',
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(type='Sample'),
dict(type='DeleteUseless', keys=['images', 'poses', 'i_data', 'idx']),
dict(
type='ToTensor',
enable=True,
keys=['pose', 'target_s'],
),
dict(
type='GetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='SelectRays',
enable=True,
sel_n=N_rand_per_sampler,
precrop_iters=10000,
precrop_frac=0.5), # 抽取N个射线
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless', enable=True,
keys=['pose', 'iter_n']), # 删除pose 其实求完ray就不再需要了
]
test_pipeline = [
dict(
type='ToTensor',
enable=True,
keys=['pose'],
),
dict(
type='GetRays',
enable=True,
),
dict(type='FlattenRays',
enable=True), # 原来是(H, W, ..) 变成(H*W, ...) 记录下原来的尺寸
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # 同上train_pipeline
dict(type='PerturbZvals', enable=False), # 测试集不扰动
dict(type='GetPts', enable=True),
dict(type='DeleteUseless', enable=True,
keys=['pose']), # 删除pose 其实求完ray就不再需要了
]
data = dict(
train_loader=dict(batch_size=1, num_workers=4),
train=dict(
type='SceneBaseDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='SceneBaseDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/kilonerf/kilonerf_pretrain_Synthetic_NeRF_base01.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'kilo_nerf' # [nerf, kilo_nerf, mip_nerf]
model_type = 'single_network' #[single_network, multi_network]
phase = 'pretrain' # [pretrain, distill, finetune]
resolution_table = dict(Chair=[208, 208, 256],
Drums=[256, 208, 192],
Ficus=[128, 176, 256],
Hotdog=[256, 256, 96],
Lego=[144, 256, 160],
Materials=[256, 224, 80],
Mic=[256, 256, 240],
Ship=[256, 256, 144])
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
# max_iters = 600000
max_iters = 100000 # Hotdog only needs 100000 iterations, other scenes need 600000 iterations
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=50000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 50000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='SaveSpiralHook',
params=dict(save_folder='visualizations/spiral')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
dict(type='CalElapsedTimeHook', params=dict()),
dict(type='BuildOccupancyTreeHook',
params=dict(),
variables=dict(cfg='cfg'))
]
# runner
train_runner = dict(type='KiloNerfTrainRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/kilonerfs/Synthetic_NeRF_#DATANAME#_base01/pretrain'
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'nsvf'
datadir = 'data/nsvf/Synthetic_NeRF/#DATANAME#'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = True # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 384 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
# load_from = os.path.join(work_dir, 'latest.pth')
build_occupancy_tree_config = dict(
subsample_resolution=[3, 3, 3],
threshold=10,
voxel_batch_size=16384,
work_dir=
'./work_dirs/kilonerfs/Synthetic_NeRF_#DATANAME#_base01/pretrain_occupancy'
)
model = dict(
type='NerfNetwork',
cfg=dict(
phase='train', # 'train' or 'test'
N_importance=0, # number of additional fine samples per ray
is_perturb=is_perturb,
chunk=16384, # chunk_size, mainly work for val
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
mlp=dict( # coarse model
type='NerfMLP',
skips=[4],
netdepth=8, # layers in network
netwidth=256, # channels per layer
netchunk=1024 * 64, # number of pts sent through network in parallel;
output_ch=4, # 5 if cfg.N_importance>0 else 4
use_viewdirs=use_viewdirs,
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
),
),
mlp_fine=None,
render=dict( # render model
type='NerfRender',
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
),
)
basedata_cfg = dict(
dataset_type=dataset_type,
datadir=datadir,
half_res=False, # load nsvf synthetic data at 800x800
testskip=
8, # will load 1/N images from test/val sets, useful for large datasets like deepvoxels
white_bkgd=white_bkgd,
is_batching=False,
render_test=True,
mode='train',
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(type='Sample'),
dict(type='DeleteUseless', keys=['images', 'poses', 'i_data', 'idx']),
dict(
type='ToTensor',
enable=True,
keys=['pose', 'target_s'],
),
dict(
type='GetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='SelectRays',
enable=True,
sel_n=N_rand_per_sampler,
precrop_iters=10000,
precrop_frac=0.5), # 抽取N个射线
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless', enable=True,
keys=['pose', 'iter_n']), # 删除pose 其实求完ray就不再需要了
]
test_pipeline = [
dict(
type='ToTensor',
enable=True,
keys=['pose'],
),
dict(
type='GetRays',
enable=True,
),
dict(type='FlattenRays',
enable=True), # 原来是(H, W, ..) 变成(H*W, ...) 记录下原来的尺寸
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # 同上train_pipeline
dict(type='PerturbZvals', enable=False), # 测试集不扰动
dict(type='GetPts', enable=True),
dict(type='DeleteUseless', enable=True,
keys=['pose']), # 删除pose 其实求完ray就不再需要了
]
data = dict(
train_loader=dict(batch_size=1, num_workers=4),
train=dict(
type='SceneBaseDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='SceneBaseDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/mipnerf/mipnerf_blender.py
================================================
import os
from datetime import datetime
method = 'mip_nerf' # [nerf, kilo_nerf, mip_nerf]
use_multiscale = False
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
max_iters = 1000000
lr_config = dict(
policy='Mip',
lr_init=5e-4,
lr_final=5e-6,
max_steps=max_iters,
lr_delay_steps=2500,
lr_delay_mult=0.01,
by_epoch=False,
)
checkpoint_config = dict(interval=100000, by_epoch=False)
optimizer_config = dict(grad_clip=None)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 100000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook', params=dict(save_folder='val_results/')),
dict(type='SaveSpiralHook', params=dict(save_folder='spiral_results/')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook',
params=dict(ndown=1,
dump_json=True,
save_img=True,
save_folder='test_results/'),
variables=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = f'/mnt/lustre/ganshikang/Projects/xrnerf/single_results/#DATANAME#'
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
# set to render synthetic data on a white bkgd (always use for dvoxels)
white_bkgd = True
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
num_samples = 128 # number of samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
# load_from = os.path.join(work_dir, 'latest.pth')
model = dict(
type='MipNerfNetwork',
cfg=dict(
num_levels=2, # The number of sampling levels.
# If True, sample linearly in disparity, not in depth.
ray_shape='cone', # The shape of cast rays ('cone' or 'cylinder').
resample_padding=0.01, # Dirichlet/alpha "padding" on the histogram.
use_multiscale=use_multiscale, # If True, use multiscale.
coarse_loss_mult=0.1, # How much to downweight the coarse loss(es).
chunk=800, # mainly work for val
bs_data='rays_o'),
mlp=dict( # coarse model
type='NerfMLP',
skips=[4],
netdepth=8, # layers in network
netwidth=256, # channels per layer
netchunk=1024 * 32, # number of pts sent through network in parallel;
use_viewdirs=use_viewdirs,
embedder=dict(
type='MipNerfEmbedder',
# Min degree of positional encoding for 3D points.
min_deg_point=0,
# Max degree of positional encoding for 3D points.
max_deg_point=16,
min_deg_view=0, # Min degree of positional encoding for viewdirs.
max_deg_view=4, # Max degree of positional encoding for viewdirs.
use_viewdirs=use_viewdirs,
append_identity=True),
),
render=dict( # render model
type='MipNerfRender',
# set to render synthetic data on a white bkgd (always use for dvoxels)
white_bkgd=white_bkgd,
raw_noise_std=0, # Standard deviation of noise added to raw density.
density_bias=-1., # The shift added to raw densities pre-activation.
rgb_padding=0.001, # Padding added to the RGB outputs.
density_activation='softplus', # density activation
),
)
basedata_cfg = dict(
dataset_type=dataset_type,
datadir=f'data/multiscale/#DATANAME#',
half_res=False, # load blender synthetic data at 400x400 instead of 800x800
testskip=16,
white_bkgd=white_bkgd,
is_batching=False,
mode='train',
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
testdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
testdata_cfg.update(dict(mode='test', testskip=0))
train_pipeline = [
dict(type='Sample'),
dict(type='DeleteUseless', keys=['images', 'poses', 'i_data', 'idx']),
dict(
type='ToTensor',
enable=True,
keys=['pose', 'target_s'],
),
dict(type='GetRays', enable=True,
include_radius=True), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='SelectRays',
enable=True,
sel_n=N_rand_per_sampler,
include_radius=True), # 抽取N个射线
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True, near_new=2., far_new=6.),
dict(type='GetZvals',
enable=True,
lindisp=lindisp,
N_samples=num_samples + 1,
randomized=True),
dict(type='DeleteUseless', enable=True,
keys=['pose', 'iter_n']), # 删除pose 其实求完ray就不再需要了
]
test_pipeline = [
dict(
type='ToTensor',
enable=True,
keys=['pose'],
),
dict(type='GetRays', enable=True, include_radius=True),
dict(type='FlattenRays', enable=True,
include_radius=True), # 原来是(H, W, ..) 变成(H*W, ...) 记录下原来的尺寸
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True, near_new=2., far_new=6.),
dict(type='GetZvals',
enable=True,
lindisp=lindisp,
N_samples=num_samples + 1,
randomized=False),
dict(type='DeleteUseless', enable=True,
keys=['pose']), # 删除pose 其实求完ray就不再需要了
]
data = dict(
train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='SceneBaseDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='SceneBaseDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='SceneBaseDataset',
cfg=testdata_cfg,
pipeline=test_pipeline, # same pipeline as validation
),
)
================================================
FILE: configs/mipnerf/mipnerf_multiscale.py
================================================
import os
from datetime import datetime
method = 'mip_nerf' # [nerf, kilo_nerf, mip_nerf]
use_multiscale = True
# optimizer
optimizer = dict(type='Adam', lr=5e-4)
optimizer_config = dict(grad_clip=None)
max_iters = 1000000
lr_config = dict(
policy='Mip',
lr_init=5e-4,
lr_final=5e-6,
max_steps=max_iters,
lr_delay_steps=2500,
lr_delay_mult=0.01,
by_epoch=False,
)
checkpoint_config = dict(interval=100000, by_epoch=False)
optimizer_config = dict(grad_clip=None)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook', params=dict(save_folder='val_results/')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
# no need for open-source vision
dict(type='OccupationHook', params=dict()),
]
test_hooks = [
dict(type='TestHook',
params=dict(ndown=4,
dump_json=True,
save_img=True,
save_folder='test_results/'),
variables=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/mip_nerf/#DATANAME#/'
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'multiscale'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
# set to render synthetic data on a white bkgd (always use for dvoxels)
white_bkgd = True
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
num_samples = 128 # number of samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
# load_from = os.path.join(work_dir, 'latest.pth')
model = dict(
type='MipNerfNetwork',
cfg=dict(
num_levels=2, # The number of sampling levels.
# If True, sample linearly in disparity, not in depth.
ray_shape='cone', # The shape of cast rays ('cone' or 'cylinder').
resample_padding=0.01, # Dirichlet/alpha "padding" on the histogram.
use_multiscale=use_multiscale, # If True, use multiscale.
coarse_loss_mult=0.1, # How much to downweight the coarse loss(es).
chunk=800, # mainly work for val
bs_data='rays_o'
# randomized=True, # Use randomized stratified sampling.
),
mlp=dict( # coarse model
type='NerfMLP',
skips=[4],
netdepth=8, # layers in network
netwidth=256, # channels per layer
netchunk=1024 * 32, # number of pts sent through network in parallel;
use_viewdirs=use_viewdirs,
embedder=dict(
type='MipNerfEmbedder',
# Min degree of positional encoding for 3D points.
min_deg_point=0,
# Max degree of positional encoding for 3D points.
max_deg_point=16,
min_deg_view=0, # Min degree of positional encoding for viewdirs.
max_deg_view=4, # Max degree of positional encoding for viewdirs.
use_viewdirs=use_viewdirs,
append_identity=True),
),
render=dict( # render model
type='MipNerfRender',
# set to render synthetic data on a white bkgd (always use for dvoxels)
white_bkgd=white_bkgd,
raw_noise_std=0, # Standard deviation of noise added to raw density.
density_bias=-1., # The shift added to raw densities pre-activation.
rgb_padding=0.001, # Padding added to the RGB outputs.
density_activation='softplus', # density activation
),
)
basedata_cfg = dict(
dataset_type=dataset_type,
datadir=f'data/multiscale/#DATANAME#',
white_bkgd=white_bkgd,
mode='train',
N_rand_per_sampler=N_rand_per_sampler,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
testdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
testdata_cfg.update(dict(mode='test'))
ray_keys = ['rays_o', 'rays_d', 'viewdirs', 'radii', 'lossmult', 'near', 'far']
train_pipeline = [
dict(type='MipMultiScaleSample',
keys=['target_s'] + ray_keys,
N_rand=N_rand_per_sampler),
dict(type='GetZvals',
enable=True,
lindisp=lindisp,
N_samples=num_samples + 1,
randomized=True),
dict(type='ToTensor', keys=['target_s'] + ray_keys),
]
test_pipeline = [
dict(type='GetZvals',
enable=True,
lindisp=lindisp,
N_samples=num_samples + 1,
randomized=False),
dict(type='ToTensor', keys=['image'] + ray_keys),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=1),
train=dict(
type='MipMultiScaleDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='MipMultiScaleDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='MipMultiScaleDataset',
cfg=testdata_cfg,
pipeline=test_pipeline, # same pipeline as validation
),
)
================================================
FILE: configs/nerf/nerf_blender_base01.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'nerf' # [nerf, kilo_nerf, mip_nerf]
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
max_iters = 200000
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=5, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=5,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 5), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='SaveSpiralHook',
params=dict(save_folder='visualizations/spiral')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/nerf/nerf_#DATANAME#_base01/'
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = True # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 4 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
model = dict(
type='NerfNetwork',
cfg=dict(
phase='train', # 'train' or 'test'
N_importance=128, # number of additional fine samples per ray
is_perturb=is_perturb,
chunk=1024 * 32, # mainly work for val
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
mlp=dict( # coarse model
type='NerfMLP',
skips=[4],
netdepth=8, # layers in network
netwidth=256, # channels per layer
netchunk=1024 * 32, # number of pts sent through network in parallel;
output_ch=5, # 5 if cfg.N_importance>0 else 4
use_viewdirs=use_viewdirs,
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
),
),
mlp_fine=dict( # fine model
type='NerfMLP',
skips=[4],
netdepth=8, # layers in fine network
netwidth=256, # channels per layer in fine network
netchunk=1024 * 32,
output_ch=5, # 5 if cfg.N_importance>0 else 4
use_viewdirs=use_viewdirs, # same as above
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
),
),
render=dict( # render model
type='NerfRender',
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
),
)
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/nerf_synthetic/#DATANAME#',
half_res=True, # load blender synthetic data at 400x400 instead of 800x800
testskip=
8, # will load 1/N images from test/val sets, useful for large datasets like deepvoxels
white_bkgd=white_bkgd,
is_batching=False, # True for blender, False for llff
mode='train',
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
testdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
testdata_cfg.update(dict(mode='test', testskip=0))
train_pipeline = [
dict(type='Sample'),
dict(type='DeleteUseless', keys=['images', 'poses', 'i_data', 'idx']),
dict(
type='ToTensor',
enable=True,
keys=['pose', 'target_s'],
),
dict(
type='GetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='SelectRays',
enable=True,
sel_n=N_rand_per_sampler,
precrop_iters=500,
precrop_frac=0.5), # 抽取N个射线
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless', enable=True,
keys=['pose', 'iter_n']), # 删除pose 其实求完ray就不再需要了
]
test_pipeline = [
dict(
type='ToTensor',
enable=True,
keys=['pose'],
),
dict(
type='GetRays',
enable=True,
),
dict(type='FlattenRays',
enable=True), # 原来是(H, W, ..) 变成(H*W, ...) 记录下原来的尺寸
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # 同上train_pipeline
dict(type='PerturbZvals', enable=False), # 测试集不扰动
dict(type='GetPts', enable=True),
dict(type='DeleteUseless', enable=True,
keys=['pose']), # 删除pose 其实求完ray就不再需要了
]
data = dict(
train_loader=dict(batch_size=1, num_workers=4),
train=dict(
type='SceneBaseDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='SceneBaseDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='SceneBaseDataset',
cfg=testdata_cfg,
pipeline=test_pipeline, # same pipeline as validation
),
)
================================================
FILE: configs/nerf/nerf_llff_base01.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'nerf' # [nerf, kilo_nerf, mip_nerf]
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
max_iters = 20
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=5, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=5,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 5), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='SaveSpiralHook',
params=dict(save_folder='visualizations/spiral')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
# dict(type='SaveDistillResultsHook', params=dict(), variables=dict(model='network', cfg='cfg', trainset='trainset')), # kilo示例
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/nerf/nerf_#DATANAME#_base01/'
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'llff'
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
model = dict(
type='NerfNetwork',
cfg=dict(
phase='train', # 'train' or 'test'
N_importance=128, # number of additional fine samples per ray
is_perturb=is_perturb,
chunk=1024 * 32, # mainly work for val
bs_data='rays_o', # the data's shape indicates the real batch-size
),
mlp=dict( # coarse model
type='NerfMLP',
skips=[4],
netdepth=8, # layers in network
netwidth=256, # channels per layer
netchunk=1024 * 32, # number of pts sent through network in parallel;
output_ch=5, # 5 if cfg.N_importance>0 else 4
use_viewdirs=use_viewdirs,
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
),
),
mlp_fine=dict( # fine model
type='NerfMLP',
skips=[4],
netdepth=8, # layers in fine network
netwidth=256, # channels per layer in fine network
netchunk=1024 * 32,
output_ch=5, # 5 if cfg.N_importance>0 else 4
use_viewdirs=use_viewdirs, # same as above
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
),
),
render=dict( # render model
type='NerfRender',
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
raw_noise_std=
1e0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
),
)
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/nerf_llff_data/#DATANAME#',
half_res=False, # load blender synthetic data at 400x400 instead of 800x800
testskip=
8, # will load 1/N images from test/val sets, useful for large datasets like deepvoxels
N_rand_per_sampler=N_rand_per_sampler,
llffhold=8, # will take every 1/N images as LLFF test set, paper uses 8
no_ndc=no_ndc,
white_bkgd=white_bkgd,
spherify=False, # set for spherical 360 scenes
shape='greek', # options : armchair / cube / greek / vase
factor=8, # downsample factor for LLFF images
is_batching=True, # True for blender, False for llff
mode='train',
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
testdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
testdata_cfg.update(dict(mode='test', testskip=0))
train_pipeline = [
dict(
type='BatchSample',
enable=True,
N_rand=N_rand_per_sampler,
),
dict(type='DeleteUseless', keys=['rays_rgb', 'idx']),
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s'],
),
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True),
dict(type='GetZvals', enable=True, lindisp=lindisp, N_samples=N_samples),
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless', enable=True, keys=['iter_n']), # iter_n
]
test_pipeline = [
dict(
type='ToTensor',
enable=True,
keys=['pose'],
),
dict(
type='GetRays',
enable=True,
),
dict(type='FlattenRays',
enable=True), # 原来是(H, W, ..) 变成(H*W, ...) 记录下原来的尺寸
dict(
type='GetViewdirs',
enable=use_viewdirs,
),
dict(
type='ToNDC',
enable=(not no_ndc),
),
dict(type='GetBounds', enable=True),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # 同上train_pipeline
dict(type='PerturbZvals', enable=False), # 测试集不扰动
dict(type='GetPts', enable=True),
dict(type='DeleteUseless', enable=True,
keys=['pose']), # 删除pose 其实求完ray就不再需要了
]
data = dict(
train_loader=dict(batch_size=4, num_workers=4),
train=dict(
type='SceneBaseDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='SceneBaseDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='SceneBaseDataset',
cfg=testdata_cfg,
pipeline=test_pipeline, # same pipeline as validation
),
)
================================================
FILE: configs/neuralbody/nb_zjumocap_313.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'neuralbody'
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/neuralbody/zjumocap_313/' # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_frame = 60
model = dict(
type='NeuralBodyNetwork',
cfg=dict(
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
use_viewdirs=use_viewdirs,
is_perturb=is_perturb,
chunk=1024 * 4, # mainly work for val
smpl_embedder=dict(
type='SmplEmbedder',
voxel_size=[0.005, 0.005, 0.005],
),
num_train_frame=num_train_frame,
nerf_mlp=dict(
type='NB_NeRFMLP',
num_frame=num_train_frame,
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x).split('_')[4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x).split('_')[4]) - 1
frame_interval = 1
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/zju_mocap/CoreView_313',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=0.5, # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 6, 12, 18],
test_view=[1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20],
num_train_frame=num_train_frame,
training_frame=[0, num_train_frame * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='NeuralBodyDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/neuralbody/nb_zjumocap_315.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'neuralbody'
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/neuralbody/zjumocap_315/' # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_frame = 400
model = dict(
type='NeuralBodyNetwork',
cfg=dict(
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
use_viewdirs=use_viewdirs,
is_perturb=is_perturb,
chunk=1024 * 4, # mainly work for val
smpl_embedder=dict(
type='SmplEmbedder',
voxel_size=[0.005, 0.005, 0.005],
),
num_train_frame=num_train_frame,
nerf_mlp=dict(
type='NB_NeRFMLP',
num_frame=num_train_frame,
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x).split('_')[4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x).split('_')[4]) - 1
frame_interval = 1
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/zju_mocap/CoreView_315',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=0.5, # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 6, 12, 18],
test_view=[1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20],
num_train_frame=num_train_frame,
training_frame=[0, num_train_frame * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='NeuralBodyDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/neuralbody/nb_zjumocap_377.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'neuralbody'
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/neuralbody/zjumocap_377/' # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_frame = 300
model = dict(
type='NeuralBodyNetwork',
cfg=dict(
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
use_viewdirs=use_viewdirs,
is_perturb=is_perturb,
chunk=1024 * 4, # mainly work for val
smpl_embedder=dict(
type='SmplEmbedder',
voxel_size=[0.005, 0.005, 0.005],
),
num_train_frame=num_train_frame,
nerf_mlp=dict(
type='NB_NeRFMLP',
num_frame=num_train_frame,
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 1
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/zju_mocap/CoreView_377',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=0.5, # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 6, 12, 18],
test_view=[
1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22
],
num_train_frame=num_train_frame,
training_frame=[0, num_train_frame * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='NeuralBodyDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/neuralbody/nb_zjumocap_386.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'neuralbody'
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/neuralbody/zjumocap_386/' # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_frame = 300
model = dict(
type='NeuralBodyNetwork',
cfg=dict(
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
use_viewdirs=use_viewdirs,
is_perturb=is_perturb,
chunk=1024 * 4, # mainly work for val
smpl_embedder=dict(
type='SmplEmbedder',
voxel_size=[0.005, 0.005, 0.005],
),
num_train_frame=num_train_frame,
nerf_mlp=dict(
type='NB_NeRFMLP',
num_frame=num_train_frame,
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 1
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/zju_mocap/CoreView_386',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=0.5, # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 6, 12, 18],
test_view=[
1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22
],
num_train_frame=num_train_frame,
training_frame=[0, num_train_frame * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='NeuralBodyDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/neuralbody/nb_zjumocap_387.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'neuralbody'
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/neuralbody/zjumocap_387/' # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_frame = 300
model = dict(
type='NeuralBodyNetwork',
cfg=dict(
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
use_viewdirs=use_viewdirs,
is_perturb=is_perturb,
chunk=1024 * 4, # mainly work for val
smpl_embedder=dict(
type='SmplEmbedder',
voxel_size=[0.005, 0.005, 0.005],
),
num_train_frame=num_train_frame,
nerf_mlp=dict(
type='NB_NeRFMLP',
num_frame=num_train_frame,
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 1
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/zju_mocap/CoreView_387',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=0.5, # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 6, 12, 18],
test_view=[
1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22
],
num_train_frame=num_train_frame,
training_frame=[0, num_train_frame * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='NeuralBodyDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/neuralbody/nb_zjumocap_390.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'neuralbody'
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/neuralbody/zjumocap_390/' # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_frame = 300
model = dict(
type='NeuralBodyNetwork',
cfg=dict(
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
use_viewdirs=use_viewdirs,
is_perturb=is_perturb,
chunk=1024 * 4, # mainly work for val
smpl_embedder=dict(
type='SmplEmbedder',
voxel_size=[0.005, 0.005, 0.005],
),
num_train_frame=num_train_frame,
nerf_mlp=dict(
type='NB_NeRFMLP',
num_frame=num_train_frame,
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 1
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/zju_mocap/CoreView_390',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=0.5, # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 6, 12, 18],
test_view=[
1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22
],
num_train_frame=num_train_frame,
training_frame=[700, 700 + num_train_frame * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='NeuralBodyDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/neuralbody/nb_zjumocap_392.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'neuralbody'
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/neuralbody/zjumocap_392/' # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_frame = 300
model = dict(
type='NeuralBodyNetwork',
cfg=dict(
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
use_viewdirs=use_viewdirs,
is_perturb=is_perturb,
chunk=1024 * 4, # mainly work for val
smpl_embedder=dict(
type='SmplEmbedder',
voxel_size=[0.005, 0.005, 0.005],
),
num_train_frame=num_train_frame,
nerf_mlp=dict(
type='NB_NeRFMLP',
num_frame=num_train_frame,
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 1
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/zju_mocap/CoreView_392',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=0.5, # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 6, 12, 18],
test_view=[
1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22
],
num_train_frame=num_train_frame,
training_frame=[0, num_train_frame * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='NeuralBodyDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/neuralbody/nb_zjumocap_393.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'neuralbody'
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/neuralbody/zjumocap_393/' # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_frame = 300
model = dict(
type='NeuralBodyNetwork',
cfg=dict(
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
use_viewdirs=use_viewdirs,
is_perturb=is_perturb,
chunk=1024 * 4, # mainly work for val
smpl_embedder=dict(
type='SmplEmbedder',
voxel_size=[0.005, 0.005, 0.005],
),
num_train_frame=num_train_frame,
nerf_mlp=dict(
type='NB_NeRFMLP',
num_frame=num_train_frame,
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 1
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/zju_mocap/CoreView_393',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=0.5, # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 6, 12, 18],
test_view=[
1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22
],
num_train_frame=num_train_frame,
training_frame=[0, num_train_frame * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='NeuralBodyDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/neuralbody/nb_zjumocap_394.py
================================================
_base_ = [
# '../_base_/models/nerf.py',
# '../_base_/schedules/adam_20w_iter.py',
# '../_base_/default_runtime.py'
]
import os
from datetime import datetime
method = 'neuralbody'
# optimizer
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
lr_rate = 5e-4
max_iters = 2000000
evalute_config = dict()
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False)
checkpoint_config = dict(interval=10000, by_epoch=False)
log_level = 'INFO'
log_config = dict(interval=10000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 10000), ('val', 1)]
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否多卡,mmcv对dp多卡支持不好,故而要么单卡要么ddp多卡
work_dir = './work_dirs/neuralbody/zjumocap_394/' # noqa
timestamp = datetime.now().strftime('%d-%b-%H-%M')
# shared params by model and data and ...
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True # 源代码中'if args.dataset_type != 'llff' or args.no_ndc:' 就设置no_ndc
white_bkgd = False # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 1 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
load_from = os.path.join(work_dir, 'latest.pth')
num_train_frame = 300
model = dict(
type='NeuralBodyNetwork',
cfg=dict(
raw_noise_std=
0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
white_bkgd=
white_bkgd, # set to render synthetic data on a white bkgd (always use for dvoxels)
use_viewdirs=use_viewdirs,
is_perturb=is_perturb,
chunk=1024 * 4, # mainly work for val
smpl_embedder=dict(
type='SmplEmbedder',
voxel_size=[0.005, 0.005, 0.005],
),
num_train_frame=num_train_frame,
nerf_mlp=dict(
type='NB_NeRFMLP',
num_frame=num_train_frame,
embedder=dict(
type='BaseEmbedder',
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=
10, # log2 of max freq for positional encoding (3D location)
multires_dirs=
4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
)),
bs_data=
'rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
render=dict( # render model
type='NerfRender', ),
)
img_path_to_smpl_idx = lambda x: int(os.path.basename(x)[:-4])
img_path_to_frame_idx = lambda x: int(os.path.basename(x)[:-4])
frame_interval = 1
val_frame_interval = 30
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/zju_mocap/CoreView_394',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=0.5, # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 6, 12, 18],
test_view=[
1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22
],
num_train_frame=num_train_frame,
training_frame=[0, num_train_frame * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
train_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
), # 与batching型dataset不同的是, 需要从pose生成rays
dict(type='NBSelectRays', enable=True, sel_n=N_rand_per_sampler), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
test_pipeline = [
dict(
type='LoadImageAndCamera',
enable=True,
), # 读取图片和相机参数
dict(
type='LoadSmplParam',
enable=True,
), # 读取SMPL参数
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'target_s', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'ims', 'cfg', 'data_root', 'idx',
'img_path', 'num_cams'
]),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=0),
train=dict(
type='NeuralBodyDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
)
================================================
FILE: configs/neuralbody/nb_zjumocap_render_313.py
================================================
_base_ = ['nb_zjumocap_313.py']
from configs.neuralbody.nb_zjumocap_313 import *
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='NBSaveSpiralHook', params=dict()),
]
ratio = 0.5
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/zju_mocap/CoreView_313',
smpl_vertices_dir='new_vertices',
smpl_params_dir='new_params',
ratio=ratio, # reduce the image resolution by ratio
unit=1000.,
training_view=[0, 6, 12, 18],
test_view=[1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20],
num_train_frame=num_train_frame,
training_frame=[0, num_train_frame * frame_interval
], # [begin_frame, end_frame]
frame_interval=frame_interval,
val_frame_interval=val_frame_interval,
white_bkgd=white_bkgd,
mode='train',
img_path_to_smpl_idx=img_path_to_smpl_idx,
img_path_to_frame_idx=img_path_to_frame_idx,
)
frame_idx_to_smpl_idx = lambda x: x + 1
frame_idx_to_latent_idx = lambda x: x
valdata_cfg = basedata_cfg.copy()
valdata_cfg.update(
dict(mode='render',
num_render_views=50,
frame_idx=0,
frame_idx_to_smpl_idx=frame_idx_to_smpl_idx,
frame_idx_to_latent_idx=frame_idx_to_latent_idx,
render_H=int(1024 * ratio),
render_W=int(1024 * ratio),
ratio=ratio))
test_pipeline = [
dict(
type='LoadCamAndSmplParam',
enable=True,
), # 读取相机和Smpl参数
dict(
type='NBGetRays',
enable=True,
),
dict(type='NBSelectRays', enable=True, sel_all=True,
sel_rgb=False), # 抽取N个射线
dict(
type='ToTensor',
enable=True,
keys=['rays_o', 'rays_d', 'near', 'far', 'mask_at_box'],
),
dict(type='GetZvals', enable=True, lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=False),
dict(type='GetPts', enable=True),
dict(type='DeleteUseless',
enable=True,
keys=[
'iter_n', 'cams', 'cam_inds', 'cfg', 'data_root', 'idx',
'spiral_poses', 'K'
]),
]
data.update(
dict(test=dict(
type='NeuralBodyDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
), ))
================================================
FILE: docker/Dockerfile
================================================
ARG PYTORCH="1.9.0"
ARG CUDA="11.1"
ARG CUDNN="8"
FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel
ENV TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
ENV CMAKE_PREFIX_PATH="$(dirname $(which conda))/../"
RUN rm /etc/apt/sources.list.d/cuda.list
RUN rm /etc/apt/sources.list.d/nvidia-ml.list
RUN apt-key del 7fa2af80
# RUN apt-get update && apt-get install -y --no-install-recommends wget --assume-yes apt-utils
# RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-keyring_1.0-1_all.deb
# RUN dpkg -i cuda-keyring_1.0-1_all.deb
RUN apt-get update && \
apt-get install git ninja-build ffmpeg libsm6 libxext6 vim -y -f && \
apt-get install build-essential -y && \
apt-get install wget -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install torch1.10 and mmcv-full
RUN wget https://download.pytorch.org/whl/cu111/torch-1.10.0%2Bcu111-cp37-cp37m-linux_x86_64.whl
RUN pip install torch-1.10.0+cu111-cp37-cp37m-linux_x86_64.whl && \
pip cache purge && rm torch-1.10.0+cu111-cp37-cp37m-linux_x86_64.whl
RUN pip install opencv-python>=3 yapf imageio scikit-image && \
pip cache purge
RUN pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.10.0/index.html && \
pip cache purge
RUN pip install coverage pytest && \
pip cache purge
# Install neural-body needed pkgs
RUN pip install spconv-cu111 && \
pip cache purge
RUN pip install lpips trimesh matplotlib smplx && \
pip cache purge
RUN git clone https://github.com/facebookresearch/pytorch3d.git
RUN cd pytorch3d && pip install -e . && \
pip cache purge
# Install tcnn
RUN git clone --recursive https://github.com/nvlabs/tiny-cuda-nn
# below may meet error, because 'docker build' runs without gpus by default
# https://stackoverflow.com/questions/59691207/docker-build-with-nvidia-runtime
RUN cd tiny-cuda-nn/bindings/torch && python setup.py install
# Install xrnerf extension
RUN git clone https://github.com/openxrlab/xrnerf.git
RUN cd xrnerf/extensions/mesh_grid && python setup.py install
RUN cd xrnerf/extensions/ngp_raymarch && python setup.py build_ext --inplace && python setup.py install
# Verification
RUN cd xrnerf && coverage run --source xrnerf/models -m pytest -s test/models && coverage report -m
================================================
FILE: docker/DockerfileCN
================================================
ARG PYTORCH="1.9.0"
ARG CUDA="11.1"
ARG CUDNN="8"
FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel
# ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0+PTX"
ENV TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
ENV CMAKE_PREFIX_PATH="$(dirname $(which conda))/../"
RUN rm /etc/apt/sources.list.d/cuda.list
RUN rm /etc/apt/sources.list.d/nvidia-ml.list
RUN apt-key del 7fa2af80
ADD docker/sources.list /etc/apt/
# RUN apt-get update && apt-get install -y --no-install-recommends wget --assume-yes apt-utils
# RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-keyring_1.0-1_all.deb
# RUN dpkg -i cuda-keyring_1.0-1_all.deb
RUN apt-get update && \
apt-get install git ninja-build ffmpeg libsm6 libxext6 vim -y -f && \
apt-get install build-essential -y && \
apt-get install wget -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install torch1.10 and mmcv-full
RUN wget https://download.pytorch.org/whl/cu111/torch-1.10.0%2Bcu111-cp37-cp37m-linux_x86_64.whl
RUN pip install torch-1.10.0+cu111-cp37-cp37m-linux_x86_64.whl -i https://pypi.tuna.tsinghua.edu.cn/simple && \
pip cache purge && rm torch-1.10.0+cu111-cp37-cp37m-linux_x86_64.whl
RUN pip install opencv-python>=3 yapf imageio scikit-image -i https://pypi.doubanio.com/simple && \
pip cache purge
RUN pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.10.0/index.html && \
pip cache purge
RUN pip install coverage pytest -i https://pypi.tuna.tsinghua.edu.cn/simple && \
pip cache purge
# Install neural-body needed pkgs
RUN pip install spconv-cu111 -i https://pypi.tuna.tsinghua.edu.cn/simple && \
pip cache purge
RUN pip install lpips trimesh matplotlib smplx -i https://pypi.tuna.tsinghua.edu.cn/simple && \
pip cache purge
RUN git clone https://gitclone.com/github.com/facebookresearch/pytorch3d.git
RUN cd pytorch3d && pip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple && \
pip cache purge
# Install tcnn
# (If meet network problem, commented below out, download & install manually)
RUN git clone https://gitclone.com/github.com/nvlabs/tiny-cuda-nn
RUN cd tiny-cuda-nn/dependencies && git clone https://gitclone.com/github.com/fmtlib/fmt.git
RUN cd tiny-cuda-nn/dependencies && git clone https://gitclone.com/github.com/NVIDIA/cutlass.git
RUN cd tiny-cuda-nn/bindings/torch && python setup.py install
# gitclone收录日,家祭无忘告乃翁
# 0907 update:已收录,以下取消注释
RUN git clone https://gitclone.com/github.com/openxrlab/xrnerf.git
RUN cd xrnerf/extensions/mesh_grid && python setup.py install
RUN cd xrnerf/extensions/ngp_raymarch && python setup.py build_ext --inplace && python setup.py install
# 运行ut验证安装
RUN cd xrnerf && coverage run --source xrnerf/models -m pytest -s test/models && coverage report -m
================================================
FILE: docker/daemon.json
================================================
{
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
},
"default-runtime": "nvidia"
}
================================================
FILE: docker/sources.list
================================================
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
================================================
FILE: docs/en/CONTRIBUTING.md
================================================
# Contributing to XRNeRF
All kinds of contributions are welcome, including but not limited to the following.
- Fixes (typo, bugs)
- New features and components
## Workflow
1. Fork and pull the latest xrnerf
1. Checkout a new branch with a meaningful name (do not use master branch for PRs)
1. Commit your changes
1. Create a PR
```{note}
- If you plan to add some new features that involve large changes, it is encouraged to open an issue for discussion first.
- If you are the author of some papers and would like to include your method to xrnerf, please contact us. We will much appreciate your contribution.
```
## Code style
### Python
We adopt [PEP8](https://www.python.org/dev/peps/pep-0008/) as the preferred code style.
We use the following tools for linting and formatting:
- [flake8](http://flake8.pycqa.org/en/latest/): linter
- [yapf](https://github.com/google/yapf): formatter
- [isort](https://github.com/timothycrosley/isort): sort imports
Style configurations of yapf and isort can be found in [setup.cfg](../setup.cfg).
We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `flake8`, `yapf`, `isort`, `trailing whitespaces`,
fixes `end-of-files`, sorts `requirments.txt` automatically on every commit.
The config for a pre-commit hook is stored in [.pre-commit-config](../.pre-commit-config.yaml).
After you clone the repository, you will need to install initialize pre-commit hook.
```
pip install -U pre-commit
```
From the repository folder
```
pre-commit install
```
If you are facing an issue when installing markdown lint, you may install ruby for markdown lint by
referring to [this repo](https://github.com/innerlee/setup) by following the usage and taking [`zzruby.sh`](https://github.com/innerlee/setup/blob/master/zzruby.sh)
or by the following steps
```shell
# install rvm
curl -L https://get.rvm.io | bash -s -- --autolibs=read-fail
rvm autolibs disable
# install ruby
rvm install 2.7.1
```
After this on every commit check code linters and formatter will be enforced.
> Before you create a PR, make sure that your code lints and is formatted by yapf.
### C++ and CUDA
We follow the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html).
================================================
FILE: docs/en/additional_licenses.md
================================================
# Additional Licenses
We would like to pay tribute to open-source implementations to which we make reference. Note that they may carry additional license requiresments.
## instant-ngp
Copyright (c) 2022, NVIDIA Corporation & affiliates. All rights reserved.
NVIDIA Source Code License for instant neural graphics primitives
=======================================================================
1. Definitions
"Licensor" means any person or entity that distributes its Work.
"Software" means the original work of authorship made available under
this License.
"Work" means the Software and any additions to or derivative works of
the Software that are made available under this License.
The terms "reproduce," "reproduction," "derivative works," and
"distribution" have the meaning as provided under U.S. copyright law;
provided, however, that for the purposes of this License, derivative
works shall not include works that remain separable from, or merely
link (or bind by name) to the interfaces of, the Work.
Works, including the Software, are "made available" under this License
by including in or with the Work either (a) a copyright notice
referencing the applicability of this License to the Work, or (b) a
copy of this License.
2. License Grants
2.1 Copyright Grant. Subject to the terms and conditions of this
License, each Licensor grants to you a perpetual, worldwide,
non-exclusive, royalty-free, copyright license to reproduce,
prepare derivative works of, publicly display, publicly perform,
sublicense and distribute its Work and any resulting derivative
works in any form.
3. Limitations
3.1 Redistribution. You may reproduce or distribute the Work only
if (a) you do so under this License, (b) you include a complete
copy of this License with your distribution, and (c) you retain
without modification any copyright, patent, trademark, or
attribution notices that are present in the Work.
3.2 Derivative Works. You may specify that additional or different
terms apply to the use, reproduction, and distribution of your
derivative works of the Work ("Your Terms") only if (a) Your Terms
provide that the use limitation in Section 3.3 applies to your
derivative works, and (b) you identify the specific derivative
works that are subject to Your Terms. Notwithstanding Your Terms,
this License (including the redistribution requirements in Section
3.1) will continue to apply to the Work itself.
3.3 Use Limitation. The Work and any derivative works thereof only
may be used or intended for use non-commercially. Notwithstanding
the foregoing, NVIDIA and its affiliates may use the Work and any
derivative works commercially. As used herein, "non-commercially"
means for research or evaluation purposes only.
3.4 Patent Claims. If you bring or threaten to bring a patent claim
against any Licensor (including any claim, cross-claim or
counterclaim in a lawsuit) to enforce any patents that you allege
are infringed by any Work, then your rights under this License from
such Licensor (including the grant in Section 2.1) will terminate
immediately.
3.5 Trademarks. This License does not grant any rights to use any
Licensor�s or its affiliates� names, logos, or trademarks, except
as necessary to reproduce the notices described in this License.
3.6 Termination. If you violate any term of this License, then your
rights under this License (including the grant in Section 2.1) will
terminate immediately.
4. Disclaimer of Warranty.
THE WORK IS PROVIDED "AS IS" WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR
NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER
THIS LICENSE.
5. Limitation of Liability.
EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL
THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE
SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
OR RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK
(INCLUDING BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION,
LOST PROFITS OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER
COMMERCIAL DAMAGES OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF
THE POSSIBILITY OF SUCH DAMAGES.
=======================================================================
================================================
FILE: docs/en/apis.md
================================================
# APIS
## run_nerf
input: args, running parameters
purpose: parse running parameters, and train, test or render a nerf model according to specified parameters
## train_nerf
input: cfg, mmcv.Config
purpose: parse running parameters, train a nerf model according to specified parameters
## test_nerf
input: cfg, mmcv.Config
purpose: parse running parameters, test or render a nerf model according to specified parameters
## parse_args
input: args, running parameters
purpose: parse running parameters, convert to a mmcv.Config
================================================
FILE: docs/en/benchmark.md
================================================
# Benchmark
We compare our results with some popular frameworks and official releases in terms of speed.
## Settings
### Software Environment
- Python 3.7
- PyTorch 1.10
- CUDA 11.1
- CUDNN 8.1.0
## Main Results
### SceneNeRF
#### NeRF
| test data |
PSNR |
SSIM |
| NeRF |
XRNeRF |
NeRF |
XRNeRF |
| blender_chair |
33.927 | 34.528 | 0.967 | 0.985 |
| blender_drums |
25.600 | 25.685 | 0.925 | 0.946 |
| blender_ficus |
30.13 | 29.300 | 0.964 | 0.972 |
| blender_hotdog |
36.18 | 35.905 | 0.974 | 0.985 |
| blender_materials |
29.62 | 29.014 | 0.949 | 0.967 |
| blender_mic |
32.58 | 32.95 | 0.980 | 0.986 |
| blender_ship |
28.65 | 29.46 | 0.856 | 0.932 |
| llff_fern |
25.17 | 26.277 | 0.792 | 0.892 |
| llff_flower |
27.40 | 26.592 | 0.827 | 0.884 |
| llff_fortress |
31.16 | 31.485 | 0.881 | 0.952 |
| llff_horns |
27.45 | 26.162 | 0.828 | 0.895 |
| llff_leaves |
20.92 | 19.749 | 0.690 | 0.668 |
#### Kilo-NeRF
| test data |
PSNR |
SSIM |
elapsed_time(ms) |
| KiloNeRF |
XRNeRF |
KiloNerf |
XRNeRF |
KiloNerf |
XRNeRF |
| nsvf_Synthetic_NeRF_chair |
33.044 | 33.037 | 0.971 | 0.979 | 384.98 | 407.78 |
| nsvf_Synthetic_NeRF_drums |
25.327 | 25.308 | 0.931 | 0.949 | 413.03 | 353.62 |
| nsvf_Synthetic_NeRF_ficus |
30.1 | 30.176 | 0.967 | 0.975 | 351.04 | 337.22 |
| nsvf_Synthetic_NeRF_hotdog |
32.316 | 33.408 | 0.974 | 0.986 | 484.22 | 491.49 |
| nsvf_Synthetic_NeRF_lego |
33.398 | 33.381 | 0.971 | 0.982 | 379.1 | 365.16 |
| nsvf_Synthetic_NeRF_materials |
29.193 | 29.175 | 0.951 | 0.966 | 380.28 | 358.57 |
| nsvf_Synthetic_NeRF_mic |
33.186 | 33.346 | 0.982 | 0.987 | 370.31 | 346.71 |
| nsvf_Synthetic_NeRF_ship |
28.892 | 29.295 | 0.874 | 0.933 | 491.92 | 488.35 |
| Average |
30.68 | 30.89102 | 0.9526 | 0.9697 | 406.86 | 393.61 |
#### Mip-NeRF
| MultiScale Blender |
PSNR |
| 800x800 |
400x400 |
200x200 |
100x100 |
| Jax |
XRNeRF |
Jax |
XRNeRF |
Jax |
XRNeRF |
Jax |
XRNeRF |
| blender_ship |
29.599 | 28.522 | 31.955 | 30.754 | 33.845 | 32.848 | 34.868 | 33.754 |
| blender_mic |
33.739 | 32.478 | 36.353 | 35.008 | 38.837 | 37.958 | 39.011 | 38.064 |
| blender_materials |
30.128 | 29.278 | 31.424 | 30.505 | 33.163 | 32.192 | 34.174 | 33.122 |
| blender_lego |
33.971 | 32.803 | 35.248 | 34.123 | 35.796 | 34.848 | 35.223 | 34.382 |
| blender_hotdog |
36.457 | 35.803 | 38.382 | 37.631 | 39.831 | 39.096 | 39.935 | 39.038 |
| blender_ficus |
31.490 | 29.222 | 32.267 | 30.093 | 33.255 | 31.655 | 33.606 | 31.785 |
| blender_drums |
25.297 | 24.790 | 26.463 | 26.020 | 27.808 | 27.510 | 28.791 | 28.369 |
| blender_chair |
33.351 | 32.429 | 36.517 | 35.618 | 38.056 | 37.342 | 37.950 | 37.257 |
| Average |
31.754 | 30.666 | 33.576 | 32.469 | 35.074 | 34.181 | 35.445 | 34.472 |
#### InstantNGP
| test data |
PSNR |
| InstantNGP |
XRNeRF |
| blender_chair |
32.927 | 32.71 |
| blender_drums |
26.02 | 26.9 |
| blender_ficus |
33.51 | 33.97 |
| blender_hotdog |
37.40 | 37.17 |
| blender_lego |
36.39 | 35.1 |
| blender_materials |
29.78 | 30.73 |
| blender_mic |
36.22 | 34.05 |
| blender_ship |
31.1 | 30.0 |
| average |
32.92 | 32.58 |
### HumanNeRF
#### Neural Body
| test data |
PSNR |
SSIM |
| Neural Body |
XRNeRF |
Neural Body |
XRNeRF |
| 313 |
35.21 | 37.76 | 0.985 | 0.993 |
| 315 |
33.07 | 35.99 | 0.988 | 0.992 |
| 377 |
33.86 | 33.86 | 0.985 | 0.986 |
| 386 |
36.07 | 34.24 | 0.984 | 0.984 |
| 387 |
31.39 | 31.99 | 0.975 | 0.979 |
| 390 |
34.48 | 35.45 | 0.980 | 0.984 |
| 392 |
35.76 | 35.11 | 0.984 | 0.986 |
| 393 |
33.24 | 33.50 | 0.979 | 0.985 |
| 394 |
34.31 | 35.61 | 0.980 | 0.984 |
#### Animatable NeRF
| test data (Novel pose) |
PSNR |
SSIM |
| Animatable NeRF |
XRNeRF |
Animatable NeRF |
XRNeRF |
| S1 |
30.11 | 31.98 | 0.981 | 0.984 |
| S5 |
32.60 | 33.25 | 0.987 | 0.990 |
| S6 |
29.49 | 30.12 | 0.972 | 0.974 |
| S7 |
31.54 | 34.47 | 0.984 | 0.988 |
| S8 |
30.77 | 32.01 | 0.983 | 0.985 |
| S9 |
31.94 | 28.61 | 0.980 | 0.976 |
| S11 |
33.12 | 33.43 | 0.986 | 0.986 |
#### GNR
| test data |
PSNR |
SSIM |
| GNR |
XRNeRF |
GNR |
XRNeRF |
| amanda |
23.62 | 25.35 | 0.93 | 0.95 |
| barry |
29.28 | 30.71 | 0.94 | 0.95 |
| fuzhizhi |
21.96 | 21.42 | 0.90 | 0.89 |
| jinyutong |
23.90 | 24.08 | 0.90 | 0.91 |
| joseph |
26.30 | 24.46 | 0.94 | 0.92 |
| maria |
21.51 | 23.69 | 0.90 | 0.90 |
| mahaoran |
28.41 | 30.93 | 0.93 | 0.94 |
| natacha |
28.71 | 27.98 | 0.91 | 0.91 |
| soufianou |
27.64 | 28.83 | 0.93 | 0.93 |
| zhuna |
25.40 | 24.32 | 0.93 | 0.92 |
================================================
FILE: docs/en/dataset_preparation.md
================================================
# Data Preparation
We provide some tips for XRNeRF data preparation in this file.
- [Data Preparation](#data-preparation)
- [Getting Data](#getting-data)
- [Dataset Organization](#dataset-organization)
- [Dataset Download](#dataset-download)
## Getting Data
#### Dataset Organization
It is recommended to symlink the dataset root to $PROJECT/data. If your folder structure is different, you may need to change the corresponding paths in config files.
```
xrnerf
├── xrnerf
├── docs
├── configs
├── test
├── extensions
├── data
│ ├── nerf_llff_data
│ ├── nerf_synthetic
│ ├── multiscale
│ ├── multiscale_google
│ ├── ...
```
#### Dataset Download
1. Download ```nerf_synthetic``` and ```nerf_llff_data``` from [here](https://drive.google.com/drive/folders/128yBriW1IG_3NJ5Rp7APSTZsJqdJdfc1), and put it under ```xrnerf/data```
2. Credit to NSVF authors for providing [their datasets](https://github.com/facebookresearch/NSVF), read introductions [here](https://github.com/creiser/kilonerf#download-nsvf-datasets)
3. For mip-nerf training, you can generate the multiscale dataset used in the paper by running the following command, ```python tools/convert_blender_data.py --blenderdir /data/nerf_synthetic --outdir data/multiscale```
4. For the training of NeuralBody, please download the dataset from [here](https://github.com/zju3dv/neuralbody/blob/master/INSTALL.md#zju-mocap-dataset).
5. For the training of Animatable NeRF, please download the dataset from [here](https://github.com/zju3dv/animatable_nerf/blob/master/INSTALL.md#human36m-dataset).
6. For the training of GNR, please download the dataset from [here](https://generalizable-neural-performer.github.io/genebody.html).
7. For the training of BungeeNeRF, please download the dataset from [here](https://drive.google.com/drive/folders/1ybq-BuRH0EEpcp5OZT9xEMi-Px1pdx4D?usp=sharing).
================================================
FILE: docs/en/faq.md
================================================
# FAQ
## Outline
We list some common issues faced by many users and their corresponding solutions here.
- [FAQ](#faq)
- [Outline](#outline)
- [Installation](#installation)
- [Data](#data)
- [Training](#training)
- [Testing](#testing)
- [Deploying](#deploying)
Feel free to enrich the list if you find any frequent issues and have ways to help others to solve them.
## Installation
- **"No module named 'mmcv'"**
1. Install mmcv-full following the [installation instruction](https://mmcv.readthedocs.io/en/latest/#installation)
- **"No module named 'raymarch'"**
1. Change workdir to extensions' directory using `cd extensions/ngp_raymarch`
2. Compile cuda extensions using `rm -rf build && clear && python setup.py build_ext --inplace`
3. Install cuda extensions using `python setup.py install`
================================================
FILE: docs/en/get_started.md
================================================
# Getting Started
This page provides basic tutorials about the usage of XRNeRF.
For installation instructions, please see [installation.md](installation.md).
- [Getting Started](#getting-started)
- [Datasets](#datasets)
- [Build a Model](#build-a-model)
- [Basic Concepts](#basic-concepts)
- [Write a new network](#write-a-new-network)
- [Installation](#installation)
- [Train a Model](#train-a-model)
- [Iteration Controls](#iteration-controls)
- [Train](#train)
- [Test](#test)
- [Tutorials](#tutorials)
- [Other Documents](#other-documents)
## Datasets
It is recommended to symlink the dataset root to `$PROJECT/data`.
If your folder structure is different, you may need to change the corresponding paths in config files.
```
xrnerf
├── xrnerf
├── docs
├── configs
├── test
├── extensions
├── data
│ ├── nerf_llff_data
│ ├── nerf_synthetic
│ ├── multiscale
│ ├── multiscale_google
│ ├── ...
```
For more information on data preparation, please see [dataset_preparation.md](dataset_preparation.md)
## Build a Model
### Basic Concepts
In XRNeRF, model components are basically categorized as 4 types.
- network: the whole nerf model pipeline, usually contains a embedder, mlp and render.
- embedder: convert point-position and viewdirection data into embedded data, embedder can be function only or with trainable paramters.
- mlp: use the output of embedder as input, and output raw data (the rgb and density value at sampled position) for render, usually contains FC layers.
- render: receive mlp's raw data, output the rgb value at a pixel.
Following some basic pipelines (e.g., `NerfNetwork`), the model structure
can be customized through config files with no pains.
### Write a new network
To write a new nerf network, you need to inherit from `BaseNerfNetwork`,
which defines the following abstract methods.
- `train_step()`: forward method of the training mode.
- `val_step()`: forward method of the testing mode.
[NerfNetwork](../../xrnerf/models/networks/nerf.py) is a good example which show how to do that.
To be specific, if we want to implement some new components, there are several things to do.
1. create a new file in `xrnerf/models/networks/my_networks.py`.
```python
from ..builder import NETWORKS
from .nerf import NerfNetwork
@NETWORKS.register_module()
class MyNerfNetwork(NerfNetwork):
def __init__(self, cfg, mlp=None, mlp_fine=None, render=None):
super().__init__(cfg, mlp, mlp_fine, render)
def forward(self, data):
....
def train_step(self, data, optimizer, **kwargs):
....
def val_step(self, data, optimizer=None, **kwargs):
....
```
2. Import the module in `xrnerf/models/networks/__init__.py`
```python
from .my_networks import MyNerfNetwork
```
3. modify the [config file](../../configs/nerf/nerf_blender_base01.py) from
```python
model = dict(
type='NerfNetwork',
....
```
to
```python
model = dict(
type='MyNerfNetwork',
....
```
To implement some new components for embedder/mlp/render, procedure is similar to above.
* To write a new nerf embedder, you need to inherit from `nn.Module` or `BaseEmbedder`, and define the `forward` method. [BaseEmbedder](../../xrnerf/models/embedders/base.py) is a good example.
* To write a new nerf mlp, you need to inherit from `nn.Module` or `BaseMLP`, and define the `forward` method. [NerfMLP](../../xrnerf/models/mlps/nerf_mlp.py) is a good example.
* To write a new nerf render, you need to inherit from `nn.Module` or `BaseRender`, and define the `forward` method. [NerfRender](../../xrnerf/models/renders/nerf_render.py) is a good example.
## Installation
We provide detailed [installation tutorial](installation.md) for xrnerf, users can install from scratch or use provided [dockerfile](../../docker/Dockerfile).
It is recommended to start by creating a docker image:
```shell
docker build -f ./docker/Dockerfile --rm -t xrnerf .
```
For more information, please follow our [installation tutorial](installation.md).
## Train a Model
### Iteration Controls
XRnerf use `mmcv.runner.IterBasedRunner` to control training, and `mmcv.runner.EpochBasedRunner` to for test mode.
In training mode, the `max_iters` in config file decide how many iters.
In test mode, `max_iters` is forced to change to 1, which represents only 1 epoch to test.
### Train
```shell
python run_nerf.py --config configs/nerf/nerf_blender_base01.py --dataname lego
```
Arguments are:
- `--config`: config file path.
- `--dataname`: select which data under dataset directory.
### Test
We have provided model ```iter_200000.pth``` for test, download from [here](https://drive.google.com/file/d/147wRy3TFlRVrZdWqAgHNak7s6jiMZA1-/view?usp=sharing)
```shell
python run_nerf.py --config configs/nerf/nerf_blender_base01.py --dataname lego --test_only --load_from iter_200000.pth
```
Arguments are:
- `--config`: config file path.
- `--dataname`: select which data under dataset directory.
- `--test_only`: influence on whole testset once.
- `--load_from`: load which checkpoint to test, this will overwrite the original `load_from` in config file to for convenience.
## Tutorials
Currently, we provide some tutorials for users to
* [learn about configs](tutorials/config.md)
* [customize data pipelines](tutorials/data_pipeline.md)
* [model define](tutorials/model.md)
## Other Documents
Except for that,The document also includes the following
* [api](api.md)
* [dataset_preparation](dataset_preparation.md)
* [installation](installation.md)
================================================
FILE: docs/en/installation.md
================================================
# Installation
We provide some tips for XRNeRF installation in this file.
- [Installation](#installation)
- [Requirements](#requirements)
- [Prepare environment](#prepare-environment)
- [a. Install development libs.](#a-install-development-libs)
- [b. Create a conda virtual environment and activate it.](#b-create-a-conda-virtual-environment-and-activate-it)
- [c. Install PyTorch and torchvision](#c-install-pytorch-and-torchvision)
- [d. Install Other Needed Python Packages](#d-install-other-needed-python-packages)
- [e. Install Extensions](#e-install-extensions)
- [d. Download smpl_t_pose to surport GNR](#d-download-smpl_t_pose-to-surport-gnr)
- [Another option: Docker Image](#another-option-docker-image)
- [a. Build an Image](#a-build-an-image)
- [b. Create a Container](#b-create-a-container)
- [Verification](#verification)
## Requirements
- Linux
- Python 3.7+
- **PyTorch 1.10+ (necessary)**
- **CUDA 11.0+ (necessary)**
- GCC 7.5+
- build-essential: Install by `apt-get install -y build-essential git ninja-build ffmpeg libsm6 libxext6 libgl1`
- [mmcv-full](https://github.com/open-mmlab/mmcv)
- Numpy
- ffmpeg (4.2 is preferred)
- [opencv-python 3+](https://github.com/dmlc/decord): Install by `pip install opencv-python>=3`
- [imageio](https://github.com/dmlc/decord): Install by `pip install imageio`
- [scikit-image](https://github.com/dmlc/decord): Install by `pip install scikit-image`
- [lpips](https://github.com/richzhang/PerceptualSimilarity): Install by `pip install lpips`
- [trimesh](https://github.com/mikedh/trimesh): Install by `pip install trimesh`
- [smplx](https://github.com/vchoutas/smplx): Install by `pip install smplx`
- [spconv](https://github.com/dmlc/decord): Install proper vision that matches your cuda-vision, for example `pip install spconv-cu113`
- [pytorch3d](https://github.com/dmlc/decord): Install by `pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"`
About hardware requirements:
Instant-NGP need GPU-ARCH>=75, which means that at least a RTX 20X0 is required to have a full support.
| RTX 30X0 | A100 | RTX 20X0 | TITAN V / V100 | GTX 10X0 / TITAN Xp | GTX 9X0 | K80 |
|:--------:|:----:|:--------:|:--------------:|:-------------------:|:-------:|:---:|
| 86 | 80 | 75 | 70 | 61 | 52 | 37 |
If you don't need instant-ngp, [spconv](https://github.com/traveller59/spconv#spconv-spatially-sparse-convolution-library) depends the minimum cuda version. So at least cuda 10.2 is needed.
## Prepare environment
#### a. Install development libs.
```shell
sudo apt install libgl-dev freeglut3-dev build-essential git ninja-build ffmpeg libsm6 libxext6 libgl1
```
#### b. Create a conda virtual environment and activate it.
```shell
conda create -n xrnerf python=3.7 -y
conda activate xrnerf
```
#### c. Install PyTorch and torchvision
1. check pytorch-cuda vision match table from [here](https://pytorch.org/get-started/previous-versions/) or [here](https://blog.csdn.net/weixin_42069606/article/details/105198845)
2. find a proper torch vision (>=1.10.0 and match your cuda vision) from [here](https://download.pytorch.org/whl/torch_stable.html), like ```cu111/torch-1.10.0%2Bcu111-cp37-cp37m-linux_x86_64.whl```, download the whl file
3. install your whl file, for example ```pip install torch-1.10.0+cu111-cp37-cp37m-linux_x86_64.whl```
4. check [here](https://pypi.org/project/torchvision/) and install specified vision of torchvision, for example ```pip install torchvision==0.12.0```
#### d. Install Other Needed Python Packages
* you can use ```pip install requirements.txt``` to install most of the needed pkgs. If this step succeeds, you should jump to ```kilo-cuda``` and ```spconv``` step to install them manually. Or you can skip this step and follow the installation steps below
* ```pip install 'opencv-python>=3' yapf imageio scikit-image lpips trimesh smplx```
* install ```mmcv-full``` following their [Installation](https://mmcv.readthedocs.io/en/latest/get_started/installation.html)
* install ```spconv``` using pip install, for example ```pip install spconv-cu111```. notice that only specified cuda-vision are supported, following their [Installation](https://github.com/traveller59/spconv)
* install ```pytorch3d``` using ```pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"```
* install ```kilo-cuda``` following their [Installation](https://github.com/creiser/kilonerf#option-b-build-cuda-extension-yourself)(optional, only needed for kilo-nerf)
* install ```tcnn``` using ```pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch```, or following their [Installation](https://github.com/NVlabs/tiny-cuda-nn#pytorch-extension)(optional, only needed for instant-ngp)
#### e. Install Extensions
* build cuda-extension ```raymarch``` for instant-ngp supported, following [ngp_raymarch](../../extensions/ngp_raymarch/README.md)
* build cuda-extension ```mesh_grid``` for gnr supported, following [mesh_grid](../../extensions/mesh_grid/README.md)
#### d. Download smpl_t_pose to surport GNR
* In order to support the ```GNR``` algorithm, you need to download the ```smpl_t_pose``` folder from [GNR](https://github.com/generalizable-neural-performer/gnr), and modify ```basedata_cfg.t_pose_path``` in ```configs/gnr/gnr_genebody.py``` to the corresponding storage location
## Another option: Docker Image
You need to set docker daemon, to enable docker-build's gpu support (for cuda extension install).
```shell
sudo apt-get install nvidia-container-runtime -f -y
sudo cp -f docker/daemon.json /etc/docker
sudo systemctl restart docker
```
See [here](https://stackoverflow.com/questions/59691207/docker-build-with-nvidia-runtime) for detail.
#### a. Build an Image
We provide a [Dockerfile](../../docker/Dockerfile) to build an image.
```shell
docker build -f ./docker/Dockerfile --rm -t xrnerf .
```
**Important:** Make sure you've installed the [nvidia-container-toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker).
#### b. Create a Container
Create a container with command:
```shell
docker run --gpus all -it xrnerf /bin/bash
```
Open a teiminal in your host computer, copy project into docker container
```shell
# d287273af72e is container id, using 'docker ps -a' to find id
docker cp ProjectPath/xrnerf d287273af72e:/workspace
```
## Verification
To verify whether XRNeRF and the required environment are installed correctly, we can run unit-test python codes
```shell
coverage run --source xrnerf/models -m pytest -s test/models && coverage report -m
```
Notice that ```coverage``` and ```pytest``` need to be installed before that
```
pip install coverage pytest -i https://pypi.tuna.tsinghua.edu.cn/simple
```
================================================
FILE: docs/en/tutorials/config.md
================================================
# Tutorial 1: Learn about Configs
We use python files as configs, incorporate modular and inheritance design into our config system, which is convenient to conduct various experiments.
You can find all the provided configs under `$PROJECT/configs`.
- [Tutorial 1: Learn about Configs](#tutorial-1-learn-about-configs)
- [Configuration Components](#configuration-components)
## Configuration Components
We can logically divide the configuration file into components:
* training
* model
* data
The fllowing content explain these configuration components one by one.
* training
training configurations contains all paramters to control model training, include optimizer, hooks, runner and soon on.
```python
import os
from datetime import datetime
method = 'nerf' # which nerf method
# optimizer setting
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
max_iters = 20000 # train for how many iters
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False) # learning rate and decay
checkpoint_config = dict(interval=5000, by_epoch=False) # when to save checkpoint
log_level = 'INFO'
log_config = dict(interval=5000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 5000), ('val', 1)] # loop: train 5000 iters, validate 1 iter
# hooks
# 'params' are numeric type value, 'variables' are variables in local environment
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='SaveSpiralHook',
params=dict(save_folder='visualizations/spiral')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
dict(type='OccupationHook',
params=dict()), # no need for open-source vision
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # whether to use ddp
work_dir = './work_dirs/nerfsv3/nerf_#DATANAME#_base01/' # where to save ckpt, images, video, logs
timestamp = datetime.now().strftime('%d-%b-%H-%M') # to make sure different log-files each train
# some shared params by model and data, to avoid define twice
dataset_type = 'blender'
no_batching = True # only take random rays from 1 image at a time
no_ndc = True
white_bkgd = True # set to render synthetic data on a white bkgd (always use for dvoxels)
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 4 # how many N_rand in get_item() function
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # number of coarse samples per ray
# resume_from = os.path.join(work_dir, 'latest.pth')
# load_from = os.path.join(work_dir, 'latest.pth')
```
* model
define network structure, a network is usually composed of embedder, mlp and render.
```python
model = dict(
type='NerfNetwork', # network class name
cfg=dict(
phase='train', # 'train' or 'test'
N_importance=128, # number of additional fine samples per ray
is_perturb=is_perturb, # see above
chunk=1024 * 32, # mainly work for val, to avoid oom
bs_data='rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
mlp=dict( # coarse mlp model
type='NerfMLP', # mlp class name
skips=[4],
netdepth=8, # layers in network
netwidth=256, # channels per layer
netchunk=1024 * 32, # to avoid oom
output_ch=5, # 5 if cfg.N_importance>0 else 4
use_viewdirs=use_viewdirs,
embedder=dict(
type='BaseEmbedder', # embedder class name
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=10, # log2 of max freq for positional encoding (3D location)
multires_dirs=4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
),
),
mlp_fine=dict( # fine model
type='NerfMLP',
skips=[4],
netdepth=8,
netwidth=256,
netchunk=1024 * 32,
output_ch=5,
use_viewdirs=use_viewdirs,
embedder=dict(
type='BaseEmbedder',
i_embed=0,
multires=10,
multires_dirs=4,
),
),
render=dict(
type='NerfRender', # render cloass name
white_bkgd=white_bkgd, # see above
raw_noise_std=0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
),
)
```
* data
define network structure, a network is usually composed of embedder, mlp and render.
```python
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/nerf_synthetic/#DATANAME#',
half_res=True, # load blender synthetic data at 400x400 instead of 800x800
testskip=
8, # will load 1/N images from test/val sets, useful for large datasets like deepvoxels
white_bkgd=white_bkgd,
is_batching=False, # True for blender, False for llff
mode='train',
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
testdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
testdata_cfg.update(dict(mode='test', testskip=0))
train_pipeline = [
dict(type='Sample'),
dict(type='DeleteUseless', keys=['images', 'poses', 'i_data', 'idx']),
dict(type='ToTensor', keys=['pose', 'target_s']),
dict(type='GetRays'),
dict(type='SelectRays',
sel_n=N_rand_per_sampler,
precrop_iters=500,
precrop_frac=0.5), # in the first 500 iter, select rays inside center of image
dict(type='GetViewdirs', enable=use_viewdirs),
dict(type='ToNDC', enable=(not no_ndc)),
dict(type='GetBounds'),
dict(type='GetZvals', lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts'),
dict(type='DeleteUseless', keys=['pose', 'iter_n']),
]
test_pipeline = [
dict(type='ToTensor', keys=['pose']),
dict(type='GetRays'),
dict(type='FlattenRays'),
dict(type='GetViewdirs', enable=use_viewdirs),
dict(type='ToNDC', enable=(not no_ndc)),
dict(type='GetBounds'),
dict(type='GetZvals', lindisp=lindisp, N_samples=N_samples),
dict(type='PerturbZvals', enable=False), # do not perturb when test
dict(type='GetPts'),
dict(type='DeleteUseless', keys=['pose']),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=4),
train=dict(
type='SceneBaseDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='SceneBaseDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='SceneBaseDataset',
cfg=testdata_cfg,
pipeline=test_pipeline, # same pipeline as validation
),
)
```
================================================
FILE: docs/en/tutorials/data_pipeline.md
================================================
# Tutorial 2: Customize Data Pipelines
In this tutorial, we will introduce some methods about the design of data pipelines, and how to customize and extend your own data pipelines for the project.
- [Tutorial 2: Customize Data Pipelines](#tutorial-2-customize-data-pipelines)
- [Concept of Data Pipelines](#concept-of-data-pipelines)
- [Design of Data Pipelines](#design-of-data-pipelines)
## Concept of Data Pipelines
Data Pipeline is a modular form for data process. We make common data processing operations into python class, which named ```pipeline```.
The following code block shows how to define a pipeline class to calculate viewdirs from rays' direction.
```python
@PIPELINES.register_module()
class GetViewdirs:
"""get viewdirs from rays_d
"""
def __init__(self, enable=True, **kwargs):
self.enable = enable
def __call__(self, results):
"""get viewdirs
Args:
results (dict): The resulting dict to be modified and passed
to the next transform in pipeline.
"""
if self.enable:
viewdirs = results['rays_d'].clone()
viewdirs = viewdirs / torch.norm(viewdirs, dim=-1, keepdim=True)
viewdirs = torch.reshape(viewdirs, [-1, 3]).float()
results['viewdirs'] = viewdirs
return results
```
To use the `GetViewdirs`, we can simply add `dict(type='GetViewdirs')` to `train_pipeline` in config file.
## Design of Data Pipelines
We logically divide data process pipeline into 4 python files:
* `creat.py` create or calculate new variables.
* `augment.py` data augmentation operations.
* `transforms.py` convert data type or change coordinate system.
* `compose.py` Combine various data processing operations into a pipeline.
A complete data pipeline configuration is shown below.
```python
train_pipeline = [
dict(type='Sample'),
dict(type='DeleteUseless', keys=['images', 'poses', 'i_data', 'idx']),
dict(type='ToTensor', keys=['pose', 'target_s']),
dict(type='GetRays'),
dict(type='SelectRays',
sel_n=N_rand_per_sampler,
precrop_iters=500,
precrop_frac=0.5), # in the first 500 iter, select rays inside center of image
dict(type='GetViewdirs', enable=use_viewdirs),
dict(type='ToNDC', enable=(not no_ndc)),
dict(type='GetBounds'),
dict(type='GetZvals', lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts'),
dict(type='DeleteUseless', keys=['pose', 'iter_n']),
]
```
In this case, the input data is a dict, created in [_fetch_train_data()](../../../xrnerf/datasets/scene_dataset.py)
```python
data = {'poses': self.poses, 'images': self.images, 'i_data': self.i_train, 'idx': idx}
```
In data pipeline, the data processing flow is as follows:
* `Sample` select one image or pose via `idx`, create `pose` and `target_s`
* `DeleteUseless` delete `'images', 'poses', 'i_data', 'idx'` in dict, they are already useless
* `ToTensor` convert `'pose', 'target_s'` in dict
* `GetRays` calculate `'rays_d', 'rays_o'` from camera parameter and images shape
* `SelectRays` select a batchsize rays
* `GetViewdirs` calculate viewdirs from rays' direction
* `ToNDC` Coordinate system transformation
* `GetBounds` get near and far
* `GetZvals` samples points along rays between near point and far point
* `PerturbZvals` data augmentation
* `GetPts` get points' position
================================================
FILE: docs/en/tutorials/model.md
================================================
# Tutorial 3: Model
In this tutorial, we will introduce the design of nerf model, and how data is processed inside model.
- [Tutorial 3: Model](#tutorial-3-model)
- [The Design of Nerf Model](#the-design-of-nerf-model)
- [Overview](#overview)
- [Embedder](#embedder)
- [MLP](#mlp)
- [RENDERS](#renders)
- [NETWORKS](#networks)
## The Design of Nerf Model
### Overview
In XRNeRF, models are basically categorized as 4 types.
- embedder: convert point-position and viewdirection data into embedded data, embedder can be function only or with trainable paramters.
- mlp: use the output of embedder as input, and output raw data (the rgb and density value at sampled position) for render, usually contains FC layers.
- render: receive mlp's raw data, output the rgb value at a pixel.
- network: the whole nerf model pipeline, usually contains a embedder, mlp and render.
For all models, the input or output is a dict, named `data`. Model use item in `data`, create new item and add into `dada`. Take [origin nerf](../../../configs/nerfs/nerf_blender_base01.py) method as example, the `data` is supposed to contain `pts`(shape is n_rays, n_pts, 3) and `viewdirs`(shape is n_rays, n_pts, 3).
### Embedder
The embedder usually takes points' position `pts` and rays' view direction `viewdirs` as input, generate embedded feature `embedded` and add it to `data`.
You can read [origin nerf's embedder](../../../xrnerf/models/embedders/base.py) to have a clear understanding of how embedder works.
To use [existed embedders](../../../xrnerf/models/embedders/__init__.py) in xrnerf, you can directlly choose one and specify it in config file. To realize your own embedder, read the following introductions.
* Create a `my_embedder.py` file under [embedders directory](../../../xrnerf/models/embedders/).
* Write a `MyEmbedder` class which inherits from `nn.Module` or `BaseEmbedder`, and define the `forward` method.
* Import your new class in [init file](../../../xrnerf/models/embedders/__init__.py).
* Modify the config file.
### MLP
The mlp usually takes points' embedded feature `embedded` as input, generate raw data and add it to `data`.
You can read [origin nerf's mlp](../../../xrnerf/models/mlps/nerf_mlp.py) to have a clear understanding of how mlp works.
To use [existed mlps](../../../xrnerf/models/mlps/__init__.py) in xrnerf, you can directlly choose one and specify it in config file. To realize your own mlp, the steps are similar to the embedder's.
### RENDERS
The render usually takes points' raw data as input, generate rgb values at each pixel (or ray).
You can read [origin nerf's render](../../../xrnerf/models/renders/nerf_render.py) to have a clear understanding of how render works.
To use [existed renders](../../../xrnerf/models/renders/__init__.py) in xrnerf, you can directlly choose one and specify it in config file. To realize your own render, the steps are similar to the embedder's.
### NETWORKS
The network contains defined embedder, mlp and render, it interacts with the mmcv training pipeline during training.
A network need to implement
two abstract methods: `train_step` and `val_step`. [Here](../get_started.md) is a detail case about how to define a network.
================================================
FILE: docs/zh_cn/apis.md
================================================
# APIS
## run_nerf
input: args, 运行python文件时的命令行参数
purpose: 解析命令行参数,并根据参数训练/测试/渲染一个nerf模型
## train_nerf
input: cfg, mmcv.Config
purpose: args, 运行python文件时的命令行参数, 训练一个nerf模型
## test_nerf
input: cfg, mmcv.Config
purpose: args, 运行python文件时的命令行参数, 测试/渲染一个nerf模型
## parse_args
input: args, 运行python文件时的命令行参数
purpose: 解析命令行参数
================================================
FILE: docs/zh_cn/dataset_preparation.md
================================================
# 数据准备
本文介绍了如何准备XRNeRF所需数据集
- [数据准备](#数据准备)
- [数据集存放结构](#数据集存放结构)
- [数据集下载](#数据集下载)
#### 数据集存放结构
我们推荐把数据集放在`项目目录/data`下面,否则可能需要修改config中的内容
```
xrnerf
├── xrnerf
├── docs
├── configs
├── test
├── extensions
├── data
│ ├── nerf_llff_data
│ ├── nerf_synthetic
│ ├── multiscale
│ ├── multiscale_google
│ ├── ...
```
#### 数据集下载
1. 从[这里](https://drive.google.com/drive/folders/128yBriW1IG_3NJ5Rp7APSTZsJqdJdfc1)下载 ```nerf_synthetic``` 和 ```nerf_llff_data``` , 并放在 ```xrnerf/data``` 里面
2. 下载[NSVF数据集](https://github.com/facebookresearch/NSVF), 具体请阅读[详细介绍](https://github.com/creiser/kilonerf#download-nsvf-datasets)
3. 对于mip-nerf方法的训练,需要生成需要的多尺度数据集,可通过命令生成 ```python tools/convert_blender_data.py --blenderdir /data/nerf_synthetic --outdir data/multiscale```
4. 对于NeuralBody方法的训练, 请从[这里](https://github.com/zju3dv/neuralbody/blob/master/INSTALL.md#zju-mocap-dataset)下载数据集
5. 对于Animatable方法的训练, 请从[这里](https://github.com/zju3dv/animatable_nerf/blob/master/INSTALL.md#human36m-dataset)下载数据集
6. 对于GNR方法的训练, 请从[这里](https://generalizable-neural-performer.github.io/genebody.html)下载数据集
7. 对于BungeeNeRF方法的训练, 请从[这里](https://drive.google.com/drive/folders/1ybq-BuRH0EEpcp5OZT9xEMi-Px1pdx4D?usp=sharing)下载数据集
================================================
FILE: docs/zh_cn/get_started.md
================================================
# 快速开始
本文档提供 XRNeRF 相关用法的基本教程。对于安装说明,请参阅 [安装指南](installation.md)。
- [快速开始](#快速开始)
- [数据集](#数据集)
- [创建模型](#创建模型)
- [基本概念](#基本概念)
- [自定义一个新模型](#自定义一个新模型)
- [训练](#训练)
- [迭代次数控制](#迭代次数控制)
- [训练命令](#训练命令)
- [测试](#测试)
- [详细教程](#详细教程)
## 数据集
我们推荐把数据集放在`项目目录/data`下面,否则可能需要修改config中的内容
```
xrnerf
├── xrnerf
├── docs
├── configs
├── test
├── extensions
├── data
│ ├── nerf_llff_data
│ ├── nerf_synthetic
│ ├── multiscale
│ ├── multiscale_google
│ ├── ...
```
请参阅 [数据集准备](dataset_preparation.md) 获取数据集准备的相关信息。
## 创建模型
### 基本概念
在XRNeRF中,模型被分为4个部分
- embedder: 输入点的位置和视角,输出embedded特征数据,embedder可能是纯函数型的,或者带有可学习参数的
- mlp: 使用embedder的输出作为输入,输出原始的点数据(采样点的rgb值和密度值)送给render, 一般由多层感知机组成
- render: 获取mlp的输出数据,沿着射线上的点进行积分等操作,输出图像上一个像素点的rgb值
- network: 将以上三个部分组织起来,同时也是与mmcv的runner进行交互的部分,控制了训练时的loss计算和验证时的指标计算
对于上述所有模型而言,输入都是一个字典类型的`data`。模型使用字典`data`中的内容来创建新的键值对,并加入`data`。以[origin nerf](../../configs/nerf/nerf_blender_base01.py)为例,最开始的`data`应该包含`pts`(尺寸为 n_rays, n_pts, 3) and `viewdirs`(尺寸为 n_rays, n_pts, 3).
### 自定义一个新模型
如果要自定义一个network,需要继承`BaseNerfNetwork`,其中定义了两个抽象方法
- `train_step()`: training 模式下的推理和计算loss的函数.
- `val_step()`: testing 模式下的推理函数.
[NerfNetwork](../../xrnerf/models/networks/nerf.py) 是一个很好的例子
具体而言,如果想要实现一个具有新feature的nerf方法,有以下几步需要做
1. 创建一个新文件如 `xrnerf/models/networks/my_networks.py`.
```python
from ..builder import NETWORKS
from .nerf import NerfNetwork
@NETWORKS.register_module()
class MyNerfNetwork(NerfNetwork):
def __init__(self, cfg, mlp=None, mlp_fine=None, render=None):
super().__init__(cfg, mlp, mlp_fine, render)
def forward(self, data):
....
def train_step(self, data, optimizer, **kwargs):
....
def val_step(self, data, optimizer=None, **kwargs):
....
```
2. 修改 `xrnerf/models/networks/__init__.py` 文件
```python
from .my_networks import MyNerfNetwork
```
3. 修改配置文件[config file](../../configs/nerf/nerf_blender_base01.py)
原来
```python
model = dict(
type='NerfNetwork',
....
```
现在
```python
model = dict(
type='MyNerfNetwork',
....
```
同样的,要实现embedder/mlp/render的新功能,步骤与上述类似
* 要定义一个新的embedder, 需要继承`nn.Module` 或者 `BaseEmbedder`, 并定义 `forward` 方法. [BaseEmbedder](../../xrnerf/models/embedders/base.py) 是个很好的例子
* 要定义一个新的mlp, 需要继承 `nn.Module` 或者 `BaseMLP`, 并定义 `forward` 方法. [NerfMLP](../../xrnerf/models/mlps/nerf_mlp.py) 可供参考
* 要定义一个新的render, 需要继承 `nn.Module` 或者 `BaseRender`, 并定义 `forward` 方法. [NerfRender](../../xrnerf/models/renders/nerf_render.py) 可供参考
## 训练
### 迭代次数控制
XRnerf 使用 `mmcv.runner.IterBasedRunner` 来控制训练, 并用 `mmcv.runner.EpochBasedRunner` 来测试.
训练时, 配置文件的 `max_iters` 表示最多训练多少次.
测试时, `max_iters` 被强制改为1, 表示进行一次完整的epoch.
### 训练命令
```shell
python run_nerf.py --config configs/nerf/nerf_blender_local01.py --dataname lego
```
参数为:
- `--config`: 配置文件位置
- `--dataname`: 使用数据集下的哪个数据来训练
### 测试
```shell
python run_nerf.py --config configs/nerf/nerf_blender_local01.py --dataname lego --test_only --load_from iter_50000.pth
```
参数为:
- `--config`: 配置文件位置
- `--dataname`: 使用数据集下的哪个数据
- `--test_only`: 切换为测试模式
- `--load_from`: 重载覆盖掉原来配置文件里的 `load_from`, 在某些情况下为了方便而使用
## 详细教程
目前, XRNeRF 提供以下几种更详细的教程
* [如何编写配置文件](tutorials/config.md)
* [数据处理流程](tutorials/data_pipeline.md)
* [模型定义](tutorials/model.md)
除此以外,文档还包括以下内容
* [api介绍](api.md)
* [数据集准备](dataset_preparation.md)
* [安装](installation.md)
================================================
FILE: docs/zh_cn/installation.md
================================================
# 安装
本文档提供了安装 XRNeRF 的相关步骤。
- [安装](#安装)
- [安装依赖包](#安装依赖包)
- [准备环境](#准备环境)
- [a. 安装系统依赖库.](#a-安装系统依赖库)
- [b. 创建并激活 conda 虚拟环境.](#b-创建并激活-conda-虚拟环境)
- [c. 安装 PyTorch 和 torchvision](#c-安装-pytorch-和-torchvision)
- [d. 安装其他python包](#d-安装其他python包)
- [e. 安装cuda扩展](#e-安装cuda扩展)
- [d. 下载smpl_t_pose支持GNR](#d-下载smpl_t_pose支持gnr)
- [利用 Docker 镜像安装 XRNeRF](#利用-docker-镜像安装-xrnerf)
- [a. 创建docker镜像](#a-创建docker镜像)
- [b. 运行docker容器](#b-运行docker容器)
- [安装验证](#安装验证)
## 安装依赖包
- Linux
- Python 3.7+
- **PyTorch 1.10+ (低版本可能无法支持)**
- **CUDA 11.0+ (低版本可能无法支持)**
- GCC 7.5+
- build-essential: Install by `apt-get install -y build-essential git ninja-build ffmpeg libsm6 libxext6 libgl1`
- [mmcv-full](https://github.com/open-mmlab/mmcv)
- Numpy
- ffmpeg
- [opencv-python 3+](https://github.com/dmlc/decord): 可通过 `pip install opencv-python>=3` 安装
- [imageio](https://github.com/dmlc/decord): 可通过 `pip install imageio` 安装
- [scikit-image](https://github.com/dmlc/decord): 可通过 `pip install scikit-image` 安装
- [lpips](https://github.com/richzhang/PerceptualSimilarity): 可通过 `pip install lpips` 安装
- [trimesh](https://github.com/mikedh/trimesh): 可通过 `pip install trimesh` 安装
- [smplx](https://github.com/vchoutas/smplx): 可通过 `pip install smplx` 安装
- [spconv](https://github.com/dmlc/decord): 从支持的版本中选择跟你本地cuda版本一致的安装, 比如 `pip install spconv-cu113`
- [pytorch3d](https://github.com/dmlc/decord): 可通过 `pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"` 安装
关于硬件依赖:
Instant-NGP需要GPU架构>=75, 也就是说至少需要RTX 20X0及以上的显卡,才能获得xrnerf的完整支持。
| RTX 30X0 | A100 | RTX 20X0 | TITAN V / V100 | GTX 10X0 / TITAN Xp | GTX 9X0 | K80 |
|:--------:|:----:|:--------:|:--------------:|:-------------------:|:-------:|:---:|
| 86 | 80 | 75 | 70 | 61 | 52 | 37 |
如果不需要运行Instant-NGP, [spconv](https://github.com/traveller59/spconv#spconv-spatially-sparse-convolution-library) 决定了最低的cuda版本依赖. 根据他们的表格可见,cuda10.2 是最低要求。
## 准备环境
#### a. 安装系统依赖库.
```shell
sudo apt install libgl-dev freeglut3-dev build-essential git ninja-build ffmpeg libsm6 libxext6 libgl1
```
#### b. 创建并激活 conda 虚拟环境.
```shell
conda create -n xrnerf python=3.7 -y
conda activate xrnerf
```
#### c. 安装 PyTorch 和 torchvision
1. 查看pytorch-cuda版本匹配表,选择合适的版本 [here](https://pytorch.org/get-started/previous-versions/) or [here](https://blog.csdn.net/weixin_42069606/article/details/105198845)
2. 从[这里](https://download.pytorch.org/whl/torch_stable.html)下载合适版本的pytorch (>=1.10.0 且需要与你的cuda版本匹配), 比如 ```cu111/torch-1.10.0%2Bcu111-cp37-cp37m-linux_x86_64.whl```, 下载这个whl文件
3. 安装这个whl文件, 比如 ```pip install torch-1.10.0+cu111-cp37-cp37m-linux_x86_64.whl```
4. 在[这里](https://pypi.org/project/torchvision/)查看版本匹配信息, 并安装正确版本的torchvision, 比如 ```pip install torchvision==0.12.0```
#### d. 安装其他python包
* 您可以使用 ```pip install requirements.txt``` 来安装大部分需要的 pkgs。 如果此步骤成功,您应该跳转到 ```kilo-cuda``` 和 ```spconv``` 步骤手动安装它们。 或者您可以跳过此步骤并按照以下安装步骤进行操作
* ```pip install 'opencv-python>=3' yapf imageio scikit-image lpips trimesh smplx```
* 根据[官方说明](https://mmcv.readthedocs.io/en/latest/get_started/installation.html),安装 ```mmcv-full```
* 安装 ```spconv```, 比如 ```pip install spconv-cu111```. 值得注意的是只有部分cuda版本是支持的, 具体请查看 [官方说明](https://github.com/traveller59/spconv)
* 通过 ```pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"``` 安装 ```pytorch3d```
* 查看[官方说明](https://github.com/creiser/kilonerf#option-b-build-cuda-extension-yourself) 安装 ```kilo-cuda``` (非必须,运行kilo-nerf方法需要)
* 通过```pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch``` 安装 ```tcnn```, 如果网络问题无法下载cutlass等,参考如下命令
```shell
git clone https://gitclone.com/github.com/nvlabs/tiny-cuda-nn
cd tiny-cuda-nn/dependencies
git clone https://gitclone.com/github.com/fmtlib/fmt.git
git clone https://gitclone.com/github.com/NVIDIA/cutlass.git
cd ../bindings/torch && python setup.py install
```
(非必须,运行instant-ngp方法需要)
#### e. 安装cuda扩展
* 为了支持instant-ngp算法,需要编译安装cuda扩展 ```raymarch```, 查看[具体教程](../../extensions/ngp_raymarch/README.md)
* 为了支持gnr算法,需要编译安装cuda扩展 ```mesh_grid```, 查看[具体教程](../../extensions/mesh_grid/README.md)
#### d. 下载smpl_t_pose支持GNR
* 为了支持gnr算法,需要从[GNR](https://github.com/generalizable-neural-performer/gnr)下载```smpl_t_pose```文件夹,并修改```configs/gnr/gnr_genebody.py```中的```basedata_cfg.t_pose_path```为对应的存放位置
## 利用 Docker 镜像安装 XRNeRF
我们根据国内的网络环境优化了dockerfile,请使用[DockerfileCN](../../docker/DockerfileCN)
在安装前需要修改docker的daemon配置,从而让docker的build过程支持gpu (为了编译cuda扩展):
```shell
sudo apt-get install nvidia-container-runtime -f -y
sudo cp -f docker/daemon.json /etc/docker
sudo systemctl restart docker
```
[这里](https://stackoverflow.com/questions/59691207/docker-build-with-nvidia-runtime)有更详细的解释.
#### a. 创建docker镜像
XRNeRF 提供一个 [DockerfileCN](../../docker/DockerfileCN) 可以直接创建 docker 镜像
```shell
docker build -f ./docker/DockerfileCN --rm -t xrnerf .
```
**注意** 用户需要确保已经安装了 [nvidia-container-toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker)。
#### b. 运行docker容器
运行以下命令,创建容器:
```shell
docker run --gpus all -it xrnerf /bin/bash
```
在本机上(非docker镜像机内)开启一个终端,将项目文件(包括数据集)复制进docker镜像机
```shell
# d287273af72e 是镜像的id, usin通过 'docker ps -a' 确定id
docker cp ProjectPath/xrnerf d287273af72e:/workspace
```
## 安装验证
为了验证 XRNeRF 和所需的依赖包是否已经安装成功,可以运行单元测试模块
```shell
coverage run --source xrnerf/models -m pytest -s test/models && coverage report -m
```
注意,运行单元测试模块前需要额外安装 ```coverage``` 和 ```pytest```
```
pip install coverage pytest -i https://pypi.tuna.tsinghua.edu.cn/simple
```
================================================
FILE: docs/zh_cn/tutorials/config.md
================================================
# 教程 1: 如何编写配置文件
XRNeRF 使用 python 文件作为配置文件。其配置文件系统的设计将模块化与继承整合进来,方便用户进行各种实验。
XRNeRF 提供的所有配置文件都放置在 `$PROJECT/configs` 文件夹下。
- [教程 1: 如何编写配置文件](#教程-1-如何编写配置文件)
- [配置文件组成部分](#配置文件组成部分)
## 配置文件组成部分
配置文件的内容在逻辑上可以分为3个部分:
* 训练
* 模型
* 数据
下面的内容将会逐部分介绍配置文件
* 训练
训练配置部分包含了控制训练过程的各类参数,包括optimizer, hooks, runner等等
```python
import os
from datetime import datetime
method = 'nerf' # nerf方法
# optimizer 参数
optimizer = dict(type='Adam', lr=5e-4, betas=(0.9, 0.999))
optimizer_config = dict(grad_clip=None)
max_iters = 20000 # 训练多少个iter
lr_config = dict(policy='step', step=500 * 1000, gamma=0.1, by_epoch=False) # 学习率和衰减
checkpoint_config = dict(interval=5000, by_epoch=False) # 保存checkpoint的间隔
log_level = 'INFO'
log_config = dict(interval=5000,
by_epoch=False,
hooks=[dict(type='TextLoggerHook')])
workflow = [('train', 5000), ('val', 1)] # 循环: 每训练 5000 iters, 验证 1 iter
# hooks
# 'params' 是数值型参数, 'variables' 是代码运行上下面出现的变量
train_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='valset')),
dict(type='ValidateHook',
params=dict(save_folder='visualizations/validation')),
dict(type='SaveSpiralHook',
params=dict(save_folder='visualizations/spiral')),
dict(type='PassIterHook', params=dict()), # 将当前iter数告诉dataset
]
test_hooks = [
dict(type='SetValPipelineHook',
params=dict(),
variables=dict(valset='testset')),
dict(type='TestHook', params=dict()),
]
# runner
train_runner = dict(type='NerfTrainRunner')
test_runner = dict(type='NerfTestRunner')
# runtime settings
num_gpus = 1
distributed = (num_gpus > 1) # 是否使用 ddp
work_dir = './work_dirs/nerfsv3/nerf_#DATANAME#_base01/' # 保存运行时产生文件的位置
timestamp = datetime.now().strftime('%d-%b-%H-%M') # 保证每次的workspace都不同
# some shared params by model and data, to avoid define twice
dataset_type = 'blender'
no_batching = True # 每次选择1张图片来抽取射线
no_ndc = True
white_bkgd = True # 渲染时背景设定为全白
is_perturb = True # set to 0. for no jitter, 1. for jitter
use_viewdirs = True # use full 5D input instead of 3D
N_rand_per_sampler = 1024 * 4 # 在取多少根射线 在 get_item() 函数中使用
lindisp = False # sampling linearly in disparity rather than depth
N_samples = 64 # 在coarse模型中输入多少根射线
# resume_from = os.path.join(work_dir, 'latest.pth')
# load_from = os.path.join(work_dir, 'latest.pth')
```
* 模型
模型部分的配置信息,定义了网络模型结构,一个network通常由embedder, mlp 和 render组成。
```python
model = dict(
type='NerfNetwork', # network 类名字
cfg=dict(
phase='train', # 'train' or 'test'
N_importance=128, # number of additional fine samples per ray
is_perturb=is_perturb, # see above
chunk=1024 * 32, # mainly work for val, to avoid oom
bs_data='rays_o', # the data's shape indicates the real batch-size, this's also the num of rays
),
mlp=dict( # coarse mlp model
type='NerfMLP', # mlp class name
skips=[4],
netdepth=8, # layers in network
netwidth=256, # channels per layer
netchunk=1024 * 32, # to avoid oom
output_ch=5, # 5 if cfg.N_importance>0 else 4
use_viewdirs=use_viewdirs,
embedder=dict(
type='BaseEmbedder', # embedder class name
i_embed=0, # set 0 for default positional encoding, -1 for none
multires=10, # log2 of max freq for positional encoding (3D location)
multires_dirs=4, # this is 'multires_views' in origin codes, log2 of max freq for positional encoding (2D direction)
),
),
mlp_fine=dict( # fine model
type='NerfMLP',
skips=[4],
netdepth=8,
netwidth=256,
netchunk=1024 * 32,
output_ch=5,
use_viewdirs=use_viewdirs,
embedder=dict(
type='BaseEmbedder',
i_embed=0,
multires=10,
multires_dirs=4,
),
),
render=dict(
type='NerfRender', # render cloass name
white_bkgd=white_bkgd, # see above
raw_noise_std=0, # std dev of noise added to regularize sigma_a output, 1e0 recommended
),
)
```
* 数据
数据部分的配置信息,定义了数据集类型,数据的处理流程,batchsize等等信息。
```python
basedata_cfg = dict(
dataset_type=dataset_type,
datadir='data/nerf_synthetic/#DATANAME#',
half_res=True, # load blender synthetic data at 400x400 instead of 800x800
testskip=
8, # will load 1/N images from test/val sets, useful for large datasets like deepvoxels
white_bkgd=white_bkgd,
is_batching=False, # True for blender, False for llff
mode='train',
)
traindata_cfg = basedata_cfg.copy()
valdata_cfg = basedata_cfg.copy()
testdata_cfg = basedata_cfg.copy()
traindata_cfg.update(dict())
valdata_cfg.update(dict(mode='val'))
testdata_cfg.update(dict(mode='test', testskip=0))
train_pipeline = [
dict(type='Sample'),
dict(type='DeleteUseless', keys=['images', 'poses', 'i_data', 'idx']),
dict(type='ToTensor', keys=['pose', 'target_s']),
dict(type='GetRays'),
dict(type='SelectRays',
sel_n=N_rand_per_sampler,
precrop_iters=500,
precrop_frac=0.5), # in the first 500 iter, select rays inside center of image
dict(type='GetViewdirs', enable=use_viewdirs),
dict(type='ToNDC', enable=(not no_ndc)),
dict(type='GetBounds'),
dict(type='GetZvals', lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts'),
dict(type='DeleteUseless', keys=['pose', 'iter_n']),
]
test_pipeline = [
dict(type='ToTensor', keys=['pose']),
dict(type='GetRays'),
dict(type='FlattenRays'),
dict(type='GetViewdirs', enable=use_viewdirs),
dict(type='ToNDC', enable=(not no_ndc)),
dict(type='GetBounds'),
dict(type='GetZvals', lindisp=lindisp, N_samples=N_samples),
dict(type='PerturbZvals', enable=False), # do not perturb when test
dict(type='GetPts'),
dict(type='DeleteUseless', keys=['pose']),
]
data = dict(
train_loader=dict(batch_size=1, num_workers=4),
train=dict(
type='SceneBaseDataset',
cfg=traindata_cfg,
pipeline=train_pipeline,
),
val_loader=dict(batch_size=1, num_workers=0),
val=dict(
type='SceneBaseDataset',
cfg=valdata_cfg,
pipeline=test_pipeline,
),
test_loader=dict(batch_size=1, num_workers=0),
test=dict(
type='SceneBaseDataset',
cfg=testdata_cfg,
pipeline=test_pipeline, # same pipeline as validation
),
)
```
================================================
FILE: docs/zh_cn/tutorials/data_pipeline.md
================================================
# 教程 2: 如何设计数据处理流程
在本教程中,我们将介绍一些有关数据前处理流水线设计的方法,以及如何为项目自定义和扩展自己的数据流水线。
- [教程 2: 如何设计数据处理流程](#教程-2-如何设计数据处理流程)
- [数据处理流程的基本概念](#数据处理流程的基本概念)
- [设计数据处理流程](#设计数据处理流程)
## 数据处理流程的基本概念
数据处理流程是用于数据处理的模块。我们把常见的nerf方法数据处理操作抽象化为一个个python类,即```pipeline```。
下面的代码块展示了如何定义一个数据处理流程类来从rays' direction计算viewdirs
```python
@PIPELINES.register_module()
class GetViewdirs:
"""get viewdirs from rays_d
"""
def __init__(self, enable=True, **kwargs):
self.enable = enable
def __call__(self, results):
"""get viewdirs
Args:
results (dict): The resulting dict to be modified and passed
to the next transform in pipeline.
"""
if self.enable:
viewdirs = results['rays_d'].clone()
viewdirs = viewdirs / torch.norm(viewdirs, dim=-1, keepdim=True)
viewdirs = torch.reshape(viewdirs, [-1, 3]).float()
results['viewdirs'] = viewdirs
return results
```
我们可以直接在配置文件中,把`dict(type='GetViewdirs')`添加到`train_pipeline`中去来使用`GetViewdirs`。
## 设计数据处理流程
我们根据处理逻辑把数据处理流程划分为了4个python文件:
* `creat.py` 创建和计算新变量
* `augment.py` 数据增强操作
* `transforms.py` 修改数据格式或者变换坐标系
* `compose.py` 组合各种流程在一起.
下面展示了一个完整的数据处理流程配置
```python
train_pipeline = [
dict(type='Sample'),
dict(type='DeleteUseless', keys=['images', 'poses', 'i_data', 'idx']),
dict(type='ToTensor', keys=['pose', 'target_s']),
dict(type='GetRays'),
dict(type='SelectRays',
sel_n=N_rand_per_sampler,
precrop_iters=500,
precrop_frac=0.5), # in the first 500 iter, select rays inside center of image
dict(type='GetViewdirs', enable=use_viewdirs),
dict(type='ToNDC', enable=(not no_ndc)),
dict(type='GetBounds'),
dict(type='GetZvals', lindisp=lindisp,
N_samples=N_samples), # N_samples: number of coarse samples per ray
dict(type='PerturbZvals', enable=is_perturb),
dict(type='GetPts'),
dict(type='DeleteUseless', keys=['pose', 'iter_n']),
]
```
在上面的例子中,输入数据是一个字典,在[_fetch_train_data()](../../../xrnerf/datasets/scene_dataset.py)中创建
```python
data = {'poses': self.poses, 'images': self.images, 'i_data': self.i_train, 'idx': idx}
```
在上面的数据处理流程中,分别做了以下事:
* `Sample` 选择一张图和对应的pose,创建 `pose` 和 `target_s`
* `DeleteUseless` 删除字典中的 `'images', 'poses', 'i_data', 'idx'`, 这些变量后面已经不会再被用到了
* `ToTensor` 把 `'pose', 'target_s'` 变成tensor
* `GetRays` 从摄像机参数中计算calculate `'rays_d', 'rays_o'`
* `SelectRays` 选择一个batch的射线
* `GetViewdirs` 从rays' direction计算viewdirs
* `ToNDC` 进行坐标系转换
* `GetBounds` 获取射线上采样区间的最远和最近距离
* `GetZvals` 在射线上采样区间采点
* `PerturbZvals` 数据增强
* `GetPts` 获取点的坐标
================================================
FILE: docs/zh_cn/tutorials/model.md
================================================
# 教程 3: 模型
在这个教程中,将介绍XRNeRF中模型的设计,以及数据在模型中数如何依次被处理的
- [教程 3: 模型](#教程-3-模型)
- [XRNeRF中模型的设计](#xrnerf中模型的设计)
- [概述](#概述)
- [Embedder](#embedder)
- [MLP](#mlp)
- [RENDERS](#renders)
- [NETWORKS](#networks)
## XRNeRF中模型的设计
### 概述
在XRNeRF中,模型被分为4个部分
- embedder: 输入点的位置和视角,输出embedded特征数据,embedder可能是纯函数型的,或者带有可学习参数的
- mlp: 使用embedder的输出作为输入,输出原始的点数据(采样点的rgb值和密度值)送给render, 一般由多层感知机组成
- render: 获取mlp的输出数据,沿着射线上的点进行积分等操作,输出图像上一个像素点的rgb值
- network: 将以上三个部分组织起来,同时也是与mmcv的runner进行交互的部分,控制了训练时的loss计算和验证时的指标计算
对于上述所有模型而言,输入都是一个字典类型的`data`。模型使用字典`data`中的内容来创建新的键值对,并加入`data`。以[origin nerf](../../../configs/nerfs/nerf_blender_base01.py)为例,最开始的`data`应该包含`pts`(尺寸为 n_rays, n_pts, 3) and `viewdirs`(尺寸为 n_rays, n_pts, 3).
### Embedder
Embedder的输入是点坐标`pts`和射线的角度`viewdirs`,输出嵌入后的特征数据 `embedded` 并加入`data`中去。可以阅读[origin nerf's embedder](../../../xrnerf/models/embedders/base.py) 来加深对这一过程的理解。
如果要使用XRNeRF中[已经存在的embedder](../../../xrnerf/models/embedders/__init__.py),可以直接选择一种,然后修改配置文件即可。而如果要实现自己的embedder,可以按照下面的指引
* 在[embedders](../../../xrnerf/models/embedders/)目录下创建一个 `my_embedder.py` 文件
* 在文件中实现一个 `MyEmbedder` 类,继承自`nn.Module` 或者 `BaseEmbedder`,并且定义 `forward` 方法.
* 修改[init](../../../xrnerf/models/embedders/__init__.py)文件
* 修改配置文件
### MLP
mlp通常接收采样点的embedded feature `embedded`作为输入,产生raw data 并加入 `data`.
可以阅读[origin nerf's mlp](../../../xrnerf/models/mlps/nerf_mlp.py) 来加深对这一过程的理解。
如果要使用XRNeRF中[已经存在的mlp](../../../xrnerf/models/mlps/__init__.py),可以直接选择一种,然后修改配置文件即可。而如果要实现自己的mlp,操作步骤与上述过程类似
### RENDERS
render通常接收采样点的raw data作为输入,输出图像上像素点的rgb值
产生raw data 并加入 `data`.
可以阅读[origin nerf's mlp](../../../xrnerf/models/mlps/nerf_mlp.py) 来加深对这一过程的理解。
如果要使用XRNeRF中[已经存在的render](../../../xrnerf/models/renders/nerf_render.py),可以直接选择一种,然后修改配置文件即可。而如果要实现自己的render,操作步骤与上述过程类似
### NETWORKS
一个network包括embedder, mlp 和 render,network会负责跟mmcv的训练流程交互。对一个network而言,需要实现以下方法:`train_step` 和 `val_step`. [这里](../get_started.md) 是如何定义network的例子。
================================================
FILE: extensions/mesh_grid/README.md
================================================
# gnr_mesh_grid
## Install
build and install mesh_grid,to support gnr
```
cd extensions/mesh_grid
rm -rf build && clear && python setup.py install
```
================================================
FILE: extensions/mesh_grid/__init__.py
================================================
from .mesh_grid_searcher import MeshGridSearcher
================================================
FILE: extensions/mesh_grid/matrix.h
================================================
#ifndef _MATRIX_H_
#define _MATRIX_H_
#ifndef __device__
#define __device__
#endif
#ifndef __host__
#define __host__
#endif
#ifndef ABS
#define ABS(A) ((A) < 0 ? -(A) : (A))
#endif
template
__device__ __host__ bool solve3(scalar A[9], scalar b[3], scalar eps = 1e-6) {
unsigned char pivot = 0, rank = 3, permute[3] = {0,1,2};
bool valid = true;
scalar t = 0;
if(ABS(A[0]) < ABS(A[1])) pivot = 1;
if(ABS(A[pivot])< ABS(A[2])) pivot = 2;
if(ABS(A[pivot])<= eps) {
t = A[0]; A[0] = A[6]; A[6] = t;
t = A[1]; A[1] = A[7]; A[7] = t;
t = A[2]; A[2] = A[8]; A[8] = t;
permute[--rank] = 0; pivot = 0;
if(ABS(A[0]) < ABS(A[1])) pivot = 1;
if(ABS(A[pivot])< ABS(A[2])) pivot = 2;
if(ABS(A[pivot])<= eps) {
t = A[0]; A[0] = A[3]; A[3] = t;
t = A[1]; A[1] = A[4]; A[4] = t;
t = A[2]; A[2] = A[5]; A[5] = t;
permute[--rank] = 0; pivot = 0;
if(ABS(A[0]) < ABS(A[1])) pivot = 1;
if(ABS(A[pivot])< ABS(A[2])) pivot = 2;
if(ABS(A[pivot])<= eps)
permute[--rank] = 0;
}
}
if(rank > 0) {
if(pivot == 1) {
A[0] /= A[1];
t = A[4]; A[4] = A[3] - A[0]*t; A[3] = t;
t = A[7]; A[7] = A[6] - A[0]*t; A[6] = t;
t = b[1]; b[1] = b[0] - A[0]*t; b[0] = t;
A[0] = A[1]; pivot = 0;
} else {
A[1] /= A[pivot];
A[4] = A[4] - A[1]*A[pivot+3];
A[7] = A[7] - A[1]*A[pivot+6];
b[1] = b[1] - A[1]*b[pivot];
}
if(pivot == 2) {
A[0] /= A[2];
t = A[5]; A[5] = A[3] - A[0]*t; A[3] = t;
t = A[8]; A[8] = A[6] - A[0]*t; A[6] = t;
t = b[2]; b[2] = b[0] - A[0]*t; b[0] = t;
A[0] = A[2];
} else {
A[2] /= A[pivot];
A[5] = A[5] - A[2]*A[pivot+3];
A[8] = A[8] - A[2]*A[pivot+6];
b[2] = b[2] - A[2]*b[pivot];
}
if(rank > 1) {
pivot = (ABS(A[4]) < ABS(A[5]) ? 2 : 1);
if(ABS(A[pivot]) <= eps) {
if(rank > 2) {
t = A[3]; A[3] = A[6]; A[6] = t;
t = A[4]; A[4] = A[7]; A[7] = t;
t = A[5]; A[5] = A[8]; A[8] = t;
permute[--rank] = 1;
pivot = (ABS(A[4]) < ABS(A[5]) ? 2 : 1);
if(ABS(A[pivot]) <= eps)
permute[--rank] = 1;
} else permute[--rank] = 1;
}
}
if(rank > 1) {
if(pivot == 2) {
A[4] /= A[5];
t = A[8]; A[8] = A[7] - A[4]*t; A[7] = t;
t = b[2]; b[2] = b[1] - A[4]*t; b[1] = t;
A[4] = A[5];
} else {
A[5] /= A[4];
A[8] = A[8] - A[5]*A[7];
b[2] = b[2] - A[5]*b[1];
}
if(rank >= 3 && ABS(A[8]) <= eps) permute[--rank] = 2;
}
}
if(rank >= 3) {
b[2] = b[2] / A[8];
} else if(ABS(b[2]) > eps) {
valid = false;
}
if(rank >= 2) {
b[1] = (b[1] - A[7]*b[2]) / A[4];
} else if(ABS(b[1]) > eps) {
valid = false;
}
if(rank >= 1) {
b[0] = (b[0] - A[6]*b[2] - A[3]*b[1]) / A[0];
} else if(ABS(b[0]) > eps) {
valid = false;
}
if(rank <= 1 && permute[1] != 1) {
t = b[1]; b[1] = b[permute[1]]; b[permute[1]] = t;
}
if(rank <= 2 && permute[2] != 2) {
t = b[2]; b[2] = b[permute[2]]; b[permute[2]] = t;
}
return valid;
}
template
__device__ __host__ bool solve4(scalar A[16], scalar b[4], scalar eps = 1e-6) {
unsigned char pivot = 0, rank = 4, permute[4] = {0,1,2,3};
bool valid = true;
scalar t = 0;
if(ABS(A[0]) < ABS(A[1])) pivot = 1;
if(ABS(A[pivot])< ABS(A[2])) pivot = 2;
if(ABS(A[pivot])< ABS(A[3])) pivot = 3;
if(ABS(A[pivot])<= eps) {
t = A[0]; A[0] = A[12]; A[12] = t;
t = A[1]; A[1] = A[13]; A[13] = t;
t = A[2]; A[2] = A[14]; A[14] = t;
t = A[3]; A[3] = A[15]; A[15] = t;
permute[--rank] = 0; pivot = 0;
if(ABS(A[0]) < ABS(A[1])) pivot = 1;
if(ABS(A[pivot])< ABS(A[2])) pivot = 2;
if(ABS(A[pivot])< ABS(A[3])) pivot = 3;
if(ABS(A[pivot])<= eps) {
t = A[0]; A[0] = A[8]; A[8] = t;
t = A[1]; A[1] = A[9]; A[9] = t;
t = A[2]; A[2] = A[10];A[10]= t;
t = A[3]; A[3] = A[11];A[11]= t;
permute[--rank] = 0; pivot = 0;
if(ABS(A[0]) < ABS(A[1])) pivot = 1;
if(ABS(A[pivot])< ABS(A[2])) pivot = 2;
if(ABS(A[pivot])< ABS(A[3])) pivot = 3;
if(ABS(A[pivot])<= eps) {
t = A[0]; A[0] = A[4]; A[4] = t;
t = A[1]; A[1] = A[5]; A[5] = t;
t = A[2]; A[2] = A[6]; A[6] = t;
t = A[3]; A[3] = A[7]; A[7] = t;
permute[--rank] = 0; pivot = 0;
if(ABS(A[0]) < ABS(A[1])) pivot = 1;
if(ABS(A[pivot])< ABS(A[2])) pivot = 2;
if(ABS(A[pivot])< ABS(A[3])) pivot = 3;
if(ABS(A[pivot])<= eps)
permute[--rank] = 0;
}
}
}
if(rank > 0) {
if(pivot == 1) {
A[0] /= A[1];
t = A[5]; A[5] = A[4] - A[0]*t; A[4] = t;
t = A[9]; A[9] = A[8] - A[0]*t; A[8] = t;
t = A[13];A[13]= A[12]- A[0]*t; A[12]= t;
t = b[1]; b[1] = b[0] - A[0]*t; b[0] = t;
A[0] = A[1]; pivot = 0;
} else {
A[1] /= A[pivot];
A[5] = A[5] - A[1]*A[pivot+4];
A[9] = A[9] - A[1]*A[pivot+8];
A[13]= A[13]- A[1]*A[pivot+12];
b[1] = b[1] - A[1]*b[pivot];
}
if(pivot == 2) {
A[0] /= A[2];
t = A[6]; A[6] = A[4] - A[0]*t; A[4] = t;
t = A[10];A[10]= A[8] - A[0]*t; A[8] = t;
t = A[14];A[14]= A[12]- A[0]*t; A[12]= t;
t = b[2]; b[2] = b[0] - A[0]*t; b[0] = t;
A[0] = A[2]; pivot = 0;
} else {
A[2] /= A[pivot];
A[6] = A[6] - A[2]*A[pivot+4];
A[10]= A[10]- A[2]*A[pivot+8];
A[14]= A[14]- A[2]*A[pivot+12];
b[2] = b[2] - A[2]*b[pivot];
}
if(pivot == 3) {
A[0] /= A[3];
t = A[7]; A[7] = A[4] - A[0]*t; A[4] = t;
t = A[11];A[11]= A[8] - A[0]*t; A[8] = t;
t = A[15];A[15]= A[12]- A[0]*t; A[12]= t;
t = b[3]; b[3] = b[0] - A[0]*t; b[0] = t;
A[0] = A[3];
} else {
A[3] /= A[pivot];
A[7] = A[7] - A[3]*A[pivot+4];
A[11]= A[11]- A[3]*A[pivot+8];
A[15]= A[15]- A[3]*A[pivot+12];
b[3] = b[3] - A[3]*b[pivot];
}
}
if(rank > 1) {
pivot = 1;
if(ABS(A[5]) < ABS(A[6])) pivot = 2;
if(ABS(A[pivot+4])< ABS(A[7])) pivot = 3;
if(ABS(A[pivot+4]) <= eps) {
if(rank > 2) {
t = A[4]; A[4] = A[rank*4-4]; A[rank*4-4] = t;
t = A[5]; A[5] = A[rank*4-3]; A[rank*4-3] = t;
t = A[6]; A[6] = A[rank*4-2]; A[rank*4-2] = t;
t = A[7]; A[7] = A[rank*4-1]; A[rank*4-1] = t;
permute[--rank] = 1; pivot = 1;
if(ABS(A[5]) < ABS(A[6])) pivot = 2;
if(ABS(A[pivot+4])< ABS(A[7])) pivot = 3;
if(ABS(A[pivot+4])<= eps) {
if(rank > 2) {
t = A[4]; A[4] = A[rank*4-4]; A[rank*4-4] = t;
t = A[5]; A[5] = A[rank*4-3]; A[rank*4-3] = t;
t = A[6]; A[6] = A[rank*4-2]; A[rank*4-2] = t;
t = A[7]; A[7] = A[rank*4-1]; A[rank*4-1] = t;
permute[--rank] = 1; pivot = 1;
if(ABS(A[5]) < ABS(A[6])) pivot = 2;
if(ABS(A[pivot+4])< ABS(A[7])) pivot = 3;
} else permute[--rank] = 1;
}
} else permute[--rank] = 1;
}
}
if(rank > 1) {
if(pivot == 2) {
A[5] /= A[6];
t = A[10];A[10]= A[9] - A[5]*t; A[9] = t;
t = A[14];A[14]= A[13]- A[5]*t; A[13]= t;
t = b[2]; b[2] = b[1] - A[5]*t; b[1] = t;
A[5] = A[6]; pivot = 1;
} else {
A[6] /= A[pivot+4];
A[10]= A[10]- A[6]*A[pivot+8];
A[14]= A[14]- A[6]*A[pivot+12];
b[2] = b[2] - A[6]*b[pivot];
}
if(pivot == 3) {
A[5] /= A[7];
t = A[11];A[11]= A[9] - A[5]*t; A[9] = t;
t = A[15];A[15]= A[13]- A[5]*t; A[13]= t;
t = b[3]; b[3] = b[1] - A[5]*t; b[1] = t;
A[5] = A[7];
} else {
A[7] /= A[pivot+4];
A[11]= A[11]- A[7]*A[pivot+8];
A[15]= A[15]- A[7]*A[pivot+12];
b[3] = b[3] - A[7]*b[pivot];
}
}
if(rank > 2) {
pivot = (ABS(A[10]) < ABS(A[11]) ? 3 : 2);
if(ABS(A[pivot+8]) <= eps) {
if(rank > 3) {
t = A[8]; A[8] = A[12]; A[12] = t;
t = A[9]; A[9] = A[13]; A[13] = t;
t = A[10];A[10]= A[14]; A[14] = t;
t = A[11];A[11]= A[15]; A[15] = t;
permute[--rank] = 2;
pivot = (ABS(A[10]) < ABS(A[11]) ? 3 : 2);
if(ABS(A[pivot+8])<= eps) {
if(rank > 3) {
t = A[8]; A[8] = A[12]; A[12] = t;
t = A[9]; A[9] = A[13]; A[13] = t;
t = A[10];A[10]= A[14]; A[14] = t;
t = A[11];A[11]= A[15]; A[15] = t;
permute[--rank] = 2;
pivot = (ABS(A[10]) < ABS(A[11]) ? 3 : 2);
} else permute[--rank] = 2;
}
} else permute[--rank] = 2;
}
}
if(rank > 2) {
if(pivot == 3) {
A[10] /= A[11];
t = A[15];A[15]= A[14]- A[10]*t; A[14]= t;
t = b[3]; b[3] = b[2] - A[10]*t; b[2] = t;
A[10] = A[11];
} else {
A[11] /= A[pivot+8];
A[15]= A[15]- A[11]*A[pivot+12];
b[3] = b[3] - A[11]*b[pivot];
}
if(rank > 3 && ABS(A[15]) <= eps) permute[--rank] = 3;
}
if(rank >= 4) {
b[3] = b[3] / A[15];
} else if(ABS(b[3]) > eps) {
valid = false;
}
if(rank >= 3) {
b[2] = (b[2] - A[14]*b[3]) / A[10];
} else if(ABS(b[1]) > eps) {
valid = false;
}
if(rank >= 2) {
b[1] = (b[1] - A[9]*b[2] - A[13]*b[3]) / A[5];
} else if(ABS(b[1]) > eps) {
valid = false;
}
if(rank >= 1) {
b[0] = (b[0] - A[4]*b[1] - A[8]*b[2] - A[12]*b[3]) / A[0];
} else if(ABS(b[0]) > eps) {
valid = false;
}
if(rank <= 1 && permute[1] != 1) {
t = b[1]; b[1] = b[permute[1]]; b[permute[1]] = t;
}
if(rank <= 2 && permute[2] != 2) {
t = b[2]; b[2] = b[permute[2]]; b[permute[2]] = t;
}
if(rank <= 3 && permute[3] != 3) {
t = b[3]; b[3] = b[permute[3]]; b[permute[3]] = t;
}
return valid;
}
#endif
================================================
FILE: extensions/mesh_grid/mesh_grid.cpp
================================================
#include
at::Tensor insert_grid_surface_cuda(
at::Tensor verts, at::Tensor faces,
at::Tensor minmax, at::Tensor num, float step,
at::Tensor tri_num
);
void search_nearest_point_cuda (
at::Tensor points, at::Tensor verts, at::Tensor faces,
at::Tensor tri_num, at::Tensor tri_idx, at::Tensor num,
at::Tensor minmax, float step, at::Tensor near_faces,
at::Tensor near_pts, at::Tensor coeff
);
void search_inside_mesh_cuda (
at::Tensor points, at::Tensor verts, at::Tensor faces,
at::Tensor tri_num, at::Tensor tri_idx, at::Tensor num,
at::Tensor minmax, float step, at::Tensor signs
);
void search_intersect_cuda (
at::Tensor origins, at::Tensor directions, at::Tensor verts,
at::Tensor faces, at::Tensor tri_num, at::Tensor tri_idx,
at::Tensor num, at::Tensor minmax, float step, at::Tensor intersect
);
#define CHECK_CUDA(x) TORCH_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor")
at::Tensor insert_grid_surface(
at::Tensor verts, at::Tensor faces,
at::Tensor minmax, at::Tensor num, float step,
at::Tensor tri_num
) {
CHECK_CUDA(verts);
CHECK_CUDA(faces);
CHECK_CUDA(minmax);
CHECK_CUDA(num);
CHECK_CUDA(tri_num);
return insert_grid_surface_cuda(verts, faces, minmax, num, step, tri_num);
}
void search_nearest_point(
at::Tensor points, at::Tensor verts, at::Tensor faces,
at::Tensor tri_num, at::Tensor tri_idx, at::Tensor num,
at::Tensor minmax, float step, at::Tensor near_faces,
at::Tensor near_pts, at::Tensor coeff
) {
CHECK_CUDA(points);
CHECK_CUDA(verts);
CHECK_CUDA(faces);
CHECK_CUDA(tri_num);
CHECK_CUDA(tri_idx);
CHECK_CUDA(num);
CHECK_CUDA(minmax);
CHECK_CUDA(near_faces);
CHECK_CUDA(coeff);
search_nearest_point_cuda(points, verts, faces, tri_num, tri_idx, num,
minmax, step, near_faces, near_pts, coeff);
}
void search_inside_mesh(
at::Tensor points, at::Tensor verts, at::Tensor faces,
at::Tensor tri_num, at::Tensor tri_idx, at::Tensor num,
at::Tensor minmax, float step, at::Tensor signs
) {
CHECK_CUDA(points);
CHECK_CUDA(verts);
CHECK_CUDA(faces);
CHECK_CUDA(tri_num);
CHECK_CUDA(tri_idx);
CHECK_CUDA(num);
CHECK_CUDA(minmax);
CHECK_CUDA(signs);
search_inside_mesh_cuda(points, verts, faces, tri_num, tri_idx, num,
minmax, step, signs);
}
void search_intersect (
at::Tensor origins, at::Tensor directions, at::Tensor verts,
at::Tensor faces, at::Tensor tri_num, at::Tensor tri_idx,
at::Tensor num, at::Tensor minmax, float step, at::Tensor intersect
){
CHECK_CUDA(origins);
CHECK_CUDA(directions);
CHECK_CUDA(verts);
CHECK_CUDA(faces);
CHECK_CUDA(tri_num);
CHECK_CUDA(tri_idx);
CHECK_CUDA(num);
CHECK_CUDA(minmax);
CHECK_CUDA(intersect);
search_intersect_cuda(origins, directions, verts, faces, tri_num, tri_idx, num,
minmax, step, intersect);
}
at::Tensor cumsum(
at::Tensor input
){
input.set_(input.cumsum(0));
// input.set_(at::zeros(input.sizes()));
// input.zero_();
input = input.reshape({1,1,-1});
return input;
}
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
m.def("insert_grid_surface", &insert_grid_surface, "INSERT_GRID_SURFACE (CUDA)");
m.def("search_nearest_point", &search_nearest_point, "SEARCH_NEAREST_POINT (CUDA)");
m.def("search_inside_mesh", &search_inside_mesh, "SEARCH_INSIDE_MESH (CUDA)");
m.def("search_intersect", &search_intersect, "SEARCH_INTERSECT (CUDA)");
m.def("cumsum", &cumsum, "RESHAPE_TENSOR");
}
================================================
FILE: extensions/mesh_grid/mesh_grid_kernel.cu
================================================
#include
#include
#include
#include
#include
#include "matrix.h"
#ifndef MAX
#define MAX(a,b) ((a) < (b) ? (b) : (a))
#endif
template
__device__ scalar_t search_nearest_proj(
const scalar_t patch[9], scalar_t coeff[3], scalar_t precision = 1e-9) {
scalar_t p[29];
/* coeff[0] = coeff[1] = coeff[2] = 1./3;
p[0] = coeff[0]*patch[0]+coeff[1]*patch[3]+coeff[2]*patch[6];
p[1] = coeff[0]*patch[1]+coeff[1]*patch[4]+coeff[2]*patch[7];
p[2] = coeff[0]*patch[2]+coeff[1]*patch[5]+coeff[2]*patch[8];
return p[0]*p[0]+p[1]*p[1]+p[2]*p[2];
*/ unsigned char i = 0, j = 1, k = 2;
for(i = 0; i < 3; ++i)
for(j = i; j < 3; ++j) {
p[20+j+3*i] = 0;
for(k = 0; k < 3; ++k)
p[20+j+3*i] += patch[k+i*3] * patch[k+j*3];
p[20+i+3*j] = p[20+j+3*i];
}
p[0] = p[20]; p[1] = p[21]; p[2] = p[22]; p[3] = 1;
p[4] = p[23]; p[5] = p[24]; p[6] = p[25]; p[7] = 1;
p[8] = p[26]; p[9] = p[27]; p[10]= p[28]; p[11]= 1;
p[12]= 1; p[13]= 1; p[14]= 1; p[15]= 0;
p[16]= 0;
p[17]= 0;
p[18]= 0;
p[19]= 1;
if(!solve4(p, p+16, precision)) {
p[0] = p[24]+p[28]-p[25]-p[27];
p[1] = p[28]+p[20]-p[26]-p[22];
p[2] = p[20]+p[24]-p[21]-p[23];
i = (p[0] < p[1] ? 1 : 0);
i = (p[i] < p[2] ? 2 : i);
j = (i+1) % 3; k = 3-i-j;
p[0] = p[20+4*j]; p[1] = p[20+3*j+k];p[2] = 1;
p[3] = p[20+3*k+j];p[4] = p[20+4*k]; p[5] = 1;
p[6] = 1; p[7] = 1; p[8] = 0;
p[9] = 0;
p[10]= 0;
p[11]= 1;
if(!solve3(p, p+9, precision)) {
coeff[i] = 0;
coeff[j] =.5;
coeff[k] =.5;
return (p[20+4*j]+p[20+4*k]) / 2;
} else if(p[9] < 0) {
coeff[i] = 0;
coeff[j] = 0;
coeff[k] = 1;
return p[20+4*k];
} else if(p[10] < 0) {
coeff[i] = 0;
coeff[j] = 1;
coeff[k] = 0;
return p[20+4*j];
} else {
coeff[i] = 0;
coeff[j] = p[9];
coeff[k] = p[10];
return ABS(p[11]);
}
} else {
i = (p[16] > p[17] ? 1 : 0);
i = (p[16+i]> p[18] ? 2 : i);
if(p[16+i] < 0) {
j = (i+1) % 3; k = 3-i-j;
p[0] = p[20+4*j]; p[1] = p[20+3*j+k];p[2] = 1;
p[3] = p[20+3*k+j];p[4] = p[20+4*k]; p[5] = 1;
p[6] = 1; p[7] = 1; p[8] = 0;
p[9] = 0;
p[10]= 0;
p[11]= 1;
solve3(p, p+9, precision);
if(p[9] < 0) {
coeff[i] = 0;
coeff[j] = 0;
coeff[k] = 1;
return p[20+4*k];
} else if(p[10] < 0) {
coeff[i] = 0;
coeff[j] = 1;
coeff[k] = 0;
return p[20+4*j];
} else {
coeff[i] = 0;
coeff[j] = p[9];
coeff[k] = p[10];
return ABS(p[11]);
}
} else {
coeff[0] = p[16];
coeff[1] = p[17];
coeff[2] = p[18];
return ABS(p[19]);
}
}
}
template
__global__ void insert_grid_surface_kernel(
const scalar_t *points, const index *_surf, index n,
scalar_t step, const scalar_t _min[dim], const index num[dim],
index *surf_num, index *surf_idx = NULL) {
// const scalar_t step = _step[0];
const int id = blockIdx.x * blockDim.x + threadIdx.x;
if(points == NULL || _surf == NULL || _min == NULL || num == NULL || surf_num == NULL
|| dim <= 0 || step <= 0 || n <= 0 || id >= n)
return;
const index *surf = _surf + id * dim;
index bbox[dim * 2], bbox_num = 1;
for(unsigned char d = 0; d < dim; ++d) {
scalar_t minmax[2] = {
points[dim*surf[0] + d],
points[dim*surf[0] + d]};
for(unsigned char j = 1; j < dim; ++j)
if(minmax[0] > points[dim*surf[j] + d])
minmax[0] = points[dim*surf[j] + d];
else if(minmax[1] < points[dim*surf[j] + d])
minmax[1] = points[dim*surf[j] + d];
scalar_t x = (minmax[0] - _min[d]) / step;
bbox[d] = x < 0 ? 0 : (x >= num[d] ? num[d] - 1 : (index)floor(x));
x = (minmax[1] - _min[d]) / step;
bbox[d+dim] =(x < 0 ? 0 : (x >= num[d] ? num[d] - 1 : (index)floor(x))) + 1;
bbox_num *= (bbox[d+dim] - bbox[d]);
}
for(index j = 0; j < bbox_num; ++j) {
index ind = 0, k = j;
for(unsigned char d = 0; d < dim; ++d) {
if(d > 0) ind *= num[d];
ind += (bbox[d] + k % (bbox[d+dim] - bbox[d]));
k /= (bbox[d+dim] - bbox[d] + 1e-8);
}
if(surf_idx == NULL)
// ++surf_num[ind];
atomicAdd(surf_num+ind, 1);
else
for(k = (ind == 0 ? 0 : surf_num[ind-1]); k < surf_num[ind]; ++k)
if(atomicCAS(surf_idx+k, 0, id+1) == 0) {
// surf_idx[k] = i + 1;
// atomicExch(&surf_idx[k], i+1)
break;
}
}
}
template
void print_tensor(at::Tensor tensor){
int32_t size = tensor.size(0);
if (size < 100)
for (int i=0; i() << " ";
}
else{
// for (int i=0; i<3; i++)
// std::cout << tensor[i].item() << " ";
// std::cout << " ... ";
// for (int i=-1; i>-4; i--)
// std::cout << tensor[i].item() << " ";
for (int i=0; i() << " ";
std::cout << std::endl;
}
}
std::cout << std::endl;
}
at::Tensor insert_grid_surface_cuda(
at::Tensor verts,
at::Tensor faces,
at::Tensor minmax,
at::Tensor num,
float step,
at::Tensor tri_num
) {
if(faces.sizes().size() != 2) faces = faces.reshape({-1,3});
const int32_t num_faces = faces.size(0);
const int threads = 512;
const dim3 blocks (num_faces / threads + 1, 1, 1);
tri_num.zero_(); // clear tri_num buffer
AT_DISPATCH_FLOATING_TYPES(verts.type(), "insert_grid_surface_cuda", ([&] {
insert_grid_surface_kernel<<>>(
verts.data(),
faces.data(),
num_faces,
step,
minmax.data(),
num.data(),
tri_num.data(),
NULL
);
}));
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess)
printf("Error in first insert_grid_surface_cuda: %s\n", cudaGetErrorString(err));
tri_num.set_(at::_cast_Int(tri_num.cumsum(0))); // cumsum determines the size of tri_idx buffer
// make buffer
const int32_t size = tri_num[-1].item();
// tri_idx.resize_({size});
// tri_idx.zero_();
at::Tensor tri_idx = at::zeros({size}, tri_num.options());
AT_DISPATCH_FLOATING_TYPES(verts.type(), "insert_grid_surface_cuda2", ([&] {
insert_grid_surface_kernel<<>>(
verts.data(),
faces.data(),
num_faces,
step,
minmax.data(),
num.data(),
tri_num.data(),
tri_idx.data()
);
}));
err = cudaGetLastError();
if (err != cudaSuccess)
printf("Error in second insert_grid_surface_cuda: %s\n", cudaGetErrorString(err));
return tri_idx;
}
template
__global__ void search_nearest_point_kenerel(
const index *tri_num, const index *tri_idx, const index *size,
const scalar_t *_min, scalar_t step,
const scalar_t *points_base, const index *tri,
const scalar_t *point_search_, const index points_num,
scalar_t *coeff_ = NULL, scalar_t *proj_ = NULL,
index *near_idx_ = NULL, scalar_t max_r2 = 0)
{
const int id = blockIdx.x * blockDim.x + threadIdx.x;
const scalar_t *point_search = point_search_ + 3 * id;
scalar_t *coeff = coeff_ + 3 * id;
scalar_t *proj = proj_ + 3 * id;
index *near_idx = near_idx_ + id;
if(points_base == NULL || tri == NULL || point_search_ == NULL
|| tri_num == NULL || tri_idx == NULL || size == NULL || _min == NULL
|| step <= 0 || id >= points_num)
return;
index x[dim*2+1], maxLinf = 0, n = 1, nearest = tri_num[size[dim]-1];
for(unsigned char d = 0; d < dim; ++d) {
scalar_t xf = (point_search[d] - _min[d]) / step;
xf = (xf < 0 ? 0 :(xf >= size[d] ? size[d]-1 : floor(xf)));
x[d] = (index)xf;
x[dim] = d > 0 ? x[dim] * size[d] + x[d] : x[d];
if(x[d] > size[d] - x[d])
maxLinf = MAX(maxLinf, x[d]);
else
maxLinf = MAX(maxLinf, size[d]-x[d]);
}
scalar_t dist2 = 0, e = 0, dis2 = (max_r2 <= 0 ? -1 : max_r2);
for(index Linf = 0; Linf < maxLinf; ++Linf) {
n = 1;
for(unsigned char d = 1; d < dim; ++d)
n *= (2*Linf+1);
for(index f = 0; f < (Linf == 0 ? 1 : 2*dim); ++f) {
x[dim+1+f%dim] = f < dim ? -Linf : Linf;
for(index k = 0; k < n; ++k) {
index i, j = k;
for(unsigned char d = 1; d < dim; ++d) {
if(d+f >= 2*dim) {
x[dim+1+(d+f)%dim] = j%(2*Linf-1) - Linf + 1;
j = j / (2*Linf-1);
} else if(d+f >= dim) {
x[dim+1+(d+f)%dim] = j%(2*Linf) - Linf + 1;
j = j / (2*Linf);
} else {
x[dim+1+(d+f)%dim] = j%(2*Linf+1) - Linf;
j = j / (2*Linf+1);
}
}
dist2 = 0;
for(unsigned char d = 0; d < dim; ++d) {
index y = x[d] + x[dim+1+d];
if(y < 0 || y >= size[d]) {
x[dim] = size[dim]; break;
}
if(x[dim+1+d] < 0) {
e = point_search[d] - _min[d] - step*(y+1);
dist2 += e * e;
} else if(x[dim+1+d] > 0) {
e =-point_search[d] + _min[d] + step*y;
dist2 += e * e;
}
x[dim] = d > 0 ? x[dim] * size[d] + y : y;
}
if(x[dim] >= size[dim]) continue;
if(dis2 >= 0 && dis2 < dist2) continue;
// Find closest point and distance in a triangle face
for(i = x[dim] == 0 ? 0 : tri_num[x[dim]-1]; i < tri_num[x[dim]]; ++i) {
scalar_t patch[dim * dim];
scalar_t _coeff[dim] = {0.33,0.33,0.33};
for(unsigned char d = 0; d < dim; ++d){
for(unsigned char d_= 0; d_< dim; ++d_){
patch[d_+ d*dim] = points_base[d_+dim*
tri[d+dim*tri_idx[i]-dim]] -
point_search[d_];
}
}
dist2 = search_nearest_proj(patch, _coeff);
// printf("%d: %f %f %f\n", (int)threadIdx.x, _coeff[0], _coeff[1], _coeff[2]);
if(dis2 < 0 || dist2 < dis2) {
if(coeff != NULL) {
coeff[0] = _coeff[0];
coeff[1] = _coeff[1];
coeff[2] = _coeff[2];
proj[0] = point_search[0] +
coeff[0]*patch[0] +
coeff[1]*patch[3] +
coeff[2]*patch[6];
proj[1] = point_search[1] +
coeff[0]*patch[1] +
coeff[1]*patch[4] +
coeff[2]*patch[7];
proj[2] = point_search[2] +
coeff[0]*patch[2] +
coeff[1]*patch[5] +
coeff[2]*patch[8];
}
nearest = tri_idx[i] - 1;
dis2 = dist2;
}
}
}
if(f < dim-1)
n = n / (2*Linf+1) * (2*Linf);
else if(f >= dim)
n = n / (2*Linf) * (2*Linf-1);
}
if(dis2 >= 0 && dis2 < Linf*Linf*step*step) break;
}
// return nearest;
near_idx[0] = nearest;
}
void search_nearest_point_cuda (
at::Tensor points,
at::Tensor verts,
at::Tensor faces,
at::Tensor tri_num,
at::Tensor tri_idx,
at::Tensor num,
at::Tensor minmax,
float step,
at::Tensor near_faces,
at::Tensor near_pts,
at::Tensor coeff
) {
if(points.sizes().size() != 2) points = points.reshape({-1,3});
int32_t points_num = points.size(0);
const int threads = 512;
const dim3 blocks (points_num / threads + 1, 1, 1);
// make output
// near_faces.resize_({points_num});
// near_faces.zero_();
// near_pts.resize_({points_num, 3});
// near_pts.zero_();
// coeff.resize_({points_num, 3});
// coeff.zero_();
AT_DISPATCH_FLOATING_TYPES(verts.type(), "search_nearest_point_cuda", ([&] {
search_nearest_point_kenerel<<>>(
tri_num.data(),
tri_idx.data(),
num.data(),
minmax.data(),
step,
verts.data(),
faces.data(),
points.data(),
points_num,
coeff.data(),
near_pts.data(),
near_faces.data()
);
}));
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess)
printf("Error in search_nearest_point_cuda: %s\n", cudaGetErrorString(err));
}
template
bool __device__ intersect_tri(
const scalar_t* src, unsigned char dir,
scalar_t* patch, unsigned char dim
) {
if(dir > 2 * dim) return false;
bool intersect = false;
scalar_t patch_[6], det = 0;
switch(dir % 2) {
case 1: for(unsigned char d = 0; d < dim; ++d)
if(patch[dir/2+dim*d] > src[dir/2]) {
intersect = true; break;
}
if(!intersect) return false;
break;
default:for(unsigned char d = 0; d < dim; ++d)
if(patch[dir/2+dim*d] < src[dir/2]) {
intersect = true; break;
}
if(!intersect) return false;
break;}
if(dim <= 1) {
return true;
} else if(dim > 2) {
unsigned char r = 0;
for(unsigned char d = 0; d < dim; ++d) {
for(unsigned char i = 0; i < dim-1; ++i) {
patch_[i] = src[(i+1+dir/2)%dim];
for(unsigned char j = 1; j < dim; ++j)
patch_[i+(dim-1)*j] =
patch[(i+1+dir/2)%dim+dim*((j+d)%dim)];
}
r += intersect_tri(patch_, 0, patch_+dim-1, dim-1);
}
if(r % 2 == 0) return false;
}
for(unsigned char i = 0; i < dim*dim; ++i)
patch[i] -= src[i%dim];
/* For 3-dimension, dir % 2 == 0, dir / 2 == 0, we have
[Xa Xb Xc 1][ Ca ] [X] Ca >= 0
[Ya Yb Yc 0][ Cb ] = [Y], Cb >= 0
[Za Zb Zc 0][ Cc ] [Z] Cc >= 0
[ 1 1 1 0][lambda] [1] lambda>= 0
solve [Xa-X Xb-X Xc-X 1]-1[0]
[Ya-Y Yb-Y Yc-Y 0] [0]
[Za-Z Zb-Z Zc-Z 0] [0] >= 0
[ 1 1 1 0] [1]
For arbitrary case, (i = dir/2)
[V ei]-1[0] = V^-1ei ( bigger than 0 if dir%2==0 else 1)
[e^T 0] [1] e^TV^-1ei
*/
switch(dim) {
case 2: patch_[0] = (dir/2==0 ? patch[3]:-patch[2]);
patch_[1] = (dir/2==0 ?-patch[1]: patch[0]);
det = patch[0]*patch[3] - patch[1]*patch[2];
break;
case 3: patch_[0] = (dir/2==0 ?
patch[4]*patch[8]-patch[5]*patch[7] : (dir/2==1 ?
patch[5]*patch[6]-patch[3]*patch[8] :
patch[3]*patch[7]-patch[4]*patch[6]));
patch_[1] = (dir/2==0 ?
patch[2]*patch[7]-patch[1]*patch[8] : (dir/2==1 ?
patch[0]*patch[8]-patch[2]*patch[6] :
patch[1]*patch[6]-patch[0]*patch[7]));
patch_[2] = (dir/2==0 ?
patch[1]*patch[5]-patch[2]*patch[4] : (dir/2==1 ?
patch[2]*patch[3]-patch[0]*patch[5] :
patch[0]*patch[4]-patch[1]*patch[3]));
det = patch_[0]*patch[dir/2] +
patch_[1]*patch[dir/2+3] +
patch_[2]*patch[dir/2+6];
break;
default:for(unsigned char d = 0; d < dim; ++d)
patch_[d] = (d == dir/2) ? 1 : 0;
// Gauss elimination
for(unsigned char i = 0; i < dim; ++i) {
unsigned char pivot = i;
for(unsigned char j = i + 1; j < dim; ++j)
if(ABS(patch[pivot+dim*i]) < ABS(patch[j+dim*i]))
pivot = j;
if(ABS(patch[pivot+dim*i]) <= 0) return false;
for(unsigned char j = 0; j < dim; ++j)
if(j != pivot) {
scalar_t factor = patch[j+dim*i] / patch[pivot+dim*i];
for(unsigned char k = i+1; k < dim; ++k)
patch[j+dim*k] -= factor * patch[pivot+dim*k];
patch_[j] -= factor * patch[pivot];
}
if(i != pivot) {
for(unsigned char k = i; k < dim; ++k) {
det = patch[i+dim*k];
patch[i+dim*k] = patch[pivot+dim*k];
patch[pivot+dim*k] = det;
}
det = patch_[i];
patch_[i] = patch_[pivot];
patch_[pivot] = det;
}
}
det = 1; break;}
if(det == 0) return false;
intersect = (det > 0) ^ (dir % 2);
for(unsigned char d = 0; d < dim; ++d)
if(intersect ^ (patch_[d] < 0))
return false;
return true;
}
template
void __global__ search_inside_mesh_kernel(const index *tri_num, const index *tri_idx, const index *size,
const scalar_t *_min, scalar_t step,
const scalar_t *points_base, const index *tri,
const scalar_t *points_query, const index points_num,
scalar_t *signs) {
const int id = blockIdx.x * blockDim.x + threadIdx.x;
if(points_base == NULL || tri == NULL || points_query == NULL
|| tri_num == NULL || tri_idx == NULL || size == NULL || _min == NULL
|| step <= 0 || id >= points_num)
return;
const scalar_t *point = points_query + 3 * id;
scalar_t *sign = signs + id;
index x[dim+1], to_end[2*dim];
scalar_t patch[dim*dim];
unsigned char out_dim = 0;
for(unsigned char d = 0; d < dim; ++d) {
scalar_t xf = (point[d] - _min[d]) / step;
if(xf < 0 || xf >= size[d]){
// return false;
sign[0] = -1;
return;
}
x[d] = (index)xf;
to_end[2*d] = x[d];
to_end[2*d+1]= size[d]-1-x[d];
x[dim] = d > 0 ? x[dim] * size[d] + x[d] : x[d];
}
for(unsigned char d = 1; d < 2*dim; ++d)
if(to_end[d] < to_end[out_dim])
out_dim = d;
// std::vector visited(1, 0);
// thrust::device_vector visited(1, 0);
index visited[16] = {};
index visited_size = 1;
for(index i = 0; i <= to_end[out_dim]; ++i) {
for(index j =(x[dim]==0?0:tri_num[x[dim]-1]); j < tri_num[x[dim]]; ++j) {
for(unsigned char d = 0; d < dim; ++d)
for(unsigned char d_= 0; d_< dim; ++d_)
patch[d_+ d*dim] = points_base[d_+dim*
tri[d+dim*tri_idx[j]-dim]];
if(intersect_tri(point, out_dim, patch, dim)) {
bool find = false;
for(index t = 1; t < visited_size; ++t)
if(visited[t] == tri_idx[j]-1) {
find = true; break;
}
if(!find) {
// visited.resize(visited.size()+1);
// visited[visited.size()-1] = tri_idx[j]-1;
if(visited_size < sizeof(visited)/sizeof(visited[0]))
visited[visited_size++] = tri_idx[j]-1;
else { for(index i = 1; i+1 <
sizeof(visited)/sizeof(visited[0]); ++i)
visited[i] = visited[i+1];
visited[sizeof(visited)/sizeof(visited[0])-1]
= tri_idx[j]-1;
visited_size++;
}
}
}
}
if(out_dim % 2 == 1)
++x[out_dim/2];
else --x[out_dim/2];
for(unsigned char d = 0; d < dim; ++d)
x[dim] = d > 0 ? x[dim] * size[d] + x[d] : x[d];
}
// return visited.size()-1;
sign[0] = ((visited_size) % 2 == 0) ? 1 : -1;
}
void search_inside_mesh_cuda (
at::Tensor points,
at::Tensor verts,
at::Tensor faces,
at::Tensor tri_num,
at::Tensor tri_idx,
at::Tensor num,
at::Tensor minmax,
float step,
at::Tensor signs
) {
if(points.sizes().size() != 2) points = points.reshape({-1,3});
int32_t points_num = points.size(0);
const int threads = 512;
const dim3 blocks (points_num / threads + 1, 1, 1);
// make output
// signs.resize_({points_num});
// signs.zero_();
AT_DISPATCH_FLOATING_TYPES(verts.type(), "search_inside_mesh_cuda", ([&] {
search_inside_mesh_kernel<<>>(
tri_num.data(),
tri_idx.data(),
num.data(),
minmax.data(),
step,
verts.data(),
faces.data(),
points.data(),
points_num,
signs.data()
);
}));
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess)
printf("Error in search_inside_mesh_cuda: %s\n", cudaGetErrorString(err));
}
template
unsigned char __device__ ray_intersect_grid(
const scalar_t start[dim], const scalar_t direction[dim],
scalar_t step, const scalar_t min_[dim], const index num[dim + 1],
index ind, bool first = false, scalar_t inter_point[dim] = NULL) {
scalar_t _min[dim], _max[dim];
if(ind < num[dim]) {
for(unsigned char d = dim - 1; d > 0; ind /= num[d--])
_max[d] = (_min[d] = min_[d] + step * (ind % num[d])) + step;
_max[0] = (_min[0] = min_[0] + step * ind) + step;
} else for(unsigned char d = 0; d < dim; ++d)
_max[d] = (_min[d] = min_[d]) + step * num[d];
scalar_t min_dot = -1, point[dim];
unsigned out_dim = 2 * dim;
for(unsigned char d = 0; d < dim; ++d) {
const scalar_t *inter;
if(first) {
if(start[d] < _min[d] && direction[d] > 0)
inter = _min;
else if(start[d] > _max[d] && direction[d] < 0)
inter = _max;
else if(start[d] > _min[d] && direction[d] < 0)
inter = _min;
else if(start[d] < _max[d] && direction[d] > 0)
inter = _max;
else
continue;
} else {
if(direction[d] > 0)
inter = _max;
else if(direction[d] < 0)
inter = _min;
else
continue;
}
scalar_t dot = (inter[d] - start[d]) / direction[d];
if(dot < 0) continue;
for(unsigned char d_= 0; d_< dim; ++d_)
if(d_ != d) {
point[d_] = start[d_] + direction[d_] * dot;
if(point[d_] < _min[d_] || point[d_] > _max[d_]) {
dot = min_dot; break;
}
} else
point[d_] = inter[d_];
if(dot >= 0 && (min_dot < 0 || dot < min_dot)) {
min_dot = dot;
out_dim = 2 * d + (inter == _max);
if(inter_point != NULL)
for(unsigned char d_= 0; d_< dim; ++d_)
inter_point[d_] = point[d_];
}
}
return out_dim;
}
template
__device__ bool intersect_tri2(const scalar_t src[3], const scalar_t dir[3],
const scalar_t va[3], const scalar_t vb[3], const scalar_t vc[3],
scalar_t coeff[3] = NULL, bool both_direction = false,
scalar_t precision = 1e-9) {
scalar_t A[] = { va[0]-src[0], vb[0]-src[0], vc[0]-src[0], -dir[0],
va[1]-src[1], vb[1]-src[1], vc[1]-src[1], -dir[1],
va[2]-src[2], vb[2]-src[2], vc[2]-src[2], -dir[2],
1, 1, 1, 0},
A3inv[9],
Ainv[4];
A3inv[0] = A[5]*A[10]- A[6]*A[9];
A3inv[1] = A[2]*A[9] - A[1]*A[10];
A3inv[2] = A[1]*A[6] - A[2]*A[5];
A3inv[3] = A[6]*A[8] - A[4]*A[10];
A3inv[4] = A[0]*A[10]- A[2]*A[8];
A3inv[5] = A[2]*A[4] - A[0]*A[6];
A3inv[6] = A[4]*A[9] - A[5]*A[8];
A3inv[7] = A[1]*A[8] - A[0]*A[9];
A3inv[8] = A[0]*A[5] - A[1]*A[4];
Ainv[0] =-A[3]*A3inv[0] - A[7]*A3inv[1] - A[11]*A3inv[2];
Ainv[1] =-A[3]*A3inv[3] - A[7]*A3inv[4] - A[11]*A3inv[5];
Ainv[2] =-A[3]*A3inv[6] - A[7]*A3inv[7] - A[11]*A3inv[8];
Ainv[3] = A[0]*A3inv[0] + A[4]*A3inv[1] + A[8]*A3inv[2];
scalar_t det = Ainv[0] + Ainv[1] + Ainv[2];
if(det > precision || det < -precision) {
if(coeff != NULL) {
coeff[0] = Ainv[0] / det;
coeff[1] = Ainv[1] / det;
coeff[2] = Ainv[2] / det;
// coeff[3] = Ainv[3] / det;
}
if(det < 0) {
for(unsigned i = 0; i < 4; ++i)
Ainv[i] = -Ainv[i];
det = -det;
}
return Ainv[0] >=-precision &&
Ainv[1] >=-precision &&
Ainv[2] >=-precision &&
(both_direction || Ainv[3] >=-precision);
} else {
scalar_t norm = A[3]*A[3] + A[7]*A[7] + A[11]*A[11],
S[] = {
A3inv[0] + A3inv[3] + A3inv[6],
A3inv[1] + A3inv[4] + A3inv[7],
A3inv[2] + A3inv[5] + A3inv[8]},
area = S[0]*S[0] + S[1]*S[1] + S[2]*S[2];
if(norm <= precision) {
// direction degenerate to a point
if(area > precision) {
Ainv[0] = A3inv[0]*S[0]+A3inv[1]*S[1]+A3inv[2]*S[2];
Ainv[1] = A3inv[3]*S[0]+A3inv[4]*S[1]+A3inv[5]*S[2];
Ainv[2] = A3inv[6]*S[0]+A3inv[7]*S[1]+A3inv[8]*S[2];
if(coeff != NULL) {
coeff[0] = Ainv[0] / area;
coeff[1] = Ainv[1] / area;
coeff[2] = Ainv[2] / area;
// coeff[3] = 0;
}
return Ainv[0] >=-precision &&
Ainv[1] >=-precision &&
Ainv[2] >=-precision &&
Ainv[3] >=-precision && Ainv[3] <= precision;
} else {
scalar_t e[] = { vc[0]-vb[0], vc[1]-vb[1], vc[2]-vb[2],
va[0]-vc[0], va[1]-vc[1], va[2]-vc[2],
vb[0]-va[0], vb[1]-va[1], vb[2]-va[2]},
l[] = { e[0]*e[0] + e[1]*e[1] + e[2]*e[2],
e[3]*e[3] + e[4]*e[4] + e[5]*e[5],
e[6]*e[6] + e[7]*e[7] + e[8]*e[8]};
unsigned i = (l[0] < l[1] ? 1 : 0), j, k;
i = (l[i] < l[2] ? 2 : i);
j = (i+1) % 3;
k = (i+2) % 3;
if(l[i] > precision) {
// triangle degenerate to a segment
Ainv[i] = A3inv[3*i] * A3inv[3*i] +
A3inv[3*i+1] * A3inv[3*i+1]+
A3inv[3*i+2] * A3inv[3*i+2];
Ainv[j] = A[k]*e[3*i] + A[k+4]*e[3*i+1] + A[k+8]*e[3*i+2];
Ainv[k] =-A[j]*e[3*i] - A[j+4]*e[3*i+1] - A[j+8]*e[3*i+2];
if(coeff != NULL) {
coeff[i] = 0;
coeff[j] = Ainv[j] / l[i];
coeff[k] = Ainv[k] / l[i];
// coeff[3] = 0;
}
return Ainv[i] <= precision &&
Ainv[j] >=-precision &&
Ainv[k] >=-precision &&
Ainv[3] >=-precision && Ainv[3] <= precision;
} else {
// triangle degenerate to a point
Ainv[i] = A[i]*A[i] + A[i+4]*A[i+4] + A[i+8]*A[i+8];
if(coeff != NULL) {
coeff[i] = 1;
coeff[j] = 0;
coeff[k] = 0;
// coeff[3] = 0;
}
return Ainv[i] <= precision &&
Ainv[3] >=-precision && Ainv[3] <= precision;
}
}
} else {
if(area <= precision) {
scalar_t e[] = { vc[0]-vb[0], vc[1]-vb[1], vc[2]-vb[2],
va[0]-vc[0], va[1]-vc[1], va[2]-vc[2],
vb[0]-va[0], vb[1]-va[1], vb[2]-va[2]},
l[] = { e[0]*e[0] + e[1]*e[1] + e[2]*e[2],
e[3]*e[3] + e[4]*e[4] + e[5]*e[5],
e[6]*e[6] + e[7]*e[7] + e[8]*e[8]};
unsigned i = (l[0] < l[1] ? 1 : 0), j, k;
i = (l[i] < l[2] ? 2 : i);
j = (i+1) % 3;
k = (i+2) % 3;
if(l[i] <= precision) {
// triangle degenerate to a point
scalar_t cross[] = {
A[i+4]*A[11]-A[i+8]*A[7],
A[i+8]*A[3] -A[i] *A[11],
A[i] *A[7] -A[i+4]*A[3]};
Ainv[i]=cross[0] * cross[0] +
cross[1] * cross[1] +
cross[2] * cross[2];
Ainv[3]=-A[i]*A[3] - A[i+4]*A[7] - A[i+8]*A[11];
if(coeff != NULL) {
coeff[i] = 1;
coeff[j] = 0;
coeff[k] = 0;
// coeff[3] = Ainv[3] / norm;
}
return Ainv[i] <= precision &&
(both_direction || Ainv[3] >=-precision);
} else {
// triangle degenerate to a segment
scalar_t norm_ =
A3inv[3*i] * A3inv[3*i] +
A3inv[3*i+1]* A3inv[3*i+1]+
A3inv[3*i+2]* A3inv[3*i+2];
if(norm_ > precision) {
scalar_t cross[] = {
A[j+4]*A[11]-A[j+8]*A[7],
A[j+8]*A[3] -A[j] *A[11],
A[j] *A[7] -A[j+4]*A[3],
A[k+4]*A[11]-A[k+8]*A[7],
A[k+8]*A[3] -A[k] *A[11],
A[k] *A[7] -A[k+4]*A[3]};
Ainv[j] = A3inv[3*i] * cross[3] +
A3inv[3*i+1] * cross[4] +
A3inv[3*i+2] * cross[5];
Ainv[k] =-A3inv[3*i] * cross[0] -
A3inv[3*i+1] * cross[1] -
A3inv[3*i+2] * cross[2];
Ainv[3] = Ainv[j] + Ainv[k];
} else {
// starting point is on the segment
Ainv[j] = A[k]*e[3*i] + A[k+4]*e[3*i+1] + A[k+8]*e[3*i+2];
Ainv[k] =-A[j]*e[3*i] - A[j+4]*e[3*i+1] - A[j+8]*e[3*i+2];
Ainv[3] = l[i];
}
if(coeff != NULL) {
if(Ainv[3] >=-precision && Ainv[3] <= precision)
Ainv[3] = precision;
coeff[i] = 0;
coeff[j] = Ainv[j] / Ainv[3];
coeff[k] = Ainv[k] / Ainv[3];
// coeff[3] = norm_ / Ainv[3];
}
return Ainv[i] >=-precision && Ainv[i] <= precision &&
Ainv[j] >=-precision &&
Ainv[k] >=-precision &&
(both_direction || Ainv[3] > precision);
}
} else {
// direction parallel to triangle
Ainv[0] = A3inv[0]*S[0]+A3inv[1]*S[1]+A3inv[2]*S[2];
Ainv[1] = A3inv[3]*S[0]+A3inv[4]*S[1]+A3inv[5]*S[2];
Ainv[2] = A3inv[6]*S[0]+A3inv[7]*S[1]+A3inv[8]*S[2];
unsigned i = (Ainv[0] < Ainv[1] ? 0 : 1), j, k;
i = (Ainv[i] < Ainv[2] ? i : 2);
j = (i+1) % 3;
k = (i+2) % 3;
if(Ainv[k] < -precision) {
k = j; j = i; i = 3 - j - k;
}
if(Ainv[j] < -precision) {
scalar_t cross[] = {
A[i+4]*A[11]-A[i+8]*A[7],
A[i+8]*A[3] -A[i] *A[11],
A[i] *A[7] -A[i+4]*A[3],
A[j+4]*A[11]-A[j+8]*A[7],
A[j+8]*A[3] -A[j] *A[11],
A[j] *A[7] -A[j+4]*A[3],
A[k+4]*A[11]-A[k+8]*A[7],
A[k+8]*A[3] -A[k] *A[11],
A[k] *A[7] -A[k+4]*A[3]};
scalar_t dot[] = {
A3inv[3*i] * cross[6] +
A3inv[3*i+1]* cross[7] +
A3inv[3*i+2]* cross[8],
-A3inv[3*i] * cross[3] -
A3inv[3*i+1]* cross[4] -
A3inv[3*i+2]* cross[5],
A3inv[3*j] * cross[0] +
A3inv[3*j+1]* cross[1] +
A3inv[3*j+2]* cross[2],
-A3inv[3*j] * cross[6] -
A3inv[3*j+1]* cross[7] -
A3inv[3*j+2]* cross[8]};
scalar_t sum[] = {dot[0]+dot[1], dot[2]+dot[3]};
scalar_t norm[]= {
A3inv[3*i] * A3inv[3*i] +
A3inv[3*i+1]* A3inv[3*i+1]+
A3inv[3*i+2]* A3inv[3*i+2],
A3inv[3*j] * A3inv[3*j] +
A3inv[3*j+1]* A3inv[3*j+1]+
A3inv[3*j+2]* A3inv[3*j+2]};
bool valid[] = {
dot[0] >=-precision && dot[1] >=-precision &&
(both_direction || norm[0] > precision),
dot[2] >=-precision && dot[3] >=-precision &&
(both_direction || norm[1] > precision)};
if(coeff != NULL) {
if(valid[0]) {
coeff[i] = 0;
coeff[j] = dot[0] / sum[0];
coeff[k] = dot[1] / sum[0];
// coeff[3] = norm[0] / sum[0];
} else {
coeff[i] = dot[3] / sum[1];
coeff[j] = 0;
coeff[k] = dot[2] / sum[1];
// coeff[3] = norm[1] / sum[1];
}
}
return (valid[0] || valid[1]) &&
Ainv[3] >=-precision && Ainv[3] <= precision;
} else if(Ainv[i] < -precision) {
scalar_t cross[] = {
A[j+4]*A[11]-A[j+8]*A[7],
A[j+8]*A[3] -A[j] *A[11],
A[j] *A[7] -A[j+4]*A[3],
A[k+4]*A[11]-A[k+8]*A[7],
A[k+8]*A[3] -A[k] *A[11],
A[k] *A[7] -A[k+4]*A[3]};
Ainv[j] = A3inv[3*i] * cross[3] +
A3inv[3*i+1] * cross[4] +
A3inv[3*i+2] * cross[5];
Ainv[k] =-A3inv[3*i] * cross[0] -
A3inv[3*i+1] * cross[1] -
A3inv[3*i+2] * cross[2];
Ainv[i] = Ainv[j] + Ainv[k];
// scalar_t norm_ =
// A3inv[3*i] * A3inv[3*i] +
// A3inv[3*i+1]* A3inv[3*i+1]+
// A3inv[3*i+2]* A3inv[3*i+2];
if(coeff != NULL) {
if(Ainv[i] >=-precision && Ainv[i] <= precision)
Ainv[i] = precision;
coeff[i] = 0;
coeff[j] = Ainv[j] / Ainv[i];
coeff[k] = Ainv[k] / Ainv[i];
// coeff[3] = norm_ / Ainv[i];
}
return Ainv[j] >=-precision &&
Ainv[k] >=-precision &&
Ainv[3] >=-precision && Ainv[3] <= precision &&
(both_direction || Ainv[i] > precision);
} else if(coeff != NULL) {
coeff[0] = Ainv[0] / area;
coeff[1] = Ainv[1] / area;
coeff[2] = Ainv[2] / area;
// coeff[3] = 0;
}
return Ainv[i] >=-precision &&
Ainv[3] >=-precision && Ainv[3] <= precision;
}
}
}
}
template
__global__ void search_ray_grid_kernel(
const index *tri_num, const index *tri_idx,
const index *size, const scalar_t *_min, scalar_t step,
const scalar_t *points_base, const index *tri,
const scalar_t *_origin, const scalar_t *_direction,
bool *_valid, index points_num,
scalar_t *coeff = NULL, index exclude_ind = 0,
bool both_dir = false, scalar_t max_r2 = 0) {
// const unsigned char dim = 3;
const int id = blockIdx.x * blockDim.x + threadIdx.x;
const scalar_t precision = 1e-9;
if(points_base == NULL || tri == NULL || _origin == NULL || _direction == NULL
|| tri_num == NULL || tri_idx == NULL || size == NULL || _min == NULL
|| step <= 0 || id >= points_num || _valid == NULL)
return;
bool *valid = _valid + id;
const scalar_t *origin = _origin + id * 3;
const scalar_t *direction = _direction + id * 3;
index inter_ind = tri_num[size[dim]-1], x[dim*2+2];
scalar_t inter_point[dim], _coeff[dim+1],
direction_[] = {-direction[0],-direction[1],-direction[2]},
dist2 = 0, e = 0, dis2 = (max_r2 <= 0 ? -1 : max_r2);
unsigned char out_dim[2] = {0, 2 * dim};
for(unsigned char d = 0; d < dim; ++d) {
dist2 += direction[d] * direction[d];
scalar_t xf = (origin[d] - _min[d]) / step;
if(xf < 0 || xf >= size[d]) {
x[dim] = size[dim]; break;
}
x[dim+1+d] = x[d] = (index)xf;
x[dim] = d > 0 ? x[dim] * size[d] + x[d] : x[d];
}
if(dist2 < precision) {
valid[0] = (inter_ind != tri_num[size[dim]-1]);
return;
}
if(x[dim] >= size[dim]) {
out_dim[0] = ray_intersect_grid(origin, direction,
step, _min, size, size[dim], true, inter_point);
if(out_dim[0] >= 2 * dim && !both_dir){
valid[0] = false;
return;
}
for(unsigned char d = 0; d < dim; ++d) {
scalar_t xf = (inter_point[d] - _min[d]) / step;
xf = (xf < 0 ? 0 :(xf >= size[d] ? size[d]-1 : floor(xf)));
x[d] = (index)xf;
x[dim] = d > 0 ? x[dim] * size[d] + x[d] : x[d];
}
if(both_dir) {
out_dim[1] = ray_intersect_grid(origin,direction_,
step, _min, size, size[dim], true, inter_point);
if(out_dim[1] < 2 * dim) {
for(unsigned char d = 0; d < dim; ++d) {
scalar_t xf = (inter_point[d] - _min[d]) / step;
xf = (xf < 0 ? 0 :(xf >= size[d]?size[d]-1:floor(xf)));
x[dim+1+d] = (index)xf;
x[dim+1+dim] = d > 0 ?
x[dim*2+1]*size[d] + x[dim+1+d] : x[dim+1+d];
}
} else if(out_dim[0] >= 2 * dim){
valid[0] = (inter_ind != tri_num[size[dim]-1]);
return;
}
}
} else if(both_dir) {
out_dim[1] = 0;
x[dim*2+1] = x[dim];
}
while(out_dim[0] < 2 * dim || out_dim[1] < 2 * dim) {
for(index j = (x[dim]==0?0:tri_num[x[dim]-1]); j < tri_num[x[dim]]; ++j) {
if(exclude_ind > 0) {
if(tri[dim*tri_idx[j]-3] == exclude_ind-1
|| tri[dim*tri_idx[j]-2] == exclude_ind-1
|| tri[dim*tri_idx[j]-1] == exclude_ind-1)
continue;
} else if(exclude_ind+1+tri_idx[j] == 0)
continue;
if(intersect_tri2(origin, direction,
points_base + dim * tri[dim * tri_idx[j] - 3],
points_base + dim * tri[dim * tri_idx[j] - 2],
points_base + dim * tri[dim * tri_idx[j] - 1],
_coeff, false, precision)) {
dist2 = 0;
for(unsigned char d = 0; d < dim; ++d) {
inter_point[d] =
_coeff[0]*points_base[d+dim*tri[dim*tri_idx[j]-3]]+
_coeff[1]*points_base[d+dim*tri[dim*tri_idx[j]-2]]+
_coeff[2]*points_base[d+dim*tri[dim*tri_idx[j]-1]];
e = inter_point[d] - origin[d];
dist2 += e * e;
}
out_dim[0] = 2 * dim;
if(dis2 < 0 || dist2 < dis2) {
if(coeff != NULL)
for(unsigned char d = 0; d < dim; ++d)
coeff[d] = _coeff[d];
inter_ind = tri_idx[j] - 1;
dist2 = dis2;
}
}
}
if(out_dim[1] < 2 * dim) {
for(index j = (x[dim*2+1]==0?0:tri_num[x[dim*2+1]-1]);
j < tri_num[x[dim*2+1]]; ++j) {
if(exclude_ind > 0) {
if(tri[dim*tri_idx[j]-3] == exclude_ind-1
|| tri[dim*tri_idx[j]-2] == exclude_ind-1
|| tri[dim*tri_idx[j]-1] == exclude_ind-1)
continue;
}
if(intersect_tri2(origin, direction_,
points_base + dim * tri[dim * tri_idx[j] - 3],
points_base + dim * tri[dim * tri_idx[j] - 2],
points_base + dim * tri[dim * tri_idx[j] - 1],
_coeff, false, precision)) {
dist2 = 0;
for(unsigned char d = 0; d < dim; ++d) {
inter_point[d] =
_coeff[0]*points_base[d+dim*tri[dim*tri_idx[j]-3]]+
_coeff[1]*points_base[d+dim*tri[dim*tri_idx[j]-2]]+
_coeff[2]*points_base[d+dim*tri[dim*tri_idx[j]-1]];
e = inter_point[d] - origin[d];
dist2 += e * e;
}
out_dim[1] = 2 * dim;
if(dis2 < 0 || dist2 < dis2) {
if(coeff != NULL)
for(unsigned char d = 0; d < dim; ++d)
coeff[d] = _coeff[d];
inter_ind = tri_idx[j] - 1;
dist2 = dis2;
}
}
}
if(out_dim[1] < 2 * dim) {
out_dim[1] = ray_intersect_grid(origin,direction_,
step, _min, size, x[dim*2+1], false, inter_point);
if(dis2 >= 0) {
dist2 = 0;
for(unsigned char d = 0; d < dim; ++d) {
e = inter_point[d] - origin[d];
dist2 += e * e;
}
if(dist2 > dis2)
out_dim[1] = 2 * dim;
}
if(out_dim[1] < 2 * dim) {
if(out_dim[1] % 2 == 1) {
if(x[dim+1+out_dim[1]/2] == size[out_dim[1]/2] - 1)
out_dim[1] = 2 * dim;
else
++x[dim+1+out_dim[1]/2];
} else { if(x[dim+1+out_dim[1]/2] == 0)
out_dim[1] = 2 * dim;
else
--x[dim+1+out_dim[1]/2];
}
}
}
if(out_dim[1] < 2 * dim) {
for(unsigned char d = 0; d < dim; ++d)
x[dim*2+1] = d > 0 ?
x[dim*2+1]*size[d]+x[dim+1+d]:x[dim+1+d];
} else if(out_dim[0] >= 2 * dim) {
valid[0] = (inter_ind != tri_num[size[dim]-1]);
return;
}
} else if(out_dim[0] >= 2 * dim){
valid[0] = (inter_ind != tri_num[size[dim]-1]);
return;
}
out_dim[0] = ray_intersect_grid(origin, direction,
step, _min, size, x[dim], false, inter_point);
if(dis2 >= 0) {
dist2 = 0;
for(unsigned char d = 0; d < dim; ++d) {
e = inter_point[d] - origin[d];
dist2 += e * e;
}
if(dist2 > dis2)
out_dim[0] = 2 * dim;
}
if(out_dim[0] < 2 * dim) {
if(out_dim[0] % 2 == 1) {
if(x[out_dim[0]/2] == size[out_dim[0]/2] - 1)
out_dim[0] = 2 * dim;
else
++x[out_dim[0]/2];
} else { if(x[out_dim[0]/2] == 0)
out_dim[0] = 2 * dim;
else
--x[out_dim[0]/2];
}
if(out_dim[0] < 2 * dim)
for(unsigned char d = 0; d < dim; ++d)
x[dim] = d > 0 ? x[dim]*size[d]+x[d] : x[d];
}
}
valid[0] = (inter_ind != tri_num[size[dim]-1]);
return;
}
void search_intersect_cuda (
at::Tensor origins,
at::Tensor directions,
at::Tensor verts,
at::Tensor faces,
at::Tensor tri_num,
at::Tensor tri_idx,
at::Tensor num,
at::Tensor minmax,
float step,
at::Tensor intersect
) {
if(origins.sizes().size() != 2) origins = origins.reshape({-1,3});
if(directions.sizes().size() != 2) directions = directions.reshape({-1,3});
int32_t points_num = origins.size(0);
const int threads = 512;
const dim3 blocks (points_num / threads + 1, 1, 1);
// make output
// intersect.resize_({points_num});
// intersect.zero_();
AT_DISPATCH_FLOATING_TYPES(verts.type(), "search_intersect_cuda", ([&] {
search_ray_grid_kernel<<>>(
tri_num.data(),
tri_idx.data(),
num.data(),
minmax.data(),
step,
verts.data(),
faces.data(),
origins.data(),
directions.data(),
intersect.data(),
points_num
);
}));
// __global__ void search_ray_grid_kernel(
// const index *tri_num, const index *tri_idx,
// const index *size, const scalar_t *_min, scalar_t step,
// const scalar_t *points_base, const index *tri,
// const scalar_t *_origin, const scalar_t *_direction,
// bool *_valid, index points_num,
// scalar_t *coeff = NULL, index exclude_ind = 0,
// bool both_dir = false, scalar_t max_r2 = 0)
cudaError_t err = cudaGetLastError();
if (err != cudaSuccess)
printf("Error in search_intersect_cuda: %s\n", cudaGetErrorString(err));
}
================================================
FILE: extensions/mesh_grid/mesh_grid_searcher.py
================================================
import torch
import trimesh
from mesh_grid import (cumsum, insert_grid_surface, search_inside_mesh,
search_intersect, search_nearest_point)
class MeshGridSearcher:
def __init__(self, verts=None, faces=None):
if verts is not None and faces is not None:
self.set_mesh(verts, faces)
def set_mesh(self, verts, faces):
self.verts = verts
self.faces = faces
_min, _ = torch.min(verts, 0)
_max, _ = torch.max(verts, 0)
self.step = (torch.cumprod(_max - _min, 0)[-1] / len(verts))**(1. / 3.)
l = _max - _min
c = (_max + _min) / 2
l = torch.max(torch.floor(l / self.step), torch.zeros_like(l)) + 1
_min_step = c - self.step * l / 2
self.num = torch.cat([l, torch.cumprod(l, 0)[-1:]]).int()
self.minmax = torch.cat([_min_step, _max])
self.tri_num = torch.zeros(self.num[-1],
dtype=torch.int32).to(verts.device)
self.tri_idx = insert_grid_surface(self.verts, self.faces, self.minmax,
self.num, self.step, self.tri_num)
def nearest_points(self, points):
points = points.to(self.verts.device)
nearest_faces = torch.zeros(points.shape[-2],
dtype=torch.int32).to(self.verts.device)
coeff = torch.zeros(points.shape,
dtype=torch.float32).to(self.verts.device)
nearest_pts = torch.zeros_like(coeff)
search_nearest_point(points, self.verts, self.faces, self.tri_num,
self.tri_idx, self.num, self.minmax, self.step,
nearest_faces, nearest_pts, coeff)
return nearest_pts, nearest_faces
def inside_mesh(self, points):
points = points.to(self.verts.device)
inside = torch.zeros(points.shape[-2],
dtype=torch.float32).to(self.verts.device)
search_inside_mesh(points, self.verts, self.faces, self.tri_num,
self.tri_idx, self.num, self.minmax, self.step,
inside)
return inside
def intersects_any(self, origins, directions):
origins = origins.to(self.verts.device)
directions = directions.to(self.verts.device)
intersect = torch.zeros(origins.shape[-2],
dtype=torch.bool).to(self.verts.device)
search_intersect(origins, directions, self.verts, self.faces,
self.tri_num, self.tri_idx, self.num, self.minmax,
self.step, intersect)
return intersect
================================================
FILE: extensions/mesh_grid/render.cpp
================================================
#include
#include
#include
#include
#include
#ifdef USE_CUDA
template
index zbuffer_forward(index,index,index,index,const scalar*,const index*,
scalar*,vector*,index*,scalar*,bool*,bool,scalar);
template
bool zbuffer_forward_gpu(index,index,index,index,const scalar*,const index*,
index*,scalar*, bool*,bool,scalar);
#else
#include "render.h"
#endif
#include
using namespace torch;
template
index zbuffer_forward_cpu(index h, index w, index n, index f,
const scalar *v, const index *tri,
index *ind, scalar *coeff, bool *vis,
bool persp, scalar eps) {
scalar *zbuf = (scalar*)malloc(sizeof(scalar)*h*w);
std::vector > ibuf(h*w);
for(index i = 0; i < h*w; ++i) {
zbuf[i] = std::numeric_limits::max();
ibuf[i].clear();
}
index r = zbuffer_forward >
(h, w, n, f, v, tri, zbuf, ibuf.data(), ind, coeff, vis, persp, eps);
free(zbuf);
return r;
}
std::vector render_forward(Tensor verts, Tensor tri,
uint64_t h, uint64_t w,
bool persp, double eps = 1e-6) {
uint64_t n = verts.size(0),
f = tri.size(0);
bool cuda = verts.type().is_cuda();
Tensor index =-torch::ones({(int64_t)h,(int64_t)w}, cuda ? CUDA(kLong) : CPU(kLong)),
visual= torch::ones({(int64_t)n}, cuda ? CUDA(kBool) : CPU(kBool)),
coeff;
switch(verts.type().scalarType()) {
case torch::ScalarType::Float:
coeff = torch::zeros({(int64_t)h,(int64_t)w,3}, cuda ? CUDA(kFloat) : CPU(kFloat));
if(cuda) {
#ifdef USE_CUDA
zbuffer_forward_gpu(
(int64_t)h,(int64_t)w,(int64_t)n,(int64_t)f,
verts.data(), tri.data(),
index.data(),coeff.data(),visual.data(),
persp, (float)eps);
#endif
} else {
zbuffer_forward_cpu(
(int64_t)h,(int64_t)w,(int64_t)n,(int64_t)f,
verts.data(), tri.data(),
index.data(),coeff.data(),visual.data(),
persp, (float)eps);
} break;
default: break;}
return {index, coeff, visual};
}
PYBIND11_MODULE(_render, m) {
m.def("forward", &render_forward);
}
================================================
FILE: extensions/mesh_grid/render.cu
================================================
#ifndef USE_CUDA
#define USE_CUDA
#endif
#include
#include
#include "render.h"
template
static inline __device__ __host__ scalar numeric_max() {
if((scalar)-1 > 0) return (scalar)-1;
bool is_float = ((scalar)1.1 != (scalar)1);
switch(sizeof(scalar)) {
case 8: if(is_float) {
return (scalar)1.7976931348623157879e308;
} else return (scalar)9223372036854775807;
case 4: if(is_float) {
return (scalar)3.40282346638528875558e38f;
} else return (scalar)2147483647;
case 2: return (scalar)32767;
default:return (scalar)127;}
}
template
class vector_gpu {
public:
__device__ vector_gpu(uint64_t n = 0):
ptr(NULL), len(n), mutex(0) {
if(n > 0) {
n = allocate(len);
ptr = (T*)malloc(sizeof(T) * n);
if(ptr == NULL) len = 0;
}
}
__device__ ~vector_gpu() {
if(ptr != NULL) free(ptr);
}
__device__ uint64_t size() const {return len;}
__device__ T &operator[](uint64_t i) const {
return ptr[i % len];
}
__device__ void clear() {
while(ptr != NULL)
if(atomicCAS(&mutex, 0, 1) == 0) {
free(ptr); len = 0; ptr = NULL;
atomicExch(&mutex, 0);
}
}
__device__ bool push_back(T p) {
bool inserted = true;
bool blocked = true;
while(blocked)
if(atomicCAS(&mutex, 0, 1) == 0) {
if(len % bufsize == 0) {
T*tmp = (T*)malloc(sizeof(T) *(len+bufsize));
if(inserted = (tmp != NULL)) {
for(uint64_t i = 0; i < len; ++i)
tmp[i] = ptr[i];
free(ptr); ptr = tmp;
}
}
if(inserted) ptr[len++] = p;
atomicExch(&mutex, 0);
blocked = false;
}
return inserted;
}
protected:
inline __device__ uint64_t allocate(uint64_t n) {
return ((n + bufsize - 1) % bufsize) * bufsize;
}
mutable T*ptr;
uint64_t len;
int mutex;
};
template
__global__ void zbuffer_forward_kernel(index h,index w,index n,index f,
const scalar *v, const index *tri,
scalar *zbuf, vector_gpu *ibuf,
index *i, scalar *coeff, bool *vis, bool persp, scalar eps) {
index st = 0, ed = h*w;
for(index i = st; i < ed; ++i)
zbuf[i] = numeric_max();
zbuffer_forward >(
h, w, n, f, v, tri, zbuf, ibuf, i, coeff, vis, persp, eps);
}
#include
template
bool zbuffer_forward_gpu(index h, index w, index n, index f,
const scalar *v, const index *tri,
index *ind, scalar *coeff, bool *vis,
bool persp, scalar eps) {
vector_gpu *ibuf = NULL;
scalar *zbuf = NULL;
cudaMalloc((void**)&ibuf, sizeof(vector_gpu) * h * w);
if(ibuf == NULL) return false;
cudaMemset(ibuf, 0, sizeof(vector_gpu) * h * w);
cudaMalloc((void**)&zbuf, sizeof(scalar) * h * w);
if(zbuf == NULL) {cudaFree(ibuf); return false;}
index threads = 512;
zbuffer_forward_kernel<<<1,threads>>>(h, w, n, f,
v, tri, zbuf, ibuf, ind, coeff, vis, persp, eps);
cudaError_t e = cudaGetLastError();
if(e != cudaSuccess) std::cout << cudaGetErrorString(e) << std::endl;
cudaFree(zbuf);
cudaFree(ibuf);
return e == cudaSuccess;
}
#include
#define IMPLEMENT(scalar) \
template int64_t zbuffer_forward >( \
int64_t,int64_t,int64_t,int64_t,const scalar*,const int64_t*,scalar*, \
std::vector*,int64_t*,scalar*,bool*,bool,scalar); \
template bool zbuffer_forward_gpu(int64_t,int64_t,int64_t,int64_t, \
const scalar*,const int64_t*,int64_t*,scalar*, bool*,bool,scalar);
IMPLEMENT(float)
================================================
FILE: extensions/mesh_grid/render.h
================================================
#ifndef _RENDER_H_
#define _RENDER_H_
#ifndef __device__
#define __device__
#endif
#ifndef __host__
#define __host__
#endif
#include
#include
#include
#ifdef USE_CUDA
static __device__ float atomicMin(float* address, float val) {
int* address_as_i = (int*) address;
int old = *address_as_i, assumed;
do {
assumed = old;
old = atomicCAS(address_as_i, assumed,
__float_as_int(fminf(val, __int_as_float(assumed))));
} while (assumed != old);
return __int_as_float(old);
}
#endif
template
inline __device__ bool split_for_loop(index &st, index &ed, index stride = 1) {
#ifdef __CUDA_ARCH__
index num = gridDim.x * blockDim.x;
num = (ed + num * stride - 1 - st) / (num * stride);
st = st + (blockIdx.x*blockDim.x + threadIdx.x) * num * stride;
ed = st + num * stride < ed ? st + num * stride : ed;
#endif
return st < ed;
}
template
__device__ __host__ unsigned char process_one_tri(const scalar v[9],
index w, index h, index bbox[4],
scalar Ainv[9], scalar eps, bool double_face = false) {
scalar umin = (scalar)w, vmin = (scalar)h, umax = 0, vmax = 0;
if(v != NULL) for(unsigned char i = 0; i < 3; ++i)
if(i == 0) {
umax = umin = v[3*i];
vmax = vmin = v[3*i+1];
} else {
if(umin > v[3*i]) umin = v[3*i];
else if(umax < v[3*i]) umax = v[3*i];
if(vmin > v[3*i+1]) vmin = v[3*i+1];
else if(vmax = w ? w-1: umax);
bbox[2] = (index)(vmin < 0 ? 0 : vmin);
bbox[3] = (index)(vmax >= h ? h-1: vmax);
if(bbox[1] < bbox[0] || bbox[3] < bbox[2])
return false;
}
if(Ainv == NULL) return false;
unsigned char type = 0;
Ainv[6] = v[3]*v[7]-v[6]*v[4];
Ainv[7] = v[6]*v[1]-v[0]*v[7];
Ainv[8] = v[0]*v[4]-v[3]*v[1];
scalar det = Ainv[6] + Ainv[7] + Ainv[8];
if(!double_face && det > eps)
return false;
Ainv[0] = v[4]-v[7];
Ainv[1] = v[7]-v[1];
Ainv[2] = v[1]-v[4];
Ainv[3] = v[6]-v[3];
Ainv[4] = v[0]-v[6];
Ainv[5] = v[3]-v[0];
if(det <= eps && det >= -eps) {
scalar l2[] = {
Ainv[0]*Ainv[0]+Ainv[3]*Ainv[3],
Ainv[1]*Ainv[1]+Ainv[4]*Ainv[4],
Ainv[2]*Ainv[2]+Ainv[5]*Ainv[5]};
unsigned char i = (l2[0] > l2[1] ? 0 : 1), j, k;
i = (l2[i] > l2[2] ? i : 2);
j = (i+1)%3;
k = (j+1)%3;
if(l2[i] > eps*eps) {
type = (1<
__device__ __host__ bool normalize_coeff(scalar c[3], const scalar uv[2],
const scalar Ainv[9], unsigned char t, scalar eps) {
unsigned char i = 0, j = 1, k = 2;
switch(t) {
case 7: c[0] = Ainv[0]*uv[0] + Ainv[3]*uv[1] + Ainv[6];
c[1] = Ainv[1]*uv[0] + Ainv[4]*uv[1] + Ainv[7];
c[2] = Ainv[2]*uv[0] + Ainv[5]*uv[1] + Ainv[8];
return (c[0] >= -eps && c[1] >= -eps && c[2] >= -eps);
case 3: case 5: case 6:
i = (7-t)/2; j = (i+1)%3; k = (j+1)%3;
c[0] = Ainv[0]*uv[0] + Ainv[3]*uv[1] + Ainv[6];
c[1] = Ainv[1]*uv[0] + Ainv[4]*uv[1] + Ainv[7];
c[2] = Ainv[2]*uv[0] + Ainv[5]*uv[1] + Ainv[8];
if(c[i]*c[i] > eps*eps) return false;
c[i] = 0;
return (c[j] >= -eps && c[k] >= -eps);
case 1: case 2: case 4:
i = t/2; j = (i+1)%3; k = (j+1)%3;
c[j] = (uv[0] - Ainv[0]);
c[k] = (uv[1] - Ainv[1]);
c[i] = (c[j]*c[j] + c[k]*c[k]);
if(c[i] > eps*eps) return false;
c[j] = c[k] = 0;
c[i] = 1;
return true;
default:return false;}
}
template
__device__ __host__ index zbuffer_forward(index h, index w, index n, index f,
const scalar*v, const index *tri, scalar *zbuf, vector *ibuf,
index *ind, scalar*coeff, bool*vis, bool persp, scalar eps) {
index st = 0, ed = n, count = 0;
#ifdef __CUDA_ARCH__
split_for_loop(st, ed);
#endif
for(index i = st; i < ed; ++i) {
scalar x = v[3*i], y = v[3*i+1];
if(persp) {
if(v[3*i+2] <= eps) {
vis[i] = false; continue;
} else {
x /= v[3*i+2];
y /= v[3*i+2];
}
}
x = floor(x); y = floor(y);
if(x < 0 || y < 0 || x >= (scalar)w || y >= (scalar)h) {
vis[i] = false; continue;
} else {
index j = (index)x + (index)y * w;
vis[i] = true;
ibuf[j].push_back(i);
}
}
st = 0; ed = f;
#ifdef __CUDA_ARCH__
__syncthreads();
split_for_loop(st, ed);
#endif
scalar Ainv[9], c[3], uv[2], z;
index bbox[4];
unsigned char t = 0;
for(index i = st; i < ed; ++i) {
if((v[3*tri[3*i] +2] <= eps
|| v[3*tri[3*i+1]+2] <= eps
|| v[3*tri[3*i+2]+2] <= eps) && persp)
continue;
scalar v_[] = {
v[3*tri[3*i]], v[3*tri[3*i]+1], v[3*tri[3*i] +2],
v[3*tri[3*i+1]],v[3*tri[3*i+1]+1],v[3*tri[3*i+1]+2],
v[3*tri[3*i+2]],v[3*tri[3*i+2]+1],v[3*tri[3*i+2]+2]};
if(persp) for(unsigned char j = 0; j < 3; ++j) {
v_[3*j] /= v_[3*j+2];
v_[3*j+1]/= v_[3*j+2];
}
if((t = process_one_tri(v_, w, h, bbox, Ainv, eps)))
for(index y = bbox[2]; y <= bbox[3]; ++y)
for(index x = bbox[0]; x <= bbox[1]; ++x) {
++count;
index j = x + y*w;
uv[0] = (scalar)x;
uv[1] = (scalar)y;
if(normalize_coeff(c, uv, Ainv, t, eps)) {
if(persp) {
c[0] /= v_[2]; c[1] /= v_[5]; c[2] /= v_[8];
z = c[0] + c[1] + c[2];
if(z <= eps) continue;
c[0] /= z; c[1] /= z; c[2] /= z;
z = 1./ z;
} else z = c[0]*v_[2] + c[2]*v_[5] + c[2]*v_[8];
#ifdef __CUDA_ARCH__
if(atomicMin(zbuf + j, z) > z)
#else
if(zbuf[j] > z)
#endif
{ zbuf[j] = z;
ind[j] = i;
coeff[3*j] = c[0];
coeff[3*j+1]= c[1];
coeff[3*j+2]= c[2];
}
}
for(index k = 0; k < ibuf[j].size(); ++k) {
if(ibuf[j][k] == tri[3*i]
|| ibuf[j][k] == tri[3*i+1]
|| ibuf[j][k] == tri[3*i+2])
continue;
uv[0] = v[3*ibuf[j][k]];
uv[1] = v[3*ibuf[j][k]+1];
if(persp) {
uv[0] /= v[3*ibuf[j][k]+2];
uv[1] /= v[3*ibuf[j][k]+2];
}
if(normalize_coeff(c, uv, Ainv, t, eps)) {
if(persp) {
c[0] /= v_[2]; c[1] /= v_[5]; c[2] /= v_[8];
z = c[0] + c[1] + c[2];
if(z <= eps) continue;
c[0] /= z; c[1] /= z; c[2] /= z;
z = 1./ z;
} else z = c[0]*v_[2] + c[2]*v_[5] + c[2]*v_[8];
if(z <= v[3*ibuf[j][k]+2])
vis[ibuf[j][k]] = false;
}
}
}
}
st = 0; ed = h*w;
#ifdef __CUDA_ARCH__
__syncthreads();
split_for_loop(st, ed);
#endif
for(index i = st; i < ed; ++i) ibuf[i].clear();
#ifdef __CUDA_ARCH__
__syncthreads();
#endif
return count;
}
#endif
================================================
FILE: extensions/mesh_grid/setup.py
================================================
import unittest
from setuptools import find_packages, setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
CUDA_FLAGS = []
INSTALL_REQUIREMENTS = []
ext_modules = [
CUDAExtension('mesh_grid', [
'mesh_grid.cpp',
'mesh_grid_kernel.cu',
]),
]
setup(ext_modules=ext_modules, cmdclass={'build_ext': BuildExtension})
================================================
FILE: extensions/mesh_grid/surface_inside.cpp
================================================
#define USE_CUDA
#ifdef USE_CUDA
#include
#include
template
extern scalar surface_inside_integral(unsigned char,index,
const scalar*,const index*,const scalar*,scalar*,scalar=1e-6);
template
extern bool surface_inside_gpu(index,index,index,char*,
const scalar*,const scalar*,const index*,scalar=1e-6,
const scalar* =NULL,const index* =NULL,const index* =NULL,const index* =NULL);
template
extern scalar surface_inside_grid(unsigned char,index,const scalar*,
const index*,const scalar*,scalar*,const scalar*,const index*,
const index*,const index*,index = 256);
#else
#include "surface_inside.h"
#endif
#include "torch_util.h"
template
index surface_inside_cpu(index n, index d, index m, char *inside,
const scalar *points, const scalar *v,
const index *tri, scalar eps = 1e-6,
const scalar *_min_step = NULL, const index *size = NULL,
const index *tri_num = NULL, const index *tri_idx = NULL) {
bool has_grid =(_min_step != NULL && size != NULL &&
tri_num != NULL && tri_idx != NULL);
index num = 0;
eps = (eps < 0 ? -eps : eps);
scalar *patch = (scalar*)malloc(sizeof(scalar) * d * d);
if(patch == NULL) return 0;
if(has_grid) {
for(index i = 0; i < n; ++i) {
scalar r = surface_inside_grid(
d, m, v, tri, points + d*i, patch,
_min_step, size, tri_num, tri_idx);
if(inside != NULL) {
if((r - floor(r)) <= eps) {
inside[i] = ((index)floor(r < 0 ? -r : r) % 2);
num += inside[i];
} else inside[i] = -1; // on the boundary
}
}
} else for(index i = 0; i < n; ++i) {
scalar r = surface_inside_integral(
d, m, v, tri, points + d*i, patch, eps);
if(inside != NULL) {
if((r - floor(r)) <= eps) {
inside[i] = ((index)floor(r < 0 ? -r : r) % 2);
num += inside[i];
} else inside[i] = -1; // on the boundary
}
}
free(patch);
return num;
}
using namespace std;
using namespace torch;
torch::Tensor surface_inside(torch::Tensor points,
torch::Tensor vertices, torch::Tensor tri,
torch::Tensor params, torch::Tensor tri_num,
torch::Tensor tri_idx, double eps = 1e-6) {
int64_t n = get_size(points, 0),
d = get_size(points, 1),
m = get_size(tri, 0);
bool isCuda = points.type().is_cuda(),
has_grid = false;
vector sz = {n, d};
CHECK_SIZE(points, sz);
sz[0] = get_size(vertices, 0);
CHECK_SIZE(vertices, sz);
CHECK_TYPE(points, vertices);
sz[0] = m;
CHECK_SIZE(tri, sz);
CHECK_TYPE(tri, tri_num);
sz = get_size(params);
if(sz.size() == 1 && sz[0] == d + 1) {
CHECK_TYPE(params, points);
sz = get_size(tri_num);
if(sz.size() == d) {
vector s = get_size(tri_idx);
if(s.size() == 1) {
CHECK_TYPE(tri_num, tri_idx);
has_grid = true;
sz.push_back(1);
for(unsigned char i = 0; i < d; ++i)
sz[d] *= sz[i];
}
}
}
Tensor inside = torch::zeros({n}, NEW_TYPE(kChar,isCuda));
char *inside_ = (char*)inside.data_ptr();
switch(TYPE(points)) {
case ScalarType::Float:
if(isCuda) {
#ifdef USE_CUDA
surface_inside_gpu(n, d, m,
inside_, points.data(),
vertices.data(), tri.data(),
(float)eps,
has_grid ? params.data() : NULL,
has_grid ? sz.data() : NULL,
has_grid ? tri_num.data() : NULL,
has_grid ? tri_idx.data() : NULL);
#endif
} else {
surface_inside_cpu(n, d, m,
inside_, points.data(),
vertices.data(), tri.data(),
(float)eps,
has_grid ? params.data() : NULL,
has_grid ? sz.data() : NULL,
has_grid ? tri_num.data() : NULL,
has_grid ? tri_idx.data() : NULL);
} break;
case ScalarType::Double:
if(isCuda) {
#ifdef USE_CUDA
surface_inside_gpu(n, d, m,
inside_, points.data(),
vertices.data(), tri.data(), eps,
has_grid ? params.data() : NULL,
has_grid ? sz.data() : NULL,
has_grid ? tri_num.data() : NULL,
has_grid ? tri_idx.data() : NULL);
#endif
} else {
surface_inside_cpu(n, d, m,
inside_, points.data(),
vertices.data(), tri.data(), eps,
has_grid ? params.data() : NULL,
has_grid ? sz.data() : NULL,
has_grid ? tri_num.data() : NULL,
has_grid ? tri_idx.data() : NULL);
} break;
default: CHECK_FLOAT(points);}
return inside;
}
PYBIND11_MODULE(surface_inside, m) {
m.def("forward", &surface_inside, "Point Inside Surface");
}
================================================
FILE: extensions/mesh_grid/test_mesh_grid.py
================================================
import os
import numpy as np
import torch
import trimesh
from mesh_grid_searcher import MeshGridSearcher
torch.set_default_tensor_type('torch.cuda.FloatTensor')
data_dir = '../../data/human2/SMPL'
subjects = os.listdir(data_dir)
for subject in subjects:
mesh_path = os.path.join(data_dir, subject, f'smplx.obj')
mesh = trimesh.load(mesh_path)
verts = torch.Tensor(mesh.vertices)
faces = torch.Tensor(mesh.faces).int()
mygrid = MeshGridSearcher(verts, faces)
B_MAX = mesh.vertices.max(0)
B_MIN = mesh.vertices.min(0)
length = B_MAX - B_MIN
points = torch.Tensor(np.random.rand(10, 3) * length + B_MIN)
nearest_pts, _ = mygrid.nearest_points(points)
inside = mygrid.inside_mesh(points)
inside_trimesh = mesh.contains(points.cpu().numpy())
sdf = (torch.norm(nearest_pts - points, dim=1) *
inside.float()).cpu().numpy()
sdf_trimesh = trimesh.proximity.signed_distance(mesh, points.cpu().numpy())
inside = (inside.cpu().numpy() + 1) / 2
inside_error = np.abs(inside - inside_trimesh).sum()
dist_error = np.abs(sdf - sdf_trimesh).sum()
print('[', subject, '] inside_error: ', inside_error, ' dist_error: ',
dist_error)
print('scale: ', length.max())
print(np.abs(sdf - sdf_trimesh))
================================================
FILE: extensions/ngp_raymarch/README.md
================================================
# ngp_raymarch
## Install
build and install cuda-extension,to support instant-ngp
```
cd extensions/ngp_raymarch
rm -rf build && clear && python setup.py build_ext --inplace \
2>&1 | tee build.log
python setup.py install
```
## Notice
* This code mainly based on [instance-ngp](https://github.com/NVlabs/instant-ngp) code modification
* This code's license belongs to [instance-ngp](https://github.com/NVlabs/instant-ngp/blob/master/LICENSE.txt)
* If you found this code useful, please cite [instance-ngp](https://github.com/NVlabs/instant-ngp#license-and-citation)
* We appreciate [instance-ngp](https://github.com/NVlabs/instant-ngp) for their cool code implementation
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/.gitignore
================================================
qrc_*cxx
*.orig
*.pyc
*.diff
diff
*.save
save
*.old
*.gmo
*.qm
core
core.*
*.bak
*~
*build*
*.moc.*
*.moc
ui_*
CMakeCache.txt
tags
.*.swp
activity.png
*.out
*.php*
*.log
*.orig
*.rej
log
patch
*.patch
a
a.*
lapack/testing
lapack/reference
.*project
.settings
Makefile
!ci/build.gitlab-ci.yml
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/.gitlab/issue_templates/Bug Report.md
================================================
### Summary
### Environment
- **Operating System** : Windows/Linux
- **Architecture** : x64/Arm64/PowerPC ...
- **Eigen Version** : 3.3.9
- **Compiler Version** : Gcc7.0
- **Compile Flags** : -O3 -march=native
- **Vector Extension** : SSE/AVX/NEON ...
### Minimal Example
```cpp
//show your code here
```
### Steps to reproduce
1. first step
2. second step
3. ...
### What is the current *bug* behavior?
### What is the expected *correct* behavior?
### Relevant logs
### Warning Messages
### Benchmark scripts and results
### Anything else that might help
- [ ] Have a plan to fix this issue.
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/.gitlab/issue_templates/Feature Request.md
================================================
### Describe the feature you would like to be implemented.
### Would such a feature be useful for other users? Why?
### Any hints on how to implement the requested feature?
### Additional resources
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/.gitlab/merge_request_templates/Merge Request Template.md
================================================
### Reference issue
### What does this implement/fix?
### Additional information
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/.gitlab-ci.yml
================================================
# This file is part of Eigen, a lightweight C++ template library
# for linear algebra.
#
# Copyright (C) 2020 Arm Ltd. and Contributors
#
# This Source Code Form is subject to the terms of the Mozilla
# Public License v. 2.0. If a copy of the MPL was not distributed
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
stages:
- buildsmoketests
- smoketests
- build
- test
variables:
BUILDDIR: builddir
EIGEN_CI_CMAKE_GENEATOR: "Ninja"
include:
- "/ci/smoketests.gitlab-ci.yml"
- "/ci/build.gitlab-ci.yml"
- "/ci/test.gitlab-ci.yml"
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/.hgeol
================================================
[patterns]
*.sh = LF
*.MINPACK = CRLF
scripts/*.in = LF
debug/msvc/*.dat = CRLF
debug/msvc/*.natvis = CRLF
unsupported/test/mpreal/*.* = CRLF
** = native
[repository]
native = LF
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/COPYING.APACHE
================================================
/*
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/COPYING.BSD
================================================
/*
Copyright (c) 2011, Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/COPYING.GPL
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/COPYING.LGPL
================================================
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
Copyright (C)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/COPYING.MINPACK
================================================
Minpack Copyright Notice (1999) University of Chicago. All rights reserved
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
3. The end-user documentation included with the
redistribution, if any, must include the following
acknowledgment:
"This product includes software developed by the
University of Chicago, as Operator of Argonne National
Laboratory.
Alternately, this acknowledgment may appear in the software
itself, if and wherever such third-party acknowledgments
normally appear.
4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
BE CORRECTED.
5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
POSSIBILITY OF SUCH LOSS OR DAMAGES.
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/COPYING.MPL2
================================================
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/COPYING.README
================================================
Eigen is primarily MPL2 licensed. See COPYING.MPL2 and these links:
http://www.mozilla.org/MPL/2.0/
http://www.mozilla.org/MPL/2.0/FAQ.html
Some files contain third-party code under BSD or LGPL licenses, whence the other
COPYING.* files here.
All the LGPL code is either LGPL 2.1-only, or LGPL 2.1-or-later.
For this reason, the COPYING.LGPL file contains the LGPL 2.1 text.
If you want to guarantee that the Eigen code that you are #including is licensed
under the MPL2 and possibly more permissive licenses (like BSD), #define this
preprocessor symbol:
EIGEN_MPL2_ONLY
For example, with most compilers, you could add this to your project CXXFLAGS:
-DEIGEN_MPL2_ONLY
This will cause a compilation error to be generated if you #include any code that is
LGPL licensed.
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/CTestConfig.cmake
================================================
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## enable_testing()
## include(CTest)
set(CTEST_PROJECT_NAME "Eigen")
set(CTEST_NIGHTLY_START_TIME "00:00:00 UTC")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=Eigen")
set(CTEST_DROP_SITE_CDASH TRUE)
#set(CTEST_PROJECT_SUBPROJECTS
#Official
#Unsupported
#)
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/CTestCustom.cmake.in
================================================
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "2000")
set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS "2000")
list(APPEND CTEST_CUSTOM_ERROR_EXCEPTION @EIGEN_CTEST_ERROR_EXCEPTION@)
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/Eigen/Cholesky
================================================
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_CHOLESKY_MODULE_H
#define EIGEN_CHOLESKY_MODULE_H
#include "Core"
#include "Jacobi"
#include "src/Core/util/DisableStupidWarnings.h"
/** \defgroup Cholesky_Module Cholesky module
*
*
*
* This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices.
* Those decompositions are also accessible via the following methods:
* - MatrixBase::llt()
* - MatrixBase::ldlt()
* - SelfAdjointView::llt()
* - SelfAdjointView::ldlt()
*
* \code
* #include
* \endcode
*/
#include "src/Cholesky/LLT.h"
#include "src/Cholesky/LDLT.h"
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/Cholesky/LLT_LAPACKE.h"
#endif
#include "src/Core/util/ReenableStupidWarnings.h"
#endif // EIGEN_CHOLESKY_MODULE_H
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/Eigen/CholmodSupport
================================================
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_CHOLMODSUPPORT_MODULE_H
#define EIGEN_CHOLMODSUPPORT_MODULE_H
#include "SparseCore"
#include "src/Core/util/DisableStupidWarnings.h"
extern "C" {
#include
}
/** \ingroup Support_modules
* \defgroup CholmodSupport_Module CholmodSupport module
*
* This module provides an interface to the Cholmod library which is part of the suitesparse package.
* It provides the two following main factorization classes:
* - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization.
* - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial).
*
* For the sake of completeness, this module also propose the two following classes:
* - class CholmodSimplicialLLT
* - class CholmodSimplicialLDLT
* Note that these classes does not bring any particular advantage compared to the built-in
* SimplicialLLT and SimplicialLDLT factorization classes.
*
* \code
* #include
* \endcode
*
* 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.
* The dependencies depend on how cholmod has been compiled.
* For a cmake based project, you can use our FindCholmod.cmake module to help you in this task.
*
*/
#include "src/CholmodSupport/CholmodSupport.h"
#include "src/Core/util/ReenableStupidWarnings.h"
#endif // EIGEN_CHOLMODSUPPORT_MODULE_H
================================================
FILE: extensions/ngp_raymarch/include/op_include/eigen/Eigen/Core
================================================
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 Gael Guennebaud
// Copyright (C) 2007-2011 Benoit Jacob
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_CORE_MODULE_H
#define EIGEN_CORE_MODULE_H
// first thing Eigen does: stop the compiler from reporting useless warnings.
#include "src/Core/util/DisableStupidWarnings.h"
// then include this file where all our macros are defined. It's really important to do it first because
// it's where we do all the compiler/OS/arch detections and define most defaults.
#include "src/Core/util/Macros.h"
// This detects SSE/AVX/NEON/etc. and configure alignment settings
#include "src/Core/util/ConfigureVectorization.h"
// We need cuda_runtime.h/hip_runtime.h to ensure that
// the EIGEN_USING_STD macro works properly on the device side
#if defined(EIGEN_CUDACC)
#include
#elif defined(EIGEN_HIPCC)
#include
#endif
#ifdef EIGEN_EXCEPTIONS
#include
#endif
// Disable the ipa-cp-clone optimization flag with MinGW 6.x or newer (enabled by default with -O3)
// See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556 for details.
#if EIGEN_COMP_MINGW && EIGEN_GNUC_AT_LEAST(4,6) && EIGEN_GNUC_AT_MOST(5,5)
#pragma GCC optimize ("-fno-ipa-cp-clone")
#endif
// Prevent ICC from specializing std::complex operators that silently fail
// on device. This allows us to use our own device-compatible specializations
// instead.
#if defined(EIGEN_COMP_ICC) && defined(EIGEN_GPU_COMPILE_PHASE) \
&& !defined(_OVERRIDE_COMPLEX_SPECIALIZATION_)
#define _OVERRIDE_COMPLEX_SPECIALIZATION_ 1
#endif
#include
// this include file manages BLAS and MKL related macros
// and inclusion of their respective header files
#include "src/Core/util/MKL_support.h"
#if defined(EIGEN_HAS_CUDA_FP16) || defined(EIGEN_HAS_HIP_FP16)
#define EIGEN_HAS_GPU_FP16
#endif
#if defined(EIGEN_HAS_CUDA_BF16) || defined(EIGEN_HAS_HIP_BF16)
#define EIGEN_HAS_GPU_BF16
#endif
#if (defined _OPENMP) && (!defined EIGEN_DONT_PARALLELIZE)
#define EIGEN_HAS_OPENMP
#endif
#ifdef EIGEN_HAS_OPENMP
#include
#endif
// MSVC for windows mobile does not have the errno.h file
#if !(EIGEN_COMP_MSVC && EIGEN_OS_WINCE) && !EIGEN_COMP_ARM
#define EIGEN_HAS_ERRNO
#endif
#ifdef EIGEN_HAS_ERRNO
#include
#endif
#include
#include
#include
#include
#include
#include
#ifndef EIGEN_NO_IO
#include
#endif
#include
#include
#include
#include // for CHAR_BIT
// for min/max:
#include
#if EIGEN_HAS_CXX11
#include
#endif
// for std::is_nothrow_move_assignable
#ifdef EIGEN_INCLUDE_TYPE_TRAITS
#include
#endif
// for outputting debug info
#ifdef EIGEN_DEBUG_ASSIGN
#include
#endif
// required for __cpuid, needs to be included after cmath
// also required for _BitScanReverse on Windows on ARM
#if EIGEN_COMP_MSVC && (EIGEN_ARCH_i386_OR_x86_64 || EIGEN_ARCH_ARM64) && !EIGEN_OS_WINCE
#include
#endif
#if defined(EIGEN_USE_SYCL)
#undef min
#undef max
#undef isnan
#undef isinf
#undef isfinite
#include
#include