Lab 3 — PointNet on ModelNet10¶

Goal. Train a PointNet for 3D shape classification on ModelNet10. Evaluate the model's equivariance breakage by rotating test inputs.

What you ship. Notebook with a trained PointNet, a confusion matrix on ModelNet10 test, and a rotation-robustness curve showing accuracy as a function of test-time rotation angle.

Setup¶

Install the dependencies (one-time).

In [ ]:
# !pip install torch torch_geometric matplotlib scikit-learn
In [ ]:
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.datasets import ModelNet
from torch_geometric.loader import DataLoader
import torch_geometric.transforms as T
from sklearn.metrics import classification_report, confusion_matrix
import numpy as np

torch.manual_seed(42)
device = 'cuda' if torch.cuda.is_available() else 'cpu'

ModelNet10¶

The first run downloads ~50 MB.

In [ ]:
transform = T.Compose([T.SamplePoints(1024), T.NormalizeScale()])
train_ds = ModelNet(root='/tmp/ModelNet10', name='10', train=True,  transform=transform)
test_ds  = ModelNet(root='/tmp/ModelNet10', name='10', train=False, transform=transform)
print('classes:', train_ds.num_classes, 'train:', len(train_ds), 'test:', len(test_ds))

Exercise 1 — Implement a minimal PointNet¶

In [ ]:
# YOUR TURN
# Define a PointNet with: per-point MLP -> global max-pool -> classifier MLP.
# 3 input dims (xyz), 10 output classes.

Exercise 2 — Train and report test accuracy¶

In [ ]:
# YOUR TURN
# Train for 30 epochs with Adam(lr=1e-3). Report test accuracy and confusion matrix.

Exercise 3 — Rotation-robustness curve¶

In [ ]:
# YOUR TURN
# For theta in {0, 30, 60, 90, 120, 150, 180} degrees, rotate every test
# point cloud about a random axis and report classification accuracy.
# Plot the resulting curve.

Done?¶

Submit per the cohort schedule. Peer review pairing announced the following Monday.