support-local-realtime-SIBR-viewer

This commit is contained in:
wugunjun 2024-01-10 13:54:51 +08:00
parent d412f8b22d
commit eff2ff2e80
4 changed files with 19 additions and 7 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ tensorboard_3d
screenshots screenshots
data/ data/
data data
submodules/

4
.gitmodules vendored
View File

@ -1,9 +1,7 @@
[submodule "submodules/simple-knn"] [submodule "submodules/simple-knn"]
path = submodules/simple-knn path = submodules/simple-knn
url = https://gitlab.inria.fr/bkerbl/simple-knn.git url = https://gitlab.inria.fr/bkerbl/simple-knn.git
[submodule "submodules/diff-gaussian-rasterization"]
path = submodules/diff-gaussian-rasterization
url = https://github.com/graphdeco-inria/diff-gaussian-rasterization
[submodule "submodules/depth-diff-gaussian-rasterization"] [submodule "submodules/depth-diff-gaussian-rasterization"]
path = submodules/depth-diff-gaussian-rasterization path = submodules/depth-diff-gaussian-rasterization
url = https://github.com/ingra14m/depth-diff-gaussian-rasterization url = https://github.com/ingra14m/depth-diff-gaussian-rasterization

View File

@ -76,7 +76,7 @@ def receive():
world_view_transform[:,2] = -world_view_transform[:,2] world_view_transform[:,2] = -world_view_transform[:,2]
full_proj_transform = torch.reshape(torch.tensor(message["view_projection_matrix"]), (4, 4)).cuda() full_proj_transform = torch.reshape(torch.tensor(message["view_projection_matrix"]), (4, 4)).cuda()
full_proj_transform[:,1] = -full_proj_transform[:,1] full_proj_transform[:,1] = -full_proj_transform[:,1]
custom_cam = MiniCam(width, height, fovy, fovx, znear, zfar, world_view_transform, full_proj_transform) custom_cam = MiniCam(width, height, fovy, fovx, znear, zfar, world_view_transform, full_proj_transform,time=0)
except Exception as e: except Exception as e:
print("") print("")
traceback.print_exc() traceback.print_exc()

View File

@ -103,21 +103,34 @@ def scene_reconstruction(dataset, opt, hyper, pipe, testing_iterations, saving_i
viewpoint_stack = temp_list.copy() viewpoint_stack = temp_list.copy()
else: else:
load_in_memory = False load_in_memory = False
#
count = 0
for iteration in range(first_iter, final_iter+1): for iteration in range(first_iter, final_iter+1):
if network_gui.conn == None: if network_gui.conn == None:
network_gui.try_connect() network_gui.try_connect()
while network_gui.conn != None: while network_gui.conn != None:
try: try:
net_image_bytes = None net_image_bytes = None
custom_cam, do_training, pipe.convert_SHs_python, pipe.compute_cov3D_python, keep_alive, scaling_modifer, ts = network_gui.receive() custom_cam, do_training, pipe.convert_SHs_python, pipe.compute_cov3D_python, keep_alive, scaling_modifer = network_gui.receive()
if custom_cam != None: if custom_cam != None:
count +=1
viewpoint_index = (count ) % len(video_cams)
if (count //(len(video_cams))) % 2 == 0:
viewpoint_index = viewpoint_index
else:
viewpoint_index = len(video_cams) - viewpoint_index - 1
# print(viewpoint_index)
viewpoint = video_cams[viewpoint_index]
custom_cam.time = viewpoint.time
# print(custom_cam.time, viewpoint_index, count)
net_image = render(custom_cam, gaussians, pipe, background, scaling_modifer, stage=stage, cam_type=scene.dataset_type)["render"] net_image = render(custom_cam, gaussians, pipe, background, scaling_modifer, stage=stage, cam_type=scene.dataset_type)["render"]
net_image_bytes = memoryview((torch.clamp(net_image, min=0, max=1.0) * 255).byte().permute(1, 2, 0).contiguous().cpu().numpy()) net_image_bytes = memoryview((torch.clamp(net_image, min=0, max=1.0) * 255).byte().permute(1, 2, 0).contiguous().cpu().numpy())
network_gui.send(net_image_bytes, dataset.source_path) network_gui.send(net_image_bytes, dataset.source_path)
if do_training and ((iteration < int(opt.iterations)) or not keep_alive): if do_training and ((iteration < int(opt.iterations)) or not keep_alive) :
break break
except Exception as e: except Exception as e:
print(e)
network_gui.conn = None network_gui.conn = None
iter_start.record() iter_start.record()