Giter Club home page Giter Club logo

nerfies's Introduction

Nerfies: Deformable Neural Radiance Fields

This is the code for Nerfies: Deformable Neural Radiance Fields.

This codebase is implemented using JAX, building on JaxNeRF.

This repository has been updated to reflect the version used for our ICCV 2021 submission.

Demo

We provide an easy-to-get-started demo using Google Colab!

These Colabs will allow you to train a basic version of our method using Cloud TPUs (or GPUs) on Google Colab.

Note that due to limited compute resources available, these are not the fully featured models. If you would like to train a fully featured Nerfie, please refer to the instructions below on how to train on your own machine.

Description Link
Process a video into a Nerfie dataset Open In Colab
Train a Nerfie Open In Colab
Render a Nerfie video Open In Colab

Setup

The code can be run under any environment with Python 3.8 and above. (It may run with lower versions, but we have not tested it).

We recommend using Miniconda and setting up an environment:

conda create --name nerfies python=3.8

Next, install the required packages:

pip install -r requirements.txt

Install the appropriate JAX distribution for your environment by following the instructions here. For example:

# For CUDA version 11.0
pip install --upgrade "jax[cuda111]" -f https://storage.googleapis.com/jax-releases/jax_releases.html

Training

After preparing a dataset, you can train a Nerfie by running:

export DATASET_PATH=/path/to/dataset
export EXPERIMENT_PATH=/path/to/save/experiment/to
python train.py \
    --data_dir $DATASET_PATH \
    --base_folder $EXPERIMENT_PATH \
    --gin_configs configs/test_vrig.gin

To plot telemetry to Tensorboard and render checkpoints on the fly, also launch an evaluation job by running:

python eval.py \
    --data_dir $DATASET_PATH \
    --base_folder $EXPERIMENT_PATH \
    --gin_configs configs/test_vrig.gin

The two jobs should use a mutually exclusive set of GPUs. This division allows the training job to run without having to stop for evaluation.

Configuration

  • We use Gin for configuration.
  • We provide a couple preset configurations.
  • Please refer to config.py for documentation on what each configuration does.
  • Preset configs:
    • gpu_vrig_paper.gin: This is the configuration we used to generate the table in the paper. It requires 8 GPUs for training.
    • gpu_fullhd.gin: This is a high-resolution model and will take around 3 days to train on 8 GPUs.
    • gpu_quarterhd.gin: This is a low-resolution model and will take around 14 hours to train on 8 GPUs.
    • test_local.gin: This is a test configuration to see if the code runs. It probably will not result in a good looking result.
    • test_vrig.gin: This is a test configuration to see if the code runs for validation rig captures. It probably will not result in a good looking result.
  • Training on fewer GPUs will require tuning of the batch size and learning rates. We've provided an example configuration for 4 GPUs in gpu_quarterhd_4gpu.gin but we have not tested it, so please only use it as a reference.

Datasets

A dataset is a directory with the following structure:

dataset
    ├── camera
    │   └── ${item_id}.json
    ├── camera-paths
    ├── rgb
    │   ├── ${scale}x
    │   └── └── ${item_id}.png
    ├── metadata.json
    ├── points.npy
    ├── dataset.json
    └── scene.json

At a high level, a dataset is simply the following:

  • A collection of images (e.g., from a video).
  • Camera parameters for each image.

We have a unique identifier for each image which we call item_id, and this is used to match the camera and images. An item_id can be any string, but typically it is some alphanumeric string such as 000054.

camera

  • This directory contains cameras corresponding to each image.
  • We use a camera model identical to the OpenCV camera model, which is also supported by COLMAP.
  • Each camera is a serialized version of the Camera class defined in camera.py and looks like this:
{
  // A 3x3 world-to-camera rotation matrix representing the camera orientation.
  "orientation": [
    [0.9839, -0.0968, 0.1499],
    [-0.0350, -0.9284, -0.3699],
    [0.1749, 0.358, -0.9168]
  ],
  // The 3D position of the camera in world-space.
  "position": [-0.3236, -3.26428, 5.4160],
  // The focal length of the camera.
  "focal_length": 2691,
  // The principle point [u_0, v_0] of the camera.
  "principal_point": [1220, 1652],
  // The skew of the camera.
  "skew": 0.0,
  // The aspect ratio for the camera pixels.
  "pixel_aspect_ratio": 1.0,
  // Parameters for the radial distortion of the camera.
  "radial_distortion": [0.1004, -0.2090, 0.0],
  // Parameters for the tangential distortion of the camera.
  "tangential": [0.001109, -2.5733e-05],
  // The image width and height in pixels.
  "image_size": [2448, 3264]
}

camera-paths

  • This directory contains test-time camera paths which can be used to render videos.
  • Each sub-directory in this path should contain a sequence of JSON files.
  • The naming scheme does not matter, but the cameras will be sorted by their filenames.

rgb

  • This directory contains images at various scales.
  • Each subdirectory should be named ${scale}x where ${scale} is an integer scaling factor. For example, 1x would contain the original images while 4x would contain images a quarter of the size.
  • We assume the images are in PNG format.
  • It is important the scaled images are integer factors of the original to allow the use of area relation when scaling the images to prevent Moiré. A simple way to do this is to simply trim the borders of the image to be divisible by the maximum scale factor you want.

metadata.json

  • This defines the 'metadata' IDs used for embedding lookups.
  • Contains a dictionary of the following format:
{
    "${item_id}": {
        // The embedding ID used to fetch the deformation latent code
        // passed to the deformation field.
        "warp_id": 0,
        // The embedding ID used to fetch the appearance latent code
        // which is passed to the second branch of the template NeRF.
        "appearance_id": 0,
        // For validation rig datasets, we use the camera ID instead
        // of the appearance ID. For example, this would be '0' for the
        // left camera and '1' for the right camera. This can potentially
        // also be used for multi-view setups as well.
        "camera_id": 0
    },
    ...
},

scene.json

  • Contains information about how we will parse the scene.
  • See comments inline.
{
  // The scale factor we will apply to the pointcloud and cameras. This is
  // important since it controls what scale is used when computing the positional
  // encoding.
  "scale": 0.0387243672920458,
  // Defines the origin of the scene. The scene will be translated such that
  // this point becomes the origin. Defined in unscaled coordinates.
  "center": [
    1.1770838526103944e-08,
    -2.58235339289195,
    -1.29117656263135
  ],
  // The distance of the near plane from the camera center in scaled coordinates.
  "near": 0.02057418950149491,
  // The distance of the far plane from the camera center in scaled coordinates.
  "far": 0.8261601717667288
}

dataset.json

  • Defines the training/validation split of the dataset.
  • See inline comments:
{
  // The total number of images in the dataset.
  "count": 114,
  // The total number of training images (exemplars) in the dataset.
  "num_exemplars": 57,
  // A list containins all item IDs in the dataset.
  "ids": [...],
  // A list containing all training item IDs in the dataset.
  "train_ids": [...],
  // A list containing all validation item IDs in the dataset.
  // This should be mutually exclusive with `train_ids`.
  "val_ids": [...],
}

points.npy

  • A numpy file containing a single array of size (N,3) containing the background points.
  • This is required if you want to use the background regularization loss.

Citing

If you find our work useful, please consider citing:

@article{park2021nerfies
  author    = {Park, Keunhong 
               and Sinha, Utkarsh 
               and Barron, Jonathan T. 
               and Bouaziz, Sofien 
               and Goldman, Dan B 
               and Seitz, Steven M. 
               and Martin-Brualla, Ricardo},
  title     = {Nerfies: Deformable Neural Radiance Fields},
  journal   = {ICCV},
  year      = {2021},
}

nerfies's People

Contributors

aricursion avatar jamesperlman avatar keunhong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nerfies's Issues

how to use on video that does not contain a face?

Hi,
Currently the pre processing notebook for dataset generation is limited to being used with videos that contain faces despite this being marked as an "optional" step.

the mediapipe library is used to get a mesh of the face and parts of this are used to generate the scene.json as well as the test camera path.

Do you have a more generic workflow or simplified method for generating the scene.json?

Jacobian computation

Hi,

I have a question w.r.t the computation of Jacobian matrix in warping.py.
For each input point, the network predicts the SE(3) transformation which is then used to warp the point to a new position.

In my opinion, the Jacobian of the new position w.r.t the input point position is essentially the rotation part of the SE(3). Therefore, since you already have the analytical Jacobian, I am wondering whether it is necessary to call Jax to compute it again as shown

out['jacobian'] = jac_fn(points, metadata_embed, extra)


Updated: I made a stupid mistake by ignoring the fact that the predicted SE(3) also depends on the input point. Thus, the Jacobian definitely is not equal to the rotation part of the SE(3).

Small bug on pixel_aspect_ratio?

pixel_aspect_ratio is always one because of pixel_aspect_ratio=colmap_camera.fx / colmap_camera.fx

def convert_colmap_camera(colmap_camera, colmap_image):
  """Converts a pycolmap `image` to an SFM camera."""
  camera_rotation = colmap_image.R()
  camera_position = -(colmap_image.t @ camera_rotation)
  new_camera = Camera(
      orientation=camera_rotation,
      position=camera_position,
      focal_length=colmap_camera.fx,
      pixel_aspect_ratio=colmap_camera.fx / colmap_camera.fx,
      principal_point=np.array([colmap_camera.cx, colmap_camera.cy]),
      radial_distortion=np.array([colmap_camera.k1, colmap_camera.k2, 0.0]),
      tangential_distortion=np.array([colmap_camera.p1, colmap_camera.p2]),
      skew=0.0,
      image_size=np.array([colmap_camera.width, colmap_camera.height])
  )
  return new_camera

Strictly, it should be pixel_aspect_ratio=colmap_camera.fy / colmap_camera.fx

TypeError: 'NoneType' object is not subscriptable

Hi, while trying to execute the "Create training iterators" under the Nerfies Training.ipynb colab notebook, I'm facing the following issue:
nerfies_train
Is it the issue with setting the runtime as TPU or JAX version compatibility?

How to install required packages?

Hi, I'm trying to get the code run on my Mac (might not work since there is no cuda support in Mojave) but I'm still wondering what to do next.
So far I have installed Miniconda and installed the environment with
conda create --name nerfies python=3.8

Next step is to install the required packages with
pip install -r requirements.txt

Where exactly do I execute this install command?

Dependency conflict

I created a brand new Conda environment, python 3.8 and tried to PIP install with -r requriements.txt, but it's giving me an error:

ERROR: Cannot install flax because these package versions have conflicting dependencies.

The conflict is caused by:
optax 0.1.1 depends on jaxlib>=0.1.37
optax 0.1.0 depends on jaxlib>=0.1.37
optax 0.0.91 depends on jaxlib>=0.1.37
optax 0.0.9 depends on jaxlib>=0.1.37
optax 0.0.8 depends on jaxlib>=0.1.37
optax 0.0.6 depends on jaxlib>=0.1.37
optax 0.0.5 depends on jaxlib>=0.1.37
optax 0.0.3 depends on jaxlib>=0.1.37
optax 0.0.2 depends on jaxlib>=0.1.37
optax 0.0.1 depends on jaxlib>=0.1.37

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip attempt to solve the dependency conflict
    I tried changing flax and jax from an == requirement to a >= requirement, but that didn't resolve the issue.

Anyone else have this, or know how to resolve?

Thanks

train loss becomes nan

Hi, while I am training my data locally, the loss becomes nan. What are the possible reasons? Thank you!
b63c8a64498a8caa91e9c9f85adea6d

Camera coordinate and bds

Hello!

I really appreciate to your great work!!

However, I have some questions about camera coordinate on nerfies dataset you released.

I want to use the NeRF code which is implemented on pytorch framework and it provide llff dataset dataloader.

As I know, llff dataset uses camera poses which are saved as format of [-u, r, -t]

and they load the saved poses and rotate them to [r, u, -t] following codes.

image

Since I want to use your dataset(Nerfies) and directory format, I loaded saved poses in camera directories.

image

As I know, you uses opencv camera model whose coordinate axis is [r, -u, t]

So I rotate poses after load the saved poses of your dataset following codes to convert the pose as llff dataset format [-u, r, -t] (I loaded poses and create poses matrix whose shape is 3 x 5 x frame_number, and 3x5 poses matrix consisting of 3x4 pose matrix and 3x1 Height, Width, focal length as llff format)

image

Finally, I generate rays to train our network with undistortion process which you given in nerfies code and I think it works.

but training didn't work well.

I think the reason is that loaded camera poses are wrong because network was trained well when I use broom dataset which is provided as llff format by NSFF author's github(but they don't provide validation dataset. only training data is provided)

I really wonder what is the problem when load the cameras.

Is the saved camera coordinate system [r, -u, t] correct?

If it is correct, then what should I do additionally to get correct camera pose?

I also applied scene_scale, scene_center, principal_points, undistortions as you did in nerfies code.

It will be really helpful if you give answer about the questions!

Thank you.

possible error in the warp code

repro -

  • capture a head as still as possible - not one's own but a subject against a wall looking at fixed point.
    in my test the starting point of the capture was not aligned to face center but to right ear, then an arc and an orbit.

  • follow the example colabs - I tested twice, once on a colab without changing parameters, once in jupyter with scale factor of 2

There should be no 'warp' on any of those. And yet there is, causing the test cameras to be wrong - unless 'warp' is introduced from the capture camera at smallest rotation from the test camera one is trying to render.

I noticed that there are scaling and reorientation of scenes, I traced and found no obvious fault with the rotation code.

I see mediapipe is used, and while mp is great it is returns probabilistic fitting, not pixel accurate - but didnt purse further where the error in the warping code comes from - could it be mediapipe?

I can send rendered videos or even the scene if necessary - but not on an open forum.
thanks
xvdp

If Im wrong, please telll me what is wrong w my process.

Questions about face processing section in Colab

Hi, thanks for releasing the codes.

In Colab, process a video into a Nerfie dataset, it seems that the face processing section is optional. I skipped this section and ran compute scene information section. It gives errors, "name 'new_scene_manager' is not defined' ". 'new_scene_manager' is defined in face processing section. Is it necessary to run the face processing section or did I miss anything?

WeChat Image_20210204220139

Thank you!

Cannot run eval.py

Hi, Nerfies team.

Thank you for creating such great work!

I cannot run eval.py. However, train.py is working properly.

Any suggestion to solve the problem? Thank you.

Configuration:

include 'gpu_fullhd.gin'

TrainConfig.use_background_loss = False
ModelConfig.num_coarse_samples = 64
ModelConfig.num_fine_samples = 128

Terminal output:

I0520 14:04:02.444777 140460358084416 eval.py:202] *** Starting experiment
I0520 14:04:02.445011 140460358084416 eval.py:205] *** Loading Gin configs from: ['configs/train.gin']
I0520 14:04:02.448294 140460358084416 resource_reader.py:50] system_path_file_exists:gpu_fullhd.gin
E0520 14:04:02.448478 140460358084416 resource_reader.py:55] Path not found: gpu_fullhd.gin
I0520 14:04:02.449614 140460358084416 resource_reader.py:50] system_path_file_exists:warp_defaults.gin
E0520 14:04:02.449765 140460358084416 resource_reader.py:55] Path not found: warp_defaults.gin
I0520 14:04:02.462348 140460358084416 resource_reader.py:50] system_path_file_exists:defaults.gin
E0520 14:04:02.462505 140460358084416 resource_reader.py:55] Path not found: defaults.gin
I0520 14:04:02.472962 140460358084416 eval.py:221] 	exp_dir = runs/labjuice
I0520 14:04:02.474851 140460358084416 eval.py:226] 	summary_dir = runs/labjuice/summaries/eval
I0520 14:04:02.475837 140460358084416 eval.py:231] 	renders_dir = runs/labjuice/renders
I0520 14:04:02.476572 140460358084416 eval.py:236] 	checkpoint_dir = runs/labjuice/checkpoints
I0520 14:04:04.813610 140460358084416 eval.py:250] Creating datasource: {'type': 'nerfies', 'data_dir': 'data/labjuice'}
I0520 14:04:04.858571 140460358084416 nerfies.py:73] *** Loading dataset IDs from data/labjuice/dataset.json
I0520 14:04:04.924658 140460358084416 core.py:302] *** Creating a dataset with 11 items.
I0520 14:04:07.831447 140417687979776 core.py:375] 	Loaded item frame_0120: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 119, 'warp': 119}
I0520 14:04:07.845319 140417704765184 core.py:375] 	Loaded item frame_0061: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 60, 'warp': 60}
I0520 14:04:07.849324 140417035134720 core.py:375] 	Loaded item frame_0269: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 268, 'warp': 268}
I0520 14:04:07.849992 140417679587072 core.py:375] 	Loaded item frame_0150: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 149, 'warp': 149}
I0520 14:04:07.852888 140417671194368 core.py:375] 	Loaded item frame_0180: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 179, 'warp': 179}
I0520 14:04:07.853951 140449278314240 core.py:375] 	Loaded item frame_0002: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 1, 'warp': 1}
I0520 14:04:07.855388 140417662801664 core.py:375] 	Loaded item frame_0210: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 209, 'warp': 209}
I0520 14:04:07.855896 140449269921536 core.py:375] 	Loaded item frame_0031: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 30, 'warp': 30}
I0520 14:04:07.856396 140417043527424 core.py:375] 	Loaded item frame_0239: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 238, 'warp': 238}
I0520 14:04:07.857960 140417026742016 core.py:375] 	Loaded item frame_0299: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 298, 'warp': 298}
I0520 14:04:07.859418 140417696372480 core.py:375] 	Loaded item frame_0091: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 90, 'warp': 90}
I0520 14:04:08.227674 140460358084416 core.py:138] *** Loaded dataset items: num_rays=6286896, num_examples=11
I0520 14:04:08.655340 140460358084416 core.py:302] *** Creating a dataset with 38 items.
I0520 14:04:09.231013 140416028698368 core.py:375] 	Loaded item frame_0001: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 0, 'warp': 0}
I0520 14:04:09.267059 140413033805568 core.py:375] 	Loaded item frame_0049: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 48, 'warp': 48}
I0520 14:04:09.290294 140411976791808 core.py:375] 	Loaded item frame_0105: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 104, 'warp': 104}
I0520 14:04:09.391631 140411993577216 core.py:375] 	Loaded item frame_0089: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 88, 'warp': 88}
I0520 14:04:09.405202 140410332641024 core.py:375] 	Loaded item frame_0241: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 240, 'warp': 240}
I0520 14:04:09.407492 140416020305664 core.py:375] 	Loaded item frame_0009: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 8, 'warp': 8}
I0520 14:04:09.410925 140415995127552 core.py:375] 	Loaded item frame_0033: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 32, 'warp': 32}
I0520 14:04:09.417380 140416011912960 core.py:375] 	Loaded item frame_0017: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 16, 'warp': 16}
I0520 14:04:09.426120 140412001969920 core.py:375] 	Loaded item frame_0081: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 80, 'warp': 80}
I0520 14:04:09.440179 140409795770112 core.py:375] 	Loaded item frame_0297: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 296, 'warp': 296}
I0520 14:04:09.446149 140410827548416 core.py:375] 	Loaded item frame_0225: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 224, 'warp': 224}
I0520 14:04:09.452231 140411985184512 core.py:375] 	Loaded item frame_0097: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 96, 'warp': 96}
I0520 14:04:09.478314 140416003520256 core.py:375] 	Loaded item frame_0025: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 24, 'warp': 24}
I0520 14:04:09.483593 140411372812032 core.py:375] 	Loaded item frame_0161: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 160, 'warp': 160}
I0520 14:04:09.488675 140412010362624 core.py:375] 	Loaded item frame_0073: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 72, 'warp': 72}
I0520 14:04:09.489866 140411356026624 core.py:375] 	Loaded item frame_0177: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 176, 'warp': 176}
I0520 14:04:09.501473 140411406382848 core.py:375] 	Loaded item frame_0129: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 128, 'warp': 128}
I0520 14:04:09.502885 140410869511936 core.py:375] 	Loaded item frame_0185: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 184, 'warp': 184}
I0520 14:04:09.504619 140413025412864 core.py:375] 	Loaded item frame_0057: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 56, 'warp': 56}
I0520 14:04:09.504841 140411960006400 core.py:375] 	Loaded item frame_0121: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 120, 'warp': 120}
I0520 14:04:09.505058 140410282284800 core.py:375] 	Loaded item frame_0289: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 288, 'warp': 288}
I0520 14:04:09.506297 140410290677504 core.py:375] 	Loaded item frame_0281: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 280, 'warp': 280}
I0520 14:04:09.506653 140411381204736 core.py:375] 	Loaded item frame_0153: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 152, 'warp': 152}
I0520 14:04:09.509786 140410835941120 core.py:375] 	Loaded item frame_0217: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 216, 'warp': 216}
I0520 14:04:09.516040 140411364419328 core.py:375] 	Loaded item frame_0169: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 168, 'warp': 168}
I0520 14:04:09.518889 140410844333824 core.py:375] 	Loaded item frame_0209: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 208, 'warp': 208}
I0520 14:04:09.520003 140410299070208 core.py:375] 	Loaded item frame_0273: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 272, 'warp': 272}
I0520 14:04:09.522838 140411389597440 core.py:375] 	Loaded item frame_0145: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 144, 'warp': 144}
I0520 14:04:09.523147 140411968399104 core.py:375] 	Loaded item frame_0113: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 112, 'warp': 112}
I0520 14:04:09.523772 140410861119232 core.py:375] 	Loaded item frame_0193: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 192, 'warp': 192}
I0520 14:04:09.525799 140413436401408 core.py:375] 	Loaded item frame_0041: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 40, 'warp': 40}
I0520 14:04:09.526642 140410307462912 core.py:375] 	Loaded item frame_0265: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 264, 'warp': 264}
I0520 14:04:09.528127 140410324248320 core.py:375] 	Loaded item frame_0249: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 248, 'warp': 248}
I0520 14:04:09.528872 140410852726528 core.py:375] 	Loaded item frame_0201: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 200, 'warp': 200}
I0520 14:04:09.531115 140412622956288 core.py:375] 	Loaded item frame_0065: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 64, 'warp': 64}
I0520 14:04:09.533269 140410819155712 core.py:375] 	Loaded item frame_0233: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 232, 'warp': 232}
I0520 14:04:09.535274 140411397990144 core.py:375] 	Loaded item frame_0137: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 136, 'warp': 136}
I0520 14:04:09.535899 140410315855616 core.py:375] 	Loaded item frame_0257: shape=(567, 1008, 3), scale_factor=1.000000, metadata={'appearance': 256, 'warp': 256}
I0520 14:04:10.983216 140460358084416 core.py:138] *** Loaded dataset items: num_rays=21718368, num_examples=38
W0520 14:04:12.018282 140460358084416 nerfies.py:170] test camera path does not exist: data/labjuice/camera-paths/orbit-extreme
I0520 14:04:45.636032 140460358084416 checkpoints.py:152] Restoring checkpoint from runs/labjuice/checkpoints/checkpoint_340000
I0520 14:04:46.048658 140460358084416 eval.py:157] [train:1/11] Processing frame_0002 
I0520 14:04:46.049307 140460358084416 evaluation.py:55] 	Rendering ray batch: 0/571536
Traceback (most recent call last):
  File "eval.py", line 378, in <module>
    app.run(main)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/absl/app.py", line 303, in run
    _run_main(main, args)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "eval.py", line 347, in main
    datasource=datasource)
  File "eval.py", line 188, in process_iterator
    datasource=datasource)
  File "eval.py", line 73, in process_batch
    rgb, depth_exp, depth_med, acc = render_fn(state, batch, rng=rng)
  File "/ist/ist-share/vision/pakkapon/nerf_proj/nerfies/nerfies/evaluation.py", line 80, in render_image
    state.warp_alpha)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/api.py", line 1571, in f_pmapped
    global_arg_shapes=tuple(global_arg_shapes_flat))
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/core.py", line 1461, in bind
    return call_bind(self, fun, *args, **params)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/core.py", line 1393, in call_bind
    outs = primitive.process(top_trace, fun, tracers, params)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/core.py", line 1464, in process
    return trace.process_map(self, fun, tracers, params)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/core.py", line 600, in process_call
    return primitive.impl(f, *tracers, **params)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/interpreters/pxla.py", line 618, in xla_pmap_impl
    *abstract_args)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/linear_util.py", line 260, in memoized_fun
    ans = call(fun, *args)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/interpreters/pxla.py", line 688, in parallel_callable
    jaxpr, out_sharded_avals, consts = pe.trace_to_jaxpr_final(fun, global_sharded_avals, transform_name="pmap")
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/interpreters/partial_eval.py", line 1209, in trace_to_jaxpr_final
    jaxpr, out_avals, consts = trace_to_subjaxpr_dynamic(fun, main, in_avals)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/interpreters/partial_eval.py", line 1188, in trace_to_subjaxpr_dynamic
    ans = fun.call_wrapped(*in_tracers)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/linear_util.py", line 166, in call_wrapped
    ans = self.f(*args, **dict(self.params, **kwargs))
  File "eval.py", line 303, in _model_fn
    mutable=False)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/linen/module.py", line 686, in apply
    return apply(fn, mutable=mutable)(variables, rngs=rngs)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/core/scope.py", line 591, in wrapper
    y = fn(root, *args, **kwargs)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/linen/module.py", line 685, in <lambda>
    fn = lambda scope: method(self.clone(parent=scope), *args, **kwargs)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/linen/module.py", line 221, in wrapped_module_method
    return fun(self, *args, **kwargs)
  File "/ist/ist-share/vision/pakkapon/nerf_proj/nerfies/nerfies/models.py", line 204, in __call__
    metadata_encoded)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/linen/module.py", line 221, in wrapped_module_method
    return fun(self, *args, **kwargs)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/linen/transforms.py", line 148, in wrapped_fn
    ret = trafo_fn(get_module_scopes(self), *args, **kwargs)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/core/lift.py", line 180, in wrapper
    *args)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/core/lift.py", line 379, in inner
    return mapped(variable_groups, rng_groups, args)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/api.py", line 1226, in batched_fun
    ).call_wrapped(*args_flat)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/linear_util.py", line 166, in call_wrapped
    ans = self.f(*args, **dict(self.params, **kwargs))
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/core/lift.py", line 376, in mapped
    y = fn(scope, *args)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/linen/transforms.py", line 141, in core_fn
    res = fn(cloned, *args, **kwargs)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/linen/module.py", line 221, in wrapped_module_method
    return fun(self, *args, **kwargs)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/linen/transforms.py", line 148, in wrapped_fn
    ret = trafo_fn(get_module_scopes(self), *args, **kwargs)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/core/lift.py", line 180, in wrapper
    *args)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/core/lift.py", line 379, in inner
    return mapped(variable_groups, rng_groups, args)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/api.py", line 1226, in batched_fun
    ).call_wrapped(*args_flat)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/linear_util.py", line 166, in call_wrapped
    ans = self.f(*args, **dict(self.params, **kwargs))
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/core/lift.py", line 376, in mapped
    y = fn(scope, *args)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/linen/transforms.py", line 141, in core_fn
    res = fn(cloned, *args, **kwargs)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/linen/module.py", line 221, in wrapped_module_method
    return fun(self, *args, **kwargs)
  File "/ist/ist-share/vision/pakkapon/nerf_proj/nerfies/nerfies/warping.py", line 329, in __call__
    warped_points = self.warp(points, metadata, alpha, metadata_encoded)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/linen/module.py", line 221, in wrapped_module_method
    return fun(self, *args, **kwargs)
  File "/ist/ist-share/vision/pakkapon/nerf_proj/nerfies/nerfies/warping.py", line 280, in warp
    points_embed = self.points_encoder(points, alpha=alpha)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/flax/linen/module.py", line 221, in wrapped_module_method
    return fun(self, *args, **kwargs)
  File "/ist/ist-share/vision/pakkapon/nerf_proj/nerfies/nerfies/modules.py", line 178, in __call__
    window = self.cosine_easing_window(self.num_freqs, alpha)
  File "/ist/ist-share/vision/pakkapon/nerf_proj/nerfies/nerfies/modules.py", line 201, in cosine_easing_window
    x = jnp.clip(alpha - jnp.arange(num_freqs, dtype=jnp.float32), 0.0, 1.0)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/core.py", line 498, in __sub__
    def __sub__(self, other): return self.aval._sub(self, other)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/_src/numpy/lax_numpy.py", line 5370, in deferring_binary_op
    return binary_op(self, other)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/_src/numpy/lax_numpy.py", line 418, in <lambda>
    fn = lambda x1, x2: lax_fn(*_promote_args(numpy_fn.__name__, x1, x2))
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/_src/lax/lax.py", line 348, in sub
    return sub_p.bind(x, y)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/core.py", line 259, in bind
    out = top_trace.process_primitive(self, tracers, params)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/interpreters/partial_eval.py", line 1049, in process_primitive
    out_avals = primitive.abstract_eval(*avals, **params)
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/_src/lax/lax.py", line 2023, in standard_abstract_eval
    return ShapedArray(shape_rule(*avals, **kwargs), dtype_rule(*avals, **kwargs),
  File "/ist/users/pakkaponp/.conda/envs/jax/lib/python3.6/site-packages/jax/_src/lax/lax.py", line 2119, in _broadcasting_shape_rule
    raise TypeError(msg.format(name, ', '.join(map(str, map(tuple, shapes)))))
TypeError: sub got incompatible shapes for broadcasting: (2,), (8,).

Got undesirable outputs on the broom case

Hi there,
Thank for your amazing work!
I tried to reproduce the result on broom case with default setting on 8 gpus.
trained with
"python train.py --jax_data_dir=$PATH_TO_DATA/broom --jax_base_folder=$WORK_DIR --jax_gin_configs=$PATH_TO_PROJ/nerfies/configs/gpu_vrig_paper.gin"
& evaled with
"python eval.py --jax_data_dir=$PATH_TO_DATA/broom --jax_base_folder=$WORK_DIR --jax_gin_configs=$PATH_TO_PROJ/nerfies/configs/gpu_vrig_paper.gin"
The avg psnr is about ~ 19 - 20 which is similar to the one in paper.
But got undesirable outputs like:
rgb_left1_000015
which is quite different with GT/paper result:
left1_000015

Could you help me to figure out the possible reasons? Many thanks!

Error with Nerfies configuration in "Nerfies Render Video.ipynb".

Hi, I have been using your Google Colab notebooks for several days. They were working fine but yesterday I tried to use "Nerfies Render Video.ipynb" and I got this error:

image

I have tried changing the "train_dir:" and "data_dir:", but I still get the same error. Any ideas on how to solve this problem?

dataset

Could you please share one dataset to train and render video? @keunhong

JAX error: RuntimeError: optional has no value

When Parse data in https://github.com/google/nerfies/blob/main/notebooks/Nerfies_Capture_Processing.ipynb

executing following cell:

if colmap_image_scale > 1:
  print(f'Scaling COLMAP cameras back to 1x from {colmap_image_scale}x.')
  for item_id in scene_manager.image_ids:
    camera = scene_manager.camera_dict[item_id]
    scene_manager.camera_dict[item_id] = camera.scale(colmap_image_scale)

Run into error below, seems to be a JAX error, how should we address this? Thanks

Scaling COLMAP cameras back to 1x from 4x.
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-24-32db5f4d2f95> in <module>
     11   for item_id in scene_manager.image_ids:
     12     camera = scene_manager.camera_dict[item_id]
---> 13     scene_manager.camera_dict[item_id] = camera.scale(colmap_image_scale)
     14 
     15 

/usr/local/lib/python3.8/dist-packages/nerfies/camera.py in scale(self, scale)
    315         radial_distortion=self.radial_distortion.copy(),
    316         tangential_distortion=self.tangential_distortion.copy(),
--> 317         image_size=jnp.array((int(round(self.image_size[0] * scale)),
    318                               int(round(self.image_size[1] * scale)))),
    319     )

/usr/local/lib/python3.8/dist-packages/jax/_src/numpy/lax_numpy.py in array(object, dtype, copy, order, ndmin)
   2903     _inferred_dtype = object.dtype and dtypes.canonicalize_dtype(object.dtype)
   2904     lax._check_user_dtype_supported(_inferred_dtype, "array")
-> 2905     out = _device_put_raw(object, weak_type=weak_type)
   2906     if dtype: assert _dtype(out) == dtype
   2907   elif isinstance(object, (DeviceArray, core.Tracer)):

/usr/local/lib/python3.8/dist-packages/jax/_src/lax/lax.py in _device_put_raw(x, weak_type)
   1493   else:
   1494     aval = raise_to_shaped(core.get_aval(x), weak_type=weak_type)
-> 1495     return xla.array_result_handler(None, aval)(*xla.device_put(x))
   1496 
   1497 def iota(dtype: DType, size: int) -> Array:

/usr/local/lib/python3.8/dist-packages/jax/interpreters/xla.py in make_device_array(aval, device, device_buffer)
   1032   if (isinstance(device_buffer, _CppDeviceArray)):
   1033 
-> 1034     if device_buffer.aval == aval and device_buffer._device == device:
   1035       return device_buffer
   1036     device_buffer = device_buffer.clone()

RuntimeError: optional has no value

Nerfies_Training.ipynb collab fails on model initialization

I ran both collabs in sequence Nerfies_Capture_Processing.ipynb and Nerfies_Training.ipynb
but on the process of running the second one I just met an error with having changed nothing
This project is great sincerely , but maybe I need some help to get it run in the right way.
thanks a lot

learning_rate_sched = schedules.from_config(train_config.lr_schedule)

KeyError Traceback (most recent call last)
in ()
16 devices_to_use = jax.devices()
17
---> 18 learning_rate_sched = schedules.from_config(train_config.lr_schedule)
19 warp_alpha_sched = schedules.from_config(train_config.warp_alpha_schedule)
20 elastic_loss_weight_sched = schedules.from_config(

1 frames
/usr/local/lib/python3.7/dist-packages/nerfies/schedules.py in from_config(schedule)
41 return from_tuple(schedule)
42 if isinstance(schedule, collections.Mapping):
---> 43 return from_dict(schedule)
44
45 raise ValueError(f'Unknown type {type(schedule)}.')

/usr/local/lib/python3.7/dist-packages/nerfies/schedules.py in from_dict(d)
31 def from_dict(d):
32 d = copy.copy(dict(d))
---> 33 schedule_type = d.pop('type')
34 return SCHEDULE_MAPschedule_type
35

KeyError: 'type'

TypeError in rendering video frames.

Hi,
Thanks a lot for releasing the code! I tried running the Colab demo, but got errors (as shown in figure) when rendering a video both in training and rendering notebook. How to solve this problem? (Is it related to the WARNING at the top of the figure? And how to set the 'base_64' param mentioned in the warning?)
fig

[Fixed]. NameError: name 'triangulate_points' is not defined

Hi. In the Nerfies Capture Processing notebook, the Normalize scene based on landmarks. is throwing the name error for the function "triangulate_points".

new_landmark_points = triangulate_points(landmarks_pixels, new_cameras)

Its supposed to be triangulate_landmarks()

Error on Nerfies Training v2.ipynb

Hi!

I'm trying to run the notebook Nerfies Training v2.ipynb (using the Colab environment) and I'm getting this error in the "Configuration" cell, both for GPU and TPU.

ImportError                               Traceback (most recent call last)

<ipython-input-5-be45ab41e1a4> in <module>()
      6 from IPython.display import display, Markdown
      7 
----> 8 from nerfies import configs
      9 
     10 

/usr/local/lib/python3.7/dist-packages/nerfies/configs.py in <module>()
     17 
     18 import dataclasses
---> 19 from flax import nn
     20 import gin
     21 import immutabledict

ImportError: cannot import name 'nn' from 'flax' (/usr/local/lib/python3.7/dist-packages/flax/__init__.py)

It seems that flax.nn is deprecated and flax.linen should be used instead.

Thank you very much

About the training of the sampling location offsets

Hi, Keunhong

This nerfies is an excellent work! And I have a little question want to ask: When I train the model, the translation in the code as the following img are always very high or low (nearly 0). Have you ever encountered this kind of problem? How do you limit the range of the translation?

image

Looking forward to your reply! Thanks!

Error importing configs

Hello,

I'm running the colab notebooks, and in the "Nerfies Training notebook" at the line:

from nerfies import configs
I get the following error:

ValueError                                Traceback (most recent call last)
<ipython-input-46-236bf18885cd> in <module>()
      1 get_ipython().system(' pip install flax')
      2 get_ipython().system(' pip install frozendict')
----> 3 from nerfies import configs

5 frames
/usr/lib/python3.7/dataclasses.py in _get_field(cls, a_name, a_type)
    731     # For real fields, disallow mutable defaults for known types.
    732     if f._field_type is _FIELD and isinstance(f.default, (list, dict, set)):
--> 733         raise ValueError(f'mutable default {type(f.default)} for field '
    734                          f'{f.name} is not allowed: use default_factory')
    735 

ValueError: mutable default <class 'frozendict.core.frozendict'> for field warp_kwargs is not allowed: use default_factory

Could you help me resolve this? Thanks!

[Fixed]. InvalidArgumentError: InvalidArgumentError: cannot compute MatMul as input #0(zero-based) was expected to be a float tensor but is a double tensor [Op:MatMul]

Hi.

The Origins and Directions variables in your function triangulate_rays() were invalid data types for ray_triangulate(). I fixed the problem. Please update your notebook.

def triangulate_rays(origins, directions):
  origins = origins[np.newaxis, ...].astype('float32')
  directions = directions[np.newaxis, ...].astype('float32')
  weights = np.ones(origins.shape[:2], dtype=np.float32)
  points = np.array(ray_triangulate(origins, origins + directions, weights))
  return points.squeeze()

Unable to run on GPU

I am trying to run Nerfies on GPU it always "RuntimeError: RESOURCE_EXHAUSTED: Out of memory while trying to allocate 16504591536 bytes."

I tried it locally and on colab (selected GPU runtime and GPU in code)

Both places same error.

It happens at cell "Train a Nerfie!"
on line "with time_tracker.record_time('train_step'):
state, stats, keys = ptrain_step(keys, state, batch, scalar_params)
time_tracker.toc('total')"

Any solution to this??

Flag --base_folder must have a value other than None.

I encountered this issue when I ran python train.py --data_dir $DATASET_PATH --base_folder $EXPERIMENT_PATH --gin_configs configs/test_vrig.gin. Below is the error log. What can I try to solve this? Thanks!

Traceback (most recent call last):
  File "train.py", line 54, in <module>
    jax.config.parse_flags_with_absl()
  File "/home/jllantero/miniconda3/envs/nerfies/lib/python3.8/site-packages/jax/_src/config.py", line 161, in parse_flags_with_absl
    absl.flags.FLAGS(jax_argv, known_only=True)
  File "/home/jllantero/miniconda3/envs/nerfies/lib/python3.8/site-packages/absl/flags/_flagvalues.py", line 673, in __call__
    self.validate_all_flags()
  File "/home/jllantero/miniconda3/envs/nerfies/lib/python3.8/site-packages/absl/flags/_flagvalues.py", line 533, in validate_all_flags
    self._assert_validators(all_validators)
  File "/home/jllantero/miniconda3/envs/nerfies/lib/python3.8/site-packages/absl/flags/_flagvalues.py", line 568, in _assert_validators
    raise _exceptions.IllegalFlagValueError('\n'.join(messages))
absl.flags._exceptions.IllegalFlagValueError: flag --base_folder=None: Flag --base_folder must have a value other than None.

module 'jax' has no attribute 'api'

when calling: state = jax_utils.replicate(state, devices=devices)
the terminal return: AttributeError: module 'jax' has no attribute 'api'

pip install -r requirements.txt - is faulty: minor error

Installation requirements, needs minor fix.
I presume that 2.5 will work as well, but in the interest of neatness - installation scripts oughtn't fail.

FYI

pip install -r requirements.txt

ERROR: Could not find a version that satisfies the requirement tensorflow==2.4.0 (from versions: 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3, 2.5.0)
ERROR: No matching distribution found for tensorflow==2.4.0

Confused about deformation field

Hi, thanks for the great work!
I'm trying to get a textured mesh from my nerfie capture but I'm confused about how the deformation field works.
I can get a canonical mesh (no warp) by feeding in a voxel grid of points, predicting alphas, and doing marching cubes to get a mesh of vertices and triangles. Now I want to warp this mesh using the deformation field into each of my training images. But when I feed in these mesh vertices as nerf points, the resulting warped points (out['warped_points']) don't align with my training images when I project them into each camera using camera.project(). However, if I feed in a voxel grid and do marching cubes over the warped alphas for each image, then the resulting vertices line up perfectly with my training images.
I don't understand why it works with the voxel grid, but doesn't work with the mesh vertices. It seems like deforming the points is not the same as getting the deformed alpha and doing marching cubes on that.

Error with Nerfies_Render_Video.ipynb

Hi, I faced an error while running Nerfies_Render_Video.ipynb on jupyter notebook.

from nerfies import datasets
from nerfies import image_utils

datasource = datasets.from_config(
exp_config.datasource_spec,
image_scale=exp_config.image_scale,
use_appearance_id=model_config.use_appearance_metadata,
use_camera_id=model_config.use_camera_metadata,
use_warp_id=model_config.use_warp,
random_seed=exp_config.random_seed)

show_image(datasource.load_rgb(datasource.train_ids[0]))

I ran this section, and got an error below.

TypeError Traceback (most recent call last)
in
4 from nerfies import image_utils
5
----> 6 datasource = datasets.from_config(
7 exp_config.datasource_spec,
8 image_scale=exp_config.image_scale,

~/Codes/nerfies/nerfies/datasets/init.py in from_config(spec, **kwargs)
20 def from_config(spec, **kwargs):
21 """Create a datasource from a config specification."""
---> 22 spec = dict(spec)
23 ds_type = spec.pop('type')
24 if ds_type == 'nerfies':

TypeError: 'NoneType' object is not iterable

Any ideas for solving this problem?
Thanks.

How to get points.npy

I noticed that points.npy is included in the dataset for background regularization. But it can't be created in the demo of "Process a video into a Nerfie dataset".
So how can I get it?

can not import flax in self hostet jupyter notebook

Hi,
thanks to anyone involved publishing this.
I managed to get the video extraction notebook running after installing heaps of packages missing from the 'requirements.txt'.

Now I'm stuck in the second notebook, trying to import flax.
Running the following in the same cell yields:

!python -c "import flax; print(flax)"
import flax

<module 'flax' from '/opt/conda/envs/nerfies/lib/python3.8/site-packages/flax/init.py'>

ModuleNotFoundError Traceback (most recent call last)
in
1 get_ipython().system('python -c "import flax; print(flax)"')
----> 2 import flax
ModuleNotFoundError: No module named 'flax'

Does anyone reading this have a clue what's up?
Cheers,
Magnus

points.npy file not found

Thanks a lot for sharing the code! It appears that the data processing notebook generates everything except the points.npy file. How are we suppose to get this file if we want to train with background regularization loss?

Nerfies_Training.ipynb collab fails on import configs, having changed no settings

I ran both collabs in sequence Nerfies_Capture_Processing.ipynb and Nerfies_Training.ipynb
on the process of running the second one - having changed nothing igot an error
thanks


ValueError Traceback (most recent call last)
in ()
6 from IPython.display import display, Markdown
7
----> 8 from nerfies import configs
9
10

5 frames
/usr/lib/python3.7/dataclasses.py in _get_field(cls, a_name, a_type)
731 # For real fields, disallow mutable defaults for known types.
732 if f._field_type is _FIELD and isinstance(f.default, (list, dict, set)):
--> 733 raise ValueError(f'mutable default {type(f.default)} for field '
734 f'{f.name} is not allowed: use default_factory')
735

Implementation about the 2D Toy

Hi @keunhong

I am quite interested in the 2D toy example as shown in Fig. 23 and Fig. 24 but I failed to reproduce the results.

Therefore, I am wondering whether you could kindly share the colab file with me?
If not so, could you kindly answer my following questions.

context: to simplify the example, I create a 2D toy example with only rigid transformation (i.e., only random rotation in the range of [-180°, 180°] and translation), and of course I simplify the warp network to only depend on the GLO embedding vector to product a uniform rigid transformation for each observation image.

Q1: However, I find it is really hard for the network to output reasonable rotations (any hints on this)?
Q2: as you have mentioned in the paper about the difficulty due to the "Orientation flips", do you face a similar problem in the 2D toy setting (I noticed that your 2D toy example also uses random rotation within the range of [-180°, 180°] )

Thank you very much in advance.
Best,
Longbow

Deformation for view direction?

Hi, author!

Both nerfies and non-rigid nerf use deformation field. However, in non-rigid nerf they recompute view direction after deformation. How does nerfies deal with it? I quickly reviewed your implementation and did not find related operations. Looking forward to your reply!

Rendering results are strange

In training process, predicted RGB of validation dataset is fine.
2021-05-07 10-03-44 的屏幕截图
But when rendering with the latest checkpoint, I got the strange results as follows:
2021-05-07 10-06-18 的屏幕截图

Training time

Hey!

I would like to know approximately how long does "gpu_quarterhd_4gpu.gin" settings take to train? I use 4 1080Ti GPU.

It is 500k iterations, curl dataset 4x (612, 816), batch size 3072, network width 256, both coarse/fine samples 128.

I am asking this because I have to turn off an XLA flag when using JAX due to an old cuda driver version (issue). I want to know how much slower I am now... It took me 24 hours to run 165K training iterations (~100s for 200 it.). I want to know if it is a normal training speed...

In appendix G of the paper, the HALF experiment is kind of similar. It is 100k iterations, 8 V100 GPU, batch size 8096, both coarse/fine samples 128, but network width only 128, which took only 16 hours. I think maybe the XLA flag does not make me slow significantly?

Thanks!

The way to calculate 'near' is confusing

Very appreciative for the release. I noticed that the way you calculate 'near' is confusing, in Nerfies_Capture_Processing.ipynb, under the part called Compute Scene Information, .

near = near_far['near'].quantile(0.001) / 0.8

I run it and found that some area of the face points were cut off by the near value. See the points beyond the purple near plane in this image:
image

Since the 'depths' you used are positive, maybe it should be like this?

near = near_far['near'].quantile(0.001) * 0.8

Face distortion in outputs

Hi, I have used colab demo to run on my dataset. But people's face has some distortion in the predicted results. I cannot figure out the reasons. Is it because I didn’t train enough or should be related to my dataset?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.