Table of Contents

Class PointNet<T>

Namespace
AiDotNet.PointCloud.Models
Assembly
AiDotNet.dll

Implements the PointNet architecture for processing point cloud data.

public class PointNet<T> : NeuralNetworkBase<T>, INeuralNetworkModel<T>, IInterpretableModel<T>, IInputGradientComputable<T>, IDisposable, IPointCloudClassification<T>, IPointCloudModel<T>, INeuralNetwork<T>, IFullModel<T, Tensor<T>, Tensor<T>>, IModel<Tensor<T>, Tensor<T>, ModelMetadata<T>>, IModelSerializer, ICheckpointableModel, IParameterizable<T, Tensor<T>, Tensor<T>>, IFeatureAware, IFeatureImportance<T>, ICloneable<IFullModel<T, Tensor<T>, Tensor<T>>>, IGradientComputable<T, Tensor<T>, Tensor<T>>, IJitCompilable<T>

Type Parameters

T

The numeric type used for calculations (e.g., float, double).

Inheritance
PointNet<T>
Implements
IFullModel<T, Tensor<T>, Tensor<T>>
IModel<Tensor<T>, Tensor<T>, ModelMetadata<T>>
IParameterizable<T, Tensor<T>, Tensor<T>>
ICloneable<IFullModel<T, Tensor<T>, Tensor<T>>>
IGradientComputable<T, Tensor<T>, Tensor<T>>
Inherited Members
Extension Methods

Remarks

For Beginners: PointNet is a pioneering deep learning architecture designed to directly process point clouds.

Key innovations of PointNet: - Directly processes unordered point sets (no need to convert to voxels or images) - Permutation invariant: output doesn't change if you shuffle the input points - Learns both local and global features - Uses spatial transformer networks (T-Net) for alignment

Architecture overview: 1. Input transformation: T-Net learns to align input points 2. Multi-layer perceptron (MLP): Processes each point independently 3. Feature transformation: Another T-Net aligns learned features 4. More MLPs: Further feature extraction 5. Max pooling: Aggregates information from all points 6. Global feature vector: Represents the entire point cloud 7. Classification/Segmentation: Task-specific layers

Why it's important: - First successful deep learning approach for raw point clouds - Achieves state-of-the-art results on ModelNet40 classification - Foundation for many subsequent point cloud methods - Widely used in robotics, autonomous driving, and 3D vision

Reference: "PointNet: Deep Learning on Point Sets for 3D Classification and Segmentation" by Qi et al., CVPR 2017

Constructors

PointNet()

Initializes a new instance of the PointNet class with default options.

public PointNet()

PointNet(PointNetOptions, ILossFunction<T>?)

Initializes a new instance of the PointNet class with configurable options.

public PointNet(PointNetOptions options, ILossFunction<T>? lossFunction = null)

Parameters

options PointNetOptions

Configuration options for the PointNet model.

lossFunction ILossFunction<T>

Optional loss function for training.

PointNet(int, bool, bool, ILossFunction<T>?)

Initializes a new instance of the PointNet class.

public PointNet(int numClasses, bool useInputTransform = true, bool useFeatureTransform = true, ILossFunction<T>? lossFunction = null)

Parameters

numClasses int

Number of output classes for classification.

useInputTransform bool

Whether to use input transformation network (T-Net).

useFeatureTransform bool

Whether to use feature transformation network.

lossFunction ILossFunction<T>

Optional loss function for training.

Remarks

For Beginners: Creates a PointNet model for point cloud classification.

Properties

SupportsTraining

Indicates whether this network supports training (learning from data).

public override bool SupportsTraining { get; }

Property Value

bool

Remarks

For Beginners: Not all neural networks can learn. Some are designed only for making predictions with pre-set parameters. This property tells you if the network can learn from data.

Methods

Backpropagate(Tensor<T>)

Performs backpropagation to compute gradients for network parameters.

public override Tensor<T> Backpropagate(Tensor<T> outputGradient)

Parameters

outputGradient Tensor<T>

Returns

Tensor<T>

The gradients of the loss with respect to the network inputs.

Remarks

For Beginners: Backpropagation is how neural networks learn. After making a prediction, the network calculates how wrong it was (the error). Then it works backward through the layers to figure out how each parameter contributed to that error. This method handles that backward flow of information.

The "gradients" are numbers that tell us how to adjust each parameter to reduce the error.

API Change Note: The signature changed from Vector<T> to Tensor<T> to support multi-dimensional gradients. This is a breaking change. If you need backward compatibility, consider adding an overload that accepts Vector<T> and converts it internally to Tensor<T>.

Exceptions

InvalidOperationException

Thrown when the network is not in training mode or doesn't support training.

ClassifyPointCloud(Tensor<T>)

Classifies a point cloud into one of the predefined categories.

public Vector<T> ClassifyPointCloud(Tensor<T> pointCloud)

Parameters

pointCloud Tensor<T>

Input point cloud tensor of shape [N, 3+F].

Returns

Vector<T>

A vector of class probabilities of length C, where C is the number of classes.

Remarks

For Beginners: This method determines what object the point cloud represents.

The classification process:

  • Takes the entire point cloud as input
  • Processes all points together to understand the overall shape
  • Returns probabilities for each possible category

Example with furniture classification:

  • Input: Point cloud of a furniture piece
  • Output: [0.85 chair, 0.10 stool, 0.03 table, 0.02 bench]
  • The model predicts it's most likely a chair (85% confidence)

The returned probabilities sum to 1.0, allowing you to:

  • Pick the most likely category (highest probability)
  • Understand the model's confidence in its prediction
  • Consider alternative possibilities if the top prediction has low confidence

CreateNewInstance()

Creates a new instance of the same type as this neural network.

protected override IFullModel<T, Tensor<T>, Tensor<T>> CreateNewInstance()

Returns

IFullModel<T, Tensor<T>, Tensor<T>>

A new instance of the same neural network type.

Remarks

For Beginners: This creates a blank version of the same type of neural network.

It's used internally by methods like DeepCopy and Clone to create the right type of network before copying the data into it.

DeserializeNetworkSpecificData(BinaryReader)

Deserializes network-specific data that was not covered by the general deserialization process.

protected override void DeserializeNetworkSpecificData(BinaryReader reader)

Parameters

reader BinaryReader

The BinaryReader to read the data from.

Remarks

This method is called at the end of the general deserialization process to allow derived classes to read any additional data specific to their implementation.

For Beginners: Continuing the suitcase analogy, this is like unpacking that special compartment. After the main deserialization method has unpacked the common items (layers, parameters), this method allows each specific type of neural network to unpack its own unique items that were stored during serialization.

ExtractGlobalFeatures(Tensor<T>)

Extracts global features from a point cloud.

public Vector<T> ExtractGlobalFeatures(Tensor<T> pointCloud)

Parameters

pointCloud Tensor<T>

Input point cloud tensor of shape [N, 3+F] where N is number of points, and 3+F represents XYZ coordinates plus F additional features.

Returns

Vector<T>

A feature vector representing the global characteristics of the point cloud.

Remarks

For Beginners: This method extracts a compact representation of the entire point cloud.

It's like creating a summary or "fingerprint" of the 3D object:

  • Input: Many individual 3D points (could be thousands or millions)
  • Output: A single feature vector that captures the essential characteristics
  • This summary can be used for classification, detection, or comparison

For example, extracting global features from point clouds of chairs would produce similar feature vectors for all chairs, despite differences in specific details.

ExtractPointFeatures(Tensor<T>)

Extracts per-point features from a point cloud.

public Tensor<T> ExtractPointFeatures(Tensor<T> pointCloud)

Parameters

pointCloud Tensor<T>

Input point cloud tensor of shape [N, 3+F].

Returns

Tensor<T>

A tensor of shape [N, D] where D is the feature dimension for each point.

Remarks

For Beginners: This method extracts features for each individual point.

Unlike global features which summarize the entire cloud, per-point features describe each point:

  • Input: N points with XYZ coordinates
  • Output: N feature vectors, one for each point
  • Each feature vector captures local and contextual information about that point

This is useful for tasks like:

  • Point cloud segmentation (labeling each point)
  • Finding specific features or parts in the 3D data
  • Understanding the local geometry around each point

ForwardWithMemory(Tensor<T>)

Performs a forward pass through the network while storing intermediate values for backpropagation.

public override Tensor<T> ForwardWithMemory(Tensor<T> input)

Parameters

input Tensor<T>

The input data to the network.

Returns

Tensor<T>

The output of the network.

Remarks

For Beginners: This method passes data through the network from input to output, but also remembers all the intermediate values. This is necessary for the learning process, as the network needs to know these values when figuring out how to improve.

API Change Note: The signature changed from Vector<T> to Tensor<T> to support multi-dimensional inputs. This is a breaking change. For backward compatibility, consider adding an overload that accepts Vector<T> and converts it internally to Tensor<T>.

Exceptions

InvalidOperationException

Thrown when the network doesn't support training.

GetModelMetadata()

Gets the metadata for this neural network model.

public override ModelMetadata<T> GetModelMetadata()

Returns

ModelMetadata<T>

A ModelMetaData object containing information about the model.

InitializeLayers()

Initializes the layers of the neural network based on the architecture.

protected override void InitializeLayers()

Remarks

For Beginners: This method sets up all the layers in your neural network according to the architecture you've defined. It's like assembling the parts of your network before you can use it.

Predict(Tensor<T>)

Makes a prediction using the neural network.

public override Tensor<T> Predict(Tensor<T> input)

Parameters

input Tensor<T>

The input data to process.

Returns

Tensor<T>

The network's prediction.

Remarks

For Beginners: This is the main method you'll use to get results from your trained neural network. You provide some input data (like an image or text), and the network processes it through all its layers to produce an output (like a classification or prediction).

SerializeNetworkSpecificData(BinaryWriter)

Serializes network-specific data that is not covered by the general serialization process.

protected override void SerializeNetworkSpecificData(BinaryWriter writer)

Parameters

writer BinaryWriter

The BinaryWriter to write the data to.

Remarks

This method is called at the end of the general serialization process to allow derived classes to write any additional data specific to their implementation.

For Beginners: Think of this as packing a special compartment in your suitcase. While the main serialization method packs the common items (layers, parameters), this method allows each specific type of neural network to pack its own unique items that other networks might not have.

Train(Tensor<T>, Tensor<T>)

Trains the neural network on a single input-output pair.

public override void Train(Tensor<T> input, Tensor<T> expectedOutput)

Parameters

input Tensor<T>

The input data.

expectedOutput Tensor<T>

The expected output for the given input.

Remarks

This method performs one training step on the neural network using the provided input and expected output. It updates the network's parameters to reduce the error between the network's prediction and the expected output.

For Beginners: This is how your neural network learns. You provide: - An input (what the network should process) - The expected output (what the correct answer should be)

The network then:

  1. Makes a prediction based on the input
  2. Compares its prediction to the expected output
  3. Calculates how wrong it was (the loss)
  4. Adjusts its internal values to do better next time

After training, you can get the loss value using the GetLastLoss() method to see how well the network is learning.

UpdateParameters(Vector<T>)

Updates the network's parameters with new values.

public override void UpdateParameters(Vector<T> parameters)

Parameters

parameters Vector<T>

The new parameter values to set.

Remarks

For Beginners: During training, a neural network's internal values (parameters) get adjusted to improve its performance. This method allows you to update all those values at once by providing a complete set of new parameters.

This is typically used by optimization algorithms that calculate better parameter values based on training data.