charlesq34 / pointnet

PointNet: Deep Learning on Point Sets for 3D Classification and Segmentation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to visualize the segmentation results(not npy file)

beepbeep08 opened this issue · comments

hello, i want to visualize the segmentation result.
i know that the way visualize npy file, but i want to see "pred_obj file", not gt obj file/npy file.
meshlab show me grayscale obj file.
plz help me.

@beepbeep08 i used pyvista in jupyter notebook to visualize the obj colours as i didn't have any program to view it

import re
import pyvista as pv
import numpy as np

filename = '<pathToYourInstallation>/pointnet/part_seg/test_results/12_gt.obj'

reComp = re.compile("(?<=^)(v |vn |vt |f )(.*)(?=$)", re.MULTILINE)
with open(filename) as f:
    data = [txt.group() for txt in reComp.finditer(f.read())]

v_arr, vn_arr, vt_arr, f_arr = [], [], [], []
for line in data:
    tokens = line.split(' ')
    if tokens[0] == 'v':
        v_arr.append([float(c) for c in tokens[1:]])
    elif tokens[0] == 'vn':
        vn_arr.append([float(c) for c in tokens[1:]])
    elif tokens[0] == 'vt':
        vn_arr.append([float(c) for c in tokens[1:]])
    elif tokens[0] == 'f':
        f_arr.append([[int(i) if len(i) else 0 for i in c.split('/')] for c in tokens[1:]])

points = []
colormat = []
for v in v_arr:
    points.append([v[0], v[1], v[2]])
    colormat.append([v[3], v[4], v[5]])

mesh = pv.PolyData(points)
mesh["colors"] = colormat

plotter = pv.Plotter(notebook=True)
plotter.add_mesh(mesh, show_edges=False, scalars="colors", rgb=True, point_size=3.0)
plotter.show()

# print(len(v_arr))
# print(v_arr)

it gives 3 files like 12_gt.obj, 12_pred.obj and 12_diff.obj. is there any explanation as to what these different files are for?

Ah...i see.
gt = ground truth
pred = prediction
diff = difference between ground truth and prediction