How to evaluate LangSplat and LEGaussians
How can I perform point-level open vocabulary query on LangSplat and LEGaussians to achieve the results shown in Figure 6 in the LaGa paper? Could you provide some instructions? Thank you very much!
Thanks for the interest! To achieve 3D segmentation with LangSplat and LEGaussians, you need to directly compare the CLIP text feature with 3D point-level features.
To obtain 3D point-level features, for LangSplat, you need to pass the 3D feature to its corresponding autoencoder decoder.
For LEGaussians, you should apply the index_decoder to the 3D features directly, and get a probability distribution about the codebook selection. Then, you can use this distribution to retrieve semantic information from the codebook to reconstruct the semantic information of 3D Gaussians.
@Jumpat Hi, thank you for your generous response! I have tested the performance of LangSplat on point-level open vocabulary query on the Scannet dataset according to your guidance and referred to the evaluation code in inference.ipynb. The specific code is as follows: ` clip_config = OpenCLIPNetworkConfig() CLIP_PATH = 'my_path' clip_config.clip_model_pretrained = CLIP_PATH
model_clip = load_clip(clip_config)
model_clip.eval()
#load Autoencoder
ckpt_path = "my_path"
checkpoint = torch.load(ckpt_path)
encoder_hidden_dims = [256, 128, 64, 32, 3]
decoder_hidden_dims = [16, 32, 64, 128, 256, 256, 512]
model = Autoencoder(encoder_hidden_dims, decoder_hidden_dims).cuda()
model.load_state_dict(checkpoint)
model.eval()
print(gaussians.get_language_feature.shape)
latent_features = gaussians.get_language_feature
with torch.no_grad():
features = model.decode(latent_features)
print(features.shape)
target_id = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 24, 28, 33, 34, 36] # 19
gt_file_path = f"my_path"
target_dict = {key: nyu40_dict[key] for key in target_id}
target_names = list(target_dict.values())
# load gts
# Obtained new point cloud labels, taking 19 categories as an example, where updated_labels are labels 0, 1-19.
points, labels = read_labels_from_ply(gt_file_path)
target_id_mapping = {value: index + 1 for index, value in enumerate(target_id)}
updated_labels = np.zeros_like(labels)
for original_value, new_value in target_id_mapping.items():
updated_labels[labels == original_value] = new_value
updated_gt_labels = torch.from_numpy(updated_labels.astype(np.int64)).cuda()
# NOTE Filter out points based on their opacity values.
ignored_pts = gaussians.get_opacity.squeeze() < 0.1
updated_gt_labels[ignored_pts] = 0
per_point_scores_for_all_labels = []
per_point_stack_of_cosine = []
for label in target_names:
rel, pos, neg = get_relevancy_cosine(model_clip, features.cuda(), label)
per_point_scores_for_all_labels.append(rel)
res = torch.stack(per_point_scores_for_all_labels, dim = -1)
pred_pts_score, pred_pts_cls_id = torch.max(res, dim=-1)
pred_pts_cls_id[pred_pts_score == 0] = -1
pred_pts_cls_id += 1
ious, mean_iou, accuracy, mean_acc = calculate_metrics(updated_gt_labels, pred_pts_cls_id, total_classes=len(target_names)+1)
print(f"Scene: {scan_name}, mIoU: {mean_iou:.4f}, mAcc.: {mean_acc:.4f}")
for iou, tn in zip(ious[1:], target_names):
print(f"{tn}: {iou:.4f}")`
But the test result is very bad, miou is only 0.087. I would like to ask if this result is normal, does LangSplat not learn point-level semantic features? Or is there something wrong with my code? Here is the specific result: Scene: scene0000_00, mIoU: 0.0874, mAcc.: 0.1345 [07/06 10:37:44] wall: 0.0345 [07/06 10:37:44] floor: 0.2299 [07/06 10:37:44] cabinet: 0.1598 [07/06 10:37:44] bed: 0.2140 [07/06 10:37:44] chair: 0.0000 [07/06 10:37:44] sofa: 0.2604 [07/06 10:37:44] table: 0.0263 [07/06 10:37:44] door: 0.0841 [07/06 10:37:44] window: 0.0382 [07/06 10:37:44] bookshelf: 0.0000 [07/06 10:37:44] picture: 0.0000 [07/06 10:37:44] counter: 0.0135 [07/06 10:37:44] desk: 0.0031 [07/06 10:37:44] curtain: 0.1236 [07/06 10:37:44] refrigerator: 0.0200 [07/06 10:37:44] showercurtain: 0.0000 [07/06 10:37:44] toilet: 0.0165 [07/06 10:37:44] sink: 0.0000 [07/06 10:37:44] bathtub: 0.0000 [07/06 10:37:44]
These results seem normal and align with the ones we report in the paper (from OpenGaussian). This seems caused by the 2D-3D feature misalignment.
@Jumpat Get it! Thank you very much for your help!
Hi, I am trying to reproduce the numbers for scannet, and the metrics I get using the same inference script is much lower. I tried using both NUM_LVL = 1 and 3, strangely, using NUM_LVL=1 gave better metrics. The comparison is given below.
Is there anything missing in the eval for ScanNet that I may have missed? I was able to reproduce the numbers for LERF-OVS without any issues. @Sugar55888 can you let me know if you were able to reproduce the LaGa metrics for ScanNet too? Thanks.