An unofficial implementation of Gaussian Activated Radiance Fields in TensorFlow 2.
Original paper by Chng et al. (2022): [arXiv] [webpage]
See the notebook for more info.
Now that the official code is available in PyTorch, you'll probably want to use that code instead!
This implementation expects LLFF-style, forward-facing data, such as the NeRF LLFF dataset.
from lib.data import load_data
data = load_data('path/to/data/root')
If you have other data, you can use it like so.
from lib.data import hwf_rgb_to_data
hwf = np.array([image_height, image_width, focal_length]) # in pixels
rgb = # ... list of np.array objects of shape (image_height, image_width, 3)
data = hwf_rgb_to_data(hwf, rgb)
Once you have the data, you can create a model object.
from model.garf import GaussianRadianceField
model = GaussianRadianceField(data, num_samples=128)
You can load the pre-trained model for the NeRF flower
dataset. Pass opt=True
to load the optimizer state.
model.load('pretrain/flowers', opt=False)
Render a view from a specific image index or pose with model.garf.GaussianRadianceField.render
.