๐ก ํ ์ค ์์ฝ#
StreamMapNet์ ํด๋ฆฌ๋ผ์ธ ์ ์ฒด ์ ์ ์ฐธ์กฐ์ ์ผ๋ก ํ์ฉํ๋ Multi-Point Attention๊ณผ ๋ฉ๋ชจ๋ฆฌ ์ค๋ฒํค๋ ์์ด ์ฅ๊ธฐ ์ด๋ ฅ์ ์ตํฉํ๋ **Streaming Temporal Fusion (Query Propagation + ConvGRU BEV Warping)**์ ๊ฒฐํฉํ์ฌ ๋์ ์ธ์ ๋ฒ์(100m $\times$ 50m)์์๋ 14.2 FPS์ ์ค์๊ฐ ๋งต ๊ตฌ์ถ SOTA๋ฅผ ๋ฌ์ฑํ๋ค.
๐ ๊ฐ์ ๋ฐ ํต์ฌ ๊ธฐ์ฌ (Key Contributions)#
- ์ ์: Tianyuan Yuan, Yicheng Liu, Yue Wang, Yilun Wang, Hang Zhao (Tsinghua Univ., USC)
- ๋ฐํ๋ ๋: 2024 (arXiv:2308.12570, WACV 2024)
- ์ฃผ์ ๊ธฐ์ฌ์ :
- Multi-Point Attention: ์ค์ฌ์ 1๊ฐ๋ง ๋ณด๋ ๊ธฐ์กด Deformable Attention์ ํ๊ณ๋ฅผ ๊ทน๋ณตํ๊ณ , ํด๋ฆฌ๋ผ์ธ $N_p$๊ฐ ์ ์ ์ฒด๋ฅผ Reference Point๋ก ์ง์ ํ์ฌ ๋น๊ตญ์(Non-Local) ๋์ ๋๋ก ์ ํ ํน์ง ์์ง.
- Streaming Temporal Fusion: ์์ $k$๊ฐ ์ฟผ๋ฆฌ์ ์์น/์๋ฏธ๋ฅผ ์ ํํ๋ Query Propagation๊ณผ ๋ฐ์ง BEV ํน์ง ๋งต์ ์์ฐจ ์ด๋์ผ๋ก ์ ๋ ฌํ ๋ค ์ตํฉํ๋ ConvGRU ๋ ์ง์คํฐ๋ก ์ฅ๊ธฐ ๊ธฐ์ต ๋ณด์กด.
- ์ง๋ฆฌ์ ์์น ๋์ถ ์๋ ๊ณต์ ํ Split ๊ตฌ์ถ: ๊ธฐ์กด nuScenes(85% ๊ฒน์นจ) ๋ฐ Argoverse2(54% ๊ฒน์นจ) ์ฃผํ ๊ฒ์ฆ ์์ญ ์์น ๋์ถ(Data Leakage)์ ๊ท๋ช ํ๊ณ 0% ๊ฒน์นจ ์ Geographic Split ์ ์.
๐ฏ ๊ด๋ จ ์ฐ๊ตฌ ํ๋ฆ ๋ฐ ๊ธฐ์กด ํ๊ณ (Related Work & Motivation)#
๊ด๋ จ ์ฐ๊ตฌ ํ๋ฆ#
- ๋จ์ผ ํ๋ ์ HD Map ๋ชจ๋ธ (VectorMapNet, MapTR): ํ๋ ์ ๋ ๋ฆฝ ์์ธก์ผ๋ก ์ธํด ๋คํํธ๋ญ์ด๋ ๋ํ ์ฐจ๋์ ๊ฐ๋ ค์ง(Occluded) ๋๋ก ์ ํ์ ๋ณต์ํ์ง ๋ชปํจ.
- Stacking ์๊ฐ ์ตํฉ (BEVDet4D): ๊ณผ๊ฑฐ ํ๋ ์์ ๋จ์ Concatenateํ์ฌ ํ๋ ์ ์๊ฐ ์ฆ๊ฐํจ์ ๋ฐ๋ผ ๋ฉ๋ชจ๋ฆฌ/์ง์ฐ์๊ฐ์ด $\mathcal{O}(T)$๋ก ์ฆ๊ฐ.
- StreamMapNet: ํ๋ ์ ์์ ๋ฌด๊ดํ $\mathcal{O}(1)$ ์์ ๋น์ฉ์ผ๋ก ์คํธ๋ฆฌ๋ฐ ์ฐ์ HD ๋งต ๊ตฌ์ถ.
๐ ๋ชฉ์ฐจ#
- Chapter 1: Multi-Point Attention (๋น๊ตญ์ ํด๋ฆฌ๋ผ์ธ ์ดํ ์ )
- Chapter 2: Streaming Query Propagation & ์์ฐจ ์ขํ๊ณ ๋ณด์
- Chapter 3: BEV Spatial Warping & ConvGRU ์๊ฐ ์ตํฉ
- Chapter 4: ๋ค์ค ํ์คํฌ ํ์ต ์์ค ๋ฐ Polyline Match Loss
- Chapter 5: ์ฃผ์ ์คํ ๋ฐ ๊ฒฐ๊ณผ
- Chapter 6: ๊ฒฐ๋ก ๋ฐ ์์ฌ์
๐ ๏ธ Chapter 1: Multi-Point Attention ์์#
1. ์์ฝ#
ํด๋ฆฌ๋ผ์ธ์ ๊ตฌ์ฑํ๋ $N_p$๊ฐ ์ ์ขํ $P_i^j$ ๊ฐ๊ฐ์ Deformable Reference Point๋ก ์ผ๊ณ ์ฃผ๋ณ $N_{\text{off}}$๊ฐ ์คํ์ ํผ์ฒ๋ฅผ ์ง๊ณํ์ฌ ๊ธธ๊ณ ๊ณก๋ฅ ์ด ํฐ ๋๋ก ๊ฒฝ๊ณ๋ฅผ ํ ๋ฒ์ ํฌ์ฐฉํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$Q_i = \sum_{j=1}^{N_p} \sum_{k=1}^{N_{\text{off}}} W_i^{(j-1) \cdot N_{\text{off}}+k} \cdot \text{DeformAttn}\left( Q_{i-1}, \ P_i^j + O_i^{(j-1) \cdot N_{\text{off}}+k}, \ \mathcal{F}_{\text{BEV}} \right)$$- $P_i^j$: $i$๋ฒ์งธ ๋ ์ด์ด์์ ์์ธก๋ ํด๋ฆฌ๋ผ์ธ์ $j$๋ฒ์งธ ์ ์ขํ
- $O_i$: ์ $j$ ์ฃผ๋ณ์ ํ์ต๋ ์๋ธ ์คํ์ ๋ฒกํฐ
import torch
import torch.nn as nn
import torch.nn.functional as F
class MultiPointDeformableAttention(nn.Module):
"""
StreamMapNet Multi-Point Attention: ํด๋ฆฌ๋ผ์ธ N_p๊ฐ ์ ๋ชจ๋๋ฅผ Reference Point๋ก ์ฌ์ฉ
"""
def __init__(self, embed_dim: int = 256, num_points: int = 20, num_offsets: int = 4):
super().__init__()
self.num_points = num_points
self.num_offsets = num_offsets
# N_p * N_off ์คํ์
๋ฐ ๊ฐ์ค์น ์์ฑ๊ธฐ
self.offset_proj = nn.Linear(embed_dim, num_points * num_offsets * 2)
self.weight_proj = nn.Linear(embed_dim, num_points * num_offsets)
def forward(self, query: torch.Tensor, polyline_pts: torch.Tensor, bev_feat: torch.Tensor) -> torch.Tensor:
"""
query: (B, N_queries, C)
polyline_pts: (B, N_queries, N_p, 2) -> ํด๋ฆฌ๋ผ์ธ ์์ธก ์ ์ขํ
bev_feat: (B, C, H, W)
"""
B, N_q, C = query.shape
offsets = self.offset_proj(query).view(B, N_q, self.num_points, self.num_offsets, 2)
weights = torch.softmax(
self.weight_proj(query).view(B, N_q, self.num_points, self.num_offsets), dim=-1
)
# N_p๊ฐ ์ ์ฃผ๋ณ ์คํ์
์์น์์ BEV ํผ์ฒ๋ฅผ ์ค์ ๋ก ์ํ๋ง (์ ๊ทํ ์ขํ [-1, 1] ๊ฐ์ )
sample_locations = (polyline_pts.unsqueeze(3) + offsets).clamp(-1, 1) # (B, N_q, N_p, N_off, 2)
grid = sample_locations.view(B, N_q * self.num_points, self.num_offsets, 2)
sampled = F.grid_sample(bev_feat, grid, align_corners=False) # (B, C, N_q*N_p, N_off)
sampled = sampled.view(B, C, N_q, self.num_points, self.num_offsets).permute(0, 2, 3, 4, 1)
# ํฌ์ธํธ/์คํ์
์ฐจ์์ ๋ํด ์ดํ
์
๊ฐ์คํฉ ํ ์ฟผ๋ฆฌ ์ฑ๋(C)์ ๋ง์ถฐ ์์ฐจ ๊ฒฐํฉ
attn_out = (sampled * weights.unsqueeze(-1)).sum(dim=(2, 3)) / self.num_points # (B, N_q, C)
updated_query = query + attn_out
return updated_query
# --- ์ฌ์ฉ ์์ ---
q_in = torch.randn(2, 50, 256)
pts_in = torch.rand(2, 50, 20, 2)
b_f = torch.randn(2, 256, 100, 100)
mp_attn = MultiPointDeformableAttention()
print("Multi-Point Attention ์ถ๋ ฅ Query Shape:", mp_attn(q_in, pts_in, b_f).shape)๐ ๏ธ Chapter 2: Streaming Query Propagation & ์์ฐจ ์ขํ๊ณ ๋ณด์ #
1. ์์ฝ#
์ด์ ํ๋ ์์ ์์ $k$๊ฐ ์ฟผ๋ฆฌ $Q_{t-1}$์ ํด๋ฆฌ๋ผ์ธ ์์น $\mathbf{P}_{t-1}$๋ฅผ ์์ฐจ ์ด๋ ํ๋ ฌ $\mathbf{T}$๋ก ๋ณํํ์ฌ ํ์ฌ ํ๋ ์์ ์ฟผ๋ฆฌ๋ก ์ฐ์ ์ ๋ฌ(Propagate)ํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$\mathbf{P}_t = \mathbf{T}_{t-1 \to t} \cdot \mathbf{P}_{t-1}$$$$Q_t = \text{MLP}\Big( \text{Concat}\big( Q_{t-1}, \ \text{Flatten}(\mathbf{T}) \big) \Big) + Q_{t-1}$$import torch
def propagate_queries_with_ego_transform(
prev_queries: torch.Tensor, # (B, K_top, C) ์ด์ ์์ K๊ฐ ์ฟผ๋ฆฌ
prev_polylines: torch.Tensor,# (B, K_top, N_p, 2) ์ด์ ํด๋ฆฌ๋ผ์ธ 2D ์ขํ
T_prev2curr: torch.Tensor # (B, 4, 4) Ego-Motion ๋ณํ ํ๋ ฌ
) -> tuple:
"""
StreamMapNet Query Propagation: ์ด์ ์ฟผ๋ฆฌ ๋ฐ ํด๋ฆฌ๋ผ์ธ ์ ์ ํ์ฌ ์ขํ๊ณ๋ก ์ ํ
"""
B, K_top, N_p, _ = prev_polylines.shape
# 1. 2D ํด๋ฆฌ๋ผ์ธ ์ ์ ๋์ฐจ 3D ์ขํ๋ก ํ์ฅ (x, y, 0, 1)
pts_3d_homo = torch.stack([
prev_polylines[..., 0], prev_polylines[..., 1],
torch.zeros_like(prev_polylines[..., 0]), torch.ones_like(prev_polylines[..., 0])
], dim=-1) # (B, K_top, N_p, 4)
# 2. ์ขํ ๋ณํ P_curr = P_prev @ T_trans^T
pts_transformed = torch.matmul(pts_3d_homo, T_prev2curr.transpose(-2, -1))
curr_polylines = pts_transformed[..., :2] # (B, K_top, N_p, 2)
return prev_queries, curr_polylines
# --- ์ฌ์ฉ ์์ ---
q_prev = torch.randn(1, 10, 256)
poly_prev = torch.rand(1, 10, 20, 2) * 50.0
T_trans = torch.eye(4)
T_trans[0, 3] = 2.0 # 2m ์ด๋
_, poly_curr = propagate_queries_with_ego_transform(q_prev, poly_prev, T_trans.unsqueeze(0))
print("์ ํ ๋ฐ ์ขํ ์ ๋ ฌ๋ ํ์ฌ ํด๋ฆฌ๋ผ์ธ Shape:", poly_curr.shape)๐ ๏ธ Chapter 3: BEV Spatial Warping & ConvGRU ์๊ฐ ์ตํฉ#
1. ์์ฝ#
์ด์ ํ๋ ์์ ๋ฐ์ง BEV ํน์ง ๋งต $\mathcal{F}_{\text{BEV}}^{t-1}$์ ์์ฐจ ์ด๋ ํ๋ ฌ $\mathbf{T}$๋ก ๊ณต๊ฐ ์ํ(Warping)ํ ํ, ConvGRU๋ฅผ ํต๊ณผ์์ผ ํ์ฌ BEV ํน์ง ๋งต $\mathcal{F}_{\text{BEV}}^t$์ ์ ์์ ์ตํฉํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$\tilde{\mathcal{F}}_{\text{BEV}}^{t-1} = \text{Warp}\left( \mathcal{F}_{\text{BEV}}^{t-1}, \ \mathbf{T} \right)$$$$\mathcal{F}_{\text{BEV}}^t = \text{LayerNorm}\left( \text{ConvGRU}\big( \tilde{\mathcal{F}}_{\text{BEV}}^{t-1}, \ \mathcal{F}_{\text{BEV}}^t \big) \right)$$import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvGRUBEVFusion(nn.Module):
"""
StreamMapNet ๋ฐ์ง BEV ํน์ง ๋งต ConvGRU ์๊ฐ ์ตํฉ ๋ชจ๋
"""
def __init__(self, channels: int = 256):
super().__init__()
self.update_gate = nn.Conv2d(channels * 2, channels, kernel_size=3, padding=1)
self.reset_gate = nn.Conv2d(channels * 2, channels, kernel_size=3, padding=1)
self.out_gate = nn.Conv2d(channels * 2, channels, kernel_size=3, padding=1)
def forward(self, warped_prev_bev: torch.Tensor, curr_bev: torch.Tensor) -> torch.Tensor:
concat_in = torch.cat([warped_prev_bev, curr_bev], dim=1)
z = torch.sigmoid(self.update_gate(concat_in))
r = torch.sigmoid(self.reset_gate(concat_in))
h_candidate = torch.tanh(self.out_gate(torch.cat([r * warped_prev_bev, curr_bev], dim=1)))
fused_bev = (1.0 - z) * warped_prev_bev + z * h_candidate
return fused_bev
# --- ์ฌ์ฉ ์์ ---
prev_w = torch.randn(1, 256, 50, 50)
curr_b = torch.randn(1, 256, 50, 50)
gru_fusion = ConvGRUBEVFusion()
print("ConvGRU ์ตํฉ BEV Feature Shape:", gru_fusion(prev_w, curr_b).shape)๐ ๏ธ Chapter 4: ๋ค์ค ํ์คํฌ ํ์ต ์์ค ํจ์#
1. ์์ฝ#
ํด๋ฆฌ๋ผ์ธ ์ขํ Smooth L1 ์์ค $\mathcal{L}_{\text{line}}$, ๋ถ๋ฅ Focal Loss $\mathcal{L}_{\text{Focal}}$, ๊ทธ๋ฆฌ๊ณ ์ฟผ๋ฆฌ ์ ํ ๋ณด์กฐ ์์ค $\mathcal{L}_{\text{trans}}$๋ฅผ ๊ฐ์ค ํฉ์ฐํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$\mathcal{L}_{\text{train}} = 50 \cdot \mathcal{L}_{\text{line}} + 5 \cdot \mathcal{L}_{\text{Focal}} + 5 \cdot \mathcal{L}_{\text{trans}}$$import torch
import torch.nn.functional as F
def compute_streammapnet_total_loss(
pred_polylines: torch.Tensor, # (B, N_q, N_p, 2)
gt_polylines: torch.Tensor, # (B, N_q, N_p, 2)
cls_logits: torch.Tensor,
gt_cls_labels: torch.Tensor
) -> torch.Tensor:
"""
StreamMapNet ๋ค์ค ํ์คํฌ ์์ค ๊ณ์ฐ (Line Regression + Focal Classification)
"""
loss_line = F.smooth_l1_loss(pred_polylines, gt_polylines, reduction='mean')
loss_cls = F.cross_entropy(cls_logits.view(-1, cls_logits.shape[-1]), gt_cls_labels.view(-1))
total_loss = 50.0 * loss_line + 5.0 * loss_cls
return total_loss
# --- ์ฌ์ฉ ์์ ---
p_poly = torch.randn(2, 50, 20, 2)
g_poly = torch.randn(2, 50, 20, 2)
p_c = torch.randn(2, 50, 4)
g_c = torch.randint(0, 4, (2, 50))
print("StreamMapNet ํ์ต ์์ค:", compute_streammapnet_total_loss(p_poly, g_poly, p_c, g_c).item())๐ ์ฃผ์ ์คํ ๋ฐ ๊ฒฐ๊ณผ (Experiments & Results)#
1. Argoverse2 100m $\times$ 50m ์ง๋ฆฌ์ 0% ๊ฒน์นจ Split ๋ฆฌ๋๋ณด๋#
| ์๊ณ ๋ฆฌ์ฆ (Method) | ์ ๋ ฅ ๋ชจ๋ฌ๋ฆฌํฐ | ์ธ์ ๋ฒ์ (Range) | mAP โ | ์ถ๋ก ์๋ (FPS) โ |
|---|---|---|---|---|
| VectorMapNet | Camera | 100m $\times$ 50m | 25.7 | 5.5 FPS (๋๋ฆผ) |
| MapTR | Camera | 100m $\times$ 50m | 40.2 | 18.0 FPS |
| StreamMapNet (Ours) | Camera | 100m $\times$ 50m (๊ด๋ฒ์) | 51.2 (+11.0%) | 14.2 FPS (์ค์๊ฐ SOTA) |
- ๊ฒฐ๊ณผ: Multi-Point Attention ๋ฐ Streaming ์๊ฐ ์ตํฉ์ผ๋ก ๋์ 100m ํ์ง ์์ญ์์ MapTR์ +11.0 mAP ์ฐจ์ด๋ก ์์ ํ ์๋.
๐ก ๊ฒฐ๋ก ๋ฐ ์์ฌ์ (Conclusion & Insights)#
1. ๊ฒฐ๋ก #
StreamMapNet์ ์จ๋ผ์ธ ๋ฒกํฐ HD ๋งต ๊ตฌ์ถ ๋ถ์ผ์ Multi-Point Attention๊ณผ 1ํ๋ ์ ์ง์ฐ ์คํธ๋ฆฌ๋ฐ ์๊ฐ ์ตํฉ์ ๋์ ํ์ฌ 100m ๋๋ฒ์ ๊ณ ์ ๋ฐ ๋งต ์์ฑ์ ์ค์๊ฐํํ ํ์ํ ํ๋ ์์ํฌ์ ๋๋ค.
2. ํ๊ณ์ ๋ฐ ์์ฌ์ด ์ #
- ๋ฒค์น๋งํฌ ์ฌ์ ์๋ผ๋ ๊ธฐ์ฌ๊ฐ ๋ชจ๋ธ ์์ฒด์ ๊ธฐ์ฌ๋ฅผ ๊ฐ๋ฆด ๋งํผ ํฌ๋ฉฐ, ์ split์์์ ์ ๋ ์ฑ๋ฅ์ ์ฌ์ ํ ๋ฎ์ ํธ(100m์์ mAP 51.2)์ด๋ผ ์ค์ ๋ฐฐํฌ๊น์ง๋ ์ถ๊ฐ ๊ฐ์ ์ด ํ์ํ๋ค.
- LiDAR ์์ด ์นด๋ฉ๋ผ๋ง์ผ๋ก ๋จผ ๊ฑฐ๋ฆฌ์ ์ ๋ฐ๋๋ฅผ ํ๋ณดํ๋ ๋ฐ๋ ํ๊ณ๊ฐ ์๋ค.
์ฐธ๊ณ ์๋ฃ#
๊ด๋ จ ๋ ผ๋ฌธ: VectorMapNet, MapTR, BEVFormer, nuScenes