|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
#include <sequence_solver_function.h>
Public Member Functions | |
| SequenceSolverFunctionT (const Character &character, const ParameterTransformT< T > ¶meterTransform, const ParameterSet &universal, size_t nFrames) | |
| ~SequenceSolverFunctionT () override | |
| SequenceSolverFunctionT (const SequenceSolverFunctionT &)=delete | |
| SequenceSolverFunctionT & | operator= (const SequenceSolverFunctionT &)=delete |
| SequenceSolverFunctionT (SequenceSolverFunctionT &&)=delete | |
| SequenceSolverFunctionT & | operator= (SequenceSolverFunctionT &&)=delete |
| double | getError (const Eigen::VectorX< T > ¶meters) final |
| double | getGradient (const Eigen::VectorX< T > ¶meters, Eigen::VectorX< T > &gradient) final |
| void | initializeJacobianComputation (const Eigen::VectorX< T > ¶meters) override |
| size_t | getJacobianBlockCount () const override |
| Returns the number of Jacobian blocks available. | |
| size_t | getJacobianBlockSize (size_t blockIndex) const override |
| Returns the maximum number of rows for a specific Jacobian block. | |
| double | computeJacobianBlock (const Eigen::VectorX< T > ¶meters, size_t blockIndex, Eigen::Ref< Eigen::MatrixX< T > > jacobianBlock, Eigen::Ref< Eigen::VectorX< T > > residualBlock, size_t &actualRows) override |
| void | finalizeJacobianComputation () override |
| Optional cleanup after all Jacobian blocks have been computed. | |
| void | updateParameters (Eigen::VectorX< T > ¶meters, const Eigen::VectorX< T > &gradient) final |
| void | setEnabledParameters (const ParameterSet ¶meterSet) final |
| Specifies which parameters should be optimized. | |
| const ParameterSet & | getUniversalParameterSet () const |
| bool | needsMeshPerFrame () const |
| Returns whether the per-frame error functions need the mesh. | |
| bool | needsMeshSequence () const |
| Returns whether the sequence error functions need the mesh. | |
| void | addErrorFunction (size_t frame, std::shared_ptr< SkeletonErrorFunctionT< T > > errorFunction) |
| void | addSequenceErrorFunction (size_t startFrame, std::shared_ptr< SequenceErrorFunctionT< T > > errorFunction) |
| size_t | getNumFrames () const |
| const ModelParametersT< T > & | getFrameParameters (size_t frame) const |
| const std::vector< ModelParametersT< T > > & | getFrameParameters () const |
| const std::vector< Eigen::Index > & | getPerFrameParameterIndices () const |
| const std::vector< Eigen::Index > & | getUniversalParameterIndices () const |
| void | setFrameParameters (size_t frame, const ModelParametersT< T > ¶meters) |
| ModelParametersT< T > | getUniversalParameters () const |
| Eigen::VectorX< T > | getJoinedParameterVector () const |
| Eigen::VectorX< T > | getJoinedParameterVectorFromFrameParameters (std::span< const ModelParametersT< T > > frameParameters) const |
| Returns a joined parameter vector from a span of frame parameters. | |
| void | setJoinedParameterVector (const Eigen::VectorX< T > &joinedParameters) |
| const Skeleton * | getSkeleton () const |
| const Character & | getCharacter () const |
| const ParameterTransformT< T > * | getParameterTransform () const |
| const auto & | getErrorFunctions (size_t iFrame) const |
| const auto & | getErrorFunctions () const |
| const auto & | getSequenceErrorFunctions (size_t iFrame) const |
| const auto & | getSequenceErrorFunctions () const |
| Public Member Functions inherited from momentum::SolverFunctionT< T > | |
| virtual | ~SolverFunctionT ()=default |
| virtual double | getError (const VectorX< T > ¶meters)=0 |
| Evaluates the objective function at the given parameter values. | |
| virtual double | getGradient (const VectorX< T > ¶meters, VectorX< T > &gradient)=0 |
| Computes the gradient of the objective function. | |
| double | getJacobian (const VectorX< T > ¶meters, MatrixX< T > &jacobian, VectorX< T > &residual, size_t &actualRows) |
| Computes the Jacobian matrix for least squares problems. | |
| virtual void | getHessian (const VectorX< T > ¶meters, MatrixX< T > &hessian) |
| Computes the Hessian matrix of second derivatives. | |
| virtual double | getJtJR (const VectorX< T > ¶meters, MatrixX< T > &jtj, VectorX< T > &jtr) |
| Computes JᵀJ and JᵀR for Gauss-Newton optimization. | |
| virtual double | getJtJR_Sparse (const VectorX< T > ¶meters, SparseMatrix< T > &jtj, VectorX< T > &jtr) |
| Computes sparse JᵀJ and JᵀR for large-scale problems. | |
| virtual void | initializeJacobianComputation (const VectorX< T > ¶meters)=0 |
| Initializes Jacobian computation for the given parameters. | |
| virtual double | computeJacobianBlock (const VectorX< T > ¶meters, size_t blockIndex, Eigen::Ref< MatrixX< T > > jacobianBlock, Eigen::Ref< VectorX< T > > residualBlock, size_t &actualRows)=0 |
| Computes a specific Jacobian block. | |
| virtual double | getSolverDerivatives (const VectorX< T > ¶meters, MatrixX< T > &hess, VectorX< T > &grad) |
| Computes derivatives needed by the solver. | |
| virtual void | updateParameters (VectorX< T > ¶meters, const VectorX< T > &gradient)=0 |
| Updates parameters using the computed step direction. | |
| size_t | getNumParameters () const |
| Returns the total number of parameters in the optimization problem. | |
| size_t | getActualParameters () const |
| Returns the number of parameters currently enabled for optimization. | |
| virtual void | storeHistory (std::unordered_map< std::string, MatrixX< T > > &history, size_t iteration, size_t maxIterations_) |
| Records solver state for debugging and analysis. | |
Friends | |
| class | SequenceCholeskySolverT< T > |
| class | SequenceSolverT< T > |
Additional Inherited Members | |
| Protected Attributes inherited from momentum::SolverFunctionT< T > | |
| size_t | numParameters_ {} |
| Total number of parameters in the optimization problem. | |
| size_t | actualParameters_ {} |
| Number of parameters currently enabled for optimization. | |
| ResizeableMatrix< T > | tJacobian_ |
| Pre-allocated temporary storage for block-wise JtJ computation. | |
| ResizeableMatrix< T > | tResidual_ |
Definition at line 31 of file sequence_solver_function.h.
| momentum::SequenceSolverFunctionT< T >::SequenceSolverFunctionT | ( | const Character & | character, |
| const ParameterTransformT< T > & | parameterTransform, | ||
| const ParameterSet & | universal, | ||
| size_t | nFrames ) |
Definition at line 28 of file sequence_solver_function.cpp.
References momentum::allParams(), and momentum::EigenStrongType< ModelParametersT, ::Eigen::VectorX< T > >::Zero().
|
overridedefault |
|
delete |
|
delete |
| void momentum::SequenceSolverFunctionT< T >::addErrorFunction | ( | size_t | frame, |
| std::shared_ptr< SkeletonErrorFunctionT< T > > | errorFunction ) |
Definition at line 659 of file sequence_solver_function.cpp.
References addErrorFunction(), getNumFrames(), momentum::kAllFrames, and MT_CHECK.
Referenced by momentum::addBlendShapeRegularizer(), addErrorFunction(), momentum::addGloveConstraintsToSequenceSolver(), momentum::addKeypointProjectionConstraints(), momentum::trackPosesForFrames(), and momentum::trackSequence().
| void momentum::SequenceSolverFunctionT< T >::addSequenceErrorFunction | ( | size_t | startFrame, |
| std::shared_ptr< SequenceErrorFunctionT< T > > | errorFunction ) |
Definition at line 677 of file sequence_solver_function.cpp.
References getNumFrames(), momentum::kAllFrames, and MT_CHECK.
Referenced by momentum::trackSequence().
|
override |
Definition at line 514 of file sequence_solver_function.cpp.
References getNumFrames(), MT_PROFILE_FUNCTION, and momentum::MeshStateT< T >::update().
|
overridevirtual |
Optional cleanup after all Jacobian blocks have been computed.
Called after all blocks have been processed. Default implementation does nothing.
Reimplemented from momentum::SolverFunctionT< T >.
Definition at line 639 of file sequence_solver_function.cpp.
|
nodiscard |
Definition at line 156 of file sequence_solver_function.cpp.
|
final |
Definition at line 185 of file sequence_solver_function.cpp.
References getNumFrames(), momentum::PerFrameStateT< T >::meshState, MT_CHECK, and momentum::PerFrameStateT< T >::skeletonState.
Referenced by momentum::trackPosesForFrames(), and momentum::trackSequence().
|
inlinenodiscard |
Definition at line 132 of file sequence_solver_function.h.
|
inlinenodiscard |
Definition at line 128 of file sequence_solver_function.h.
|
inlinenodiscard |
Definition at line 94 of file sequence_solver_function.h.
|
inlinenodiscard |
Definition at line 90 of file sequence_solver_function.h.
Referenced by momentum::trackSequence().
|
final |
Definition at line 254 of file sequence_solver_function.cpp.
References getNumFrames(), MT_CHECK, momentum::SkeletonStateT< T >::set(), and momentum::MeshStateT< T >::update().
|
nodiscardoverridevirtual |
Returns the number of Jacobian blocks available.
Each block corresponds to one error function or constraint group
Implements momentum::SolverFunctionT< T >.
Definition at line 484 of file sequence_solver_function.cpp.
References getNumFrames().
|
nodiscardoverridevirtual |
Returns the maximum number of rows for a specific Jacobian block.
This is the maximum size; actual rows may be fewer (returned via actualRows)
| blockIndex | Index of the block (0 to getJacobianBlockCount()-1) |
Implements momentum::SolverFunctionT< T >.
Definition at line 489 of file sequence_solver_function.cpp.
References getNumFrames().
Referenced by initializeJacobianComputation().
|
nodiscard |
Definition at line 146 of file sequence_solver_function.cpp.
References getJoinedParameterVectorFromFrameParameters().
Referenced by momentum::trackSequence().
|
nodiscard |
Returns a joined parameter vector from a span of frame parameters.
| frameParameters | A span of frame parameters, where each element is a ModelParametersT<T> object representing the parameters for a single frame. |
Definition at line 120 of file sequence_solver_function.cpp.
References getNumFrames(), MT_CHECK, and momentum::SolverFunctionT< T >::numParameters_.
Referenced by getJoinedParameterVector().
|
inlinenodiscard |
Definition at line 86 of file sequence_solver_function.h.
Referenced by addErrorFunction(), addSequenceErrorFunction(), computeJacobianBlock(), getError(), getGradient(), getJacobianBlockCount(), getJacobianBlockSize(), getJoinedParameterVectorFromFrameParameters(), initializeJacobianComputation(), setEnabledParameters(), and setFrameParameters().
|
inlinenodiscard |
Definition at line 124 of file sequence_solver_function.h.
Referenced by momentum::detail::buildSequenceColumnIndices().
|
inlinenodiscard |
Definition at line 98 of file sequence_solver_function.h.
Referenced by momentum::detail::buildSequenceColumnIndices().
|
inlinenodiscard |
Definition at line 140 of file sequence_solver_function.h.
|
inlinenodiscard |
Definition at line 136 of file sequence_solver_function.h.
|
nodiscard |
Definition at line 151 of file sequence_solver_function.cpp.
|
inlinenodiscard |
Definition at line 102 of file sequence_solver_function.h.
|
nodiscard |
Definition at line 108 of file sequence_solver_function.cpp.
References momentum::EigenStrongType< ModelParametersT, ::Eigen::VectorX< T > >::Zero().
|
inlinenodiscard |
Definition at line 63 of file sequence_solver_function.h.
|
override |
Definition at line 465 of file sequence_solver_function.cpp.
References getJacobianBlockSize(), getNumFrames(), MT_CHECK, and MT_PROFILE_FUNCTION.
|
inlinenodiscard |
Returns whether the per-frame error functions need the mesh.
Definition at line 68 of file sequence_solver_function.h.
|
inlinenodiscard |
Returns whether the sequence error functions need the mesh.
Definition at line 73 of file sequence_solver_function.h.
|
delete |
|
delete |
|
finalvirtual |
Specifies which parameters should be optimized.
Default implementation does nothing
| parameterSet | Bitset where each bit indicates if the corresponding parameter is enabled |
Reimplemented from momentum::SolverFunctionT< T >.
Definition at line 50 of file sequence_solver_function.cpp.
References getNumFrames().
| void momentum::SequenceSolverFunctionT< T >::setFrameParameters | ( | size_t | frame, |
| const ModelParametersT< T > & | parameters ) |
Definition at line 98 of file sequence_solver_function.cpp.
References getNumFrames(), MT_CHECK, and momentum::EigenStrongType< Derived, EigenType >::size().
Referenced by momentum::trackSequence().
| void momentum::SequenceSolverFunctionT< T >::setJoinedParameterVector | ( | const Eigen::VectorX< T > & | joinedParameters | ) |
Definition at line 161 of file sequence_solver_function.cpp.
|
final |
Definition at line 645 of file sequence_solver_function.cpp.
References MT_CHECK.
|
friend |
Definition at line 187 of file sequence_solver_function.h.
|
friend |
Definition at line 187 of file sequence_solver_function.h.