diff --git a/gaussian_renderer/__init__.py b/gaussian_renderer/__init__.py index f74e336..eed5713 100644 --- a/gaussian_renderer/__init__.py +++ b/gaussian_renderer/__init__.py @@ -45,7 +45,8 @@ def render(viewpoint_camera, pc : GaussianModel, pipe, bg_color : torch.Tensor, sh_degree=pc.active_sh_degree, campos=viewpoint_camera.camera_center, prefiltered=False, - debug=pipe.debug + debug=pipe.debug, + clamp_color=True ) rasterizer = GaussianRasterizer(raster_settings=raster_settings) diff --git a/run_code.txt b/run_code.txt index 9f59708..c67522f 100644 --- a/run_code.txt +++ b/run_code.txt @@ -1,7 +1,7 @@ Running: # Train with train/test split python train.py --source_path --model_path <保存路径> --eval -python train.py --source_path /media/liuzhi/b4608ade-d2e0-430d-a40b-f29a8b22cb8c/Dataset/3DGS_Dataset/湘家荡 --model_path output/xiangjiadang --eval --resolution 1 +python train.py --source_path ../../Dataset/3DGS_Dataset/科技馆 --model_path output/kejiguan --eval --resolution 1 --source_path / -s:COLMAP 或合成 Synthetic NeRF data set的源目录的路径。COLMAP类型包含 images/, sparse/0 --model_path / -m:训练模型的存储路径,默认为 output/ diff --git a/run_train_ours.py b/run_train_ours.py new file mode 100644 index 0000000..5b627c7 --- /dev/null +++ b/run_train_ours.py @@ -0,0 +1,12 @@ +# python train.py --source_path ../../Dataset/3DGS_Dataset/凌公塘 --model_path output/linggongtang --eval --resolution 1 +# scene: {'科技馆': 'kejiguan', '万佛塔': 'wanfota', '植物': 'zhiwu', '凌公塘': 'linggongtang', '湘家荡': 'xiangjiadang', '寺平古宅': 'sipingguzhai'} +# : {'科技馆': ['kejiguan', 'cuda'], '万佛塔': ['wanfota', 'cuda'], '植物': ['zhiwu', 'cuda'], '凌公塘': ['linggongtang', 'cpu'], '湘家荡': ['xiangjiadang', 'cpu'], '寺平古宅': ['sipingguzhai', 'cpu']} +# device = cuda: 科技馆、万佛塔、植物 +# = cpu: 凌公塘、湘家荡、寺平古宅 + +import os + +for cuda, scene in enumerate({'科技馆': ['kejiguan', 'cuda'], '湘家荡': ['xiangjiadang', 'cpu'], '凌公塘': ['linggongtang', 'cpu'], '寺平古宅': ['sipingguzhai', 'cpu'],}.items()): + print('---------------------------------------------------------------------------------') + one_cmd = f'python train.py --source_path ../../Dataset/3DGS_Dataset/{scene[0]} --model_path output/{scene[1][0]} --data_device "{scene[1][1]}" --resolution 1 --eval' + os.system(one_cmd) \ No newline at end of file diff --git a/scene/dataset_readers.py b/scene/dataset_readers.py index 75cb883..b87240b 100644 --- a/scene/dataset_readers.py +++ b/scene/dataset_readers.py @@ -109,8 +109,11 @@ def readColmapCameras(cam_extrinsics, cam_intrinsics, images_folder): # 如果不是以上两种模型,抛出错误 assert False, "Colmap camera model not handled: only undistorted datasets (PINHOLE or SIMPLE_PINHOLE cameras) supported!" - image_path = os.path.join(images_folder, os.path.basename(extr.name)) + image_path = os.path.join(images_folder, extr.name) image_name = os.path.basename(image_path).split(".")[0] + + if not os.path.exists(image_path): + continue image = Image.open(image_path) cam_info = CameraInfo(uid=uid, R=R, T=T, FovY=FovY, FovX=FovX, image=image, @@ -118,6 +121,7 @@ def readColmapCameras(cam_extrinsics, cam_intrinsics, images_folder): cam_infos.append(cam_info) # 在读取完所有相机信息后换行 sys.stdout.write('\n') + print("valid Colmap camera size: {}".format(len(cam_infos))) # 返回整理好的相机信息列表 return cam_infos