๐ก ํ ์ค ์์ฝ#
์ฅ๋ฉด ์ ์ฒด๋ฅผ 3D ์์น $(x, y, z)$์ ์์ ๋ฐฉํฅ $(\theta, \phi)$์ ์ ๋ ฅ๋ฐ์ ํด๋น ์ง์ ์ ์ฒด์ ๋ฐ๋ $\sigma$์ ๋ฐฉ์ถ ์์ $(r, g, b)$์ ์ถ๋ ฅํ๋ **5D ์ฐ์ ํจ์(MLP)**๋ก ํํํ๊ณ , ๋ฏธ๋ถ ๊ฐ๋ฅํ ์ฒด์ ๋ ๋๋ง(Volume Rendering)์ผ๋ก ํ์ตํจ์ผ๋ก์จ ํฌ์ํ RGB ์ด๋ฏธ์ง๋ง์ผ๋ก ๊ทน๋๋ก ์ฌ์ค์ ์ธ ์ ์์ ํฉ์ฑ(Novel View Synthesis)์ ๋ฌ์ฑํ๋ค.
๐ ๊ฐ์ ๋ฐ ํต์ฌ ๊ธฐ์ฌ (Key Contributions)#
- ์ ์: Ben Mildenhall, Pratul P. Srinivasan, Matthew Tancik, Jonathan T. Barron, Ravi Ramamoorthi, Ren Ng (UC Berkeley, Google Research, UCSD)
- ๋ฐํ๋ ๋: 2020 (arXiv:2003.08934, ECCV 2020 Best Paper Honorable Mention)
- ์ฃผ์ ๊ธฐ์ฌ์ :
- 5D Neural Radiance Field ํํ: ๋ช ์์ ๋ฉ์(Mesh)๋ ์ด์ฐ ๋ณต์ (Voxel) ์์ด ๋จ 5MB ๋ถ๋์ ์ฐ์ ์ ๊ฒฝ๋ง(MLP) ๊ฐ์ค์น ์์ฒด๋ก 3D ์ฅ๋ฉด์ ๊ธฐํ์ ๊ดํ์ ํน์ฑ(์ ๋ฐ์ฌ, ๊ดํ ํฌํจ)์ ์๋ฌต์ (Implicit) ์ธ์ฝ๋ฉ.
- ๋ฏธ๋ถ ๊ฐ๋ฅํ ์ด์ฐ ์ฒด์ ๋ ๋๋ง (Differentiable Volume Rendering): ๊ด์ ์ ๋ฐ๋ฅธ ์ด์ฐ ์ํ ๋ธ๋ ๋ฉ ์ ๋ถ ๋ฐฉ์ ์์ ์ ๋ํ์ฌ RGB ์ค์ฐจ๋ง์ผ๋ก MLP ํ๋ผ๋ฏธํฐ $\Theta$๋ฅผ End-to-End ์ญ์ ํ ํ์ต.
- Positional Encoding & ๊ณ์ธต์ ๋ณผ๋ฅจ ์ํ๋ง (Hierarchical Sampling): ๊ณ ์ฃผํ ์คํํธ๋ผ ํธํฅ(Spectral Bias)์ ๊ทน๋ณตํ๋ ์์น ์ธ์ฝ๋ฉ๊ณผ Coarse-to-Fine 2๋จ๊ณ ๊ด์ ์ํ๋ง์ผ๋ก ๋ํ ์ผ๊ณผ ๋ ๋๋ง ํจ์จ์ ๋์ ํ๋ณด.
๐ฏ ๊ด๋ จ ์ฐ๊ตฌ ํ๋ฆ ๋ฐ ๊ธฐ์กด ํ๊ณ (Related Work & Motivation)#
๊ด๋ จ ์ฐ๊ตฌ ํ๋ฆ#
- ๋ช ์์ 3D ํํ (๋ณต์ , ๋ฉ์ฌ, ํฌ์ธํธ ํด๋ผ์ฐ๋): ๋ณต์ ํด์๋ ์ฆ๊ฐ ์ ๋ฉ๋ชจ๋ฆฌ๊ฐ $\mathcal{O}(N^3)$์ผ๋ก ํญ๋ฐํ๊ณ , ๋ฏธ๋ถ ๊ฐ๋ฅํ ๋ฉ์ ๋ ๋๋ฌ๋ ๋ณต์กํ ํ์ ์ต์ ํ๊ฐ ์ด๋ ค์.
- ์๋ฌต์ ํ๋ฉด ํํ (SDF, Occupancy Networks): 3D ํ๋ฉด ๊ธฐํ ํํ์๋ ์ฐ์ํ๋ ๋ฐ๋๊ฐ ์ฐ์์ ์ธ ์์ ์์กด์ ์์ ํํ์๋ ํ๊ณ ์กด์ฌ.
- NeRF: ์ฒด์ ๋ฐฉ์ฌ์ฅ(Volume Radiance Field)์ด๋ผ๋ ๋ฌผ๋ฆฌํ์ ๊ณ ์ ๊ฐ๋ ์ ์ฐ์ ์ ๊ฒฝ๋ง๊ณผ ๋ฏธ๋ถ ๋ ๋๋ง์ผ๋ก ํตํฉํ์ฌ ํ๋ ์ ๊ฒฝ ๋ ๋๋ง์ ํจ๋ฌ๋ค์ ์ ํ์ ์ด๋.
๐ ๋ชฉ์ฐจ#
- Chapter 1: 5D Neural Radiance Field ์ฅ๋ฉด ํํ ๊ตฌ์กฐ
- Chapter 2: Positional Encoding (์์น ์ธ์ฝ๋ฉ)
- Chapter 3: ์ฐ์ ๋ฐ ์ด์ฐ ์ฒด์ ๋ ๋๋ง (Volume Rendering)
- Chapter 4: ๊ณ์ธต์ ๋ณผ๋ฅจ ์ํ๋ง (Coarse-to-Fine Hierarchical Sampling)
- Chapter 5: NeRF ์์ค ํจ์ ๋ฐ ํ์ดํ๋ผ์ธ ์ต์ ํ
- Chapter 6: ์ฃผ์ ์คํ ๋ฐ ๊ฒฐ๊ณผ
- Chapter 7: ๊ฒฐ๋ก ๋ฐ ์์ฌ์
๐ ๏ธ Chapter 1: 5D Neural Radiance Field ์ฅ๋ฉด ํํ ๊ตฌ์กฐ#
1. ์์ฝ#
3D ๊ณต๊ฐ ์ขํ $\mathbf{x} = (x, y, z)$์ 2D ์์ ๋ฐฉํฅ ๋จ์ ๋ฒกํฐ $\mathbf{d} = (\theta, \phi)$๋ฅผ ์ ๋ ฅ์ผ๋ก ๋ฐ์, ํด๋น ์ง์ ์ ์ฒด์ ๋ฐ๋ $\sigma$์ ๋ทฐ ์์กด์ RGB ์์ $\mathbf{c} = (r, g, b)$๋ฅผ ์ถ๋ ฅํ๋ ํจ์ $F_\Theta$๋ฅผ MLP๋ก ๊ตฌ์ฑํฉ๋๋ค. ๋ฌผ์ฒด์ ์กด์ฌ ์ ๋ฌด์ธ ๋ฐ๋ $\sigma$๋ ๋ฐฉํฅ๊ณผ ๋ฌด๊ดํ๋, ๋ฐ์ฌ๊ด์ ์ํด ์์ $\mathbf{c}$๋ ๋ฐฉํฅ $\mathbf{d}$์ ์ํฅ์ ๋ฐ๋๋ก ์ฐจ๋จ ์ค๊ณํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$F_\Theta : (\mathbf{x}, \mathbf{d}) \rightarrow (\mathbf{c}, \sigma)$$import torch
import torch.nn as nn
class NeRFMLP(nn.Module):
"""
NeRF 5D ์ฐ์ ์ฅ๋ฉด ํํ MLP ๊ตฌ์กฐ (8๊ฐ FC ์ธต + Skip Connection)
"""
def __init__(self, pos_dim: int = 60, dir_dim: int = 24, net_depth: int = 8, net_width: int = 256):
super().__init__()
self.pos_dim = pos_dim
self.dir_dim = dir_dim
# 1. 3D ์์น ์ขํ ์ฒ๋ฆฌ ๋ฐฑ๋ณธ (8๊ฐ ์ธต, 5๋ฒ์งธ ์ธต์ Skip Connection)
layers = []
for i in range(net_depth):
in_channels = pos_dim if i == 0 else (net_width + pos_dim if i == 5 else net_width)
layers.append(nn.Linear(in_channels, net_width))
self.pts_linears = nn.ModuleList(layers)
# 2. ์ฒด์ ๋ฐ๋ (Sigma) ์ถ๋ ฅ ํค๋
self.density_linear = nn.Linear(net_width, 1)
# 3. ๋ทฐ ์์กด์ ์์ (RGB) ์ถ๋ ฅ ํค๋
self.feature_linear = nn.Linear(net_width, net_width)
self.views_linear = nn.Linear(net_width + dir_dim, net_width // 2)
self.rgb_linear = nn.Linear(net_width // 2, 3)
def forward(self, pos_enc: torch.Tensor, dir_enc: torch.Tensor) -> tuple:
"""
pos_enc: (N_rays * N_samples, pos_dim)
dir_enc: (N_rays * N_samples, dir_dim)
"""
h = pos_enc
for i, layer in enumerate(self.pts_linears):
if i == 5:
h = torch.cat([pos_enc, h], dim=-1) # Skip connection
h = torch.relu(layer(h))
# 1. ์ฒด์ ๋ฐ๋ sigma ์ถ๋ ฅ (ReLU๋ก ์์ ๋ณด์ฅ)
sigma = torch.relu(self.density_linear(h))
# 2. ํน์ง ๋ฒกํฐ + ๋ฐฉํฅ ์ธ์ฝ๋ฉ ๊ฒฐํฉ -> RGB ์ถ๋ ฅ (Sigmoid๋ก [0, 1] ๋ณด์ฅ)
feature = self.feature_linear(h)
h_dir = torch.cat([feature, dir_enc], dim=-1)
h_dir = torch.relu(self.views_linear(h_dir))
rgb = torch.sigmoid(self.rgb_linear(h_dir))
return rgb, sigma
# --- ์ฌ์ฉ ์์ ---
p_enc = torch.randn(1024, 60) # 1024๊ฐ ์ํ์ ์์น ์ธ์ฝ๋ฉ
d_enc = torch.randn(1024, 24) # 1024๊ฐ ์ํ์ ๋ฐฉํฅ ์ธ์ฝ๋ฉ
nerf = NeRFMLP()
rgb_out, sigma_out = nerf(p_enc, d_enc)
print("์ถ๋ ฅ RGB Shape:", rgb_out.shape, "Sigma Shape:", sigma_out.shape)๐ ๏ธ Chapter 2: Positional Encoding (์์น ์ธ์ฝ๋ฉ)#
1. ์์ฝ#
MLP ์ ๊ฒฝ๋ง์ ์ ๋ ฅ ๋ฐ์ดํฐ์ ์ ์ฃผํ(Low-frequency) ์ฑ๋ถ์ ์ ํธํ๋ ์ ์ฃผํ ํธํฅ(Spectral Bias)์ ๊ฐ์ต๋๋ค. ์ธ๋ฐํ ๊ณ ์ฃผํ ํ ์ค์ฒ์ ๋ ์นด๋ก์ด ๊ฒฝ๊ณ๋ฅผ ํํํ๊ธฐ ์ํด ์ ๋ ฅ ์ค์นผ๋ผ ์ขํ $p$๋ฅผ ๋ค์ค ์ฃผํ์ ์ฌ์ธ/์ฝ์ฌ์ธ ๊ธฐ์ ๋ก ์ธ์ฝ๋ฉํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$\gamma(p) = \left( \sin(2^0 \pi p), \ \cos(2^0 \pi p), \ \sin(2^1 \pi p), \ \cos(2^1 \pi p), \ \dots, \ \sin(2^{L-1} \pi p), \ \cos(2^{L-1} \pi p) \right)$$- $L$: ์ฃผํ์ ๋ฐด๋ ์ฐจ์ ($3\text{D}$ ์์น $\mathbf{x}$์๋ $L=10$ ์ ์ฉ์ผ๋ก 60์ฐจ์, $2\text{D}/3\text{D}$ ์์ ๋ฐฉํฅ $\mathbf{d}$์๋ $L=4$ ์ ์ฉ์ผ๋ก 24์ฐจ์์ผ๋ก ํ์ฅ)
import torch
class PositionalEncoding(torch.nn.Module):
"""
์
๋ ฅ ์ขํ p๋ฅผ 2 * L ์ฐจ์์ ๊ณ ์ฃผํ ์ฌ์ธ/์ฝ์ฌ์ธ ์ผ๊ฐํจ์๋ก ์๋ฒ ๋ฉ
"""
def __init__(self, num_freqs: int = 10, include_input: bool = True):
super().__init__()
self.num_freqs = num_freqs
self.include_input = include_input
self.freq_bands = 2.0 ** torch.linspace(0, num_freqs - 1, num_freqs)
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""
x Shape: (..., D)
Return Shape: (..., D * 2 * num_freqs + (D if include_input else 0))
"""
out = [x] if self.include_input else []
for freq in self.freq_bands:
out.append(torch.sin(torch.pi * freq * x))
out.append(torch.cos(torch.pi * freq * x))
return torch.cat(out, dim=-1)
# --- ์ฌ์ฉ ์์ ---
pos_3d = torch.tensor([[0.5, -0.2, 0.9]]) # (1, 3)
pe = PositionalEncoding(num_freqs=10, include_input=False) # 3 * 2 * 10 = 60 ์ฐจ์
print("3D ์์น ์ธ์ฝ๋ฉ ๊ฒฐ๊ณผ ์ฐจ์:", pe(pos_3d).shape)๐ ๏ธ Chapter 3: ์ฒด์ ๋ ๋๋ง (Volume Rendering)#
1. ์์ฝ#
์นด๋ฉ๋ผ ๋ ์ด $\mathbf{r}(t) = \mathbf{o} + t\mathbf{d}$ ์์์ ๊ทผ๊ฑฐ๋ฆฌ $t_n$๋ถํฐ ์๊ฑฐ๋ฆฌ $t_f$๊น์ง ํ์ํ๋ฉฐ ์ฐ์์ฒด์ ์ ๋ถ ๋ฐฉ์ ์์ ์ด์ฐํ๋ ์ํ ๋ธ๋ ๋ฉ(Alpha-compositing) ํํ๋ก ๋ณต์ํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
(1) ์ฐ์ ์ฒด์ ์ ๋ถ ๋ฐฉ์ ์#
$$C(\mathbf{r}) = \int_{t_n}^{t_f} T(t)\,\sigma(\mathbf{r}(t))\,\mathbf{c}(\mathbf{r}(t), \mathbf{d})\, dt, \quad T(t) = \exp\left(-\int_{t_n}^{t} \sigma(\mathbf{r}(s))\,ds\right)$$(2) ์ด์ฐํ๋ ์ฒด์ ๋ ๋๋ง ๋ฐฉ์ ์#
$$\hat{C}(\mathbf{r}) = \sum_{i=1}^{N} T_i \left(1 - \exp(-\sigma_i \delta_i)\right) \mathbf{c}_i, \quad T_i = \exp\left(-\sum_{j=1}^{i-1} \sigma_j \delta_j\right)$$- $\delta_i = t_{i+1} - t_i$: ์ธ์ ์ํ ๊ฐ ๊ตฌ๊ฐ ๊ฑฐ๋ฆฌ
- $\alpha_i = 1 - \exp(-\sigma_i \delta_i)$: $i$๋ฒ์งธ ์ํ ๊ตฌ๊ฐ์ ์ด์ฐ ๋ถํฌ๋ช ๋
- $T_i$: $i$๋ฒ์งธ ์ํ ์์น๊น์ง ๋๋ฌํ๋ ๋น์ ๋์ ํฌ๊ณผ์จ
import torch
def raw2outputs(
raw_rgb: torch.Tensor, # (N_rays, N_samples, 3)
raw_sigma: torch.Tensor, # (N_rays, N_samples, 1)
z_vals: torch.Tensor, # (N_rays, N_samples)
rays_d: torch.Tensor # (N_rays, 3)
) -> tuple:
"""
NeRF ์ด์ฐ ์ฒด์ ๋ ๋๋ง ๋ฐฉ์ ์ ๊ตฌํ
"""
# 1. ์ํ ๊ฐ ๊ฑฐ๋ฆฌ delta_i ๊ณ์ฐ
dists = z_vals[..., 1:] - z_vals[..., :-1]
# ๋ง์ง๋ง ์ํ ํ์ ๊ฑฐ๋ฆฌ ๋ฌดํ๋ ์ฐ์ฅ
dists = torch.cat([dists, torch.tensor([1e10]).expand(dists[..., :1].shape)], dim=-1)
# ๊ด์ ๋ฐฉํฅ ํฌ๊ธฐ์ ๋ฐ๋ฅธ ์ค์ ๊ฑฐ๋ฆฌ ๋ณด์
dists = dists * torch.norm(rays_d[..., None, :], dim=-1)
# 2. ์ํ ๋ถํฌ๋ช
๋ alpha_i = 1 - exp(-sigma_i * dist_i)
alpha = 1.0 - torch.exp(-raw_sigma.squeeze(-1) * dists) # (N_rays, N_samples)
# 3. ๋์ ํฌ๊ณผ์จ T_i = exp(-sum_{j<i} sigma_j * dist_j)
# T_i = cumprod(1 - alpha_j)
transmittance = torch.cumprod(torch.cat([torch.ones((alpha.shape[0], 1)), 1.0 - alpha + 1e-10], dim=-1), dim=-1)[:, :-1]
# 4. ๊ฐ์ค์น weight_i = T_i * alpha_i
weights = transmittance * alpha # (N_rays, N_samples)
# 5. ํฝ์
์ต์ข
์์ ์ ๋ถ
rgb_map = torch.sum(weights[..., None] * raw_rgb, dim=-2) # (N_rays, 3)
depth_map = torch.sum(weights * z_vals, dim=-1) # (N_rays,)
return rgb_map, depth_map, weights
# --- ์ฌ์ฉ ์์ ---
rgb_dummy = torch.rand(10, 64, 3)
sig_dummy = torch.relu(torch.randn(10, 64, 1))
z_dummy = torch.linspace(2.0, 6.0, 64).repeat(10, 1)
ray_dir = torch.tensor([[0.0, 0.0, 1.0]]).repeat(10, 1)
rgb_res, depth_res, w_res = raw2outputs(rgb_dummy, sig_dummy, z_dummy, ray_dir)
print("๋ ๋๋ง๋ RGB ์ด๋ฏธ์ง ์์ Shape:", rgb_res.shape)๐ ๏ธ Chapter 4: ๊ณ์ธต์ ๋ณผ๋ฅจ ์ํ๋ง (Coarse-to-Fine Sampling)#
1. ์์ฝ#
๊ด์ ์ ์ฒด๋ฅผ ๊ท ์ผํ๊ฒ ์ํ๋งํ๋ฉด ๊ณต๊ธฐ๋ ๋น ๊ณต๊ฐ(Empty space)์ ์ฐ์ฐ์ด ๋ญ๋น๋ฉ๋๋ค. ๋จผ์ Coarse ๋คํธ์ํฌ($N_c=64$)๋ก ๊ฐ์ค์น ๋ถํฌ $w_i$๋ฅผ ํ์ํ ํ, ๊ฐ์ค์น๊ฐ ๋์ ํต์ฌ ํ๋ฉด ์์ญ ์ฃผ๋ณ์์ ๋์ ๋ถํฌํจ์(CDF) ์ญ๋ณํ ์ํ๋ง(Inverse Transform Sampling)์ผ๋ก Fine ๋คํธ์ํฌ($N_f=128$)์ฉ ์ ๋ฐ ์ํ์ ์ ๊ณ ๋ฐ๋ ์ฑ์งํฉ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
CDF ์ญ๋ณํ ์ํ๋ง (Inverse Transform Sampling)#
$$w_i = T_i (1 - \exp(-\sigma_i \delta_i)), \quad \hat{w}_i = \frac{w_i}{\sum_{j=1}^{N_c} w_j}$$$$\text{CDF}(k) = \sum_{j=1}^k \hat{w}_j$$import torch
def sample_pdf(
bins: torch.Tensor, # (N_rays, N_samples-1) ๊ตฌ๊ฐ ๊ฒฝ๊ณ์
weights: torch.Tensor, # (N_rays, N_samples-2) Coarse ๊ฐ์ค์น w_i
N_fine_samples: int = 128
) -> torch.Tensor:
"""
Coarse ๊ฐ์ค์น PDF ๊ธฐ๋ฐ CDF ์ญ๋ณํ ์ํ๋ง (Fine ์ง์ค ์ํ ์์ฑ)
"""
# 1. ๊ฐ์ค์น ์ ๊ทํ (PDF)
weights = weights + 1e-5
pdf = weights / torch.sum(weights, dim=-1, keepdim=True)
# 2. ๋์ ๋ถํฌํจ์ (CDF) ๊ตฌ์ฑ
cdf = torch.cumsum(pdf, dim=-1)
cdf = torch.cat([torch.zeros_like(cdf[..., :1]), cdf], dim=-1) # (N_rays, N_samples)
# 3. ๊ท ๋ฑ ๋์ u ~ Uniform(0, 1) ์ํ๋ง
u = torch.rand(list(cdf.shape[:-1]) + [N_fine_samples])
# 4. CDF ์ญ๋ณํ (Invert CDF via searchsorted)
inds = torch.searchsorted(cdf, u, right=True)
below = torch.clamp(inds - 1, min=0)
above = torch.clamp(inds, max=cdf.shape[-1] - 1)
# ๊ตฌ๊ฐ ์ ํ ๋ณด๊ฐ ์ํ๋ง
cdf_g0 = torch.gather(cdf, -1, below)
cdf_g1 = torch.gather(cdf, -1, above)
bins_g0 = torch.gather(bins, -1, below)
bins_g1 = torch.gather(bins, -1, above)
denom = cdf_g1 - cdf_g0
denom = torch.where(denom < 1e-5, torch.ones_like(denom), denom)
t = (u - cdf_g0) / denom
fine_samples = bins_g0 + t * (bins_g1 - bins_g0)
return fine_samples
# --- ์ฌ์ฉ ์์ ---
bins_ex = torch.linspace(2.0, 6.0, 63).repeat(2, 1)
w_ex = torch.rand(2, 62)
fine_pts = sample_pdf(bins_ex, w_ex, N_fine_samples=128)
print("Fine ๊ณ ๋ฐ๋ ์ถ๊ฐ ์ํ Shape:", fine_pts.shape)๐ ๏ธ Chapter 5: NeRF ์์ค ํจ์ (Coarse & Fine Loss)#
1. ์์ฝ#
Coarse ๋คํธ์ํฌ์ Fine ๋คํธ์ํฌ๊ฐ ๊ฐ๊ฐ ์์ธกํ ํฝ์ ์์ $\hat{C}_c(\mathbf{r})$์ $\hat{C}_f(\mathbf{r})$๋ฅผ Ground Truth ํฝ์ $C(\mathbf{r})$์ ๋์ ๋น๊ตํ์ฌ $L_2$ ์ ๊ณฑ ์ค์ฐจ ์์ค์ ์ค์ ๋๋ค.
2. ์์ ๋ฐ ํ์ด์ฌ ์ฝ๋ ์ค๋ช #
$$\mathcal{L} = \sum_{\mathbf{r} \in \mathcal{R}} \left[ \left\| \hat{C}_c(\mathbf{r}) - C(\mathbf{r}) \right\|_2^2 + \left\| \hat{C}_f(\mathbf{r}) - C(\mathbf{r}) \right\|_2^2 \right]$$import torch
import torch.nn.functional as F
def compute_nerf_loss(
coarse_rgb: torch.Tensor, # (N_rays, 3) Coarse ์์ธก ์์
fine_rgb: torch.Tensor, # (N_rays, 3) Fine ์์ธก ์์
gt_rgb: torch.Tensor # (N_rays, 3) ์ ๋ต RGB ์์
) -> torch.Tensor:
"""
Coarse ๋ฐ Fine ๋คํธ์ํฌ ๊ณต๋ ์ต์ ํ๋ฅผ ์ํ MSE ์์ค ํจ์
"""
loss_coarse = F.mse_loss(coarse_rgb, gt_rgb)
loss_fine = F.mse_loss(fine_rgb, gt_rgb)
return loss_coarse + loss_fine
# --- ์ฌ์ฉ ์์ ---
c_rgb = torch.rand(4096, 3)
f_rgb = torch.rand(4096, 3)
target_rgb = torch.rand(4096, 3)
print("NeRF ์ด ์์ค (Loss):", compute_nerf_loss(c_rgb, f_rgb, target_rgb).item())๐ ์ฃผ์ ์คํ ๋ฐ ๊ฒฐ๊ณผ (Experiments & Results)#
1. ๋ํ ๋ฐ์ดํฐ์ ํ์ง ๋ฒค์น๋งํฌ (Realistic Synthetic 360ยฐ)#
| ๋ชจ๋ธ (Method) | PSNR โ | SSIM โ | LPIPS โ | ์ฉ๋/๋ฉ๋ชจ๋ฆฌ | ๋ ๋๋ง ์๋ |
|---|---|---|---|---|---|
| SRN (Scene Representation Networks) | 22.26 | 0.846 | 0.170 | 15 MB | 1 FPS ์ดํ |
| Neural Volumes (NV) | 26.05 | 0.893 | 0.160 | 1.5 GB | 3 FPS |
| LLFF (Local Light Field Fusion) | 24.88 | 0.901 | 0.114 | 15 GB | 0.1 FPS |
| NeRF (Ours) | 31.01 | 0.947 | 0.081 | 5 MB (์์ถ) | ~0.5 FPS (๋๋ฆผ) |
- ํ์ง ์ฑ๊ณผ: SOTA ๊ธฐ์กด ๊ธฐ๋ฒ ๋๋น PSNR +5 dB ์ด์ ์๋์ ์ฐ์๋ฅผ ์ ํ์ผ๋ฉฐ, 3D ์ฅ๋ฉด ์ ์ฒด๋ฅผ ๋จ 5MB ๊ฐ์ค์น๋ก ๋ณด๊ดํ๋ ์๋ฌต์ ํํ์ ์ฅ์ ์ ์ฆ.
๐ก ๊ฒฐ๋ก ๋ฐ ์์ฌ์ (Conclusion & Insights)#
1. ๊ฒฐ๋ก #
NeRF๋ ์ ๊ฒฝ๋ง ๊ฐ์ค์น ์์ฒด๋ก 3D ์ฅ๋ฉด์ ๋ฌผ๋ฆฌ์ ๋ฐฉ์ฌ์ฅ(Radiance Field)์ ์ฐ์ ํํํ๊ณ ๋ฏธ๋ถ ์ฒด์ ๋ ๋๋ง์ผ๋ก ํ๋ จํ๋ ํจ๋ฌ๋ค์์ ํ๋ฆฝํ์ฌ, ํ๋ 3D ์ ๊ฒฝ ๋ ๋๋ง(Novel View Synthesis) ๋ถ์ผ์ ์๋ฐ์ ์ด ๋ ๋ถํ์ ์ฐ๊ตฌ์ ๋๋ค.
2. ํ๊ณ์ #
- ๋๋ฆฐ ํ์ต ๋ฐ ๋ ๋๋ง ์๋: ํฝ์ ๋น ์๋ฐฑ ๋ฒ์ MLP ํ๊ฐ๋ก ์ธํด ์ฅ๋ฉด๋น ํ๋ จ์ 1~2์ผ, ๋ ๋๋ง์ ์ ์ด ์ด์ ์์ (์ดํ Instant-NGP, 3DGS์ ์ํด ๊ทน๋ณต๋จ).
- ์ ์ ์ฅ๋ฉด ์ ์ฉ: ๋์ ๊ฐ์ฒด๊ฐ ์๋ ์ฅ๋ฉด(์์จ์ฃผํ ๋ฑ)์๋ ๋ณ๋ ํ์ฅ์ด ํ์.
- ๋ฎ์ ํด์ยทํธ์ง ๊ฐ๋ฅ์ฑ: MLP ๊ฐ์ค์น์ ์๋ฌต์ ์ผ๋ก ์ธ์ฝ๋ฉ๋ ํํ์ ์ง์ ํด์ํ๊ฑฐ๋ ํธ์งํ๊ธฐ ์ด๋ ค์.
์ฐธ๊ณ ์๋ฃ#
๊ด๋ จ ๋ ผ๋ฌธ: 3D Gaussian Splatting