Closed shangchengPKU closed 8 months ago
你好!感谢你的关注!在修改这些代码之前你是否成功运行了extact_features和extact_sam_masks呢?根据你的报错信息,最后的错误应该是把mask和feature混淆了,将原本应该导入mask的位置导入了feature。
你好!我就是按照那个给的代码进行运行的,这两个文件应该是没问题的
---原始邮件--- 发件人: @.> 发送时间: 2024年2月3日(周六) 上午10:41 收件人: @.>; 抄送: @.**@.>; 主题: Re: [Jumpat/SegAnyGAussians] python train_contrastive_feature.py -m <path to the pre-trained 3DGS model> 找不到对应的文件 (Issue #17)
你好!感谢你的关注!在修改这些代码之前你是否成功运行了extact_features和extact_sam_masks呢?根据你的报错信息,最后的错误应该是把mask和feature混淆了,将原本应该导入mask的位置导入了feature。
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
那这里很奇怪,能否提供更多的信息呢?比如数据集文件夹下的结构以及文件夹内的文件(检查是否有sam_masks/IMG_4026.pt以及features/IMG_4026.pt这两个文件)
你好,我的sam_masks下面的话是没有IMG_4026.pt的,但是features文件夹下面是有的,但是好像train_contrastive_feature.py文件还是会直接去定位到sam_masks文件夹
I found the same error.
I found the same error.
Hi! @Lizhinwafu This is caused by the file name mismatch between the features and the image files. You may need to match them by your self, i.e., the image file 'abcd.png' should have the corresponding mask file 'abcd.pt' and feature file 'abcd.pt'. This may be caused by the colmap image process script, which output downscaled images with different name.
校友你好厉害!您好,我在运行python train_contrastive_feature.py -m <path to the pre-trained 3DGS model>这一行的时候,报错说:
(gaussian_splatting) root@shangcheng@dalab.se.sjtu.edu.cn:/home/SegAnyGAussians# python train_contrastive_feature.py -m /home/SegAnyGAussians/output/154f4d6d-5/ Looking for config file in /home/SegAnyGAussians/output/154f4d6d-5/cfg_args Config file found: /home/SegAnyGAussians/output/154f4d6d-5/cfg_args Optimizing /home/SegAnyGAussians/output/154f4d6d-5/ Loading trained model at iteration 30000, None [02/02 19:24:29] Reading camera 1/20Traceback (most recent call last): File "train_contrastive_feature.py", line 214, in
training(lp.extract(args), op.extract(args), pp.extract(args), args.iteration)
File "train_contrastive_feature.py", line 79, in training
scene = Scene(dataset, gaussians, feature_gaussians, load_iteration=iteration, shuffle=False, target='contrastive_feature', mode='train', sample_rate=sample_rate)
File "/home/SegAnyGAussians/scene/init.py", line 98, in init
scene_info = sceneLoadTypeCallbacks["Colmap"](args.source_path, args.images, args.eval, need_features = args.need_features, need_masks = args.need_masks, sample_rate = sample_rate)
File "/home/SegAnyGAussians/scene/dataset_readers.py", line 162, in readColmapSceneInfo
cam_infos_unsorted = readColmapCameras(cam_extrinsics=cam_extrinsics, cam_intrinsics=cam_intrinsics, images_folder=os.path.join(path, reading_dir), features_folder='/home/SegAnyGAussians/data/nerf_llff_data/fern/features/' if need_features else None, masks_folder='/home/SegAnyGAussians/data/nerf_llff_data/fern/sam_masks/' if need_masks else None, sample_rate=sample_rate)
File "/home/SegAnyGAussians/scene/dataset_readers.py", line 111, in readColmapCameras
masks = torch.load(os.path.join(masks_folder, image_name.split('.')[0] + ".pt")) if masks_folder is not None else None
File "/root/miniconda3/envs/gaussian_splatting/lib/python3.7/site-packages/torch/serialization.py", line 699, in load
with _open_file_like(f, 'rb') as opened_file:
File "/root/miniconda3/envs/gaussian_splatting/lib/python3.7/site-packages/torch/serialization.py", line 230, in _open_file_like
return _open_file(name_or_buffer, mode)
File "/root/miniconda3/envs/gaussian_splatting/lib/python3.7/site-packages/torch/serialization.py", line 211, in init
super(_open_file, self).init(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: '/home/SegAnyGAussians/data/nerf_llff_data/fern/sam_masks/IMG_4026.pt'
大概意思找不到对应的features文件下的IMG_4026.pt文件,但是我不太清楚他为啥直接会定位到sam_masks的文件夹里面了,并且,我试图给他把sam_masks和features文件改名,也不行,他就直接又定位到了features里面;
于是我找到了scene/dataset_readers.py文件,打算在 line 162写绝对路径 cam_infos_unsorted = readColmapCameras(cam_extrinsics=cam_extrinsics, cam_intrinsics=cam_intrinsics, images_folder=os.path.join(path, reading_dir), features_folder='/home/SegAnyGAussians/data/nerf_llff_data/fern/features/' if need_features else None, masks_folder='/home/SegAnyGAussians/data/nerf_llff_data/fern/sam_masks/' if need_masks else None, sample_rate=sample_rate),但是无效;
最后,我把features里面的文件全部移动到了sam_masks里面也不行,他就报错说:Looking for config file in /home/SegAnyGAussians/output/154f4d6d-5/cfg_args Config file found: /home/SegAnyGAussians/output/154f4d6d-5/cfg_args Optimizing /home/SegAnyGAussians/output/154f4d6d-5/ Loading trained model at iteration 30000, None [02/02 19:35:01] Reading camera 20/20 [02/02 19:35:02] Loading Training Cameras [02/02 19:35:02] Loading Test Cameras [02/02 19:35:11] Training progress: 0%| | 0/30000 [00:00<?, ?it/s] Traceback (most recent call last): File "train_contrastive_feature.py", line 214, in
training(lp.extract(args), op.extract(args), pp.extract(args), args.iteration)
File "train_contrastive_feature.py", line 128, in training
sam_masks = torch.nn.functional.interpolate(sam_masks.unsqueeze(0), size=sam_features.shape[-2:] , mode='nearest').squeeze()
File "/root/miniconda3/envs/gaussian_splatting/lib/python3.7/site-packages/torch/nn/functional.py", line 3855, in interpolate
"Input and output must have the same number of spatial dimensions, but got "
ValueError: Input and output must have the same number of spatial dimensions, but got input with with spatial dimensions of [256, 64, 64] and output size of torch.Size([64, 64]). Please provide input tensor in (N, C, d1, d2, ...,dK) format and output size in (o1, o2, ...,oK) format.