Skip to content

Commit

Permalink
rename arg
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangwei221 committed Aug 24, 2022
1 parent a1ed280 commit 6cf0775
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions render_360.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def main_canonical_360(opt):
Ts=None,
rays_per_batch=opt.rays_per_batch,
samples_per_ray=opt.samples_per_ray,
tpose=True,
render_can=True,
return_mask=False,
return_depth=False,
interval_comp=opt.geo_threshold / np.mean(can_bones)
Expand Down Expand Up @@ -119,7 +119,7 @@ def main_posed_360(opt):
rays_per_batch=opt.rays_per_batch,
samples_per_ray=opt.samples_per_ray,
white_bkg=opt.white_bkg,
tpose=False,
render_can=False,
geo_threshold=opt.geo_threshold
)
save_path = os.path.join('./demo', f'posed_360/{os.path.basename(opt.scene_dir)}', f'out_{str(i).zfill(4)}.png')
Expand Down
2 changes: 1 addition & 1 deletion trainers/human_nerf_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def validate(self):
rays_per_batch=self.opt.rays_per_batch,
samples_per_ray=self.opt.samples_per_ray,
white_bkg=True,
tpose=True,
render_can=True,
return_mask=True,
return_depth=True,
interval_comp=self.interval_comp
Expand Down
12 changes: 6 additions & 6 deletions utils/render_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def build_batch(origins, dirs, near, far):
return total_rgb_map


def render_smpl_nerf(net, cap, posed_verts, faces, Ts, rays_per_batch=32768, samples_per_ray=64, white_bkg=True, tpose=False, geo_threshold=DEFAULT_GEO_THRESH, return_depth=False, return_mask=False, interval_comp=1.0):
def render_smpl_nerf(net, cap, posed_verts, faces, Ts, rays_per_batch=32768, samples_per_ray=64, white_bkg=True, render_can=False, geo_threshold=DEFAULT_GEO_THRESH, return_depth=False, return_mask=False, interval_comp=1.0):
device = next(net.parameters()).device

def build_batch(origins, dirs, near, far):
Expand Down Expand Up @@ -212,18 +212,18 @@ def build_batch(origins, dirs, near, far):
)
_pts, _dirs, _z_vals = ray_utils.ray_to_samples(ray_batch, samples_per_ray, device=device)
_b, _n, _ = _pts.shape
if not tpose:
if render_can:
can_pts = _pts
can_dirs = _dirs
else:
can_pts, can_dirs, _ = ray_utils.warp_samples_to_canonical(
_pts.cpu().numpy(),
posed_verts.cpu().numpy(),
faces,
Ts
)
can_pts = torch.from_numpy(can_pts)
can_dirs = torch.from_numpy(can_dirs)
else:
can_pts = _pts
can_dirs = _dirs
can_dirs = torch.from_numpy(can_dirs)
can_pts = (can_pts.reshape(_b, _n, 3)).to(device).float()
can_dirs = (can_dirs.reshape(_b, _n, 3)).to(device).float()
out = net.coarse_human_net(can_pts, can_dirs)
Expand Down

0 comments on commit 6cf0775

Please sign in to comment.