Error in train_contrastive_feature.py on Lerf Dataset
Hello,
when I try to run train_contrastive_feature.py on the Lerf Dataset figurines (the one you can see used in the readme) to Train 3D Gaussian Affinity Features I get this error:
File "/home/proietti/SegAnyGAussians/train_contrastive_feature.py", line 113, in training
all_scales = torch.cat(all_scales)
TypeError: expected Tensor as element 0 in argument 0, but got NoneType
Training progress: 0%|
Any suggestion on how to fix this?
How did you extract the mask scales of the scene? Seems no scale is available.
I used python get_scale.py --image_root
Please check here. Did the script run readColmapCameras correctly? I doubt that the code use a wrong data loader, maybe a bug.
Please check here. Did the script run readColmapCameras correctly? I doubt that the code use a wrong data loader, maybe a bug.
It is not running readColmapCameras since this is written for Colmap. I also fail in this step when using lerf dataset.
The LERF dataset doesn’t use the COLMAP file format.
Camera information is stored in transforms.json, so you need to enable this section in __init__.py:
elif os.path.exists(os.path.join(args.source_path, "transforms.json")):
print("Found transforms.json file, assuming LERF dataset!")
scene_info = sceneLoadTypeCallbacks["Lerf"](args.source_path, args.white_background, args.eval)
Then, add the following code to the readCamerasFromLerfTransforms function in dataset_reader.py:
mask_dir = "sam_masks"
mask_scale_dir = "mask_scales"
mask_scale_folder = os.path.join(path, mask_scale_dir)
mask_folder = os.path.join(path, mask_dir)
mask_scales = torch.load(os.path.join(mask_scale_folder, image_name.split('.')[0] + ".pt")) if mask_scale_folder is not None else None
masks = torch.load(os.path.join(mask_folder, image_name.split('.')[0] + ".pt")) if mask_folder is not None else None