SpiralNet<T>
Models & Types · AiDotNet.NeuralNetworks
Implements the SpiralNet++ architecture for mesh-based deep learning.
Inheritance: NeuralNetworkBase<T> → DeclaredModelLayoutBase<T> → GraphModelLayoutBase<T> → SpiralNet<T>
For Beginners
SpiralNet++ is designed for learning from 3D mesh data.
Key concepts:
- Mesh: A 3D surface made of vertices connected by edges/triangles
- Spiral ordering: A consistent way to visit vertex neighbors (like a clock hand)
- Spiral convolution: Apply weights to neighbors in spiral order
How it works:
- For each vertex, define a spiral ordering of its neighbors
- Gather neighbor features in spiral order
- Apply learned weights to the gathered features
- Pool vertices to create hierarchical representations
- Classify or segment the mesh
Applications:
- 3D face reconstruction and expression recognition
- Human body shape analysis
- Medical surface analysis (organs, bones)
- CAD model classification
How It Works
SpiralNet++ processes 3D meshes by applying convolutions along spiral sequences of vertex neighbors. This creates translation-equivariant operations on irregular mesh structures without requiring mesh registration.
Reference: “SpiralNet++: A Fast and Highly Efficient Mesh Convolution Operator” by Gong et al.
Example
var options = new SpiralNetOptions { InputFeatures = 3, SpiralLength = 9 };
var vertexFeatures = Tensor<float>.CreateRandom(new[] { 1, 500, 3 });
var trainX = Tensor<float>.CreateRandom(4, 8);
var trainY = Tensor<float>.CreateRandom(4, 2);
var result = new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
.ConfigureModel(new SpiralNet<float>(options))
.Build(trainX, trainY);
var output = result.Predict(vertexFeatures);
Constructors
| Constructor | Summary |
|---|---|
SpiralNet() |
Initializes a new instance of the SpiralNet class with default options. |
SpiralNet(SpiralNetOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) |
Initializes a new instance of the SpiralNet class with specified options. |
SpiralNet(int numClasses, ILossFunction<T> lossFunction) |
Initializes a new instance of the SpiralNet class with simple parameters. |
Properties
| Property | Summary |
|---|---|
int InputFeatures { get; } |
Gets the number of input features per vertex. |
int NumClasses { get; } |
Gets the number of output classes for classification. |
int SpiralLength { get; } |
Gets the spiral sequence length. |
int[] ConvChannels { get; } |
Gets the channel configuration for spiral convolution layers. |
Methods
| Method | Summary |
|---|---|
List<T> Train(List<Tensor<T>> meshFeatures, List<int[]> spiralIndices, List<int> labels, int epochs, T learningRate) |
Trains the network on mesh data. |
ModelMetadata<T> GetModelMetadata() |
Gets metadata about this model. |
Tensor<T> Forward(Tensor<T> input) |
Performs a forward pass through the network. |
Vector<T> PredictProbabilities(Tensor<T> meshFeatures, int[] meshSpiralIndices) |
Serializes network-specific data. |
int PredictClass(Tensor<T> meshFeatures, int[] meshSpiralIndices) |
Predicts the class for a single mesh. |
void SetMultiResolutionSpiralIndices(List<int[]> spiralIndicesPerLevel) |
Sets spiral indices for multiple resolution levels (for hierarchical processing). |
void SetSpiralIndices(int[] spiralIndices) |
Sets the spiral indices for the current mesh being processed. |
void UpdateParameters(T learningRate) |
Updates network parameters using the optimizer. |