Mentions légales du service

Skip to content
Snippets Groups Projects
Commit d0fb2bfa authored by KOPANAS Georgios's avatar KOPANAS Georgios
Browse files

accomodate for new paths

parent 281c8bfe
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,7 @@ class Camera(nn.Module):
self.image = nn.Parameter(loaded_optimizedimages.requires_grad_(True))
else:
image = image.clamp(0.0, 1.0)
self.image = nn.Parameter(image.cuda().requires_grad_(True))
self.image = nn.Parameter(image.requires_grad_(True))
self.image_width = self.image.shape[3]
self.image_height = self.image.shape[2]
......
......@@ -101,7 +101,7 @@ def readColmapSceneInfo_Test(name, path):
FovY = 2.0 * math.atan(0.5 * height / focal_length_y)
FovX = 2.0 * math.atan(0.5 * width / focal_length_x)
image_path = os.path.join(path, "stereo/images", extr.name)
image_path = os.path.join(path, "stereo/images", extr.name) + ".png"
image_name = os.path.basename(image_path).split(".")[0]
image = Image.open(image_path)
image = torch.from_numpy(np.array(image)) / 255.0
......
......@@ -99,7 +99,8 @@ with torch.no_grad():
torch.manual_seed(0)
random.seed(0)
dataset_name = "crazy_blade2"
dataset_name = "hallway_lamp"
path_name = "test_path2"
args.input_path = "/data/graphdeco/user/gkopanas/scenes/catacaustic_new/" + dataset_name + "/sibr/pbnrScene/" + dataset_name + ".json"
with open(args.input_path) as json_file:
......@@ -117,7 +118,7 @@ with torch.no_grad():
int(args.test_cameras), load_iter)
test_cameras_info = readColmapSceneInfo_Test(dataset_name, r"/data/graphdeco/user/gkopanas/scenes/catacaustic_new/" + dataset_name + "/colmap_1000/test_path_colmap").cameras
test_cameras_info = readColmapSceneInfo_Test(dataset_name, r"/data/graphdeco/user/gkopanas/scenes/catacaustic_new/" + dataset_name + "/colmap_1000/" + path_name).cameras
test_cameras = []
test_neighbors_dict_path = os.path.join(r"/data/graphdeco/user/gkopanas/scenes/catacaustic_new/" + dataset_name + "/sibr/pbnrScene/" + "neighbors_dict_test.json")
with open(test_neighbors_dict_path) as json_file:
......@@ -145,13 +146,15 @@ with torch.no_grad():
test_cameras[-1].neighbors = [scene.scenes[0].map_imgfilename_to_idx[image_name] for image_name in test_neighbors_dict[os.path.basename(test_cameras[-1].image_name)]]
print(test_cameras)
output = "/data/graphdeco/user/gkopanas/pointbased_neural_rendering/pbnr_pytorch/tensorboard_3d/" + dataset_name + "/path_renders_{}_{}_".format(args.w, args.h) + str(load_iter)
output = "/data/graphdeco/user/gkopanas/pointbased_neural_rendering/pbnr_pytorch/tensorboard_3d/" + dataset_name + "/{}_renders_".format(path_name) + str(load_iter)
makedirs(output, exist_ok=True)
makedirs(os.path.join(output, "gt"), exist_ok=True)
makedirs(os.path.join(output, "renders"), exist_ok=True)
imgs = torch.tensor([])
gts = torch.tensor([])
for view_cam in test_cameras:
for idx, view_cam in enumerate(test_cameras):
print(view_cam.image_name)
view_list = view_cam.neighbors
view_cam.image_width = 1000
......@@ -161,9 +164,9 @@ with torch.no_grad():
image, image_stack, _ = render_viewpoint(view_cam, pcloud_cams, patch=None)
torchvision.utils.save_image(image,
os.path.join(output, "out_{}.png".format(view_cam.image_name)))
os.path.join(output, "renders", "path_" + str(idx).zfill(4) + ".png"))
torchvision.utils.save_image(view_cam.image,
os.path.join(output, "gt_{}.png".format(view_cam.image_name)))
os.path.join(output, "gt", "path_" + str(idx).zfill(4) + ".png"))
imgs = torch.cat((imgs, image.cpu()), dim=0)
gts = torch.cat((gts, view_cam.image.cpu()), dim=0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment