Pamphlett / Outram

[ICRA 2024] Outram: One-shot Global Localization via Triangulated Scene Graph and Global Outlier Pruning
Apache License 2.0
111 stars 5 forks source link

hi~ How can we convert a .pcd label file into a .bin label file for other sequences in MCD datasets? #2

Closed lhthq closed 5 months ago

Pamphlett commented 5 months ago

Hi

Thanks for your interest in our work. We will update the script recently and I will let you know when it's done.

bear-rabbit commented 5 months ago

Hello, may I ask why the points of the label file and the pcd file do not match, but this problem will not be solved after the algorithm processing?As shown in the figure, in the data set obtained from MCD's official website, the number of points in the pcd above is inconsistent with the number of points in the label below. However, the data used in your outram is the same, how do you handle this data? 70b2a808eb9fe4df64d1ff6e566712f

Pamphlett commented 5 months ago

@bear-rabbit Hi, could you give a little bit more detail about your situation? In MCD we provide the annotated scans in one single pcd file where the semantic label is included in the scalar file. But in your case, it seems you have the points and labels in two separate files.

Pamphlett commented 5 months ago

@lhthq Hi, if you are testing Outram on the annotated Livox point clouds, there is no need for the conversion. You can just load the pcd files provided and the labels are naturally within.

bear-rabbit commented 5 months ago

@Pamphlett I use the mcd ntu01 rosbag to produce each scan pcd. And label pcd is used for extracting semantic label. But the two pcd have different point size. It means that i just need one single pcd file? Thanks

Pamphlett commented 5 months ago

@bear-rabbit Hello!

  1. For the discrepancy in the point number, I think it's because you are examining two different frames. The first frame in the bag does not necessarily correspond to the first annotated LiDAR frame.
  2. Yes, you have to choose the one that suits you most. If you want to test Outram. Then the annotated pcd is enough. But if you targeting at SLAM-related tasks. You can go for the rosbag.

Hope this helps!

brytsknguyen commented 5 months ago

@lhthq

Have you installed the pypcd package?

Using pypcd you can read the pcd into numpy array directly. Then if you want you can save numpy array as .bin quite easily. Example:

import numpy as np
from pypcd import pypcd

cloud = pypcd.PointCloud.from_path('/media/tmn/mySataSSD1/DATASETS/MCDVIRAL/MCDPointCloudLivoxSegmented/ntu_01_02_10_13/ntu_01_02_10_13_v06_exported/sequences/ntu_night_13/inW_labelled/cloud_0011.pcd').pc_data[['x', 'y', 'z', 'intensity', 'label']]

# Print the x, y, z and label of the first 10 points
print(cloud[['x', 'y', 'z', 'label']][0:10])

# Save the pointcloud as a structured array
cloud.tofile('/home/tmn/cloud_structured_array.bin')

# Save the pointcloud as a 2D array of dimension Nx5
cloud_2D = np.concatenate([cloud['x'].reshape(-1,1),
                           cloud['y'].reshape(-1,1),
                           cloud['z'].reshape(-1,1),
                           cloud['intensity'].reshape(-1,1),
                           cloud['label'].reshape(-1,1)], axis=1).astype(np.float32)

print(cloud_2D[0:10, :])

with open('/home/tmn/cloud_2D.bin', 'wb') as f:
    cloud_2D[0:10, :].tofile('/home/tmn/cloud_2D.bin')

cloud_2D_short = np.fromfile('/home/tmn/cloud_2D.bin', dtype=np.float32).reshape(-1, 5)

print(cloud_2D_short)