๐ก ํ ์ค ์์ฝ#
DETR3D๋ ๋ช ์์ ๊น์ด(Depth) ์ถ์ ๋จ๊ณ๋ฅผ ๋ฐฐ์ ํ๊ณ , 3D Object Query์ ๊ฐ์ค ์ง์ (Reference Point)์ ์นด๋ฉ๋ผ ํฌ์ ํ๋ ฌ์ ์ด์ฉํด 2D ๋ฉํฐ๋ทฐ ํน์ง ๋งต์ ์ญํฌ์(Back-Projection) ๋ฐ ์ํ๋งํจ์ผ๋ก์จ NMS ํ์ฒ๋ฆฌ ์์ด End-to-End ๋ฉํฐ๋ทฐ 3D ๊ฐ์ฒด ํ์ง๋ฅผ ์คํํ๋ค.
๐ ๊ฐ์ ๋ฐ ํต์ฌ ๊ธฐ์ฌ (Key Contributions)#
- ์ ์: Yue Wang, Vitor Guizilini, Tianyuan Zhang, Yilun Wang, Hang Zhao, Justin Solomon (MIT, TRI, CMU, Li Auto, Tsinghua Univ.)
- ๋ฐํ๋ ๋: 2021 (arXiv:2110.06922, CoRL 2021)
- ์ฃผ์ ๊ธฐ์ฌ์ :
- Top-Down 3D-to-2D Query ์ญํฌ์ ์ํคํ ์ฒ: ์กฐ์ ํ ํฝ์ ๋ณ ๊น์ด ์ถ์ (Bottom-up) ์ค์ฐจ ๋์ ์ ํผํ๊ธฐ ์ํด 3D ๊ณต๊ฐ ์์ ๊ฐ์ฒด ์ฟผ๋ฆฌ๋ฅผ 2D ๋ฉํฐ๋ทฐ ์นด๋ฉ๋ผ ํน์ง ๋งต์ ์ง๊ด์ ์ผ๋ก ์ญํฌ์.
- End-to-End NMS-Free 3D ํ์ง: Hungarian Bipartite Matching ๊ธฐ๋ฐ์ Set-to-Set ์ค์ฐจ ์ต์ ํ๋ก ์ค๋ณต ๋ฐ์ค ์ ๊ฑฐ ํ์ฒ๋ฆฌ(NMS) ์์ ํ์ง.
- ์นด๋ฉ๋ผ ์ค์ฒฉ ์์ญ (Camera Overlap Area) ์ ๋ณด ๊ทน๋ํ: 6๊ฐ ๋ฉํฐ๋ทฐ ์นด๋ฉ๋ผ ๋ทฐ์ 3D ์ฟผ๋ฆฌ๊ฐ ๋์์ ์ฌ์๋ ๊ฒฝ์ฐ ํน์ง๋ค์ ๋ง์คํน ์ง๊ณ(Masked Aggregation)ํ์ฌ ๊ฒฝ๊ณ์ ์๊ณก ์ต์ํ.
๐ฏ ๊ด๋ จ ์ฐ๊ตฌ ํ๋ฆ ๋ฐ ๊ธฐ์กด ํ๊ณ (Related Work & Motivation)#
๊ด๋ จ ์ฐ๊ตฌ ํ๋ฆ#
- Pseudo-LiDAR (์ด๋ฏธ์ง $\to$ Depth $\to$ Point Cloud): 2D ์ด๋ฏธ์ง์์ ์ถ์ ํ ๊น์ด๊ฐ ์กฐ๊ธ๋ง ํ๋ ค๋ 3D ๊ณต๊ฐ ํฌ์ธํธ ์์น๊ฐ ํญ๋งํจ.
- Monocular 3D Detection (FCOS3D): ์นด๋ฉ๋ผ ๊ฐ ๋ทฐ๋ฅผ ๋ ๋ฆฝ ํ์งํ ํ ํ์ฒ๋ฆฌ NMS๋ก ๋ณํฉํ์ฌ ์นด๋ฉ๋ผ ๊ฐ ์ค์ฒฉ ์์ญ ์๋์ง ๋ฏธํก.
- DETR3D: 2D DETR์ Set Prediction ์์ด๋์ด๋ฅผ 3D ๊ธฐํํ ์ขํ ํฌ์๊ณ์ ์ง์ ๊ฒฐํฉํ์ฌ ์ต์ด์ NMS-Free ๋ฉํฐ๋ทฐ 3D ํ์ง๊ธฐ ์์ฑ.
๐ ๋ชฉ์ฐจ#
- Chapter 1: 3D Object Query ๋ฐ Reference Point ํฌ์ ์์
- Chapter 2: Bilinear ํน์ง ์ํ๋ง ๋ฐ ๋ง์คํน ์ง๊ณ (Masked Aggregation)
- Chapter 3: Iterative Refinement ํค๋ ๋ฐ ๋ฐ์ค ์์ธก
- Chapter 4: Hungarian Bipartite Matching ์์ค ํจ์
- Chapter 5: ์ฃผ์ ์คํ ๋ฐ ๊ฒฐ๊ณผ
- Chapter 6: ๊ฒฐ๋ก ๋ฐ ์์ฌ์
๐ ๏ธ Chapter 1: 3D Object Query ๋ฐ Reference Point ํฌ์ ์์#
1. ์์ฝ#
$N$๊ฐ์ ํ์ต ๊ฐ๋ฅํ 3D Object Query $\mathbf{q}_{\ell i} \in \mathbb{R}^C$๋ก๋ถํฐ 3D ๋ฌต์์ ๊ฐ์ค ์์น $\mathbf{c}_{\ell i} = (x, y, z)$๋ฅผ ํ๊ทํ ํ, 6๊ฐ ์นด๋ฉ๋ผ์ ํฌ์ ํ๋ ฌ $\mathbf{P}_m = \mathbf{K}_m \mathbf{E}_m$์ ๊ณฑํด 2D ํฝ์ ์ขํ $\mathbf{c}_{\ell m i}$๋ก ์ฌ์ํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$\mathbf{c}_{\ell i} = \Phi^{\text{ref}}(\mathbf{q}_{\ell i}) \in \mathbb{R}^3$$$$\mathbf{c}_{\ell m i} = \mathbf{P}_m (\mathbf{c}_{\ell i} \oplus 1) = \mathbf{K}_m \left( \mathbf{R}_m \mathbf{c}_{\ell i} + \mathbf{t}_m \right)$$- $\mathbf{c}_{\ell m i} = [u_{m,i} \cdot z_{m,i}, \ v_{m,i} \cdot z_{m,i}, \ z_{m,i}]^T$: $m$๋ฒ์งธ ์นด๋ฉ๋ผ 2D ์ฌ์ ๋์ฐจ ์ขํ
- $\mathbf{K}_m, \mathbf{E}_m$: $m$๋ฒ์งธ ์นด๋ฉ๋ผ์ ๋ด์ฌ ๋ฐ ์ธ์ฌ ๋ณํ ํ๋ ฌ
import torch
def project_3d_queries_to_multiview_images(
query_ref_pts: torch.Tensor, # (B, N_queries, 3) 3D ์ธ๊ณ ์ขํ๊ณ Reference Points
P_matrices: torch.Tensor, # (B, N_cams, 3, 4) 6๊ฐ ์นด๋ฉ๋ผ ํฌ์ ํ๋ ฌ
img_shape: tuple # (H, W)
) -> tuple:
"""
3D Query ์ ๋ค์ 6๊ฐ ๋ฉํฐ๋ทฐ 2D ์นด๋ฉ๋ผ ํ๋ฉด์ผ๋ก ์ญํฌ์ ๋ฐ ์ ํจ์ฑ ๋ง์คํน
"""
B, N_q, _ = query_ref_pts.shape
_, N_cams, _, _ = P_matrices.shape
H, W = img_shape
# 1. Homogeneous ์ขํ ๋ณํ (x, y, z, 1)
pts_3d_homo = torch.cat([query_ref_pts, torch.ones((B, N_q, 1), device=query_ref_pts.device)], dim=-1) # (B, N_q, 4)
# Broadcast ์ฌ์ (B, N_cams, N_q, 3)
pts_3d_expanded = pts_3d_homo.unsqueeze(1).repeat(1, N_cams, 1, 1)
P_expanded = P_matrices.unsqueeze(2).repeat(1, 1, N_q, 1, 1)
pts_2d_homo = torch.matmul(P_expanded, pts_3d_expanded.unsqueeze(-1)).squeeze(-1) # (B, N_cams, N_q, 3)
depths = pts_2d_homo[..., 2]
u = pts_2d_homo[..., 0] / (depths + 1e-6)
v = pts_2d_homo[..., 1] / (depths + 1e-6)
# 2. ํฝ์
์ ํจ ๋ง์คํฌ (depth > 0 ๋ฐ ์ด๋ฏธ์ง ๊ฒฝ๊ณ ๋ด ์กด์ฌ ์ฌ๋ถ)
mask = (depths > 0.1) & (u >= 0) & (u < W) & (v >= 0) & (v < H)
# ์ ๊ทํ ์ขํ [-1, 1] (Grid Sample ์ฉ)
norm_u = (u / W) * 2.0 - 1.0
norm_v = (v / H) * 2.0 - 1.0
coords_2d = torch.stack([norm_u, norm_v], dim=-1)
return coords_2d, mask # (B, N_cams, N_q, 2), (B, N_cams, N_q)
# --- ์ฌ์ฉ ์์ ---
q_pts = torch.randn(2, 900, 3)
P_cams = torch.eye(4)[:3, :].view(1, 1, 3, 4).repeat(2, 6, 1, 1)
uv_coords, valid_mask = project_3d_queries_to_multiview_images(q_pts, P_cams, (480, 640))
print("2D ์ฌ์ ์ ๊ทํ ์ขํ Shape:", uv_coords.shape, "Valid Mask True ๊ฐ์:", valid_mask.sum().item())๐ ๏ธ Chapter 2: Bilinear ํน์ง ์ํ๋ง ๋ฐ ๋ง์คํน ์ง๊ณ#
1. ์์ฝ#
์ญํฌ์๋ 2D ์ขํ ์์น์์ Bilinear Interpolation์ผ๋ก ๊ฐ ์นด๋ฉ๋ผ ํน์ง $f_{k, m}$์ ์ํ๋งํ ํ, ์ ํจ ๋ง์คํฌ $\sigma_{k, m, i}$๋ก ํ๊ท ๋ด์ด ์ฟผ๋ฆฌ ํน์ง $\mathbf{f}_i$๋ฅผ ๊ฐฑ์ ํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$\mathbf{f}_{\ell i} = \frac{1}{\sum_{k} \sum_{m} \sigma_{\ell k m i} + \epsilon} \sum_{k=1}^K \sum_{m=1}^{N_{\text{cams}}} \sigma_{\ell k m i} \cdot \text{BilinearSample}\Big( \mathcal{F}_{k, m}, \ \mathbf{c}_{\ell m i} \Big)$$$$\mathbf{q}_{(\ell+1) i} = \mathbf{q}_{\ell i} + \mathbf{f}_{\ell i}$$import torch
import torch.nn.functional as F
def sample_and_aggregate_multiview_features(
img_feats: torch.Tensor, # (B, N_cams, C, H, W) 6๊ฐ ์นด๋ฉ๋ผ 2D ํน์ง ๋งต
coords_2d: torch.Tensor, # (B, N_cams, N_q, 2) 2D ์ ๊ทํ ์ฌ์ ์ขํ
mask: torch.Tensor # (B, N_cams, N_q) ์ ํจ์ฑ ๋ง์คํฌ
) -> torch.Tensor:
"""
Bilinear Interpolation์ผ๋ก 6๊ฐ ์นด๋ฉ๋ผ ํน์ง ์ํ๋ง ํ Masked Averaging ์ง๊ณ
"""
B, N_cams, C, H, W = img_feats.shape
N_q = coords_2d.shape[2]
# 1. Grid Sample (B * N_cams, C, H, W) & (B * N_cams, N_q, 1, 2)
feats_flat = img_feats.view(B * N_cams, C, H, W)
grid_flat = coords_2d.view(B * N_cams, N_q, 1, 2)
sampled_flat = F.grid_sample(feats_flat, grid_flat, mode='bilinear', align_corners=True) # (B*N_cams, C, N_q, 1)
sampled = sampled_flat.view(B, N_cams, C, N_q).permute(0, 1, 3, 2) # (B, N_cams, N_q, C)
# 2. Masked Averaging
mask_expanded = mask.unsqueeze(-1).float() # (B, N_cams, N_q, 1)
masked_feats = sampled * mask_expanded
sum_feats = masked_feats.sum(dim=1) # (B, N_q, C)
count = mask_expanded.sum(dim=1).clamp(min=1e-5) # (B, N_q, 1)
aggregated_feat = sum_feats / count
return aggregated_feat
# --- ์ฌ์ฉ ์์ ---
f_img = torch.randn(2, 6, 256, 32, 32)
uv_in = torch.rand(2, 6, 900, 2) * 2.0 - 1.0
m_in = torch.randint(0, 2, (2, 6, 900)).bool()
print("์ง๊ณ๋ Query Feature Shape:", sample_and_aggregate_multiview_features(f_img, uv_in, m_in).shape)๐ ๏ธ Chapter 3: Hungarian Matching ๊ธฐ๋ฐ Set Loss ์์#
1. ์์ฝ#
NMS ํ์ฒ๋ฆฌ๋ฅผ ์ ๊ฑฐํ๊ธฐ ์ํด $N$๊ฐ ์์ธก๊ณผ $M$๊ฐ GT ์ฌ์ด์ Hungarian Bipartite Matching ์ค์ฐจ ํ๋ ฌ์ ๊ณ์ฐํ์ฌ 1:1 ๋งค์นญ ํ์ต์ ์ํํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$\mathcal{L}_{\text{box}}(\mathbf{b}, \hat{\mathbf{b}}) = \lambda_{\text{L1}} \sum_{j=1}^9 \left| b_j - \hat{b}_j \right|$$$$\mathcal{L}_{\text{sup}} = \sum_{j=1}^{N} \left[ -\log \hat{p}_{\sigma^*(j)}(c_j) + \mathbf{1}_{\{c_j \neq \varnothing\}} \mathcal{L}_{\text{box}}(\mathbf{b}_j, \hat{\mathbf{b}}_{\sigma^*(j)}) \right]$$import torch
import torch.nn.functional as F
def compute_detr3d_box_loss(
pred_boxes: torch.Tensor, # (N_matched, 9) -> (x, y, z, w, l, h, sin, cos, vx)
gt_boxes: torch.Tensor # (N_matched, 9)
) -> torch.Tensor:
"""
Hungarian ๋งค์นญ๋ 3D ๋ฐ์ด๋ฉ ๋ฐ์ค ๊ฐ์ L1 Loss
"""
loss_l1 = F.l1_loss(pred_boxes, gt_boxes, reduction='mean')
return loss_l1
# --- ์ฌ์ฉ ์์ ---
p_box = torch.randn(10, 9)
g_box = torch.randn(10, 9)
print("DETR3D 3D Box L1 Loss:", compute_detr3d_box_loss(p_box, g_box).item())๐ ์ฃผ์ ์คํ ๋ฐ ๊ฒฐ๊ณผ (Experiments & Results)#
1. nuScenes ํ ์คํธ์ 3D ํ์ง ์ฑ๊ณผ#
| ๋ฐฉ๋ฒ (Method) | NMS ํ์ ์ฌ๋ถ | NDS โ | mAP โ | mATE (์์น ์ค์ฐจ) โ |
|---|---|---|---|---|
| CenterNet-MultiView | ํ์ (NMS) | 0.328 | 0.252 | 0.812 |
| FCOS3D | ํ์ (NMS) | 0.428 | 0.358 | 0.690 |
| Pseudo-LiDAR | ํ์ (NMS) | 0.160 | 0.105 | 1.210 |
| DETR3D (Ours) | ๋ถํ์ (NMS-Free) | 0.479 | 0.412 | 0.647 |
- ๊ฒฐ๊ณผ: Top-down Query ์ญํฌ์ ์ ๊ทผ ๋ฐ NMS-Free ์ค๊ณ ๋๋ถ์ nuScenes ๋ฆฌ๋๋ณด๋ 1์ (0.479 NDS) ๋ฐ ์นด๋ฉ๋ผ ์ค์ฒฉ ์์ญ ์ธ์ง ๋ํญ ํฅ์.
๐ก ๊ฒฐ๋ก ๋ฐ ์์ฌ์ (Conclusion & Insights)#
1. ๊ฒฐ๋ก #
DETR3D๋ ๊น์ด ์ถ์ ์ค์ฐจ ๋์ ๊ณผ NMS ์ฐ์ฐ ๋ณ๋ชฉ์ด๋ผ๋ ๋ ๊ฐ์ง ๊ณ ์ง์ ๋์ ๋ฅผ 3D-to-2D Query ์ญํฌ์ ๊ธฐํํ ๋งคํ์ผ๋ก ํด์ํ๋ฉฐ ํ๋ BEV/Query 3D ํ์ง ์ฐ๊ตฌ์ ์ค์ํ ์ด์ ํ๋ฅผ ์ธ์ ์ต๋๋ค.
2. ํ๊ณ์ ๋ฐ ์์ฌ์ด ์ #
- ์ฌ์ ํ translation error(mATE)๊ฐ ๋์ ํธ โ depth ์ ๋ณด ์์ด ์์น๋ฅผ ์ ํํ ์ถ์ ํ๋ ๊ฒ์ ๊ทผ๋ณธ์ ์ธ ํ๊ณ๋ก ๋จ์ ์๋ค.
- sparse query ๋ฐฉ์์ด๋ผ denseํ ์ฅ๋ฉด ์ดํด(์: occupancy)์๋ ๊ทธ๋๋ก ์ ์ฉํ๊ธฐ ์ด๋ ต๋ค.
์ฐธ๊ณ ์๋ฃ#
๊ด๋ จ ๋ ผ๋ฌธ: DETR, Attention Is All You Need, BEVFormer, Lift Splat Shoot, nuScenes