Update sorting logic in scene/dataset_readers.py for readColmapSceneInfo

This commit is contained in:
bro_SiN 2024-04-02 19:51:39 +08:00
parent d3048bebaa
commit 08a6e07266

View File

@ -143,7 +143,7 @@ def readColmapSceneInfo(path, images, eval, llffhold=8):
reading_dir = "images" if images == None else images reading_dir = "images" if images == None else images
cam_infos_unsorted = readColmapCameras(cam_extrinsics=cam_extrinsics, cam_intrinsics=cam_intrinsics, images_folder=os.path.join(path, reading_dir)) cam_infos_unsorted = readColmapCameras(cam_extrinsics=cam_extrinsics, cam_intrinsics=cam_intrinsics, images_folder=os.path.join(path, reading_dir))
cam_infos = sorted(cam_infos_unsorted.copy(), key = lambda x : x.image_name) cam_infos = sorted(cam_infos_unsorted.copy(), key = lambda x : x.uid)
if eval: if eval:
train_cam_infos = [c for idx, c in enumerate(cam_infos) if idx % llffhold != 0] train_cam_infos = [c for idx, c in enumerate(cam_infos) if idx % llffhold != 0]