Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
kwea123 committed Jun 12, 2020
1 parent e60e99a commit dd9fb2f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def get_opts():
parser.add_argument('--scene_name', type=str, default='test',
help='scene name, used as output folder name')
parser.add_argument('--split', type=str, default='test',
choices=['test', 'test_train'],
help='test or test_train')
parser.add_argument('--img_wh', nargs="+", type=int, default=[800, 800],
help='resolution (img_w, img_h) of the image')
Expand Down
5 changes: 3 additions & 2 deletions extract_color_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def f(models, embeddings, rays, N_samples, N_importance, chunk, white_back):
xmin, xmax = args.x_range
ymin, ymax = args.y_range
zmin, zmax = args.z_range
assert xmax-xmin == ymax-ymin == zmax-zmin, 'the ranges must have the same length!'
# assert xmax-xmin == ymax-ymin == zmax-zmin, 'the ranges must have the same length!'
x = np.linspace(xmin, xmax, N)
y = np.linspace(ymin, ymax, N)
z = np.linspace(zmin, zmax, N)
Expand Down Expand Up @@ -209,7 +209,7 @@ def f(models, embeddings, rays, N_samples, N_importance, chunk, white_back):

# Step 2. project the vertices onto each training image to infer the color
print('Fusing colors ...')
for idx in tqdm(range(len(dataset.image_paths))):
for idx in tqdm(range(len(dataset.image_paths[:1]))):
## read image of this pose
image = cv2.imread(dataset.image_paths[idx])[:,:,::-1]
image = cv2.resize(image, tuple(args.img_wh))
Expand Down Expand Up @@ -265,6 +265,7 @@ def f(models, embeddings, rays, N_samples, N_importance, chunk, white_back):
args.chunk,
dataset.white_back)
opacity = results['opacity_coarse'].cpu().numpy()[:, np.newaxis] # (N_vertices, 1)
opacity = np.nan_to_num(opacity, 1)

non_occluded = np.ones_like(non_occluded_sum) * 0.1/depth # weight by inverse depth
# near=more confident in color
Expand Down
4 changes: 1 addition & 3 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ def validation_step(self, batch, batch_nb):
self.logger.experiment.add_images('val/GT_pred_depth',
stack, self.global_step)

psnr_ = psnr(results[f'rgb_{typ}'], rgbs)
log['val_psnr'] = psnr_

log['val_psnr'] = psnr(results[f'rgb_{typ}'], rgbs)
return log

def validation_epoch_end(self, outputs):
Expand Down

0 comments on commit dd9fb2f

Please sign in to comment.