← تمام مضامین

aiNov 27, 20263 منٹ کا مطالعہ

NeRF vs Gaussian Splatting: Same Truck, Same Laptop, 30 Minutes Each

Animation: the same view of a red toy truck drawn by classic NeRF, fast NeRF and Gaussian Splatting after 30 seconds to 29 minutes of training; Gaussian Splatting becomes sharpest
Real snapshots from my own training runs. Top of each image blurred.

I filmed a toy truck on a carpet with my phone for one minute. Then I gave the same photos to three methods and let each train for exactly 30 minutes on the same laptop (RTX 3070 Ti): a classic NeRF, a fast NeRF that uses grids, and 3D Gaussian Splatting. The GIF shows the same view after 30 seconds, 2 minutes, 10 minutes and 29 minutes.

Both methods paint a pixel the same way

Picture a pixel as a ray going out from the camera. Along that ray there are many thin layers, and each layer is like a sheet of tinted glass.

C=sum_{i} T_i,alpha_i,c_i, qquad T_i=prod_{j<i}left(1-alpha_jright)

C is the final pixel colour, ci is the colour of layer i, αi is how solid it is (0 = clear, 1 = solid), and Ti is how much light still gets through all the layers in front of it.

Example with two layers: a front layer that is half solid and red (α = 0.5), and a fully solid blue layer behind it. The pixel is 0.5 × red + 0.5 × 1 × blue, so half red and half blue.

The difference: where the layers come from

In NeRF, a neural network decides the colour and the solidness at each point:

F_theta(x,y,z, text{direction}) rightarrow (c, sigma)

alpha_i = 1-e^{-sigma_i,delta_i}

σ is the “density” (how thick the material is at that point), and δi is the step length along the ray. Thick material over a long step gives α close to 1.

To draw one picture, the network has to be called for hundreds of points on every one of millions of pixels. That is why it is slow.

In Gaussian Splatting there is no network. The scene is made of about a million soft coloured blobs. Each blob looks like a smooth bump on the screen:

alpha = o cdot e^{-frac{1}{2},mathbf{d}^{T}Sigma^{-1}mathbf{d}}

o is the blob’s strength, d is the distance from the blob’s centre to the pixel, and Σ sets the blob’s shape (round or stretched). Near the centre α is large, and further away it fades to 0.

The blobs only need to be sorted from front to back and added up with the same first formula. No network calls, so it is very fast.

The exam

I hid 15 photos during training and asked each model to draw those views. The score is PSNR:

text{PSNR} = 10log_{10}frac{1}{text{MSE}}

MSE is the average squared difference between the drawn pixel and the real pixel. Smaller error gives a higher score. Every +3 dB means the error is roughly cut in half.

Score card: Gaussian Splatting 21.4 dB, 101 pictures per second, 225 MB; classic NeRF 18.2 dB, one picture per 6 minutes, 2 MB; fast NeRF 12.2 dB, one picture per 6 seconds, 64 MB
Real numbers from my own runs: 30 minutes of training each, one laptop.
  • Gaussian Splatting: 21.4 dB. It draws 101 pictures per second, but the file is 225 MB.
  • Classic NeRF: 18.2 dB. One picture takes about 6 minutes, but the whole model is only 2 MB. GS is 3.2 dB ahead, so its error is about half of NeRF’s (100.32 ≈ 2.1).
  • Fast NeRF: 12.2 dB. On its own training photos it scored about 22 dB, but on the hidden photos only 12. It memorised the photos instead of learning the 3D shape. This is overfitting. A well-tuned fast NeRF would score much higher. My run did not.

On speed, GS drew a picture about 38,000 times faster than the classic NeRF (375 s ÷ 0.0099 s).

What I take from this

If you need speed and sharpness, Gaussian Splatting is the choice. If storage is tight, the classic NeRF is still remarkably small. And the exam should always use photos the model never saw. Without that, my fast NeRF would have looked like the winner.

Full video (10 min)

Earlier in this series: NeRF explained, my phone video to a 3D model, and Structure from Motion, part 1.

تبصرہ

تبصرے

پہلا تبصرہ لکھیں

آپ کا ای میل کبھی ظاہر نہیں ہوگا۔ تبصرے جائزے کے بعد نظر آتے ہیں۔