rvp-group / vbr-devkit

Vision Benchmark in Rome Development Kit
https://rvp-group.net/
BSD 3-Clause "New" or "Revised" License
32 stars 0 forks source link

Pointcloud Format #3

Closed Nik-V9 closed 4 months ago

Nik-V9 commented 4 months ago

Hi, Thanks for sharing this dataset!

I'm trying to load the KITTI format pointclouds. When I use the commands shared in the README, I'm getting a numpy array with many dtypes.

I tried doing the following, however the visualization of the pointcloud (pts) looks incorrect:

pts_data = np.fromfile(bin_path, '<f4')
pts = np.reshape(pts_data, (-1, 4))
pts = pts[:, :3]

I was wondering what's the correct way to load in the LiDAR data? Also, do you guys have a PyTorch dataloader or an example?

EmanueleGiacomini commented 4 months ago

Hi, thank you for your interest :smile: Compared to original KITTI clouds that express every point as a 4-dimensional float32 vector <x, y, z, intensity>, We store for every point the complete set of channels exposed by our sensors <x, y, z, intensity, t, reflectivity, ring, ambient, range> with their respective datatypes <f4, f4, f4, f4, u4, u2, u1, u2, u4>.

During the conversion, we expose the appropriate datatype that users can use to parse the clouds. I will provide here an extended code snipper to get clouds in the typical XYZI format:

import numpy as np
import pickle

with open("campus_train0_00_kitti/ouster_points/data/.dtype.pkl", "rb") as f:
    cdtype = pickle.load(f)

cloud_np = np.fromfile("/campus_train0_00_kitti/ouster_points/data/0000000000.bin", dtype=cdtype)
pts = np.stack([
  cloud_np["x"],
  cloud_np["y"],
  cloud_np["z"],
  cloud_np["intensity"]], axis=1)

In this way, pts will contain data properly aligned as typical KITTI clouds

$> pts.shape
> (65536, 4)

You can also visualize the full set of channels by printing cdtype

$> print(cdtype)
> [('x', '<f4'), ('y', '<f4'), ('z', '<f4'), ('intensity', '<f4'), ('t', '<u4'), ('reflectivity', '<u2'), ('ring', 'u1'), ('ambient', '<u2'), ('range', '<u4')]

Concerning the PyTorch dataloader, if you provide us with more details, we can either extend our package or provide the appropriate snippets :smile:

Nik-V9 commented 4 months ago

Thanks for sharing this!

Re. PyTorch dataloader: I'm implementing a dataloader which can load in the camera images and the associated poses and depth maps. I'll open more issues here if I'm unable to figure things out.

EmanueleGiacomini commented 4 months ago

For anyone looking forward to this issue, we included support from version 0.0.9 to convert our PointClouds to the same format as KITTI clouds. During the conversion, use the flag --reduce-pcloud to preserve only the <x, y, z, intensity> components stored as float32 elements. This allows previous KITTI readers to parse our clouds.