Giter VIP home page Giter VIP logo

latent-nerf's Introduction

Latent-NeRF for Shape-Guided Generation of 3D Shapes and Textures

Text-guided image generation has progressed rapidly in recent years, inspiring major breakthroughs in text-guided shape generation. Recently, it has been shown that using score distillation, one can successfully text-guide a NeRF model to generate a 3D object. We adapt the score distillation to the publicly available, and computationally efficient, Latent Diffusion Models, which apply the entire diffusion process in a compact latent space of a pretrained autoencoder. As NeRFs operate in image space, a naΓ―ve solution for guiding them with latent score distillation would require encoding to the latent space at each guidance step. Instead, we propose to bring the NeRF to the latent space, resulting in a Latent-NeRF. Analyzing our Latent-NeRF, we show that while Text-to-3D models can generate impressive results, they are inherently unconstrained and may lack the ability to guide or enforce a specific 3D structure. To assist and direct the 3D generation, we propose to guide our Latent-NeRF using a Sketch-Shape: an abstract geometry that defines the coarse structure of the desired object. Then, we present means to integrate such a constraint directly into a Latent-NeRF. This unique combination of text and shape guidance allows for increased control over the generation process. We also show that latent score distillation can be successfully applied directly on 3D meshes. This allows for generating high-quality textures on a given geometry. Our experiments validate the power of our different forms of guidance and the efficiency of using latent rendering.

Description πŸ“œ

Official Implementation for "Latent-NeRF for Shape-Guided Generation of 3D Shapes and Textures".

TL;DR - We explore different ways of introducing shape-guidance for Text-to-3D and present three models: a purely text-guided Latent-NeRF, Latent-NeRF with soft shape guidance for more exact control over the generated shape, and Latent-Paint for texture generation for explicit shapes.

Recent Updates πŸ“°

  • 27.11.2022 - Code release

  • 14.11.2022 - Created initial repo

Latent-Paint 🎨

In the Latent-Paint application, a texture is generated for an explicit mesh directly on its texture map using stable-diffusion as a prior.

Here the geometry is used as a hard constraint where the generation process is tied to the given mesh and its parameterization.

Below we can see the progress of the generation process over the optimization process

To create such results, run the train_latent_paint script. Parameters are handled using pyrallis and can be passed from a config file or the cmd.

 python -m scripts.train_latent_paint --config_path demo_configs/latent_paint/goldfish.yaml

or alternatively

python -m scripts.train_latent_paint --log.exp_name 2022_11_22_goldfish --guide.text "A goldfish"  --guide.shape_path /nfs/private/gal/meshes/blub.obj

Sketch-Guided Latent-NeRF 🧸

Here we use a simple coarse geometry which we call a SketchShape to guide the generation process.

A SketchShape presents a soft constraint which guides the occupancy of a learned NeRF model but isn't constrained to its exact geometry.

A SketchShape can come in many forms, here are some extruded ones.

To create such results, run the train_latent_nerf script. Parameters are handled using pyrallis and can be passed from a config file or the cmd.

 python -m scripts.train_latent_nerf --config_path demo_configs/latent_nerf/lego_man.yaml

Or alternatively

python -m scripts.train_latent_nerf --log.exp_name '2022_11_25_lego_man' --guide.text 'a lego man' --guide.shape_path shapes/teddy.obj --render.nerf_type latent

Unconstrained Latent-NeRF 🏰

Here we apply a text-to-3D without any shape constraint similarly to dreamfusion and stable-dreamfusion.

We directly train the NeRF in latent space, so no encoding into the latent space is required during training.

To create such results, run the train_latent_nerf script. Parameters are handled using pyrallis and can be passed from a config file or the cmd.

 python -m scripts.train_latent_nerf --config_path demo_configs/latent_nerf/sand_castle.yaml

Or alternatively

python -m scripts.train_latent_nerf --log.exp_name 'sand_castle' --guide.text 'a highly detailed sand castle' --render.nerf_type latent

Textual Inversion 🐈

As our Latent-NeRF is supervised by Stable-Diffusion, we can also use Textual Inversion tokens as part of the input text prompt. This allows conditioning the object generation on specific objects and styles, defined only by input images.

For Textual-Inversion results use the guide.concept_name with a concept from the πŸ€— concept library. For example --guide.concept_name=cat-toy and then simply use the corresponding token in your --guide.text

Getting Started

Installation πŸ’Ύ

Install the common dependencies from the requirements.txt file

pip install -r requirements.txt

For Latent-NeRF with shape-guidance, additionally install igl

conda install -c conda-forge igl

For Latent-Paint, additionally install kaolin

 pip install git+https://github.com/NVIDIAGameWorks/kaolin

Note that you also need a πŸ€— token for StableDiffusion. First accept conditions for the model you want to use, default one is CompVis/stable-diffusion-v1-4. Then, add a TOKEN file access token to the root folder of this project, or use the huggingface-cli login command

Training πŸ‹οΈ

Scripts for training are available in the scripts/ folder, see above or in the demo_configs/ for some actual examples.

Meshes for shape-guidance are available under shapes/

Additional Tips and Tricks πŸͺ„

  • Check out the vis/train to see the actual rendering used during the optimization. You might want to play around with the guide.mesh_scale if the object looks too small or too large.

  • For Latent-NeRF with shape-guidance try changing guide.proximal_surface and optim.lambda_shape to control the strictness of the guidance

Repository structure

Path Description
Repository root folder
β”œΒ  demo_configs Configs for running specific experiments
β”œΒ  scripts The training scripts
β”œΒ  shapes Various shapes to use for shape-guidance
β”œ src The actual code for training and evaluation
β”‚Β  β”œΒ  latent_nerf Code for Latent-NeRF training
β”‚Β  β”‚Β  β”œΒ  configs Config structure for training
β”‚Β  β”‚Β  β”œΒ  models NeRF models
β”‚Β  β”‚Β  β”œΒ  raymarching The CUDA ray marching modules
β”‚Β  β”‚Β  β”œΒ  training The Trainer class and related code
β”‚Β  β”œΒ  latent_paint Code for Latent-Paint training
β”‚Β  β”‚Β  β”œΒ  configs Config structure for training
β”‚Β  β”‚Β  β”œΒ  models Textured-Mesh models
β”‚Β  β”‚Β  β”œΒ  training The Trainer class and related code

Acknowledgments

The Latent-NeRF code is heavily based on the stable-dreamfusion project, and the Latent-Paint code borrows from text2mesh.

Citation

If you use this code for your research, please cite our paper Latent-NeRF for Shape-Guided Generation of 3D Shapes and Textures

@article{metzer2022latent,
  title={Latent-NeRF for Shape-Guided Generation of 3D Shapes and Textures},
  author={Metzer, Gal and Richardson, Elad and Patashnik, Or and Giryes, Raja and Cohen-Or, Daniel},
  journal={arXiv preprint arXiv:2211.07600},
  year={2022}
}

latent-nerf's People

Contributors

eladrich avatar galmetzer 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

latent-nerf's Issues

High resolution problems.

It seems like that I encode a high resolution(over 3000 x 4000) will still be OOM, I mean not for train, just for testing the limit of encoding.

Is the setting of learning rate sensitive?

Hi, I set the epoch from 5000 to 10000, and adjusted the learning rate from 1e-3 to 5e-4, and got quite good results. However, this learning rate seems not good for every object. I am a bit confused with the setting of lr and epoch. Can somebody give me some advice? Thx a lot!

Orientation loss

Thanks for your great research.
Compared with the raw version of Dreamfusion(or Stable Dreamfusion), it seems that the orientation loss has been ignored in Latent-NeRF. This loss about normal is designed for better 3D geometry. Do you ignore this loss for some reason?

TypeError: grid_encode_forward(): incompatible function arguments.

I tried to run the command for snadcastle as per the readme which was:
python -m scripts.train_latent_nerf --config_path demo_configs/latent_nerf/sand_castle.yaml
I have installed gridencoder from the stable-dreamfusion repo, not sure how to resolve the error.
But it throws a TypeError: at Grid_encode_forward call.
Below is the trace output
`/usr/lib/python3.8/runpy.py:192 in _run_module_as_main β”‚
β”‚ β”‚
β”‚ 189 β”‚ main_globals = sys.modules["main"].dict β”‚
β”‚ 190 β”‚ if alter_argv: β”‚
β”‚ 191 β”‚ β”‚ sys.argv[0] = mod_spec.origin β”‚
β”‚ ❱ 192 β”‚ return _run_code(code, main_globals, None, β”‚
β”‚ 193 β”‚ β”‚ β”‚ β”‚ β”‚ "main", mod_spec) β”‚
β”‚ 194 β”‚
β”‚ 195 def run_module(mod_name, init_globals=None, β”‚
β”‚ β”‚
β”‚ /usr/lib/python3.8/runpy.py:85 in run_code β”‚
β”‚ β”‚
β”‚ 82 β”‚ β”‚ β”‚ β”‚ β”‚ loader = loader, β”‚
β”‚ 83 β”‚ β”‚ β”‚ β”‚ β”‚ package = pkg_name, β”‚
β”‚ 84 β”‚ β”‚ β”‚ β”‚ β”‚ spec = mod_spec) β”‚
β”‚ ❱ 85 β”‚ exec(code, run_globals) β”‚
β”‚ 86 β”‚ return run_globals β”‚
β”‚ 87 β”‚
β”‚ 88 def run_module_code(code, init_globals=None, β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/latent-nerf/scripts/train_latent_nerf.py:17 in β”‚
β”‚ β”‚
β”‚ 14 β”‚ β”‚ trainer.train() β”‚
β”‚ 15 β”‚
β”‚ 16 if name == 'main': β”‚
β”‚ ❱ 17 β”‚ main() β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/venv_sdfusion20/lib/python3.8/site-packages/pyrallis/argparsing.py:15 β”‚
β”‚ 8 in wrapper_inner β”‚
β”‚ β”‚
β”‚ 155 β”‚ β”‚ β”‚ argspec = inspect.getfullargspec(fn) β”‚
β”‚ 156 β”‚ β”‚ β”‚ argtype = argspec.annotations[argspec.args[0]] β”‚
β”‚ 157 β”‚ β”‚ β”‚ cfg = parse(config_class=argtype, config_path=config_path) β”‚
β”‚ ❱ 158 β”‚ β”‚ β”‚ response = fn(cfg, *args, **kwargs) β”‚
β”‚ 159 β”‚ β”‚ β”‚ return response β”‚
β”‚ 160 β”‚ β”‚ β”‚
β”‚ 161 β”‚ β”‚ return wrapper_inner β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/latent-nerf/scripts/train_latent_nerf.py:14 in main β”‚
β”‚ β”‚
β”‚ 11 β”‚ if cfg.log.eval_only: β”‚
β”‚ 12 β”‚ β”‚ trainer.full_eval() β”‚
β”‚ 13 β”‚ else: β”‚
β”‚ ❱ 14 β”‚ β”‚ trainer.train() β”‚
β”‚ 15 β”‚
β”‚ 16 if name == 'main': β”‚
β”‚ 17 β”‚ main() β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/latent-nerf/src/latent_nerf/training/trainer.py:124 in train β”‚
β”‚ β”‚
β”‚ 121 β”‚ def train(self): β”‚
β”‚ 122 β”‚ β”‚ logger.info('Starting training ^
^') β”‚
β”‚ 123 β”‚ β”‚ # Evaluate the initialization β”‚
β”‚ ❱ 124 β”‚ β”‚ self.evaluate(self.dataloaders['val'], self.eval_renders_path) β”‚
β”‚ 125 β”‚ β”‚ self.nerf.train() β”‚
β”‚ 126 β”‚ β”‚ β”‚
β”‚ 127 β”‚ β”‚ pbar = tqdm(total=self.cfg.optim.iters, initial=self.train_step, β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/latent-nerf/src/latent_nerf/training/trainer.py:173 in evaluate β”‚
β”‚ β”‚
β”‚ 170 β”‚ β”‚ β”‚
β”‚ 171 β”‚ β”‚ for i, data in enumerate(dataloader): β”‚
β”‚ 172 β”‚ β”‚ β”‚ with torch.cuda.amp.autocast(enabled=self.cfg.optim.fp16): β”‚
β”‚ ❱ 173 β”‚ β”‚ β”‚ β”‚ preds, preds_depth, preds_normals = self.eval_render(data) β”‚
β”‚ 174 β”‚ β”‚ β”‚ β”‚
β”‚ 175 β”‚ β”‚ β”‚ pred, pred_depth, pred_normals = tensor2numpy(preds[0]), tensor2numpy(preds
β”‚
β”‚ 176 β”‚ β”‚ β”‚ β”‚ preds_normals[0]) β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/latent-nerf/src/latent_nerf/training/trainer.py:261 in eval_render β”‚
β”‚ β”‚
β”‚ 258 β”‚ β”‚ ambient_ratio = data['ambient_ratio'] if 'ambient_ratio' in data else 1.0 β”‚
β”‚ 259 β”‚ β”‚ light_d = data['light_d'] if 'light_d' in data else None β”‚
β”‚ 260 β”‚ β”‚ β”‚
β”‚ ❱ 261 β”‚ β”‚ outputs = self.nerf.render(rays_o, rays_d, staged=True, perturb=perturb, light_d β”‚
β”‚ 262 β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ ambient_ratio=ambient_ratio, shading=shading, force_a β”‚
β”‚ 263 β”‚ β”‚ β”‚
β”‚ 264 β”‚ β”‚ pred_depth = outputs['depth'].reshape(B, H, W) β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/latent-nerf/src/latent_nerf/models/renderer.py:410 in render β”‚
β”‚ β”‚
β”‚ 407 β”‚ β”‚ β”‚ results['weights_sum'] = weights_sum β”‚
β”‚ 408 β”‚ β”‚ β”‚
β”‚ 409 β”‚ β”‚ else: β”‚
β”‚ ❱ 410 β”‚ β”‚ β”‚ results = _run(rays_o, rays_d, **kwargs) β”‚
β”‚ 411 β”‚ β”‚ β”‚
β”‚ 412 β”‚ β”‚ return results β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/latent-nerf/src/latent_nerf/models/renderer.py:282 in run_cuda β”‚
β”‚ β”‚
β”‚ 279 β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ 280 β”‚ β”‚ β”‚ β”‚ xyzs, dirs, deltas = self.raymarching.march_rays(n_alive, n_step, rays_a β”‚
β”‚ 281 β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ ❱ 282 β”‚ β”‚ β”‚ β”‚ sigmas, rgbs, normals = self(xyzs, dirs, light_d, ratio=ambient_ratio, s β”‚
β”‚ 283 β”‚ β”‚ β”‚ β”‚ self.raymarching.composite_rays(n_alive, n_step, rays_alive, rays_t, sig β”‚
β”‚ 284 β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ 285 β”‚ β”‚ β”‚ β”‚ rays_alive = rays_alive[rays_alive >= 0] β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/venv_sdfusion20/lib/python3.8/site-packages/torch/nn/modules/module.p β”‚
β”‚ y:1190 in _call_impl β”‚
β”‚ β”‚
β”‚ 1187 β”‚ β”‚ # this function, and just call forward. β”‚
β”‚ 1188 β”‚ β”‚ if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o β”‚
β”‚ 1189 β”‚ β”‚ β”‚ β”‚ or _global_forward_hooks or _global_forward_pre_hooks): β”‚
β”‚ ❱ 1190 β”‚ β”‚ β”‚ return forward_call(*input, **kwargs) β”‚
β”‚ 1191 β”‚ β”‚ # Do not call functions when jit is used β”‚
β”‚ 1192 β”‚ β”‚ full_backward_hooks, non_full_backward_hooks = [], [] β”‚
β”‚ 1193 β”‚ β”‚ if self._backward_hooks or _global_backward_hooks: β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/latent-nerf/src/latent_nerf/models/network_grid.py:108 in forward β”‚
β”‚ β”‚
β”‚ 105 β”‚ β”‚ β”‚
β”‚ 106 β”‚ β”‚ if shading == 'albedo': β”‚
β”‚ 107 β”‚ β”‚ β”‚ # no need to query normal β”‚
β”‚ ❱ 108 β”‚ β”‚ β”‚ sigma, color = self.common_forward(x) β”‚
β”‚ 109 β”‚ β”‚ β”‚ normal = None β”‚
β”‚ 110 β”‚ β”‚ β”‚
β”‚ 111 β”‚ β”‚ else: β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/latent-nerf/src/latent_nerf/models/network_grid.py:62 in β”‚
β”‚ common_forward β”‚
β”‚ β”‚
β”‚ 59 β”‚ β”‚ # x: [N, 3], in [-bound, bound] β”‚
β”‚ 60 β”‚ β”‚ β”‚
β”‚ 61 β”‚ β”‚ # sigma β”‚
β”‚ ❱ 62 β”‚ β”‚ h = self.encoder(x, bound=self.bound) β”‚
β”‚ 63 β”‚ β”‚ β”‚
β”‚ 64 β”‚ β”‚ h = self.sigma_net(h) β”‚
β”‚ 65 β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/venv_sdfusion20/lib/python3.8/site-packages/torch/nn/modules/module.p β”‚
β”‚ y:1190 in _call_impl β”‚
β”‚ β”‚
β”‚ 1187 β”‚ β”‚ # this function, and just call forward. β”‚
β”‚ 1188 β”‚ β”‚ if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks o β”‚
β”‚ 1189 β”‚ β”‚ β”‚ β”‚ or _global_forward_hooks or _global_forward_pre_hooks): β”‚
β”‚ ❱ 1190 β”‚ β”‚ β”‚ return forward_call(*input, **kwargs) β”‚
β”‚ 1191 β”‚ β”‚ # Do not call functions when jit is used β”‚
β”‚ 1192 β”‚ β”‚ full_backward_hooks, non_full_backward_hooks = [], [] β”‚
β”‚ 1193 β”‚ β”‚ if self._backward_hooks or _global_backward_hooks: β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/latent-nerf/src/latent_nerf/models/encoders/gridencoder/grid.py:149 β”‚
β”‚ in forward β”‚
β”‚ β”‚
β”‚ 146 β”‚ β”‚ prefix_shape = list(inputs.shape[:-1]) β”‚
β”‚ 147 β”‚ β”‚ inputs = inputs.view(-1, self.input_dim) β”‚
β”‚ 148 β”‚ β”‚ β”‚
β”‚ ❱ 149 β”‚ β”‚ outputs = grid_encode(inputs, self.embeddings, self.offsets, self.per_level_scal β”‚
β”‚ 150 β”‚ β”‚ outputs = outputs.view(prefix_shape + [self.output_dim]) β”‚
β”‚ 151 β”‚ β”‚ β”‚
β”‚ 152 β”‚ β”‚ #print('outputs', outputs.shape, outputs.dtype, outputs.min().item(), outputs.ma β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/venv_sdfusion20/lib/python3.8/site-packages/torch/cuda/amp/autocast_m β”‚
β”‚ ode.py:97 in decorate_fwd β”‚
β”‚ β”‚
β”‚ 94 β”‚ def decorate_fwd(*args, **kwargs): β”‚
β”‚ 95 β”‚ β”‚ if cast_inputs is None: β”‚
β”‚ 96 β”‚ β”‚ β”‚ args[0]._fwd_used_autocast = torch.is_autocast_enabled() β”‚
β”‚ ❱ 97 β”‚ β”‚ β”‚ return fwd(*args, **kwargs) β”‚
β”‚ 98 β”‚ β”‚ else: β”‚
β”‚ 99 β”‚ β”‚ β”‚ autocast_context = torch.is_autocast_enabled() β”‚
β”‚ 100 β”‚ β”‚ β”‚ args[0]._fwd_used_autocast = False β”‚
β”‚ β”‚
β”‚ /home/vghorpad/stable-diff/latent-nerf/src/latent_nerf/models/encoders/gridencoder/grid.py:49 in β”‚
β”‚ forward β”‚
β”‚ β”‚
β”‚ 46 β”‚ β”‚ else: β”‚
β”‚ 47 β”‚ β”‚ β”‚ dy_dx = None β”‚
β”‚ 48 β”‚ β”‚ β”‚
β”‚ ❱ 49 β”‚ β”‚ _backend.grid_encode_forward(inputs, embeddings, offsets, outputs, B, D, C, L, S β”‚
β”‚ 50 β”‚ β”‚ β”‚
β”‚ 51 β”‚ β”‚ # permute back to [B, L * C] β”‚
β”‚ 52 β”‚ β”‚ outputs = outputs.permute(1, 0, 2).reshape(B, L * C) β”‚
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: grid_encode_forward(): incompatible function arguments. The following argument types are supported:
1. (arg0: at::Tensor, arg1: at::Tensor, arg2: at::Tensor, arg3: at::Tensor, arg4: int, arg5: int, arg6: int, arg7: int, arg8: float, arg9: int, arg10: Optional[at::Tensor], arg11: int, arg12: bool, arg13: int) -> None

Invoked with: tensor([[0.5000, 0.5000, 0.5000],
[0.5000, 0.5000, 0.5000],
[0.5000, 0.5000, 0.5000],
...,
[0.5000, 0.5000, 0.5000],
[0.5000, 0.5000, 0.5000],
[0.5000, 0.5000, 0.5000]], device='cuda:0'), tensor([[-7.7486e-07, 5.3644e-05],
[-8.2314e-05, -7.3612e-05],
[-3.8505e-05, 2.6822e-05],
...,
[ 2.7418e-05, -5.0962e-05],
[ 6.2227e-05, 7.5281e-05],
[ 4.2677e-05, 9.2626e-05]], device='cuda:0', dtype=torch.float16), tensor([ 0, 4920, 18744, 51512, 136696, 352696, 876984, 1401272,
1925560, 2449848, 2974136, 3498424, 4022712, 4547000, 5071288, 5595576,
6119864], device='cuda:0', dtype=torch.int32), tensor([[[0., 0.],
[0., 0.],
[0., 0.],
...,
[0., 0.],
[0., 0.],
[0., 0.]],

    [[0., 0.],
     [0., 0.],
     [0., 0.],
     ...,
     [0., 0.],
     [0., 0.],
     [0., 0.]],

    [[0., 0.],
     [0., 0.],
     [0., 0.],
     ...,
     [0., 0.],
     [0., 0.],
     [0., 0.]],

    ...,

    [[0., 0.],
     [0., 0.],
     [0., 0.],
     ...,
     [0., 0.],
     [0., 0.],
     [0., 0.]],

    [[0., 0.],
     [0., 0.],
     [0., 0.],
     ...,
     [0., 0.],
     [0., 0.],
     [0., 0.]],

    [[0., 0.],
     [0., 0.],
     [0., 0.],
     ...,
     [0., 0.],
     [0., 0.],
     [0., 0.]]], device='cuda:0', dtype=torch.float16), 16512, 3, 2, 16, 0.4666666666666666, 16, None, 1, False`

Get strange result

I use the default codebase and command for training:

python -m scripts.train_latent_nerf --log.exp_name 'sand_castle' --guide.text 'a highly detailed sand castle' --render.nerf_type latent

And I get this strange result '5001_rgb.mp4'. Does anyone have some advice?

5001_rgb.mp4

How to finetune the model from latent type?

Dear eladrich,
Thx for your great repo! I want to finetune latent nerf as your paper said by changing nerf type from "latent" to "latnet_tune" nad setting optim ckpt path. However it coms up with model shape mismatch error as following:
image
Is there something wrong with my steps?

Some doubts about using rgb and rgbrefinement

In latent-paint mode, when i use rgb to train which means "texture-rgb-mesh", i get some strange results.

1. In latent mode["texture-mesh"], the result seems reasonable

image

2.In rgb mode["texture-rgb-mesh"], the results is weired
image

Question about shading

Dear eladrich,
Thanks for your great repo! I tried to add a start_shading_iter. However I find that the result of adding "lambertian" shading is kinda strange. I just wanna ask what may cause this problem? And also I find that if finetune the training epoch from 5000 to 10000, sometimes it will a produce a result which whole color is black? Has anybody faced the same problem before?

rabbit
cactus

Question: Light color in latent space?

Thanks for the great research

Seems that diffuse reflectance (a.k.a dot product shading) should work with any number of channels, but
I'm wondering what the light color, and ambient light color should be in latent space. Dream Fusion uses light color [.9, .9, .9] and ambient light color [.1, .1, .1] in RGB space. How does this translate to latent space?

Conda environment

Is there a specific conda environment that's able to be provided? Getting errors on a p3.2xl which is what the V100 is on an aws EC2

ModuleNotFoundError: No module named '_gridencoder' ninja build stopped

When running the unconstrained Latent-NeRF for text-to-3D, demo command (below), I get a runtime error during the tilegrid encoding

run command: python3 -m scripts.train_latent_nerf --config_path demo_configs/latent_nerf/sand_castle.yaml

Error:

import _gridencoder as _backend
ModuleNotFoundError: No module named '_gridencoder'
During handling of the above exception, another exception occurred:

21 errors detected in the compilation of "/tmp/tmpxft_000039fb_00000000-6_gridencoder.cpp1.ii".
ninja: build stopped: subcommand failed.

The "teddy" sketch shape cannot be loaded properly

Hi, thanks for your great work! When I tried training the sketched-guided latent nerf myself, I found the "teddy.obj" cannot be loaded properly due to unclear reasons, and the result I got with demo_configs/lego_man.yaml looks like trained from scratch and has no relation with the sketch shape. Then I tried loading the "teddy.obj" file with the trimesh library and found that it was loaded as a Scene object instead of a Trimesh object.

I have fixed this issue by converting the Scene into a Trimesh and exporting the result into a new obj file according to this link. But I still hope you can check the "teddy.obj" file in case someone else meets the same issue.

Thanks for your interesting work again!

Reproducing the german shepherd example

Hello, I'm trying to reproduce the german shepherd example in the paper by using the animal.obj file in the shapes folder but it's far from the quality presented in the paper. I'm just modifying the demo_config for lego man with the animal.obj, is there anything else I need to add to reproduce it?

[Question] Export to Mesh

What is the easiest way to convert a NeRF generated using this project into a mesh (.obj, for example)?

command to run Textual Inversion

Hi,

Thank you for your nice work and open source.

Could you give me an example command to run Textual Inversion? I run it with this command python -m scripts.train_latent_nerf --log.exp_name 'textual inversion backpack' --guide.text 'a backpack that looks like *' --render.nerf_type latent --guide.concept_name=cat-toy, but cannot get a good result, is there some problem with my command?

Hope to receive your reply. Thanks.

The results like yellow clouds

Hi,
Thanks for sharing your great work! I find for a lot of prompts, the results look like yellow clouds without rich colors , for example "a lion":
image
Do you have any idea on how to solve this problem? Thanks for your time!

Training Cost

Can you share the training cost of your awesome work? thx~

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.