how to visualize the semantic segmentation on s3dis data?
Hello,thanks for your reply,how to visualize the semantic segmentation on s3dis data?can you provide some codes about visualization?looking forward your reply.
hi @longmalongma, to visualize either semantic or instance labels, check out this function:
https://github.com/Yang7879/3D-BoNet/blob/07c99e58f7f1a646c211c150cb7b3c363fdd69d9/helper_data_plot.py#L37
hi @longmalongma, to visualize either semantic or instance labels, check out this function:
https://github.com/Yang7879/3D-BoNet/blob/07c99e58f7f1a646c211c150cb7b3c363fdd69d9/helper_data_plot.py#L37
Thanks for your reply,but I find your code can not save results of segmentation on s3dis data to .ply files,and can be visualized by meshlab.can you provide some codes about saving results of segmentation to .ply files?
hi @longmalongma, since s3dis dataset does not have faces for individual points, it's not straightforward to save the results as meshes. For your benefit, here's a script to write a ply file, which might be useful for other datasets.
def write_mesh_ply(filename, points_xyzrgb, faces):
with open(filename, 'w') as f:
header = """ply
format ascii 1.0
element vertex """
header += str(len(points_xyzrgb))
header += """
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
element face """
header += str(len(faces))
header += """
property list uchar int vertex_index
end_header
"""
f.write(header)
for point in points_xyzrgb:
for value in point[:3]:
f.write(str(value) + ' ')
continue
for value in point[3:]:
f.write(str(int(value)) + ' ')
continue
f.write('\n')
continue
for face in faces:
f.write('3 ' + str(face[0]) + ' ' + str(face[1]) + ' ' + str(face[2]) + '\n')
continue
f.close()
pass
return
Hi,thanks for your reply.you maybe misunderstanding my meanings.I only want to know how to save your results of segmentation as .ply or .obj files in your code. becase .ply or .obj files can be visualized by meshlab software.