├── CMakeLists.txt
├── LICENSE
├── Makefile
├── README.md
├── images
├── engineContext.png
├── head.png
├── head.psd
├── inferImp.png
├── inplace_right_way.svg
├── inplace_wrong_way.svg
├── mixmemory.svg
├── onnx_constant.png
├── onnx_product.jpg
├── onnx_proto组成.svg
├── pytorch自定义插件.png
├── pytorch自定义插件json.png
├── shape_right_way.svg
├── shape_wrong_way.svg
├── split_image_demo.jpg
├── tensorRT.gif
├── tensorRT库文件一览.png
├── tensorRT推理路线.svg
├── tensorRT编译推理流程.svg
├── tensor_meomory_mark.png
├── 仿射变换三步走.png
├── 仿射变换旋转.jpg
├── 双线性插值.jpg
├── 双线性插值中心对齐问题.png
└── 目标检测后处理开发流程.svg
├── src
├── application
│ ├── app_alphapose.cpp
│ ├── app_alphapose
│ │ ├── alpha_pose.cpp
│ │ └── alpha_pose.hpp
│ ├── app_alphapose_old
│ │ ├── alpha_pose_old.cpp
│ │ └── alpha_pose_old.hpp
│ ├── app_arcface.cpp
│ ├── app_arcface
│ │ ├── arcface.cpp
│ │ └── arcface.hpp
│ ├── app_bert.cpp
│ ├── app_centernet.cpp
│ ├── app_centernet
│ │ ├── centernet.cpp
│ │ ├── centernet.hpp
│ │ └── centernet_decode.cu
│ ├── app_dbface.cpp
│ ├── app_dbface
│ │ ├── dbface.cpp
│ │ ├── dbface.hpp
│ │ └── dbface_decode.cu
│ ├── app_fall_gcn
│ │ ├── fall_gcn.cpp
│ │ └── fall_gcn.hpp
│ ├── app_fall_recognize.cpp
│ ├── app_high_performance.cpp
│ ├── app_high_performance
│ │ ├── alpha_pose_high_perf.cpp
│ │ ├── alpha_pose_high_perf.hpp
│ │ ├── high_performance.cpp
│ │ ├── high_performance.hpp
│ │ ├── yolo_high_perf.cpp
│ │ └── yolo_high_perf.hpp
│ ├── app_lesson.cpp
│ ├── app_plugin.cpp
│ ├── app_python
│ │ └── interface.cpp
│ ├── app_retinaface.cpp
│ ├── app_retinaface
│ │ ├── retinaface.cpp
│ │ ├── retinaface.hpp
│ │ └── retinaface_decode.cu
│ ├── app_scrfd.cpp
│ ├── app_scrfd
│ │ ├── scrfd.cpp
│ │ ├── scrfd.hpp
│ │ └── scrfd_decode.cu
│ ├── app_yolo.cpp
│ ├── app_yolo
│ │ ├── multi_gpu.cpp
│ │ ├── multi_gpu.hpp
│ │ ├── yolo.cpp
│ │ ├── yolo.hpp
│ │ └── yolo_decode.cu
│ ├── app_yolo_fast.cpp
│ ├── app_yolo_fast
│ │ ├── yolo_fast.cpp
│ │ ├── yolo_fast.hpp
│ │ ├── yolov5_decode.cu
│ │ └── yolox_decode.cu
│ ├── app_yolo_gpuptr.cpp
│ ├── app_yolo_gpuptr
│ │ ├── yolo_gpuptr.cpp
│ │ ├── yolo_gpuptr.hpp
│ │ └── yolo_gpuptr_decode.cu
│ ├── common
│ │ ├── face_detector.hpp
│ │ └── object_detector.hpp
│ ├── test_warpaffine.cpp
│ ├── test_yolo_map.cpp
│ └── tools
│ │ ├── Eigen
│ │ ├── CMakeLists.txt
│ │ ├── Cholesky
│ │ ├── CholmodSupport
│ │ ├── Core
│ │ ├── Dense
│ │ ├── Eigen
│ │ ├── Eigenvalues
│ │ ├── Geometry
│ │ ├── Householder
│ │ ├── IterativeLinearSolvers
│ │ ├── Jacobi
│ │ ├── LU
│ │ ├── MetisSupport
│ │ ├── OrderingMethods
│ │ ├── PaStiXSupport
│ │ ├── PardisoSupport
│ │ ├── QR
│ │ ├── QtAlignedMalloc
│ │ ├── SPQRSupport
│ │ ├── SVD
│ │ ├── Sparse
│ │ ├── SparseCholesky
│ │ ├── SparseCore
│ │ ├── SparseLU
│ │ ├── SparseQR
│ │ ├── StdDeque
│ │ ├── StdList
│ │ ├── StdVector
│ │ ├── SuperLUSupport
│ │ ├── UmfPackSupport
│ │ └── src
│ │ │ ├── Cholesky
│ │ │ ├── LDLT.h
│ │ │ ├── LLT.h
│ │ │ └── LLT_LAPACKE.h
│ │ │ ├── CholmodSupport
│ │ │ └── CholmodSupport.h
│ │ │ ├── Core
│ │ │ ├── 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
│ │ │ ├── Inverse.h
│ │ │ ├── Map.h
│ │ │ ├── MapBase.h
│ │ │ ├── MathFunctions.h
│ │ │ ├── MathFunctionsImpl.h
│ │ │ ├── Matrix.h
│ │ │ ├── MatrixBase.h
│ │ │ ├── NestByValue.h
│ │ │ ├── NoAlias.h
│ │ │ ├── NumTraits.h
│ │ │ ├── PermutationMatrix.h
│ │ │ ├── PlainObjectBase.h
│ │ │ ├── Product.h
│ │ │ ├── ProductEvaluators.h
│ │ │ ├── Random.h
│ │ │ ├── Redux.h
│ │ │ ├── Ref.h
│ │ │ ├── Replicate.h
│ │ │ ├── ReturnByValue.h
│ │ │ ├── Reverse.h
│ │ │ ├── Select.h
│ │ │ ├── SelfAdjointView.h
│ │ │ ├── SelfCwiseBinaryOp.h
│ │ │ ├── Solve.h
│ │ │ ├── SolveTriangular.h
│ │ │ ├── SolverBase.h
│ │ │ ├── StableNorm.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
│ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ └── PacketMath.h
│ │ │ │ ├── AltiVec
│ │ │ │ │ ├── Complex.h
│ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ └── PacketMath.h
│ │ │ │ ├── CUDA
│ │ │ │ │ ├── Complex.h
│ │ │ │ │ ├── Half.h
│ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ ├── PacketMath.h
│ │ │ │ │ ├── PacketMathHalf.h
│ │ │ │ │ └── TypeCasting.h
│ │ │ │ ├── Default
│ │ │ │ │ └── Settings.h
│ │ │ │ ├── NEON
│ │ │ │ │ ├── Complex.h
│ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ └── PacketMath.h
│ │ │ │ ├── SSE
│ │ │ │ │ ├── Complex.h
│ │ │ │ │ ├── MathFunctions.h
│ │ │ │ │ ├── PacketMath.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
│ │ │ │ ├── Constants.h
│ │ │ │ ├── DisableStupidWarnings.h
│ │ │ │ ├── ForwardDeclarations.h
│ │ │ │ ├── MKL_support.h
│ │ │ │ ├── Macros.h
│ │ │ │ ├── Memory.h
│ │ │ │ ├── Meta.h
│ │ │ │ ├── NonMPL2.h
│ │ │ │ ├── ReenableStupidWarnings.h
│ │ │ │ ├── StaticAssert.h
│ │ │ │ └── XprHelper.h
│ │ │ ├── Eigenvalues
│ │ │ ├── ComplexEigenSolver.h
│ │ │ ├── ComplexSchur.h
│ │ │ ├── ComplexSchur_LAPACKE.h
│ │ │ ├── EigenSolver.h
│ │ │ ├── GeneralizedEigenSolver.h
│ │ │ ├── GeneralizedSelfAdjointEigenSolver.h
│ │ │ ├── HessenbergDecomposition.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
│ │ │ ├── OrthoMethods.h
│ │ │ ├── ParametrizedLine.h
│ │ │ ├── Quaternion.h
│ │ │ ├── Rotation2D.h
│ │ │ ├── RotationBase.h
│ │ │ ├── Scaling.h
│ │ │ ├── Transform.h
│ │ │ ├── Translation.h
│ │ │ ├── Umeyama.h
│ │ │ └── arch
│ │ │ │ └── Geometry_SSE.h
│ │ │ ├── Householder
│ │ │ ├── BlockHouseholder.h
│ │ │ ├── Householder.h
│ │ │ └── HouseholderSequence.h
│ │ │ ├── IterativeLinearSolvers
│ │ │ ├── BasicPreconditioners.h
│ │ │ ├── BiCGSTAB.h
│ │ │ ├── ConjugateGradient.h
│ │ │ ├── IncompleteCholesky.h
│ │ │ ├── IncompleteLUT.h
│ │ │ ├── IterativeSolverBase.h
│ │ │ ├── LeastSquareConjugateGradient.h
│ │ │ └── SolveWithGuess.h
│ │ │ ├── Jacobi
│ │ │ └── Jacobi.h
│ │ │ ├── LU
│ │ │ ├── Determinant.h
│ │ │ ├── FullPivLU.h
│ │ │ ├── InverseImpl.h
│ │ │ ├── PartialPivLU.h
│ │ │ ├── PartialPivLU_LAPACKE.h
│ │ │ └── arch
│ │ │ │ └── Inverse_SSE.h
│ │ │ ├── MetisSupport
│ │ │ └── MetisSupport.h
│ │ │ ├── OrderingMethods
│ │ │ ├── Amd.h
│ │ │ ├── Eigen_Colamd.h
│ │ │ └── Ordering.h
│ │ │ ├── PaStiXSupport
│ │ │ └── PaStiXSupport.h
│ │ │ ├── PardisoSupport
│ │ │ └── PardisoSupport.h
│ │ │ ├── QR
│ │ │ ├── ColPivHouseholderQR.h
│ │ │ ├── ColPivHouseholderQR_LAPACKE.h
│ │ │ ├── CompleteOrthogonalDecomposition.h
│ │ │ ├── FullPivHouseholderQR.h
│ │ │ ├── HouseholderQR.h
│ │ │ └── HouseholderQR_LAPACKE.h
│ │ │ ├── SPQRSupport
│ │ │ └── SuiteSparseQRSupport.h
│ │ │ ├── SVD
│ │ │ ├── BDCSVD.h
│ │ │ ├── JacobiSVD.h
│ │ │ ├── JacobiSVD_LAPACKE.h
│ │ │ ├── SVDBase.h
│ │ │ └── UpperBidiagonalization.h
│ │ │ ├── SparseCholesky
│ │ │ ├── SimplicialCholesky.h
│ │ │ └── SimplicialCholesky_impl.h
│ │ │ ├── SparseCore
│ │ │ ├── AmbiVector.h
│ │ │ ├── CompressedStorage.h
│ │ │ ├── ConservativeSparseSparseProduct.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
│ │ │ ├── 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
│ │ │ └── SparseQR.h
│ │ │ ├── StlSupport
│ │ │ ├── StdDeque.h
│ │ │ ├── StdList.h
│ │ │ ├── StdVector.h
│ │ │ └── details.h
│ │ │ ├── SuperLUSupport
│ │ │ └── SuperLUSupport.h
│ │ │ ├── UmfPackSupport
│ │ │ └── UmfPackSupport.h
│ │ │ ├── misc
│ │ │ ├── Image.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
│ │ │ ├── MatrixCwiseBinaryOps.h
│ │ │ └── MatrixCwiseUnaryOps.h
│ │ ├── auto_download.cpp
│ │ ├── deepsort.cpp
│ │ ├── deepsort.hpp
│ │ ├── pybind11.hpp
│ │ ├── zmq_remote_show.cpp
│ │ ├── zmq_remote_show.hpp
│ │ ├── zmq_u.cpp
│ │ └── zmq_u.hpp
├── direct
│ ├── direct_classifier.cpp
│ ├── direct_mae.cpp
│ ├── direct_unet.cpp
│ └── direct_yolo.cpp
├── main.cpp
└── tensorRT
│ ├── builder
│ ├── trt_builder.cpp
│ └── trt_builder.hpp
│ ├── common
│ ├── cuda_tools.cpp
│ ├── cuda_tools.hpp
│ ├── ilogger.cpp
│ ├── ilogger.hpp
│ ├── infer_controller.hpp
│ ├── json.cpp
│ ├── json.hpp
│ ├── monopoly_allocator.hpp
│ ├── preprocess_kernel.cu
│ ├── preprocess_kernel.cuh
│ ├── trt_tensor.cpp
│ └── trt_tensor.hpp
│ ├── infer
│ ├── trt_infer.cpp
│ └── trt_infer.hpp
│ ├── onnx
│ ├── onnx-ml.pb.cpp
│ ├── onnx-ml.pb.h
│ ├── onnx-operators-ml.pb.cpp
│ ├── onnx-operators-ml.pb.h
│ ├── onnx_pb.h
│ ├── onnxifi.h
│ └── readme.md
│ ├── onnx_parser
│ ├── ImporterContext.hpp
│ ├── LoopHelpers.cpp
│ ├── LoopHelpers.hpp
│ ├── ModelImporter.cpp
│ ├── ModelImporter.hpp
│ ├── NvOnnxParser.cpp
│ ├── NvOnnxParser.h
│ ├── OnnxAttrs.cpp
│ ├── OnnxAttrs.hpp
│ ├── RNNHelpers.cpp
│ ├── RNNHelpers.hpp
│ ├── ShapeTensor.cpp
│ ├── ShapeTensor.hpp
│ ├── ShapedWeights.cpp
│ ├── ShapedWeights.hpp
│ ├── Status.hpp
│ ├── TensorOrWeights.hpp
│ ├── builtin_op_importers.cpp
│ ├── builtin_op_importers.hpp
│ ├── onnx2trt.hpp
│ ├── onnx2trt_common.hpp
│ ├── onnx2trt_runtime.hpp
│ ├── onnx2trt_utils.cpp
│ ├── onnx2trt_utils.hpp
│ ├── onnxErrorRecorder.cpp
│ ├── onnxErrorRecorder.hpp
│ ├── onnx_utils.hpp
│ ├── readme.md
│ ├── toposort.hpp
│ ├── trt_utils.hpp
│ └── utils.hpp
│ └── onnxplugin
│ ├── onnxplugin.cpp
│ ├── onnxplugin.hpp
│ ├── plugin_binary_io.cpp
│ ├── plugin_binary_io.hpp
│ └── plugins
│ ├── DCNv2.cu
│ ├── HSigmoid.cu
│ ├── HSwish.cu
│ └── ScatterND.cu
└── workspace
├── exp
├── face_tracker.mp4
└── fall_video.mp4
├── face
├── library
│ ├── 2ys2.jpg
│ ├── 2ys3.jpg
│ └── male.jpg
└── recognize
│ ├── 2ys1.jpg
│ ├── 2ys3.jpg
│ └── 2ys5.jpg
├── inference
├── car.jpg
├── gril.jpg
├── group.jpg
├── yq.jpg
├── zand.jpg
└── zgjr.jpg
├── labels.imagenet.txt
├── pro
└── python
├── test_dcnv2.py
└── test_hswish.py
/images/engineContext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/engineContext.png
--------------------------------------------------------------------------------
/images/head.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/head.png
--------------------------------------------------------------------------------
/images/head.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/head.psd
--------------------------------------------------------------------------------
/images/inferImp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/inferImp.png
--------------------------------------------------------------------------------
/images/onnx_constant.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/onnx_constant.png
--------------------------------------------------------------------------------
/images/onnx_product.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/onnx_product.jpg
--------------------------------------------------------------------------------
/images/pytorch自定义插件.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/pytorch自定义插件.png
--------------------------------------------------------------------------------
/images/pytorch自定义插件json.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/pytorch自定义插件json.png
--------------------------------------------------------------------------------
/images/shape_right_way.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/split_image_demo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/split_image_demo.jpg
--------------------------------------------------------------------------------
/images/tensorRT.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/tensorRT.gif
--------------------------------------------------------------------------------
/images/tensorRT库文件一览.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/tensorRT库文件一览.png
--------------------------------------------------------------------------------
/images/tensor_meomory_mark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/tensor_meomory_mark.png
--------------------------------------------------------------------------------
/images/仿射变换三步走.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/仿射变换三步走.png
--------------------------------------------------------------------------------
/images/仿射变换旋转.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/仿射变换旋转.jpg
--------------------------------------------------------------------------------
/images/双线性插值.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/双线性插值.jpg
--------------------------------------------------------------------------------
/images/双线性插值中心对齐问题.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cvdong/TRT_PRO_LEARN/77939ba3a5b3056bdf584672afcf39e30c8ffb8d/images/双线性插值中心对齐问题.png
--------------------------------------------------------------------------------
/src/application/app_alphapose.cpp:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * @file _main.cpp
4 | * @author 手写AI (zifuture.com:8090)
5 | * @date 2021-07-26
6 | *
7 | * 实现了基于TensorRT对yolox的推理工作
8 | * 1. 基于FP32的模型编译、和推理执行
9 | * 2. 基于INT8的模型编译、和推理执行
10 | * 3. 自定义插件的实现,从pytorch导出到推理编译,并支持FP16
11 | *
12 | * 预处理、后处理采用CPU实现(若想GPU可以自行实现)
13 | * 一次推理5张图获取结果
14 | *
15 | * 我们是一群热血的个人组织者,力图发布免费高质量内容
16 | * 我们的博客地址:http://zifuture.com:8090
17 | * 我们的B站地址:https://space.bilibili.com/1413433465
18 | *
19 | * 如果想要深入学习关于tensorRT的技术栈,请通过博客中的二维码联系我们(免费崔更即可)
20 | * 请关注B站,我们根据情况发布相关教程视频(免费)
21 | */
22 |
23 | #include
24 | #include
25 | #include
26 | #include "app_alphapose/alpha_pose.hpp"
27 |
28 | using namespace std;
29 | using namespace cv;
30 |
31 | bool requires(const char* name);
32 |
33 | int app_alphapose(){
34 |
35 | TRT::set_device(0);
36 | INFO("===================== test alphapose fp32 ==================================");
37 |
38 | const char* name = "alpha-pose-136";
39 | if(not requires(name))
40 | return 0;
41 |
42 | string onnx_file = iLogger::format("%s.onnx", name);
43 | string model_file = iLogger::format("%s.FP32.trtmodel", name);
44 | int test_batch_size = 16;
45 |
46 | if(!iLogger::exists(model_file)){
47 | TRT::compile(
48 | TRT::Mode::FP32, // FP32、FP16、INT8
49 | test_batch_size, // max_batch_size
50 | onnx_file, // source
51 | model_file // save to
52 | );
53 | }
54 |
55 | Mat image = imread("inference/gril.jpg");
56 | auto engine = AlphaPose::create_infer(model_file, 0);
57 | auto box = Rect(158, 104, 176, 693);
58 | auto keys = engine->commit(make_tuple(image, box)).get();
59 | for(int i = 0; i < keys.size(); ++i){
60 | float x = keys[i].x;
61 | float y = keys[i].y;
62 | if(keys[i].z > 0.05){
63 | cv::circle(image, Point(x, y), 1, Scalar(0, 255, 0), -1, 16);
64 | }
65 | }
66 |
67 | auto save_file = "pose.show.jpg";
68 | INFO("Save to %s", save_file);
69 |
70 | imwrite(save_file, image);
71 | INFO("Done");
72 | return 0;
73 | }
--------------------------------------------------------------------------------
/src/application/app_alphapose/alpha_pose.hpp:
--------------------------------------------------------------------------------
1 | #ifndef ALPHA_POSE_HPP
2 | #define ALPHA_POSE_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | /*
11 |
12 | # change AlphaPose-master/configs/halpe_136/resnet/256x192_res50_lr1e-3_2x-regression.yaml
13 | CONV_DIM : 256 -> CONV_DIM : 128
14 |
15 | import torch
16 | import yaml
17 | from easydict import EasyDict as edict
18 |
19 | from alphapose.models import builder
20 |
21 | class Alphapose(torch.nn.Module):
22 | def __init__(self):
23 | super().__init__()
24 | config_file = "configs/halpe_136/resnet/256x192_res50_lr1e-3_2x-regression.yaml"
25 | check_point = "pretrained_models/multi_domain_fast50_regression_256x192.pth"
26 | with open(config_file, "r") as f:
27 | config = edict(yaml.load(f, Loader=yaml.FullLoader))
28 |
29 | self.pose_model = builder.build_sppe(config.MODEL, preset_cfg=config.DATA_PRESET)
30 | self.pose_model.load_state_dict(torch.load(check_point, map_location="cpu"))
31 |
32 | def forward(self, x):
33 | hm = self.pose_model(x)
34 |
35 | # postprocess
36 | stride = int(x.size(2) / hm.size(2))
37 | b, c, h, w = map(int, hm.size())
38 | prob = hm.sigmoid()
39 | confidence, _ = prob.view(-1, c, h * w).max(dim=2, keepdim=True)
40 | prob = prob / prob.sum(dim=[2, 3], keepdim=True)
41 | coordx = torch.arange(w, device=prob.device, dtype=torch.float32)
42 | coordy = torch.arange(h, device=prob.device, dtype=torch.float32)
43 | hmx = (prob.sum(dim=2) * coordx).sum(dim=2, keepdim=True) * stride
44 | hmy = (prob.sum(dim=3) * coordy).sum(dim=2, keepdim=True) * stride
45 | return torch.cat([hmx, hmy, confidence], dim=2)
46 |
47 | model = Alphapose().eval()
48 | dummy = torch.zeros(1, 3, 256, 192)
49 | torch.onnx.export(
50 | model, (dummy,), "alpha-pose-136.onnx", input_names=["images"], output_names=["keypoints"],
51 | opset_version=11,
52 | dynamic_axes={
53 | "images": {0: "batch"},
54 | "keypoints": {0: "batch"}
55 | }
56 | )
57 | */
58 |
59 | // based on https://github.com/MVIG-SJTU/AlphaPose v0.5.0 version
60 | namespace AlphaPose{
61 |
62 | using namespace std;
63 | using namespace cv;
64 |
65 | typedef tuple Input;
66 |
67 | class Infer{
68 | public:
69 | virtual shared_future> commit(const Input& input) = 0;
70 | virtual vector>> commits(const vector& inputs) = 0;
71 | };
72 |
73 | shared_ptr create_infer(const string& engine_file, int gpuid);
74 |
75 | }; // namespace AlphaPose
76 |
77 | #endif // ALPHA_POSE_HPP
--------------------------------------------------------------------------------
/src/application/app_alphapose_old/alpha_pose_old.hpp:
--------------------------------------------------------------------------------
1 | #ifndef ALPHA_POSE_HPP
2 | #define ALPHA_POSE_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | // based on https://github.com/MVIG-SJTU/AlphaPose v0.3.0 version
11 | namespace AlphaPoseOld{
12 |
13 | using namespace std;
14 | using namespace cv;
15 |
16 | typedef tuple Input;
17 |
18 | class Infer{
19 | public:
20 | virtual shared_future> commit(const Input& input) = 0;
21 | virtual vector>> commits(const vector& inputs) = 0;
22 | };
23 |
24 | shared_ptr create_infer(const string& engine_file, int gpuid);
25 |
26 | }; // namespace AlphaPose
27 |
28 | #endif // ALPHA_POSE_HPP
--------------------------------------------------------------------------------
/src/application/app_arcface/arcface.hpp:
--------------------------------------------------------------------------------
1 | #ifndef ARCFACE_HPP
2 | #define ARCFACE_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | namespace Arcface{
11 |
12 | using namespace std;
13 |
14 | struct landmarks{
15 | float points[10];
16 | };
17 |
18 | typedef cv::Mat_ feature;
19 | typedef tuple commit_input;
20 |
21 | class Infer{
22 | public:
23 | virtual shared_future commit (const commit_input& input) = 0;
24 | virtual vector> commits(const vector& inputs) = 0;
25 | };
26 |
27 | cv::Mat face_alignment(const cv::Mat& image, const landmarks& landmark);
28 | shared_ptr create_infer(const string& engine_file, int gpuid=0);
29 |
30 | }; // namespace RetinaFace
31 |
32 | #endif // ARCFACE_HPP
--------------------------------------------------------------------------------
/src/application/app_centernet/centernet.hpp:
--------------------------------------------------------------------------------
1 | #ifndef CENTERNET_HPP
2 | #define CENTERNET_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | namespace CenterNet{
13 |
14 | using namespace std;
15 | using namespace ObjectDetector;
16 |
17 | void image_to_tensor(const cv::Mat& image, shared_ptr& tensor, int ibatch);
18 |
19 | class Infer{
20 | public:
21 | virtual shared_future commit(const cv::Mat& image) = 0;
22 | virtual vector> commits(const vector& images) = 0;
23 | };
24 |
25 | shared_ptr create_infer(const string& engine_file, int gpuid, float confidence_threshold=0.25f, float nms_threshold=0.5f);
26 |
27 | }; // namespace CenterNet
28 |
29 |
30 | #endif // CENTERNET_HPP
--------------------------------------------------------------------------------
/src/application/app_dbface/dbface.hpp:
--------------------------------------------------------------------------------
1 | #ifndef DBFACE_HPP
2 | #define DBFACE_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | namespace DBFace{
13 |
14 | using namespace std;
15 | using namespace FaceDetector;
16 |
17 | void image_to_tensor(const cv::Mat& image, shared_ptr& tensor, int ibatch);
18 |
19 | class Infer{
20 | public:
21 | virtual shared_future commit(const cv::Mat& image) = 0;
22 | virtual vector> commits(const vector& images) = 0;
23 | };
24 |
25 | shared_ptr create_infer(const string& engine_file, int gpuid, float confidence_threshold=0.25f, float nms_threshold=0.5f);
26 |
27 | }; // namespace CenterNet
28 |
29 |
30 | #endif // DBFACE_HPP
--------------------------------------------------------------------------------
/src/application/app_fall_gcn/fall_gcn.hpp:
--------------------------------------------------------------------------------
1 | #ifndef FALL_GCN_HPP
2 | #define FALL_GCN_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | namespace FallGCN{
11 |
12 | using namespace std;
13 | using namespace cv;
14 |
15 | typedef tuple, Rect> Input;
16 |
17 | enum class FallState : int{
18 | Fall = 0,
19 | Stand = 1,
20 | UnCertain = 2
21 | };
22 |
23 | const char* state_name(FallState state);
24 |
25 | class Infer{
26 | public:
27 | virtual shared_future> commit(const Input& input) = 0;
28 | virtual vector>> commits(const vector& inputs) = 0;
29 | };
30 |
31 | shared_ptr create_infer(const string& engine_file, int gpuid);
32 |
33 | }; // namespace AlphaPose
34 |
35 | #endif // FALL_GCN_HPP
--------------------------------------------------------------------------------
/src/application/app_high_performance/alpha_pose_high_perf.hpp:
--------------------------------------------------------------------------------
1 | #ifndef ALPHA_POSE_HIGH_PERF_HPP
2 | #define ALPHA_POSE_HIGH_PERF_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include "high_performance.hpp"
10 |
11 | namespace AlphaPoseHighPerf{
12 |
13 | using namespace std;
14 | using namespace cv;
15 | using namespace HighPerformance;
16 |
17 | typedef tuple Input;
18 |
19 | class PointArray : public Data, public vector{
20 | public:
21 | SetupData(PointArray);
22 | };
23 |
24 | class Infer{
25 | public:
26 | virtual shared_future commit(const Input& input) = 0;
27 | virtual vector> commits(const vector& inputs) = 0;
28 | };
29 |
30 | shared_ptr create_infer(const string& engine_file, int gpuid);
31 |
32 | }; // namespace AlphaPose
33 |
34 | #endif // ALPHA_POSE_HIGH_PERF_HPP
--------------------------------------------------------------------------------
/src/application/app_high_performance/yolo_high_perf.hpp:
--------------------------------------------------------------------------------
1 | #ifndef YOLO_HIGHPERF_HPP
2 | #define YOLO_HIGHPERF_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include "high_performance.hpp"
10 |
11 | /**
12 | * @brief 发挥极致的性能体验
13 | * 支持YoloX和YoloV5
14 | */
15 | namespace YoloHighPerf{
16 |
17 | using namespace std;
18 | using namespace HighPerformance;
19 |
20 | enum class Type : int{
21 | V5 = 0,
22 | X = 1,
23 | V3 = 2,
24 | V7 = 3
25 | };
26 |
27 | struct Box{
28 | float left, top, right, bottom, confidence;
29 | int class_label;
30 |
31 | Box() = default;
32 |
33 | Box(float left, float top, float right, float bottom, float confidence, int class_label)
34 | :left(left), top(top), right(right), bottom(bottom), confidence(confidence), class_label(class_label){}
35 | };
36 |
37 | class BoxArray : public Data, public vector{
38 | public:
39 | SetupData(BoxArray);
40 | };
41 |
42 | class Infer{
43 | public:
44 | virtual shared_future commit(const cv::Mat& image) = 0;
45 | virtual vector> commits(const vector& images) = 0;
46 | };
47 |
48 | shared_ptr create_infer(const string& engine_file, Type type, int gpuid, float confidence_threshold=0.25f, float nms_threshold=0.5f);
49 | const char* type_name(Type type);
50 |
51 | }; // namespace Yolo
52 |
53 | #endif // YOLO_HIGHPERF_HPP
--------------------------------------------------------------------------------
/src/application/app_plugin.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 | #include
5 | #include "app_yolo/yolo.hpp"
6 |
7 | using namespace std;
8 |
9 | static void test_hswish(TRT::Mode mode){
10 |
11 | // The plugin.onnx can be generated by the following code
12 | // cd workspace
13 | // python test_plugin.py
14 | iLogger::set_log_level(iLogger::LogLevel::Verbose);
15 | TRT::set_device(0);
16 |
17 | auto mode_name = TRT::mode_string(mode);
18 | auto engine_name = iLogger::format("hswish.plugin.%s.trtmodel", mode_name);
19 | TRT::compile(
20 | mode, 3, "hswish.plugin.onnx", engine_name, {}
21 | );
22 |
23 | auto engine = TRT::load_infer(engine_name);
24 | engine->print();
25 |
26 | auto input0 = engine->input(0);
27 | auto input1 = engine->input(1);
28 | auto output = engine->output(0);
29 |
30 | INFO("offset %d", output->offset(1, 0));
31 | INFO("input0: %s", input0->shape_string());
32 | INFO("input1: %s", input1->shape_string());
33 | INFO("output: %s", output->shape_string());
34 |
35 | float input0_val = 0.8;
36 | float input1_val = 2;
37 | input0->set_to(input0_val);
38 | input1->set_to(input1_val);
39 |
40 | auto hswish = [](float x){float a = x + 3; a=a<0?0:(a>=6?6:a); return x * a / 6;};
41 | auto sigmoid = [](float x){return 1 / (1 + exp(-x));};
42 | auto relu = [](float x){return max(0.0f, x);};
43 | float output_real = relu(hswish(input0_val) * input1_val);
44 | engine->forward(true);
45 |
46 | INFO("output %f, output_real = %f", output->at(0, 0), output_real);
47 | }
48 |
49 | static void test_dcnv2(TRT::Mode mode){
50 |
51 | // The plugin.onnx can be generated by the following code
52 | // cd workspace
53 | // python test_plugin.py
54 | iLogger::set_log_level(iLogger::LogLevel::Verbose);
55 | TRT::set_device(0);
56 |
57 | auto mode_name = TRT::mode_string(mode);
58 | auto engine_name = iLogger::format("dcnv2.plugin.%s.trtmodel", mode_name);
59 | TRT::compile(
60 | mode, 1, "dcnv2.plugin.onnx", engine_name, {}
61 | );
62 |
63 | auto engine = TRT::load_infer(engine_name);
64 | engine->print();
65 |
66 | auto input0 = engine->input(0);
67 | auto input1 = engine->input(1);
68 | auto output = engine->output(0);
69 |
70 | INFO("input0: %s", input0->shape_string());
71 | INFO("input1: %s", input1->shape_string());
72 | INFO("output: %s", output->shape_string());
73 |
74 | float input0_val = 1;
75 | float input1_val = 1;
76 | input0->set_to(input0_val);
77 | input1->set_to(input1_val);
78 | engine->forward(true);
79 |
80 | for(int i = 0; i < output->count(); ++i)
81 | INFO("output[%d] = %f", i, output->cpu()[i]);
82 | }
83 |
84 | int app_plugin(){
85 |
86 | //test_hswish(TRT::Mode::FP32);
87 | test_dcnv2(TRT::Mode::FP32);
88 | //test_plugin(TRT::Mode::FP16);
89 | return 0;
90 | }
--------------------------------------------------------------------------------
/src/application/app_retinaface/retinaface.hpp:
--------------------------------------------------------------------------------
1 | #ifndef RETINAFACE_HPP
2 | #define RETINAFACE_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include "../common/face_detector.hpp"
10 |
11 | namespace RetinaFace{
12 |
13 | using namespace std;
14 | using namespace FaceDetector;
15 |
16 | class Infer{
17 | public:
18 | virtual shared_future commit(const cv::Mat& image) = 0;
19 | virtual vector> commits(const vector& images) = 0;
20 |
21 | };
22 |
23 | tuple crop_face_and_landmark(
24 | const cv::Mat& image, const Box& box, float scale_box=1.5f
25 | );
26 |
27 | shared_ptr create_infer(const string& engine_file, int gpuid, float confidence_threshold=0.5f, float nms_threshold=0.5f);
28 |
29 | }; // namespace RetinaFace
30 |
31 | #endif // RETINAFACE_HPP
--------------------------------------------------------------------------------
/src/application/app_scrfd/scrfd.hpp:
--------------------------------------------------------------------------------
1 | #ifndef SCRFD_HPP
2 | #define SCRFD_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include "../common/face_detector.hpp"
10 |
11 | namespace Scrfd{
12 |
13 | using namespace std;
14 | using namespace FaceDetector;
15 |
16 | class Infer{
17 | public:
18 | virtual shared_future commit(const cv::Mat& image) = 0;
19 | virtual vector> commits(const vector& images) = 0;
20 | };
21 |
22 | tuple crop_face_and_landmark(
23 | const cv::Mat& image, const Box& box, float scale_box=1.5f
24 | );
25 |
26 | shared_ptr create_infer(const string& engine_file, int gpuid, float confidence_threshold=0.5f, float nms_threshold=0.5f);
27 |
28 | }; // namespace Scrfd
29 |
30 | #endif // SCRFD_HPP
--------------------------------------------------------------------------------
/src/application/app_yolo/multi_gpu.cpp:
--------------------------------------------------------------------------------
1 | #include "multi_gpu.hpp"
2 | #include
3 | #include
4 | #include
5 |
6 | namespace Yolo{
7 |
8 | class MultiGPUInferImpl{
9 | public:
10 | virtual bool startup(
11 | const string& engine_file, Type type, const vector gpuids,
12 | float confidence_threshold, float nms_threshold,
13 | NMSMethod nms_method, int max_objects
14 | ){
15 | if(gpuids.empty()){
16 | INFOE("gpuids is empty");
17 | return false;
18 | }
19 |
20 | if(!iLogger::exists(engine_file)){
21 | INFOE("Engine file %s not exists", engine_file.c_str());
22 | return false;
23 | }
24 |
25 | infers_.resize(gpuids.size());
26 |
27 | #pragma omp parallel for num_threads(infers_.size())
28 | for(int i = 0; i < gpuids.size(); ++i){
29 | auto& gpuid = gpuids[i];
30 | infers_[i] = Yolo::create_infer(
31 | engine_file, type, gpuid, confidence_threshold,
32 | nms_threshold, nms_method, max_objects
33 | );
34 | }
35 |
36 | for(int i = 0; i < gpuids.size(); ++i){
37 | if(infers_[i] == nullptr){
38 | INFOE("Infer create failed, gpuid = %d", gpuids[i]);
39 | return false;
40 | }
41 | }
42 | return true;
43 | }
44 |
45 | protected:
46 | vector> infers_;
47 | };
48 |
49 | class BalancedImpl : public MultiGPUInfer, public MultiGPUInferImpl{
50 | public:
51 | int get_gpu_index(){
52 | return ((cursor_++) + 1) % infers_.size();
53 | }
54 |
55 | virtual shared_future commit(const cv::Mat& image) override{
56 | return infers_[get_gpu_index()]->commit(image);
57 | }
58 |
59 | virtual vector> commits(const vector& images) override{
60 | return infers_[get_gpu_index()]->commits(images);
61 | }
62 |
63 | private:
64 | atomic cursor_{0};
65 | };
66 |
67 | shared_ptr create_multi_gpu_infer(
68 | const string& engine_file, Type type, const vector gpuids,
69 | float confidence_threshold, float nms_threshold,
70 | NMSMethod nms_method, int max_objects
71 | ){
72 | shared_ptr instance(new BalancedImpl());
73 | auto impl = std::dynamic_pointer_cast(instance);
74 | if(!impl->startup(
75 | engine_file, type, gpuids, confidence_threshold, nms_threshold, nms_method, max_objects
76 | )){
77 | instance.reset();
78 | }
79 | return instance;
80 | }
81 |
82 | };
--------------------------------------------------------------------------------
/src/application/app_yolo/multi_gpu.hpp:
--------------------------------------------------------------------------------
1 | #ifndef YOLO_MULTI_GPU_HPP
2 | #define YOLO_MULTI_GPU_HPP
3 |
4 | #include "yolo.hpp"
5 |
6 | namespace Yolo{
7 |
8 | class MultiGPUInfer : public Yolo::Infer{};
9 |
10 | shared_ptr create_multi_gpu_infer(
11 | const string& engine_file, Type type, const vector gpuids,
12 | float confidence_threshold=0.25f, float nms_threshold=0.5f,
13 | NMSMethod nms_method = NMSMethod::FastGPU, int max_objects = 1024
14 | );
15 | };
16 |
17 |
18 | #endif // YOLO_MULTI_GPU_HPP
--------------------------------------------------------------------------------
/src/application/app_yolo/yolo.hpp:
--------------------------------------------------------------------------------
1 | #ifndef YOLO_HPP
2 | #define YOLO_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | /**
13 | * @brief 发挥极致的性能体验
14 | * 支持YoloX和YoloV5
15 | */
16 | namespace Yolo{
17 |
18 | using namespace std;
19 | using namespace ObjectDetector;
20 |
21 | enum class Type : int{
22 | V5 = 0,
23 | X = 1,
24 | V3 = 2,
25 | V7 = 3
26 | };
27 |
28 | enum class NMSMethod : int{
29 | CPU = 0, // General, for estimate mAP
30 | FastGPU = 1 // Fast NMS with a small loss of accuracy in corner cases
31 | };
32 |
33 | void image_to_tensor(const cv::Mat& image, shared_ptr& tensor, Type type, int ibatch);
34 |
35 | class Infer{
36 | public:
37 | virtual shared_future commit(const cv::Mat& image) = 0;
38 | virtual vector> commits(const vector& images) = 0;
39 | };
40 |
41 | shared_ptr create_infer(
42 | const string& engine_file, Type type, int gpuid,
43 | float confidence_threshold=0.25f, float nms_threshold=0.5f,
44 | NMSMethod nms_method = NMSMethod::FastGPU, int max_objects = 1024,
45 | bool use_multi_preprocess_stream = false
46 | );
47 | const char* type_name(Type type);
48 |
49 | }; // namespace Yolo
50 |
51 | #endif // YOLO_HPP
--------------------------------------------------------------------------------
/src/application/app_yolo_fast/yolo_fast.hpp:
--------------------------------------------------------------------------------
1 | #ifndef YOLO_FAST_HPP
2 | #define YOLO_FAST_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | /**
13 | * @brief 发挥极致的性能体验
14 | * 支持YoloX和YoloV5
15 | */
16 | namespace YoloFast{
17 |
18 | using namespace std;
19 | using namespace ObjectDetector;
20 |
21 | enum class Type : int{
22 | V5_P5 = 0,
23 | V5_P6 = 1,
24 | X = 2
25 | };
26 |
27 | struct DecodeMeta{
28 | int num_anchor;
29 | int num_level;
30 | float w[16], h[16];
31 | int strides[16];
32 |
33 | static DecodeMeta v5_p5_default_meta();
34 | static DecodeMeta v5_p6_default_meta();
35 | static DecodeMeta x_default_meta();
36 | };
37 |
38 | class Infer{
39 | public:
40 | virtual shared_future commit(const cv::Mat& image) = 0;
41 | virtual vector> commits(const vector& images) = 0;
42 | };
43 |
44 | void image_to_tensor(const cv::Mat& image, shared_ptr& tensor, Type type, int ibatch);
45 |
46 | shared_ptr create_infer(
47 | const string& engine_file,
48 | Type type,
49 | int gpuid,
50 | float confidence_threshold=0.25f,
51 | float nms_threshold=0.5f,
52 | const DecodeMeta& meta = DecodeMeta::v5_p5_default_meta()
53 | );
54 | const char* type_name(Type type);
55 |
56 | }; // namespace YoloFast
57 |
58 | #endif // YOLO_FAST_HPP
--------------------------------------------------------------------------------
/src/application/app_yolo_gpuptr/yolo_gpuptr.hpp:
--------------------------------------------------------------------------------
1 | #ifndef YOLO_GPUPTR_HPP
2 | #define YOLO_GPUPTR_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | /**
13 | * @brief 发挥极致的性能体验
14 | * 支持YoloX和YoloV5,允许直接提供GPU图像地址进行推理
15 | */
16 | namespace YoloGPUPtr{
17 |
18 | using namespace std;
19 | using namespace ObjectDetector;
20 |
21 | enum class Type : int{
22 | V5 = 0,
23 | X = 1,
24 | V3 = 2,
25 | V7 = 3
26 | };
27 |
28 | enum class NMSMethod : int{
29 | CPU = 0, // General, for estimate mAP
30 | FastGPU = 1 // Fast NMS with a small loss of accuracy in corner cases
31 | };
32 |
33 | enum class ImageType : int{
34 | CVMat = 0,
35 | GPUYUVNV12 = 1, // nv12
36 | GPUBGR = 2, // BGR
37 | };
38 |
39 | struct Image{
40 | ImageType type = ImageType::CVMat;
41 | cv::Mat cvmat;
42 |
43 | // GPU YUV image
44 | TRT::CUStream stream = nullptr;
45 | uint8_t* device_data = nullptr;
46 | int width = 0, height = 0;
47 | int device_id = 0;
48 |
49 | Image() = default;
50 | Image(const cv::Mat& cvmat):cvmat(cvmat), type(ImageType::CVMat){}
51 | Image(uint8_t* data_device, int width, int height, int device_id, TRT::CUStream stream, ImageType type)
52 | :device_data(data_device), width(width), height(height), device_id(device_id), stream(stream), type(type){}
53 |
54 | int get_width() const{return type == ImageType::CVMat ? cvmat.cols : width;}
55 | int get_height() const{return type == ImageType::CVMat ? cvmat.rows : height;}
56 | cv::Size get_size() const{return cv::Size(get_width(), get_height());}
57 | bool empty() const{return type == ImageType::CVMat ? cvmat.empty() : (device_data == nullptr || width < 1 || height < 1);}
58 | size_t get_data_size() const{
59 | switch(type){
60 | case ImageType::CVMat: return width * height * 3;
61 | case ImageType::GPUYUVNV12: return width * height * 1.5;
62 | case ImageType::GPUBGR: return width * height * 3;
63 | default: return 0;
64 | }
65 | }
66 | };
67 |
68 | void image_to_tensor(const cv::Mat& image, shared_ptr& tensor, Type type, int ibatch);
69 |
70 | class Infer{
71 | public:
72 | virtual shared_future commit(const Image& image) = 0;
73 | virtual vector> commits(const vector& images) = 0;
74 | virtual void* stream() = 0; // cudaStream_t
75 | };
76 |
77 | shared_ptr create_infer(
78 | const string& engine_file, Type type, int gpuid,
79 | float confidence_threshold=0.25f, float nms_threshold=0.5f,
80 | NMSMethod nms_method = NMSMethod::FastGPU, int max_objects = 1024
81 | );
82 | const char* type_name(Type type);
83 |
84 | }; // namespace YoloGPUPtr
85 |
86 | #endif // YOLO_GPUPTR_HPP
--------------------------------------------------------------------------------
/src/application/common/face_detector.hpp:
--------------------------------------------------------------------------------
1 | #ifndef FACE_DETECTOR_HPP
2 | #define FACE_DETECTOR_HPP
3 |
4 | #include
5 | #include
6 |
7 | namespace FaceDetector{
8 |
9 | struct Box{
10 | float left, top, right, bottom, confidence;
11 | float landmark[10];
12 |
13 | cv::Rect cvbox() const{return cv::Rect(left, top, right-left, bottom-top);}
14 | float width() const{return std::max(0.0f, right-left);}
15 | float height() const{return std::max(0.0f, bottom-top);}
16 | float area() const{return width() * height();}
17 | float get_left() {return left;}
18 | void set_left(float value) {left = value;}
19 | float get_top() {return top;}
20 | void set_top(float value) {top = value;}
21 | float get_right() {return right;}
22 | void set_right(float value) {right = value;}
23 | float get_bottom() {return bottom;}
24 | void set_bottom(float value) {bottom = value;}
25 | float get_confidence() {return confidence;}
26 | void set_confidence(float value){confidence = value;}
27 | };
28 |
29 | typedef std::vector BoxArray;
30 | };
31 |
32 | #endif // FACE_DETECTOR_HPP
--------------------------------------------------------------------------------
/src/application/common/object_detector.hpp:
--------------------------------------------------------------------------------
1 | #ifndef OBJECT_DETECTOR_HPP
2 | #define OBJECT_DETECTOR_HPP
3 |
4 | #include
5 |
6 | namespace ObjectDetector{
7 |
8 | struct Box{
9 | float left, top, right, bottom, confidence;
10 | int class_label;
11 |
12 | Box() = default;
13 |
14 | Box(float left, float top, float right, float bottom, float confidence, int class_label)
15 | :left(left), top(top), right(right), bottom(bottom), confidence(confidence), class_label(class_label){}
16 | };
17 |
18 | typedef std::vector BoxArray;
19 | };
20 |
21 |
22 | #endif // OBJECT_DETECTOR_HPP
--------------------------------------------------------------------------------
/src/application/tools/Eigen/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(RegexUtils)
2 | test_escape_string_as_regex()
3 |
4 | file(GLOB Eigen_directory_files "*")
5 |
6 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
7 |
8 | foreach(f ${Eigen_directory_files})
9 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src")
10 | list(APPEND Eigen_directory_files_to_install ${f})
11 | endif()
12 | endforeach(f ${Eigen_directory_files})
13 |
14 | install(FILES
15 | ${Eigen_directory_files_to_install}
16 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel
17 | )
18 |
19 | install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel FILES_MATCHING PATTERN "*.h")
20 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/Cholesky:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_CHOLESKY_MODULE_H
9 | #define EIGEN_CHOLESKY_MODULE_H
10 |
11 | #include "Core"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | /** \defgroup Cholesky_Module Cholesky module
16 | *
17 | *
18 | *
19 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices.
20 | * Those decompositions are also accessible via the following methods:
21 | * - MatrixBase::llt()
22 | * - MatrixBase::ldlt()
23 | * - SelfAdjointView::llt()
24 | * - SelfAdjointView::ldlt()
25 | *
26 | * \code
27 | * #include
28 | * \endcode
29 | */
30 |
31 | #include "src/Cholesky/LLT.h"
32 | #include "src/Cholesky/LDLT.h"
33 | #ifdef EIGEN_USE_LAPACKE
34 | #include "src/misc/lapacke.h"
35 | #include "src/Cholesky/LLT_LAPACKE.h"
36 | #endif
37 |
38 | #include "src/Core/util/ReenableStupidWarnings.h"
39 |
40 | #endif // EIGEN_CHOLESKY_MODULE_H
41 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
42 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/CholmodSupport:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H
9 | #define EIGEN_CHOLMODSUPPORT_MODULE_H
10 |
11 | #include "SparseCore"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | extern "C" {
16 | #include
17 | }
18 |
19 | /** \ingroup Support_modules
20 | * \defgroup CholmodSupport_Module CholmodSupport module
21 | *
22 | * This module provides an interface to the Cholmod library which is part of the suitesparse package.
23 | * It provides the two following main factorization classes:
24 | * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization.
25 | * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial).
26 | *
27 | * For the sake of completeness, this module also propose the two following classes:
28 | * - class CholmodSimplicialLLT
29 | * - class CholmodSimplicialLDLT
30 | * Note that these classes does not bring any particular advantage compared to the built-in
31 | * SimplicialLLT and SimplicialLDLT factorization classes.
32 | *
33 | * \code
34 | * #include
35 | * \endcode
36 | *
37 | * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies.
38 | * The dependencies depend on how cholmod has been compiled.
39 | * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task.
40 | *
41 | */
42 |
43 | #include "src/CholmodSupport/CholmodSupport.h"
44 |
45 | #include "src/Core/util/ReenableStupidWarnings.h"
46 |
47 | #endif // EIGEN_CHOLMODSUPPORT_MODULE_H
48 |
49 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/Dense:
--------------------------------------------------------------------------------
1 | #include "Core"
2 | #include "LU"
3 | #include "Cholesky"
4 | #include "QR"
5 | #include "SVD"
6 | #include "Geometry"
7 | #include "Eigenvalues"
8 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/Eigen:
--------------------------------------------------------------------------------
1 | #include "Dense"
2 | #include "Sparse"
3 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/Eigenvalues:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_EIGENVALUES_MODULE_H
9 | #define EIGEN_EIGENVALUES_MODULE_H
10 |
11 | #include "Core"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | #include "Cholesky"
16 | #include "Jacobi"
17 | #include "Householder"
18 | #include "LU"
19 | #include "Geometry"
20 |
21 | /** \defgroup Eigenvalues_Module Eigenvalues module
22 | *
23 | *
24 | *
25 | * This module mainly provides various eigenvalue solvers.
26 | * This module also provides some MatrixBase methods, including:
27 | * - MatrixBase::eigenvalues(),
28 | * - MatrixBase::operatorNorm()
29 | *
30 | * \code
31 | * #include
32 | * \endcode
33 | */
34 |
35 | #include "src/misc/RealSvd2x2.h"
36 | #include "src/Eigenvalues/Tridiagonalization.h"
37 | #include "src/Eigenvalues/RealSchur.h"
38 | #include "src/Eigenvalues/EigenSolver.h"
39 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h"
40 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h"
41 | #include "src/Eigenvalues/HessenbergDecomposition.h"
42 | #include "src/Eigenvalues/ComplexSchur.h"
43 | #include "src/Eigenvalues/ComplexEigenSolver.h"
44 | #include "src/Eigenvalues/RealQZ.h"
45 | #include "src/Eigenvalues/GeneralizedEigenSolver.h"
46 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h"
47 | #ifdef EIGEN_USE_LAPACKE
48 | #include "src/misc/lapacke.h"
49 | #include "src/Eigenvalues/RealSchur_LAPACKE.h"
50 | #include "src/Eigenvalues/ComplexSchur_LAPACKE.h"
51 | #include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h"
52 | #endif
53 |
54 | #include "src/Core/util/ReenableStupidWarnings.h"
55 |
56 | #endif // EIGEN_EIGENVALUES_MODULE_H
57 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
58 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/Geometry:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_GEOMETRY_MODULE_H
9 | #define EIGEN_GEOMETRY_MODULE_H
10 |
11 | #include "Core"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | #include "SVD"
16 | #include "LU"
17 | #include
18 |
19 | /** \defgroup Geometry_Module Geometry module
20 | *
21 | * This module provides support for:
22 | * - fixed-size homogeneous transformations
23 | * - translation, scaling, 2D and 3D rotations
24 | * - \link Quaternion quaternions \endlink
25 | * - cross products (\ref MatrixBase::cross, \ref MatrixBase::cross3)
26 | * - orthognal vector generation (\ref MatrixBase::unitOrthogonal)
27 | * - some linear components: \link ParametrizedLine parametrized-lines \endlink and \link Hyperplane hyperplanes \endlink
28 | * - \link AlignedBox axis aligned bounding boxes \endlink
29 | * - \link umeyama least-square transformation fitting \endlink
30 | *
31 | * \code
32 | * #include
33 | * \endcode
34 | */
35 |
36 | #include "src/Geometry/OrthoMethods.h"
37 | #include "src/Geometry/EulerAngles.h"
38 |
39 | #include "src/Geometry/Homogeneous.h"
40 | #include "src/Geometry/RotationBase.h"
41 | #include "src/Geometry/Rotation2D.h"
42 | #include "src/Geometry/Quaternion.h"
43 | #include "src/Geometry/AngleAxis.h"
44 | #include "src/Geometry/Transform.h"
45 | #include "src/Geometry/Translation.h"
46 | #include "src/Geometry/Scaling.h"
47 | #include "src/Geometry/Hyperplane.h"
48 | #include "src/Geometry/ParametrizedLine.h"
49 | #include "src/Geometry/AlignedBox.h"
50 | #include "src/Geometry/Umeyama.h"
51 |
52 | // Use the SSE optimized version whenever possible. At the moment the
53 | // SSE version doesn't compile when AVX is enabled
54 | #if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX
55 | #include "src/Geometry/arch/Geometry_SSE.h"
56 | #endif
57 |
58 | #include "src/Core/util/ReenableStupidWarnings.h"
59 |
60 | #endif // EIGEN_GEOMETRY_MODULE_H
61 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
62 |
63 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/Householder:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H
9 | #define EIGEN_HOUSEHOLDER_MODULE_H
10 |
11 | #include "Core"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | /** \defgroup Householder_Module Householder module
16 | * This module provides Householder transformations.
17 | *
18 | * \code
19 | * #include
20 | * \endcode
21 | */
22 |
23 | #include "src/Householder/Householder.h"
24 | #include "src/Householder/HouseholderSequence.h"
25 | #include "src/Householder/BlockHouseholder.h"
26 |
27 | #include "src/Core/util/ReenableStupidWarnings.h"
28 |
29 | #endif // EIGEN_HOUSEHOLDER_MODULE_H
30 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
31 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/IterativeLinearSolvers:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H
9 | #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H
10 |
11 | #include "SparseCore"
12 | #include "OrderingMethods"
13 |
14 | #include "src/Core/util/DisableStupidWarnings.h"
15 |
16 | /**
17 | * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module
18 | *
19 | * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse.
20 | * Those solvers are accessible via the following classes:
21 | * - ConjugateGradient for selfadjoint (hermitian) matrices,
22 | * - LeastSquaresConjugateGradient for rectangular least-square problems,
23 | * - BiCGSTAB for general square matrices.
24 | *
25 | * These iterative solvers are associated with some preconditioners:
26 | * - IdentityPreconditioner - not really useful
27 | * - DiagonalPreconditioner - also called Jacobi preconditioner, work very well on diagonal dominant matrices.
28 | * - IncompleteLUT - incomplete LU factorization with dual thresholding
29 | *
30 | * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport.
31 | *
32 | \code
33 | #include
34 | \endcode
35 | */
36 |
37 | #include "src/IterativeLinearSolvers/SolveWithGuess.h"
38 | #include "src/IterativeLinearSolvers/IterativeSolverBase.h"
39 | #include "src/IterativeLinearSolvers/BasicPreconditioners.h"
40 | #include "src/IterativeLinearSolvers/ConjugateGradient.h"
41 | #include "src/IterativeLinearSolvers/LeastSquareConjugateGradient.h"
42 | #include "src/IterativeLinearSolvers/BiCGSTAB.h"
43 | #include "src/IterativeLinearSolvers/IncompleteLUT.h"
44 | #include "src/IterativeLinearSolvers/IncompleteCholesky.h"
45 |
46 | #include "src/Core/util/ReenableStupidWarnings.h"
47 |
48 | #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H
49 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/Jacobi:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_JACOBI_MODULE_H
9 | #define EIGEN_JACOBI_MODULE_H
10 |
11 | #include "Core"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | /** \defgroup Jacobi_Module Jacobi module
16 | * This module provides Jacobi and Givens rotations.
17 | *
18 | * \code
19 | * #include
20 | * \endcode
21 | *
22 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation:
23 | * - MatrixBase::applyOnTheLeft()
24 | * - MatrixBase::applyOnTheRight().
25 | */
26 |
27 | #include "src/Jacobi/Jacobi.h"
28 |
29 | #include "src/Core/util/ReenableStupidWarnings.h"
30 |
31 | #endif // EIGEN_JACOBI_MODULE_H
32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
33 |
34 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/LU:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_LU_MODULE_H
9 | #define EIGEN_LU_MODULE_H
10 |
11 | #include "Core"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | /** \defgroup LU_Module LU module
16 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant.
17 | * This module defines the following MatrixBase methods:
18 | * - MatrixBase::inverse()
19 | * - MatrixBase::determinant()
20 | *
21 | * \code
22 | * #include
23 | * \endcode
24 | */
25 |
26 | #include "src/misc/Kernel.h"
27 | #include "src/misc/Image.h"
28 | #include "src/LU/FullPivLU.h"
29 | #include "src/LU/PartialPivLU.h"
30 | #ifdef EIGEN_USE_LAPACKE
31 | #include "src/misc/lapacke.h"
32 | #include "src/LU/PartialPivLU_LAPACKE.h"
33 | #endif
34 | #include "src/LU/Determinant.h"
35 | #include "src/LU/InverseImpl.h"
36 |
37 | // Use the SSE optimized version whenever possible. At the moment the
38 | // SSE version doesn't compile when AVX is enabled
39 | #if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX
40 | #include "src/LU/arch/Inverse_SSE.h"
41 | #endif
42 |
43 | #include "src/Core/util/ReenableStupidWarnings.h"
44 |
45 | #endif // EIGEN_LU_MODULE_H
46 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
47 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/MetisSupport:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_METISSUPPORT_MODULE_H
9 | #define EIGEN_METISSUPPORT_MODULE_H
10 |
11 | #include "SparseCore"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | extern "C" {
16 | #include
17 | }
18 |
19 |
20 | /** \ingroup Support_modules
21 | * \defgroup MetisSupport_Module MetisSupport module
22 | *
23 | * \code
24 | * #include
25 | * \endcode
26 | * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis).
27 | * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink
28 | */
29 |
30 |
31 | #include "src/MetisSupport/MetisSupport.h"
32 |
33 | #include "src/Core/util/ReenableStupidWarnings.h"
34 |
35 | #endif // EIGEN_METISSUPPORT_MODULE_H
36 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/OrderingMethods:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_ORDERINGMETHODS_MODULE_H
9 | #define EIGEN_ORDERINGMETHODS_MODULE_H
10 |
11 | #include "SparseCore"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | /**
16 | * \defgroup OrderingMethods_Module OrderingMethods module
17 | *
18 | * This module is currently for internal use only
19 | *
20 | * It defines various built-in and external ordering methods for sparse matrices.
21 | * They are typically used to reduce the number of elements during
22 | * the sparse matrix decomposition (LLT, LU, QR).
23 | * Precisely, in a preprocessing step, a permutation matrix P is computed using
24 | * those ordering methods and applied to the columns of the matrix.
25 | * Using for instance the sparse Cholesky decomposition, it is expected that
26 | * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A).
27 | *
28 | *
29 | * Usage :
30 | * \code
31 | * #include
32 | * \endcode
33 | *
34 | * A simple usage is as a template parameter in the sparse decomposition classes :
35 | *
36 | * \code
37 | * SparseLU > solver;
38 | * \endcode
39 | *
40 | * \code
41 | * SparseQR > solver;
42 | * \endcode
43 | *
44 | * It is possible as well to call directly a particular ordering method for your own purpose,
45 | * \code
46 | * AMDOrdering ordering;
47 | * PermutationMatrix perm;
48 | * SparseMatrix A;
49 | * //Fill the matrix ...
50 | *
51 | * ordering(A, perm); // Call AMD
52 | * \endcode
53 | *
54 | * \note Some of these methods (like AMD or METIS), need the sparsity pattern
55 | * of the input matrix to be symmetric. When the matrix is structurally unsymmetric,
56 | * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method.
57 | * If your matrix is already symmetric (at leat in structure), you can avoid that
58 | * by calling the method with a SelfAdjointView type.
59 | *
60 | * \code
61 | * // Call the ordering on the pattern of the lower triangular matrix A
62 | * ordering(A.selfadjointView(), perm);
63 | * \endcode
64 | */
65 |
66 | #ifndef EIGEN_MPL2_ONLY
67 | #include "src/OrderingMethods/Amd.h"
68 | #endif
69 |
70 | #include "src/OrderingMethods/Ordering.h"
71 | #include "src/Core/util/ReenableStupidWarnings.h"
72 |
73 | #endif // EIGEN_ORDERINGMETHODS_MODULE_H
74 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/PaStiXSupport:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_PASTIXSUPPORT_MODULE_H
9 | #define EIGEN_PASTIXSUPPORT_MODULE_H
10 |
11 | #include "SparseCore"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | extern "C" {
16 | #include
17 | #include
18 | }
19 |
20 | #ifdef complex
21 | #undef complex
22 | #endif
23 |
24 | /** \ingroup Support_modules
25 | * \defgroup PaStiXSupport_Module PaStiXSupport module
26 | *
27 | * This module provides an interface to the PaSTiX library.
28 | * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver.
29 | * It provides the two following main factorization classes:
30 | * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization.
31 | * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization.
32 | * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern).
33 | *
34 | * \code
35 | * #include
36 | * \endcode
37 | *
38 | * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies.
39 | * The dependencies depend on how PaSTiX has been compiled.
40 | * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task.
41 | *
42 | */
43 |
44 | #include "src/PaStiXSupport/PaStiXSupport.h"
45 |
46 | #include "src/Core/util/ReenableStupidWarnings.h"
47 |
48 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H
49 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/PardisoSupport:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H
9 | #define EIGEN_PARDISOSUPPORT_MODULE_H
10 |
11 | #include "SparseCore"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | #include
16 |
17 | /** \ingroup Support_modules
18 | * \defgroup PardisoSupport_Module PardisoSupport module
19 | *
20 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers.
21 | *
22 | * \code
23 | * #include
24 | * \endcode
25 | *
26 | * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies.
27 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration.
28 | *
29 | */
30 |
31 | #include "src/PardisoSupport/PardisoSupport.h"
32 |
33 | #include "src/Core/util/ReenableStupidWarnings.h"
34 |
35 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H
36 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/QR:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_QR_MODULE_H
9 | #define EIGEN_QR_MODULE_H
10 |
11 | #include "Core"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | #include "Cholesky"
16 | #include "Jacobi"
17 | #include "Householder"
18 |
19 | /** \defgroup QR_Module QR module
20 | *
21 | *
22 | *
23 | * This module provides various QR decompositions
24 | * This module also provides some MatrixBase methods, including:
25 | * - MatrixBase::householderQr()
26 | * - MatrixBase::colPivHouseholderQr()
27 | * - MatrixBase::fullPivHouseholderQr()
28 | *
29 | * \code
30 | * #include
31 | * \endcode
32 | */
33 |
34 | #include "src/QR/HouseholderQR.h"
35 | #include "src/QR/FullPivHouseholderQR.h"
36 | #include "src/QR/ColPivHouseholderQR.h"
37 | #include "src/QR/CompleteOrthogonalDecomposition.h"
38 | #ifdef EIGEN_USE_LAPACKE
39 | #include "src/misc/lapacke.h"
40 | #include "src/QR/HouseholderQR_LAPACKE.h"
41 | #include "src/QR/ColPivHouseholderQR_LAPACKE.h"
42 | #endif
43 |
44 | #include "src/Core/util/ReenableStupidWarnings.h"
45 |
46 | #endif // EIGEN_QR_MODULE_H
47 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
48 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/QtAlignedMalloc:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_QTMALLOC_MODULE_H
9 | #define EIGEN_QTMALLOC_MODULE_H
10 |
11 | #include "Core"
12 |
13 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED)
14 |
15 | #include "src/Core/util/DisableStupidWarnings.h"
16 |
17 | void *qMalloc(std::size_t size)
18 | {
19 | return Eigen::internal::aligned_malloc(size);
20 | }
21 |
22 | void qFree(void *ptr)
23 | {
24 | Eigen::internal::aligned_free(ptr);
25 | }
26 |
27 | void *qRealloc(void *ptr, std::size_t size)
28 | {
29 | void* newPtr = Eigen::internal::aligned_malloc(size);
30 | memcpy(newPtr, ptr, size);
31 | Eigen::internal::aligned_free(ptr);
32 | return newPtr;
33 | }
34 |
35 | #include "src/Core/util/ReenableStupidWarnings.h"
36 |
37 | #endif
38 |
39 | #endif // EIGEN_QTMALLOC_MODULE_H
40 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
41 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/SPQRSupport:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_SPQRSUPPORT_MODULE_H
9 | #define EIGEN_SPQRSUPPORT_MODULE_H
10 |
11 | #include "SparseCore"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | #include "SuiteSparseQR.hpp"
16 |
17 | /** \ingroup Support_modules
18 | * \defgroup SPQRSupport_Module SuiteSparseQR module
19 | *
20 | * This module provides an interface to the SPQR library, which is part of the suitesparse package.
21 | *
22 | * \code
23 | * #include
24 | * \endcode
25 | *
26 | * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...).
27 | * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules
28 | *
29 | */
30 |
31 | #include "src/CholmodSupport/CholmodSupport.h"
32 | #include "src/SPQRSupport/SuiteSparseQRSupport.h"
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/SVD:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_SVD_MODULE_H
9 | #define EIGEN_SVD_MODULE_H
10 |
11 | #include "QR"
12 | #include "Householder"
13 | #include "Jacobi"
14 |
15 | #include "src/Core/util/DisableStupidWarnings.h"
16 |
17 | /** \defgroup SVD_Module SVD module
18 | *
19 | *
20 | *
21 | * This module provides SVD decomposition for matrices (both real and complex).
22 | * Two decomposition algorithms are provided:
23 | * - JacobiSVD implementing two-sided Jacobi iterations is numerically very accurate, fast for small matrices, but very slow for larger ones.
24 | * - BDCSVD implementing a recursive divide & conquer strategy on top of an upper-bidiagonalization which remains fast for large problems.
25 | * These decompositions are accessible via the respective classes and following MatrixBase methods:
26 | * - MatrixBase::jacobiSvd()
27 | * - MatrixBase::bdcSvd()
28 | *
29 | * \code
30 | * #include
31 | * \endcode
32 | */
33 |
34 | #include "src/misc/RealSvd2x2.h"
35 | #include "src/SVD/UpperBidiagonalization.h"
36 | #include "src/SVD/SVDBase.h"
37 | #include "src/SVD/JacobiSVD.h"
38 | #include "src/SVD/BDCSVD.h"
39 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT)
40 | #include "src/misc/lapacke.h"
41 | #include "src/SVD/JacobiSVD_LAPACKE.h"
42 | #endif
43 |
44 | #include "src/Core/util/ReenableStupidWarnings.h"
45 |
46 | #endif // EIGEN_SVD_MODULE_H
47 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
48 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/Sparse:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_SPARSE_MODULE_H
9 | #define EIGEN_SPARSE_MODULE_H
10 |
11 | /** \defgroup Sparse_Module Sparse meta-module
12 | *
13 | * Meta-module including all related modules:
14 | * - \ref SparseCore_Module
15 | * - \ref OrderingMethods_Module
16 | * - \ref SparseCholesky_Module
17 | * - \ref SparseLU_Module
18 | * - \ref SparseQR_Module
19 | * - \ref IterativeLinearSolvers_Module
20 | *
21 | \code
22 | #include
23 | \endcode
24 | */
25 |
26 | #include "SparseCore"
27 | #include "OrderingMethods"
28 | #ifndef EIGEN_MPL2_ONLY
29 | #include "SparseCholesky"
30 | #endif
31 | #include "SparseLU"
32 | #include "SparseQR"
33 | #include "IterativeLinearSolvers"
34 |
35 | #endif // EIGEN_SPARSE_MODULE_H
36 |
37 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/SparseCholesky:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // Copyright (C) 2008-2013 Gael Guennebaud
5 | //
6 | // This Source Code Form is subject to the terms of the Mozilla
7 | // Public License v. 2.0. If a copy of the MPL was not distributed
8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 |
10 | #ifndef EIGEN_SPARSECHOLESKY_MODULE_H
11 | #define EIGEN_SPARSECHOLESKY_MODULE_H
12 |
13 | #include "SparseCore"
14 | #include "OrderingMethods"
15 |
16 | #include "src/Core/util/DisableStupidWarnings.h"
17 |
18 | /**
19 | * \defgroup SparseCholesky_Module SparseCholesky module
20 | *
21 | * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices.
22 | * Those decompositions are accessible via the following classes:
23 | * - SimplicialLLt,
24 | * - SimplicialLDLt
25 | *
26 | * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module.
27 | *
28 | * \code
29 | * #include
30 | * \endcode
31 | */
32 |
33 | #ifdef EIGEN_MPL2_ONLY
34 | #error The SparseCholesky module has nothing to offer in MPL2 only mode
35 | #endif
36 |
37 | #include "src/SparseCholesky/SimplicialCholesky.h"
38 |
39 | #ifndef EIGEN_MPL2_ONLY
40 | #include "src/SparseCholesky/SimplicialCholesky_impl.h"
41 | #endif
42 |
43 | #include "src/Core/util/ReenableStupidWarnings.h"
44 |
45 | #endif // EIGEN_SPARSECHOLESKY_MODULE_H
46 |
--------------------------------------------------------------------------------
/src/application/tools/Eigen/SparseCore:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // This Source Code Form is subject to the terms of the Mozilla
5 | // Public License v. 2.0. If a copy of the MPL was not distributed
6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 |
8 | #ifndef EIGEN_SPARSECORE_MODULE_H
9 | #define EIGEN_SPARSECORE_MODULE_H
10 |
11 | #include "Core"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | #include
16 | #include