MeshCNN<T>
Models & Types · AiDotNet.NeuralNetworks
Implements the MeshCNN architecture for processing 3D triangle meshes.
Inheritance: NeuralNetworkBase<T> → DeclaredModelLayoutBase<T> → GraphModelLayoutBase<T> → MeshCNN<T>
For Beginners
MeshCNN processes 3D shapes represented as triangle meshes.
Key concepts:
- Mesh: A 3D surface made of connected triangles (vertices + faces)
- Edge: A line segment connecting two vertices, shared by up to 2 faces
- Edge features: Properties like dihedral angle, edge ratios, face angles
How it works:
- Extract edge features from the mesh (5 features per edge by default)
- Apply edge convolutions to learn patterns in edge neighborhoods
- Pool edges by removing less important ones (simplifies the mesh)
- Repeat conv + pool to build hierarchical features
- Aggregate edge features for classification/segmentation
Applications:
- 3D shape classification (e.g., recognize chair vs table)
- Mesh segmentation (label each part of a 3D model)
- Shape retrieval (find similar 3D models)
How It Works
MeshCNN is a deep learning architecture that operates directly on 3D mesh data by treating edges as the fundamental unit of computation. This enables learning from the mesh structure itself rather than converting to voxels or point clouds.
Reference: “MeshCNN: A Network with an Edge” by Hanocka et al., SIGGRAPH 2019
Example
var options = new MeshCNNOptions { InputFeatures = 5};
var edgeFeatures = Tensor<float>.CreateRandom(new[] { 1, 500, 5 });
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 MeshCNN<float>(options))
.Build(trainX, trainY);
var output = result.Predict(edgeFeatures);
Constructors
| Constructor | Summary |
|---|---|
MeshCNN() |
Initializes a new instance of the MeshCNN class with default options. |
MeshCNN(MeshCNNOptions options, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction) |
Initializes a new instance of the MeshCNN class with specified options. |
MeshCNN(int numClasses, ILossFunction<T> lossFunction) |
Initializes a new instance of the MeshCNN class with simple parameters. |
Properties
| Property | Summary |
|---|---|
int InputFeatures { get; } |
Gets the number of input features per edge. |
int NumClasses { get; } |
Gets the number of output classes for classification. |
int[] ConvChannels { get; } |
Gets the channel configuration for edge convolution layers. |
int[] PoolTargets { get; } |
Gets the pooling targets for mesh simplification. |
Methods
| Method | Summary |
|---|---|
Dictionary<string, Tensor<T>> GetNamedLayerActivations(Tensor<T> input) |
|
ModelMetadata<T> GetModelMetadata() |
Gets metadata about this model. |
Tensor<T> Forward(Tensor<T> input) |
Performs a forward pass through the network. |
Tensor<T> ForwardForTraining(Tensor<T> input) |
|
void SetEdgeAdjacency(int[] edgeAdjacency) |
Sets the edge adjacency for the current mesh being processed. |