PointNet pooling: one summary for a set
Read these first if they are new to you
- The multilayer perceptron (MLP) Intermediate
- Order doesn't matter: permutation invariance Intermediate
The idea in one paragraph
PointNet turns a point cloud into one vector of fixed size that does not depend on the order of the points. It applies the same small MLP to every point, which gives each point a vector of features. Then, for each feature, it keeps the largest value over all the points. This step is called max pooling. The result has the same size for 100 points or 100,000, and shuffling the points cannot change it.
A classifier needs one fixed-size vector, but a cloud has any size and no order
Say a network must name the object a point cloud shows: chair, lamp or plane. Its last layers expect one input vector of a fixed size. A cloud, though, can hold 500 points or 50,000, listed in any order. Writing all the coordinates into one long vector fails twice: the size changes from cloud to cloud, and the same shape listed in another order gives a different vector. As the permutation invariance unit explains, the summary must be permutation invariant.
PointNet, a network published in 2017 by Qi and colleagues, solves this in two steps.
Same MLP for every point, then the maximum of each feature
- Shared MLP. One MLP h, with one set of weights, maps each point p on its own to K features. A cloud of n points becomes a table of n rows and K columns. The rows follow the points: shuffle the points and the rows shuffle with them.
- Max pooling. For each column k, keep the largest value: gk = max over all points p of hk(p). The table becomes one vector g of K numbers: the summary of the cloud.
The maximum of a list does not depend on the list's order, and the shared MLP treats every point the same way. So g is the same for every order of the points. It holds K numbers, whatever n is. A second MLP then reads g and names the object.
Worked by hand: four points, three features
Use 2D points to keep the numbers small: A = (0, 0), B = (2, 0), C = (1, 2) and D = (1, 0.5). Let the shared "MLP" be one linear layer followed by ReLU, which keeps positive numbers and turns negative ones into 0. Its three features are
h(x, y) = ( ReLU(x), ReLU(y), ReLU(y − x) )
The third feature says how far a point sits above the diagonal line y = x.
Predict first. Which point will set the largest value of each feature? Will any point not matter at all?
| Point | feature 1: x | feature 2: y | feature 3: ReLU(y − x) |
|---|---|---|---|
| A = (0, 0) | 0 | 0 | 0 |
| B = (2, 0) | 2 | 0 | 0 (from −2) |
| C = (1, 2) | 1 | 2 | 1 |
| D = (1, 0.5) | 1 | 0.5 | 0 (from −0.5) |
| max | 2 | 2 | 1 |
The summary is g = (2, 2, 1). B sets feature 1, and C sets features 2 and 3. A and D set no maximum. You could move D a little, or delete it, and the summary would not change.
Shuffling the points cannot change the summary; moving a winner can
| List | Point | x | y | ReLU(y−x) |
|---|---|---|---|---|
| max | ||||
Try it. Predict first: will "Shuffle the list" change the max row? Press it a few times. Then drag point D around. Find a region where D can move without changing the max row, and a move of D that does change it.
Answer
Shuffling only reorders the rows, so the max row never changes. D can move anywhere with x below 2, y below 2 and y − x below 1 without changing the summary, because it never beats B or C. Drag D to the right of x = 2, above y = 2, or more than 1 above the diagonal, and it takes over a maximum. (You can also select a point and move it with the arrow keys.)
The maximum keeps the summary steady when points go missing
Any order-free way of combining the rows would work: the sum, the mean or the maximum. The PointNet authors compared max pooling with average pooling and with an attention-weighted sum on a shape classification task, and max pooling won by a large margin. They also showed why it is robust. With K features, at most K points can hold a maximum. They called these the critical points. Deleting any other point, or moving it a little, leaves the summary unchanged, so a cloud with a few missing or noisy points gets nearly the same summary.
Real sizes are larger than the example. The original PointNet used a shared MLP with layer widths 64, 64, 64, 128 and 1,024, so each cloud became a summary of 1,024 numbers. An MLP with widths 512 and 256 then picked the object's class.
pointnet_pool.py
import numpy as np
rng = np.random.default_rng(0)
W1 = rng.normal(size=(3, 64)) # a shared MLP: 3 -> 64 -> 128
W2 = rng.normal(size=(64, 128))
def h(P): # P holds one point per row
return np.maximum(0, P @ W1) @ W2
def pointnet_pool(P):
return h(P).max(axis=0) # the largest value of each feature
P = rng.normal(size=(500, 3)) # 500 points in 3D
g = pointnet_pool(P)
print(g.shape)
# Shuffle the points: np.allclose says whether the summary stays the same, up to rounding.
print(np.allclose(g, pointnet_pool(P[rng.permutation(500)])))
print(pointnet_pool(P[:50]).shape) # 50 points: same size
# argmax(axis=0) finds, for each feature, the point that holds its maximum.
# np.unique keeps each of those points once, and len counts them.
print(len(np.unique(h(P).argmax(axis=0)))) # how many points set a maximum
(128,) True (128,) 38
The last line counts the critical points: only 38 of the 500 points decide the 128 numbers of the summary.
The full PointNet also learns small "alignment" networks that rotate the input points and the features into a standard pose, and uses batch normalization between layers. A single maximum over the whole cloud also loses detail about local neighborhoods. Its successor, PointNet++, pools over small neighborhoods first, around centers picked by farthest-point sampling, and then pools those results. Attention offers another order-free summary: a learned query can read all the points with cross-attention, giving a weighted average instead of a maximum.
Check yourself
-
Work a similar problem. The points are (3, 1), (0, 4), (2, 3) and (1, 1), and the shared features are h(x, y) = (x, y, x + y). What is the summary, and which point does not matter?
Answer
Feature values: (3, 1, 4), (0, 4, 4), (2, 3, 5) and (1, 1, 2). The maxima are 3, 4 and 5, so the summary is (3, 4, 5). The point (1, 1) holds no maximum, so it does not matter.
-
A PointNet with K = 1,024 reads one cloud of 500 points and another of 50,000 points. How long is each summary?
Answer
1,024 numbers for both. The maximum is taken over the points, so the number of points disappears.
-
You replace the maximum with the mean. Is the summary still order-free? Which points now affect it?
Answer
Yes: a mean does not depend on order either. But now every point affects every number of the summary, so there are no critical points, and a stray noisy point shifts the summary a little.
Go further
Optional background, for readers who want more than this page.
-
PointNet: Deep Learning on Point Sets for 3D Classification and Segmentation, "Symmetry Function for Unordered Input" Qi, Su, Mo and Guibas (2017) Paper section Advanced
The original argument for a symmetric function instead of sorting the points or reading them in sequence. Section 5.2 has the comparison of max pooling with the other choices.
-
Review: Deep Learning on Sets, "Deep Sets" Fabian Fuchs, Ed Wagstaff and Martin Engelcke Article Advanced
Places PointNet in the larger family of "apply the same network to each element, then pool" models, and says what that family can and cannot represent.
Where this shows up
No unit or explanation builds on this one yet.