PointPillars icon indicating copy to clipboard operation
PointPillars copied to clipboard

Point Cloud visualization problem

Open MiniDudi opened this issue 1 year ago • 2 comments

i'm trying to convert the point cloud results into a kitti dataset .bin file and for some reason it's returning me a error when running the test:

TypeError: tuple indices must be integers or slices, not str #21

convertion code:

class MinimalSubscriber(Node):

    def __init__(self):
        super().__init__('minimal_subscriber')
        self.subscription = self.create_subscription(
            PointCloud2,
            'velodyne_points',
            self.listener_callback,
            10)

    def convert_pointcloud(self, msg):

        pc = pc2.read_points(msg, field_names=("x", "y", "z", "intensity"), skip_nans=True)
        pc = np.array(list(pc), dtype=np.float32)

        x = pc[:, 0]
        y = pc[:, 1]
        z = pc[:, 2]
        intensity = pc[:, 3]
        
        arr = np.zeros(x.shape[0] * 4, dtype=np.float32)
        arr[::4] = x
        arr[1::4] = y
        arr[2::4] = z
        arr[3::4] = intensity
        
        bin_file_name = 'point_cloud_data.bin'
        with open(bin_file_name, 'wb') as f:
            arr.tofile(f)

    def listener_callback(self, msg):

        self.convert_pointcloud(msg)

To resolve the error above, i removed the following line in test.py:

#model.eval() #48

After this, the inference worked and displayed the window with the detected objects. But, all the point cloud is showing in white.

image

What am i doing wrong? Do you guys have any idea?

Thank you in advance.

MiniDudi avatar Aug 20 '24 19:08 MiniDudi

I'm facing the same problem.

kauanBestel avatar Aug 20 '24 19:08 kauanBestel

Sorry, do you know the solution now?

vutrungtam619 avatar Sep 03 '25 16:09 vutrungtam619