Skip to content

Commit

Permalink
TextMesh coarse stage implementation (#121)
Browse files Browse the repository at this point in the history
* textmesh coarse stage

* get textmesh working with tricks from Neuralangelo

* update textmesh config

* minor fixes; add orient loss to textmesh

* update textmesh config

* Update README.md

* Update README.md
  • Loading branch information
bennyguo authored and Vikram Voleti committed Jun 20, 2023
1 parent 4d98c27 commit 5100eed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions threestudio/models/renderers/nerf_volume_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
from threestudio.models.geometry.base import BaseImplicitGeometry
from threestudio.models.materials.base import BaseMaterial
from threestudio.models.renderers.base import VolumeRenderer
<<<<<<< HEAD
from threestudio.utils.ops import chunk_batch, validate_empty_rays
=======
from threestudio.utils.ops import chunk_batch
>>>>>>> TextMesh coarse stage implementation (#121)
from threestudio.utils.typing import *


Expand Down
9 changes: 6 additions & 3 deletions threestudio/models/renderers/neus_volume_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ def forward(
n_rays = rays_o_flatten.shape[0]

def alpha_fn(t_starts, t_ends, ray_indices):
ray_indices, t_starts, t_ends = validate_empty_rays(ray_indices, t_starts, t_ends)
ray_indices, t_starts, t_ends = validate_empty_rays(
ray_indices, t_starts, t_ends
)
t_starts, t_ends = t_starts[..., None], t_ends[..., None]
t_origins = rays_o_flatten[ray_indices]
t_positions = (t_starts + t_ends) / 2.0
Expand Down Expand Up @@ -153,7 +155,9 @@ def alpha_fn(t_starts, t_ends, ray_indices):
cone_angle=0.0,
)

ray_indices, t_starts_, t_ends_ = validate_empty_rays(ray_indices, t_starts_, t_ends_)
ray_indices, t_starts_, t_ends_ = validate_empty_rays(
ray_indices, t_starts_, t_ends_
)
ray_indices = ray_indices.long()
t_starts, t_ends = t_starts_[..., None], t_ends_[..., None]
t_origins = rays_o_flatten[ray_indices]
Expand All @@ -163,7 +167,6 @@ def alpha_fn(t_starts, t_ends, ray_indices):
positions = t_origins + t_dirs * t_positions
t_intervals = t_ends - t_starts


if self.training:
geo_out = self.geometry(positions, output_normal=True)
rgb_fg_all = self.material(
Expand Down
2 changes: 1 addition & 1 deletion threestudio/utils/saving.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import numpy as np
import torch
import trimesh
import wandb
from matplotlib import cm
from matplotlib.colors import LinearSegmentedColormap
from PIL import Image, ImageDraw
from pytorch_lightning.loggers import WandbLogger

import wandb
from threestudio.models.mesh import Mesh
from threestudio.utils.typing import *

Expand Down

0 comments on commit 5100eed

Please sign in to comment.