๐ก ํ ์ค ์์ฝ#
PointNet์ “๋ก์ปฌ ์ฃผ๋ณ ๊ธฐํ ๊ตฌ์กฐ ๋ฏธ๋ฐ์” ํ๊ณ๋ฅผ ๊ทน๋ณตํ๊ธฐ ์ํด Farthest Point Sampling (FPS), Ball Query ๊ณต๊ฐ ํ์, Mini-PointNet ์ธ์ฝ๋ฉ์ ์์ง ๊ฒฐํฉํ ๊ณ์ธต์ Set Abstraction ๊ตฌ์กฐ์ ๋ฐ๋ ์ ์ํ ํผ์ฒ ์ถ์ถ(MSG/MRG)์ ์ ์ํ๋ค.
๐ ๊ฐ์ ๋ฐ ํต์ฌ ๊ธฐ์ฌ (Key Contributions)#
- ์ ์: Charles R. Qi, Li Yi, Hao Su, Leonidas J. Guibas (Stanford University)
- ๋ฐํ๋ ๋: 2017 (arXiv:1706.02413, NIPS 2017)
- ์ฃผ์ ๊ธฐ์ฌ์ :
- Set Abstraction (SA) ๊ณ์ธต ๊ตฌ์กฐ: Sampling(FPS) $\to$ Grouping(Ball Query) $\to$ Mini-PointNet ๊ณผ์ ์ ๊ฑฐ์ณ 2D CNN์ ์์ฉ ์์ญ(Receptive Field) ํ์ฅ ๊ณผ์ ์ 3D ๋น์ ํ ํฌ์ธํธ ๊ณต๊ฐ์ ์ฌํ.
- Multi-Scale Grouping (MSG) & Multi-Resolution Grouping (MRG): ๋ฐ๊ฒฝ $r_1, r_2, \dots$ ๋ค์ค ๋ฐ๊ฒฝ ๊ทธ๋ฃนํ ๋ฐ Random Input Dropout์ผ๋ก ๊ฑฐ๋ฆฌ/๋ฐ๋ ๋ถ๊ท ์ผ(Density Heterogeneity) ๋ฌธ์ ํด๊ฒฐ.
- Feature Propagation (FP) ์ญ๊ฑฐ๋ฆฌ ๋ณด๊ฐ: 3D Semantic Segmentation์ ์ํด kNN ์ญ๊ฑฐ๋ฆฌ ๊ฐ์ค์น(Inverse Distance Weighting) ๋ณด๊ฐ๊ณผ Skip Connection์ ์ตํฉํ ์ธ๋ฒํฐ๋ U-Net ์ค๊ณ.
๐ฏ ๊ด๋ จ ์ฐ๊ตฌ ํ๋ฆ ๋ฐ ๊ธฐ์กด ํ๊ณ (Related Work & Motivation)#
๊ด๋ จ ์ฐ๊ตฌ ํ๋ฆ#
- PointNet: ์ ์ญ ํฌ์ธํธ ์งํฉ ์ ์ฒด์ ํ ์ฐจ๋ก Max-Pooling๋ง ์ ์ฉํ๋ฏ๋ก ์ธ๋ฐํ ๋ก์ปฌ ์ด์์ ๊ณก๋ฅ , ์ฃ์ง, ํํธ ์ฐ๊ฒฐ ์ ๋ณด๋ฅผ ํ์ ํ์ง ๋ชปํจ.
- PointNet++: ๋ฉํธ๋ฆญ ๊ณต๊ฐ ์์ ๋ฐ๊ฒฝ $r$ ๊ตฌํ ์์ญ(Ball) ๋จ์๋ก ๊ตญ์ ์ ๋ค์ ์ค์ฒฉ ๋ฌถ์ด ๊ณ์ธต์ ๋ก์ปฌ ํน์ง ํ์ต ์์ฑ.
๐ ๋ชฉ์ฐจ#
- Chapter 1: Farthest Point Sampling (FPS) & Ball Query ์์
- Chapter 2: Set Abstraction (SA) ๋ชจ๋ ํ์ดํ๋ผ์ธ
- Chapter 3: Multi-Scale Grouping (MSG) ๋ฐ๋ ์ ์ ๋ชจ๋
- Chapter 4: Feature Propagation (FP) ์ญ๊ฑฐ๋ฆฌ ๊ฐ์ค์น ๋ณด๊ฐ
- Chapter 5: ์ฃผ์ ์คํ ๋ฐ ๊ฒฐ๊ณผ
- Chapter 6: ๊ฒฐ๋ก ๋ฐ ์์ฌ์
๐ ๏ธ Chapter 1: Farthest Point Sampling (FPS) & Ball Query ์์#
1. ์์ฝ#
์ ์ฒด ์ ์งํฉ $P$์์ ์ ๋ค ๊ฐ์ ์ต์ ์ ํด๋ฆฌ๋ ๊ฑฐ๋ฆฌ๊ฐ ์ต๋๊ฐ ๋๋ ์ ์ ์ค์ฌ์ $c_i$๋ฅผ ์ ํ(FPS)ํ๊ณ , ๋ฐ๊ฒฝ $r$ ๋ด $K$๊ฐ ์ ๋ค์ ๊ทธ๋ฃนํ(Ball Query)ํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$d(p_i, S) = \min_{s \in S} \| p_i - s \|_2, \quad p_{\text{next}} = \arg\max_{p_i \notin S} d(p_i, S)$$$$\text{BallQuery}(c, r, K) = \Big\{ x_i \;\Big|\; \| x_i - c \|_2 \leq r \Big\}_{i=1}^K$$import torch
def farthest_point_sampling(pts: torch.Tensor, npoint: int) -> torch.Tensor:
"""
PointNet++ Farthest Point Sampling (FPS)
pts: (B, N, 3)
return: (B, npoint) ์ ํ๋ ๋ ๋๋ง ์ค์ฌ์ ์ธ๋ฑ์ค
"""
B, N, C = pts.shape
centroids = torch.zeros(B, npoint, dtype=torch.long, device=pts.device)
distance = torch.ones(B, N, device=pts.device) * 1e10
farthest = torch.randint(0, N, (B,), dtype=torch.long, device=pts.device)
batch_indices = torch.arange(B, dtype=torch.long, device=pts.device)
for i in range(npoint):
centroids[:, i] = farthest
centroid = pts[batch_indices, farthest, :].unsqueeze(1) # (B, 1, 3)
dist = torch.sum((pts - centroid) ** 2, -1)
mask = dist < distance
distance[mask] = dist[mask]
farthest = torch.max(distance, -1)[1]
return centroids
# --- ์ฌ์ฉ ์์ ---
pts_input = torch.randn(2, 1024, 3)
fps_indices = farthest_point_sampling(pts_input, npoint=128)
print("FPS ์ ๋ณ 128๊ฐ ์ค์ฌ์ ์ธ๋ฑ์ค Shape:", fps_indices.shape)๐ ๏ธ Chapter 2: Set Abstraction (SA) ๋ชจ๋ ํ์ดํ๋ผ์ธ#
1. ์์ฝ#
์ค์ฌ์ $c$์ ๋ฌถ์ธ ์ด์ ์ $x_i$์ ์ขํ๋ฅผ ์ค์ฌ ์๋ ์ขํ $x_i - c$๋ก ์ ๊ทํํ๊ณ Mini-PointNet์ ํตํด ๊ณ ์ฐจ์ ๋ก์ปฌ ํน์ง์ผ๋ก ์์ถํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$x_i^{\text{relative}} = x_i - c$$$$\mathbf{f}_{\text{SA}} = \text{MaxPool}_{k=1 \dots K} \Big( \text{MLP}\big( [x_k - c \;;\; \mathbf{f}_k] \big) \Big)$$import torch
import torch.nn as nn
# farthest_point_sampling์ Chapter 1์์ ์ ์ํ ํจ์๋ฅผ ๊ทธ๋๋ก ์ฌ์ฉ
class PointNetSetAbstraction(nn.Module):
"""
PointNet++ Set Abstraction (SA) ๋ชจ๋: Sampling -> Grouping -> Mini-PointNet
"""
def __init__(self, npoint: int, radius: float, nsample: int, in_channel: int, mlp: list):
super().__init__()
self.npoint = npoint
self.radius = radius
self.nsample = nsample
layers = []
last_channel = in_channel + 3 # ์๋ ์ขํ (+3)
for out_channel in mlp:
layers.extend([
nn.Conv2d(last_channel, out_channel, 1),
nn.BatchNorm2d(out_channel),
nn.ReLU()
])
last_channel = out_channel
self.mlp = nn.Sequential(*layers)
def forward(self, xyz: torch.Tensor, points: torch.Tensor = None) -> tuple:
"""
xyz: (B, N, 3), points: (B, N, C_feat)
"""
B, N, _ = xyz.shape
# 1. Sampling: FPS๋ก ์ค์ฌ์ npoint๊ฐ ์ ํ
fps_idx = farthest_point_sampling(xyz, self.npoint) # (B, npoint)
batch_indices = torch.arange(B, device=xyz.device).view(B, 1).repeat(1, self.npoint)
new_xyz = xyz[batch_indices, fps_idx, :] # (B, npoint, 3)
# 2. Grouping: ๊ฐ ์ค์ฌ์ ๋ฐ๊ฒฝ(radius) ๋ด nsample๊ฐ ์ด์์ Ball Query๋ก ํ์
sqrdists = torch.sum((new_xyz.unsqueeze(2) - xyz.unsqueeze(1)) ** 2, dim=-1) # (B, npoint, N)
group_idx = torch.arange(N, device=xyz.device).view(1, 1, N).repeat(B, self.npoint, 1)
group_idx[sqrdists > self.radius ** 2] = N # ๋ฐ๊ฒฝ ๋ฐ ํฌ์ธํธ๋ N(๋๋ฏธ)์ผ๋ก ๋ง์คํน
group_idx = group_idx.sort(dim=-1)[0][:, :, :self.nsample] # ๊ฐ๊น์ด nsample๊ฐ๋ง ์ฑํ
group_first = group_idx[:, :, 0:1].repeat(1, 1, self.nsample)
mask = group_idx == N
group_idx[mask] = group_first[mask] # ๋ฐ๊ฒฝ ๋ด ํฌ์ธํธ๊ฐ ๋ถ์กฑํ๋ฉด ์ฒซ ์ด์์ผ๋ก ํจ๋ฉ
batch_indices_g = batch_indices.view(B, self.npoint, 1).repeat(1, 1, self.nsample)
grouped_xyz = xyz[batch_indices_g, group_idx, :] - new_xyz.unsqueeze(2) # ์ค์ฌ์ ๊ธฐ์ค ์๋์ขํ
if points is not None:
grouped_points = points[batch_indices_g, group_idx, :]
grouped_feat = torch.cat([grouped_xyz, grouped_points], dim=-1)
else:
grouped_feat = grouped_xyz
grouped_feat = grouped_feat.permute(0, 3, 1, 2) # (B, C_in+3, npoint, nsample)
feat = self.mlp(grouped_feat)
new_points, _ = torch.max(feat, dim=-1) # Max-Pooling over nsample
return new_xyz, new_points.permute(0, 2, 1)
# --- ์ฌ์ฉ ์์ ---
sa_module = PointNetSetAbstraction(npoint=128, radius=0.2, nsample=32, in_channel=0, mlp=[64, 128])
xyz_in = torch.randn(2, 1024, 3)
n_xyz, n_pts = sa_module(xyz_in)
print("SA ๋ชจ๋ ์ถ๋ ฅ ์ขํ Shape:", n_xyz.shape, "์ถ๋ ฅ ํน์ง Shape:", n_pts.shape)๐ ๏ธ Chapter 3: Multi-Scale Grouping (MSG) ๋ฐ๋ ์ ์ ๋ชจ๋#
1. ์์ฝ#
ํฌ์ธํธ ํด๋ผ์ฐ๋์ ๊ฑฐ๋ฆฌ๋ณ ๋ฐ๋ ๋ถ๊ท ์ผ์ฑ์ ์ฒ๋ฆฌํ๊ธฐ ์ํด ๋ฐ๊ฒฝ $r_1 < r_2 < r_3$ ์ธ ๊ตฌํ ์์ญ์ ๋์ ๊ทธ๋ฃนํํ ํ Concatํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$\mathbf{f}_{\text{MSG}} = \text{Concat}\Big( \text{SA}_{r_1}(X), \; \text{SA}_{r_2}(X), \; \dots, \; \text{SA}_{r_M}(X) \Big)$$import torch
import torch.nn as nn
class MultiScaleGroupingModule(nn.Module):
"""
PointNet++ Multi-Scale Grouping (MSG) ๋ชจ๋
"""
def __init__(self, sa_list: list):
super().__init__()
self.sa_modules = nn.ModuleList(sa_list)
def forward(self, xyz: torch.Tensor, points: torch.Tensor = None) -> tuple:
new_xyz = None
outputs = []
for sa in self.sa_modules:
new_xyz, feat = sa(xyz, points)
outputs.append(feat)
# ๋ค์ค ์ค์ผ์ผ ํน์ง Concat
fused_msg_features = torch.cat(outputs, dim=-1)
return new_xyz, fused_msg_features
# --- ์ฌ์ฉ ์์ ---
sa1 = PointNetSetAbstraction(npoint=128, radius=0.1, nsample=16, in_channel=0, mlp=[32, 64])
sa2 = PointNetSetAbstraction(npoint=128, radius=0.2, nsample=32, in_channel=0, mlp=[64, 128])
msg_module = MultiScaleGroupingModule([sa1, sa2])
xyz_in = torch.randn(2, 1024, 3)
_, msg_out = msg_module(xyz_in)
print("MSG ๋ค์ค ์ค์ผ์ผ ์ตํฉ ํน์ง Shape:", msg_out.shape)๐ ๏ธ Chapter 4: Feature Propagation (FP) ์ญ๊ฑฐ๋ฆฌ ๊ฐ์ค์น ๋ณด๊ฐ#
1. ์์ฝ#
์ถ์๋ ์ $N'$์์ ์๋ณธ $N$๊ฐ ์ ์ผ๋ก ํน์ง์ ๋ณต์ํ๊ธฐ ์ํด $k=3$ ์ต๊ทผ์ ์ด์ ์ ๋ค์ ์ญ๊ฑฐ๋ฆฌ ๊ฐ์ค์น(Inverse Distance Weighting) $w_i$๋ก ๋ณด๊ฐ(Interpolation)ํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$f^{(j)}(x) = \frac{\sum_{i=1}^k w_i(x) f_i^{(j)}}{\sum_{i=1}^k w_i(x)}, \quad w_i(x) = \frac{1}{d(x, x_i)^p}$$import torch
def inverse_distance_weighted_interpolation(
sparse_xyz: torch.Tensor, # (B, N_sparse, 3)
sparse_feat: torch.Tensor,# (B, N_sparse, C)
dense_xyz: torch.Tensor, # (B, N_dense, 3)
k: int = 3,
p: int = 2
) -> torch.Tensor:
"""
PointNet++ Feature Propagation (FP): ์ญ๊ฑฐ๋ฆฌ ๊ฐ์ค์น (p=2) ๊ธฐ๋ฐ kNN ๋ณด๊ฐ
"""
B, N_dense, _ = dense_xyz.shape
dists = torch.cdist(dense_xyz, sparse_xyz) # (B, N_dense, N_sparse)
dists, idxs = torch.topk(dists, k=k, dim=-1, largest=False) # ์์ k๊ฐ ์ต์ ๊ฑฐ๋ฆฌ
weights = 1.0 / (dists ** p + 1e-8)
norm_weights = weights / torch.sum(weights, dim=-1, keepdim=True) # (B, N_dense, k)
# 3๊ฐ ์ด์ ํน์ง ๊ฐ์คํฉ
interpolated_feat = torch.zeros(B, N_dense, sparse_feat.shape[-1], device=sparse_xyz.device)
for b in range(B):
for i in range(k):
interpolated_feat[b] += norm_weights[b, :, i:i+1] * sparse_feat[b, idxs[b, :, i], :]
return interpolated_feat
# --- ์ฌ์ฉ ์์ ---
s_xyz = torch.randn(2, 128, 3)
s_feat = torch.randn(2, 128, 64)
d_xyz = torch.randn(2, 1024, 3)
interp_res = inverse_distance_weighted_interpolation(s_xyz, s_feat, d_xyz)
print("FP ์ญ๊ฑฐ๋ฆฌ ๋ณด๊ฐ์ผ๋ก ๋ณต์๋ ํน์ง Shape:", interp_res.shape)๐ ์ฃผ์ ์คํ ๋ฐ ๊ฒฐ๊ณผ (Experiments & Results)#
1. ModelNet40 ๋ฐ ScanNet ๋ฒค์น๋งํฌ ์ฑ๋ฅ ๋น๊ต#
| ์๊ณ ๋ฆฌ์ฆ (Method) | ๋ํ ์ ๋ ฅ ํํ | ๋ถ๋ฅ ์ ํ๋ (ModelNet40) โ | ์ธ๊ทธ๋ฉํ ์ด์ mIoU (ScanNet) โ |
|---|---|---|---|
| PointNet (Vanilla) | Point Cloud | 89.2% | 73.0% |
| PointNet++ (SSG) | Point Cloud | 91.5% | 81.2% |
| PointNet++ (MSG+DP) | Point Cloud (Multi-Scale) | 91.9% (+2.7%) | 84.5% (+11.5%) |
- ๊ฒฐ๊ณผ: PointNet ๋๋น ๋ก์ปฌ ๊ณ์ธต ์ธ์ฝ๋ฉ ๋๋ถ์ ScanNet 3D Segmentation mIoU +11.5%p ํญ๋ฐ์ ๋ํญ ์์น.
๐ก ๊ฒฐ๋ก ๋ฐ ์์ฌ์ (Conclusion & Insights)#
1. ๊ฒฐ๋ก #
PointNet++๋ ํฌ์ธํธ ํด๋ผ์ฐ๋ ์์์ ๊ณ์ธต์ 3D ์์ฉ ์์ญ(Receptive Field)์ ์ ๋ฆฝํ 3D ๋น์ ๋ถ์ผ์ ํ์ค ์ธ์ฝ๋ ๊ตฌ์กฐ์ ๋๋ค.
2. ์์จ์ฃผํ ๊ด๋ จ ์์ฌ์ #
- LiDAR ์ผ์ ๋ชจ๋ธ๋ง: ์ค์ LiDAR๋ ๊ฑฐ๋ฆฌ์ ๋ฐ๋ผ ํฌ์ธํธ ๋ฐ๋๊ฐ ๋ฌ๋ผ์ง๋ค. PointNet++์ MSG/MRG๋ ์ด ๋ถ๊ท ์ผ์ฑ์ ๋ช ์์ ์ผ๋ก ์ฒ๋ฆฌ โ ์๋ฎฌ๋ ์ดํฐ์์ ์์ฑํ ๊ท ์ผ ๋ฐ๋ ํฌ์ธํธ ํด๋ผ์ฐ๋์ ์ค์ ๋ฐ์ดํฐ ์ฌ์ด์ ๋๋ฉ์ธ ๊ฐญ์ ์ค์ด๋ ์์ด๋์ด๋ก ํ์ฉ ๊ฐ๋ฅํ๋ค.
- CenterPoint, PointPillars์์ ๊ด๊ณ: ๋ ๋ ผ๋ฌธ ๋ชจ๋ LiDAR ํฌ์ธํธ๋ฅผ BEV ๊ฒฉ์๋ก ๋ณํํ์ฌ CNN์ ์ ์ฉํ๋ค. PointNet++๋ “๊ฒฉ์ ๋ณํ ์์ด” ์ง์ ํฌ์ธํธ๋ฅผ ์ฒ๋ฆฌํ๋ ๋์์ผ๋ก, ์ธ๋ฐํ ๊ธฐํ ์ ๋ณด ๋ณด์กด์ ์ ๋ฆฌํ๋ค.
- ์ธ๊ทธ๋ฉํ ์ด์ ์์ฉ: Feature Propagation์ ๋ณด๊ฐ + skip connection ์์ด๋์ด๋ ์ดํ 3D ์๋ฏธ๋ก ์ ์ธ๊ทธ๋ฉํ ์ด์ (ScanNet ๋ฑ) ๋ชจ๋ธ์ ํ์ค ๊ตฌ์กฐ๋ก ์ ์ฐฉํ๋ค.
3. ํ๊ณ์ ๋ฐ ์์ฌ์ด ์ #
- MSG๋ ๊ณ์ฐ ๋น์ฉ์ด ๋์. ์ ์๋ค๋ inference ์๋ ํฅ์์ ํฅํ ๊ณผ์ ๋ก ๋ช ์ โ ์ดํ PointPillars, CenterPoint๊ฐ ์๋ ์ฐ์ ์ค๊ณ๋ก ์ค์ฉํ.
- FPS์ ์์ฐจ์ ์ต์์ ํ์์ ๋ณ๋ ฌํ๊ฐ ์ด๋ ค์ ๋๊ท๋ชจ ์ค์๊ฐ ํฌ์ธํธ ํด๋ผ์ฐ๋ ์ฒ๋ฆฌ์๋ ์ฌ์ ํ ๋ถ๋ด์ด ๋จ.
- Set Abstraction ๋ ๋ฒจ ์, ๋ฐ๊ฒฝ ๋ฑ ํ์ดํผํ๋ผ๋ฏธํฐ์ ์ฑ๋ฅ์ด ๋ฏผ๊ฐํ๋ค๋ ์ ์ ์ค๋ฌด ์ ์ฉ ์ ์ถ๊ฐ ํ๋ ๋ถ๋ด์ผ๋ก ๋จ์.
์ฐธ๊ณ ์๋ฃ#
๊ด๋ จ ๋ ผ๋ฌธ: PointNet, PointPillars, CenterPoint