Classifying 3D point clouds is a fundamental problem in computer vision. From my experience as a Python Keras developer, PointNet stands out as an elegant solution that handles unordered point sets directly.
In this guide, I’ll walk you through building a PointNet model for point cloud classification using Keras. You’ll get complete code snippets for every step, making it easy to build and train your own model.
What is PointNet and Why Use Keras?
PointNet is a neural network architecture designed to process raw point clouds without the need for voxelization or mesh conversion. It respects the permutation invariance of points.
Keras simplifies building and training such models with its intuitive API and TensorFlow backend, making it a great choice for implementing PointNet.
Method 1: Build the PointNet Classification Model in Keras
This method explains how to create the core PointNet architecture for classifying 3D point clouds.
Step 1: Import Required Libraries
Import the essential TensorFlow and NumPy libraries required for building PointNet.
import tensorflow as tf
from tensorflow.keras import layers, models
import numpy as npStep 2: Define the Input Transformation Network (T-Net)
The T-Net learns a spatial transformation matrix to align input points, improving model robustness.
def tnet(inputs, k=3):
x = layers.Conv1D(64, 1, activation='relu')(inputs)
x = layers.BatchNormalization()(x)
x = layers.Conv1D(128, 1, activation='relu')(x)
x = layers.BatchNormalization()(x)
x = layers.Conv1D(1024, 1, activation='relu')(x)
x = layers.BatchNormalization()(x)
x = layers.GlobalMaxPooling1D()(x)
x = layers.Dense(512, activation='relu')(x)
x = layers.BatchNormalization()(x)
x = layers.Dense(256, activation='relu')(x)
x = layers.BatchNormalization()(x)
init = tf.keras.initializers.Zeros()
x = layers.Dense(k * k, kernel_initializer='zeros', bias_initializer=init)(x)
x = layers.Reshape((k, k))(x)
identity = tf.eye(k, batch_shape=[tf.shape(inputs)[0]])
x = layers.Add()([x, identity])
return xStep 3: Build the PointNet Classification Model
Construct the full PointNet classification model using transformation and MLP layers.
def create_pointnet_classification(num_points=1024, num_classes=10):
inputs = layers.Input(shape=(num_points, 3))
# Input transform
tnet1 = tnet(inputs, k=3)
x = layers.Dot(axes=(2,1))([inputs, tnet1])
# MLP (64, 64)
x = layers.Conv1D(64, 1, activation='relu')(x)
x = layers.BatchNormalization()(x)
x = layers.Conv1D(64, 1, activation='relu')(x)
x = layers.BatchNormalization()(x)
# Feature transform
tnet2 = tnet(x, k=64)
x = layers.Dot(axes=(2,1))([x, tnet2])
# MLP (64, 128, 1024)
x = layers.Conv1D(64, 1, activation='relu')(x)
x = layers.BatchNormalization()(x)
x = layers.Conv1D(128, 1, activation='relu')(x)
x = layers.BatchNormalization()(x)
x = layers.Conv1D(1024, 1, activation='relu')(x)
x = layers.BatchNormalization()(x)
# Global feature vector
x = layers.GlobalMaxPooling1D()(x)
# Fully connected layers
x = layers.Dense(512, activation='relu')(x)
x = layers.BatchNormalization()(x)
x = layers.Dropout(0.3)(x)
x = layers.Dense(256, activation='relu')(x)
x = layers.BatchNormalization()(x)
x = layers.Dropout(0.3)(x)
outputs = layers.Dense(num_classes, activation='softmax')(x)
model = models.Model(inputs=inputs, outputs=outputs)
return model
model = create_pointnet_classification()
model.summary()You can refer to the screenshot below to see the output.

This method sets up a complete PointNet pipeline for classifying 3D point cloud data.
Method 2: Train the PointNet Model on Dummy Data
This method shows how to generate dummy point cloud data and train the classification model.
Step 1: Generate Dummy Point Cloud Data
Generate a synthetic dataset of random point clouds and labels for testing the training pipeline.
num_points = 1024
num_classes = 10
num_samples = 200
# Random 3D points
X_train = np.random.rand(num_samples, num_points, 3).astype(np.float32)
# Random class labels
y_train = np.random.randint(0, num_classes, size=(num_samples,))Step 2: Compile and Train the Model
Compile the model with a standard classification setup and train it using the dummy data.
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
model.fit(X_train, y_train, epochs=15, batch_size=16)You can refer to the screenshot below to see the output.

This method verifies that the PointNet model trains correctly by running it on simple, artificially generated point cloud data.
Tips for Point Cloud Classification with Keras
- Normalize point clouds to zero mean and unit sphere for consistent input.
- Apply data augmentation such as random rotation and jitter to improve generalization.
- Adjust dropout and batch size based on dataset size for stable training.
PointNet is a powerful and efficient architecture for point cloud classification. Implementing it in Python Keras allows quick experimentation and deployment.
The methods here provide a solid foundation to build your own models and customize them for specific 3D classification tasks.
Other Python Keras articles you may also like:
- Keypoint Detection with Transfer Learning in Keras
- Object Detection Using Vision Transformers in Keras
- Monocular Depth Estimation Using Keras
- Monocular Depth Estimation Using Keras

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.