Matrix-ASC / DeLA

Official PyTorch implementation of DeLA
MIT License
41 stars 5 forks source link

How to visualize the test results? #1

Closed zeng-ziyin closed 1 year ago

zeng-ziyin commented 1 year ago

Dear Authors: How can we visualize the test results?

binjiechen commented 1 year ago

Hi, visualization relies on coordinates and colors, so you may follow these general steps:

  1. Save paired point coordinates, colors, labels and predictions These can be done through various ways, including: ① Pick a point cloud in the test set and predict it. You may refer to dataset get_test_item and test script. ② Modify dataset get_test_item to let it return full coordinates and original colors, then save with predictions and labels (which is cum.argmax(dim=1) and y in test.py). ③ Pre construct a test set list and pass it to dataset, like scannetv2_val.txt in ScanNet, so the list order is constant, then save predictions only. The rest can be loaded like in get_item.
  2. Convert predictions and labels to colors Now say you have a prediction pred of shape N and a color table ctab of shape C x 3. (classes by rgb) You can do the conversion by col_pred = ctab[pred.long()]
  3. Use a library to visualize the coordiate color pair There are many libraries. Taking vedo for example.
    
    import torch
    from vedo import *

input xyz of N x 3, float

input col of N x 3, uint8

add alpha

col = torch.cat([col, torch.full((col.shape[0], 1), 255, dtype=torch.uint8)], dim=1) pts = Points(xyz.numpy(), r=4, c=col.float().numpy()) plt = Plotter(shape=(1,1), interactive=False, screensize=[2560,1440], size=[2560,1440]) plt.show(pts, at=0, resetcam=True)

For another, change shape too

plt.show(pts2, at=1, resetcam=True)

plt.interactor.Start()