Navigation
API > API/Plugins > API/Plugins/NearestNeighborModel
The nearest neighbor model. This model contains the linear basis of the vertex deltas and a small set of meshes for nearest neighbor search. Given a new pose, the pre-trained neural network first predicts the coefficients of the vertex deltas. Then this model uses the predicted coeffcients to find a nearest neighbor in the small dataset. The total vertex delta is computed by vertex_delta = mean_delta + basis * coeff + nearest_neighbor_delta To prevent popping, a time filtering is applied on predicted vertex deltas. The vertex delta at time t is computed by vertex_delta(t) = decay_factor * vertex_delta(t-1) + (1 - decay_factor) * vertex_delta The mesh can be separated into several sections (e.g. shirt, pants...). The nearest neighbor search is carried out separately for each section. The basis and the nearest neighbor data are compressed into morph targets.
| Name | UNearestNeighborModel |
| Type | class |
| Header File | /Engine/Plugins/Animation/MLDeformer/NearestNeighborModel/Source/NearestNeighborModel/Public/NearestNeighborModel.h |
| Include Path | #include "NearestNeighborModel.h" |
Syntax
UCLASS (MinimalAPI)
class UNearestNeighborModel : public UMLDeformerMorphModel
Inheritance Hierarchy
- UMLDeformerModel → UMLDeformerGeomCacheModel → UMLDeformerMorphModel → UNearestNeighborModel
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UNearestNeighborModel
(
const FObjectInitializer& ObjectInitializer |
NearestNeighborModel.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| EOpFlag | UE::NearestNeighborModel::EOpFlag | NearestNeighborModel.h | |
| FSection | UNearestNeighborModelSection | NearestNeighborModel.h | |
| UNetwork | UNearestNeighborOptimizedNetwork | NearestNeighborModel.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| NearestNeighborNumFloatsPerBone | int32 | NearestNeighborModel.h | |
| NearestNeighborNumFloatsPerCurve | int32 | NearestNeighborModel.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bIsReadyForInference | bool | NearestNeighborModel.h | ||
| bIsReadyForTraining | bool | NearestNeighborModel.h | ||
| MorphTargetsLastWriteTime | int64 | NearestNeighborModel.h | ||
| NetworkLastWriteArchitectureString | FString | NearestNeighborModel.h | ||
| NetworkLastWriteTime | int64 | NearestNeighborModel.h | ||
| OptimizedNetwork | TObjectPtr< UNearestNeighborOptimizedNetwork > | NearestNeighborModel.h | ||
| PCACoeffStarts | TArray< int32 > | NearestNeighborModel.h | ||
| Sections | TArray< TObjectPtr< UNearestNeighborModelSection > > | NearestNeighborModel.h |
|
|
| Version | int32 | NearestNeighborModel.h | ||
| VertexWeightSum | TArray< float > | NearestNeighborModel.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddSection
(
TObjectPtr< UNearestNeighborModelSection > Section |
NearestNeighborModel.h | ||
void ClearOptimizedNetwork() |
NearestNeighborModel.h | ||
void ClearReferences() |
NearestNeighborModel.h | ||
void ClipInputs
(
TArrayView< float > Inputs |
NearestNeighborModel.h | ||
virtual UMLDeformerInputInfo * CreateInputInfo() |
NearestNeighborModel.h | ||
virtual UMLDeformerModelInstance * CreateModelInstance
(
UMLDeformerComponent* Component |
NearestNeighborModel.h | ||
virtual bool DoesSupportQualityLevels() |
NearestNeighborModel.h | ||
bool DoesUseDualQuaternionDeltas() |
NearestNeighborModel.h | ||
bool DoesUseFileCache() |
NearestNeighborModel.h | ||
bool DoesUsePCA() |
NearestNeighborModel.h |
|
|
bool DoesUseRBF() |
NearestNeighborModel.h | ||
virtual void FinalizeMorphTargets() |
NearestNeighborModel.h | ||
virtual void GetAssetRegistryTags
(
TArray< FAssetRegistryTag >& OutTags |
NearestNeighborModel.h | ||
virtual void GetAssetRegistryTags
(
FAssetRegistryTagsContext Context |
NearestNeighborModel.h | ||
int32 GetBatchSize() |
NearestNeighborModel.h |
|
|
| NearestNeighborModel.h |
|
||
| NearestNeighborModel.h | |||
| NearestNeighborModel.h |
|
||
| NearestNeighborModel.h | |||
| NearestNeighborModel.h |
|
||
| NearestNeighborModel.h | |||
float GetDecayFactor() |
NearestNeighborModel.h | ||
virtual FString GetDefaultDeformerGraphAssetPath() |
NearestNeighborModel.h | ||
virtual FString GetDisplayName() |
NearestNeighborModel.h | ||
int32 GetEarlyStopEpochs() |
NearestNeighborModel.h |
|
|
const FString & GetFileCacheDirectory() |
NearestNeighborModel.h | ||
TArray< int32 > GetHiddenLayerDims() |
NearestNeighborModel.h |
|
|
int32 GetInputDim() |
NearestNeighborModel.h |
|
|
float GetLearningRate() |
NearestNeighborModel.h |
|
|
TArray< FInt32Range > GetMeshVertRanges
(
const USkeletalMesh& SkelMesh |
NearestNeighborModel.h | ||
FString GetModelDir() |
NearestNeighborModel.h |
|
|
FDateTime GetMorphTargetsLastWriteTime() |
NearestNeighborModel.h | ||
FMLDeformerGeomCacheTrainingInputAnim * GetNearestNeighborAnim
(
int32 SectionIndex |
NearestNeighborModel.h | ||
const FMLDeformerGeomCacheTrainingInputAnim * GetNearestNeighborAnim
(
int32 SectionIndex |
NearestNeighborModel.h | ||
float GetNearestNeighborOffsetWeight() |
NearestNeighborModel.h | ||
FString GetNetworkLastWriteArchitectureString() |
NearestNeighborModel.h | ||
FDateTime GetNetworkLastWriteTime() |
NearestNeighborModel.h | ||
int32 GetNumBasisPerSection() |
NearestNeighborModel.h |
|
|
int32 GetNumEpochs() |
NearestNeighborModel.h |
|
|
virtual int32 GetNumFloatsPerBone() |
NearestNeighborModel.h | ||
virtual int32 GetNumFloatsPerCurve() |
NearestNeighborModel.h | ||
int32 GetNumIterations() |
NearestNeighborModel.h |
|
|
int32 GetNumNetworkOutputs() |
NearestNeighborModel.h | ||
int32 GetNumSections() |
NearestNeighborModel.h |
|
|
TWeakObjectPtr< const UNetwork > GetOptimizedNetwork () |
NearestNeighborModel.h | ||
int32 GetOutputDim() |
NearestNeighborModel.h |
|
|
const TArray< int32 > & GetPCACoeffStarts() |
NearestNeighborModel.h |
|
|
float GetRBFSigma() |
NearestNeighborModel.h | ||
float GetRegularizationFactor() |
NearestNeighborModel.h |
|
|
UNearestNeighborModelSection & GetSection
(
int32 Index |
NearestNeighborModel.h | ||
const UNearestNeighborModelSection & GetSection
(
int32 Index |
NearestNeighborModel.h |
|
|
const UNearestNeighborModelSection * GetSectionPtr
(
int32 Index |
GetSectionPtr is reserved for python. Use GetSection for C++. | NearestNeighborModel.h |
|
float GetSmoothLossBeta() |
NearestNeighborModel.h |
|
|
int32 GetTotalNumBasis() |
NearestNeighborModel.h |
|
|
int32 GetTotalNumNeighbors() |
NearestNeighborModel.h | ||
const TArray< float > & GetVertexWeightSum() |
NearestNeighborModel.h | ||
void InvalidateInference() |
NearestNeighborModel.h | ||
void InvalidateInferenceModelOnly() |
NearestNeighborModel.h | ||
void InvalidateTraining() |
NearestNeighborModel.h | ||
void InvalidateTrainingModelOnly() |
NearestNeighborModel.h | ||
bool IsBeforeCustomVersionWasAdded() |
NearestNeighborModel.h | ||
bool IsBeforeDeprecateNumEpochs() |
NearestNeighborModel.h | ||
bool IsBeforeTrainedBasisAdded() |
NearestNeighborModel.h | ||
bool IsReadyForInference() |
NearestNeighborModel.h |
|
|
bool IsReadyForTraining() |
NearestNeighborModel.h |
|
|
virtual bool IsTrained() |
NearestNeighborModel.h | ||
bool LoadOptimizedNetworkFromFile
(
const FString& Filename |
NearestNeighborModel.h | ||
UNearestNeighborModelSection * OnSectionAdded
(
int32 NewIndex |
NearestNeighborModel.h | ||
virtual void PostEditChangeChainProperty
(
FPropertyChangedChainEvent& PropertyChangedEvent |
NearestNeighborModel.h | ||
virtual void PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
NearestNeighborModel.h | ||
virtual void PostLoad() |
NearestNeighborModel.h | ||
void RemoveAllSections() |
NearestNeighborModel.h | ||
virtual void Serialize
(
FArchive& Archive |
NearestNeighborModel.h | ||
void SetFileCacheDirectory
(
const FString& InFileCacheDirectory |
NearestNeighborModel.h | ||
void UpdateFileCache() |
NearestNeighborModel.h | ||
EOpFlag UpdateForInference() |
NearestNeighborModel.h | ||
EOpFlag UpdateForTraining() |
NearestNeighborModel.h | ||
void UpdateMorphTargetsLastWriteTime () |
Make sure to call this function after changing the morph targets. | NearestNeighborModel.h | |
void UpdateNetworkInputDim() |
NearestNeighborModel.h | ||
void UpdateNetworkOutputDim() |
NearestNeighborModel.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FName GetBatchSizePropertyName() |
NearestNeighborModel.h | ||
static FName GetDecayFactorPropertyName() |
NearestNeighborModel.h | ||
static FName GetEarlyStopEpochsPropertyName() |
NearestNeighborModel.h | ||
static FName GetFileCacheDirectoryPropertyName() |
NearestNeighborModel.h | ||
static FName GetHiddenLayerDimsPropertyName() |
NearestNeighborModel.h | ||
static FName GetInputDimPropertyName() |
NearestNeighborModel.h | ||
static FName GetLearningRatePropertyName() |
NearestNeighborModel.h | ||
static FName GetNearestNeighborOffsetWeightPropertyName() |
NearestNeighborModel.h | ||
static FName GetNumBasisPerSectionPropertyName() |
NearestNeighborModel.h | ||
static FName GetNumIterationsPropertyName() |
NearestNeighborModel.h | ||
static FName GetOutputDimPropertyName() |
NearestNeighborModel.h | ||
static FName GetRBFSigmaPropertyName() |
NearestNeighborModel.h | ||
static FName GetSectionsPropertyName() |
NearestNeighborModel.h | ||
static FName GetUseDualQuaternionDeltasPropertyName() |
NearestNeighborModel.h | ||
static FName GetUseFileCachePropertyName() |
NearestNeighborModel.h | ||
static FName GetUsePCAPropertyName() |
NearestNeighborModel.h | ||
static FName GetUseRBFPropertyName() |
NearestNeighborModel.h |
Deprecated Variables
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ClothPartData_DEPRECATED | PRAGMA_DISABLE_DEPRECATION_WARNINGSTArray< FClothPartData > | NearestNeighborModel.h | ||
| NumEpochs_DEPRECATED | int32 | Max number of cycles iterated through the training set. | NearestNeighborModel.h |
|