lyft/nuscenes-devkit

Invalid lidar file for exporting to kitti

hcyoo93 opened this issue · 5 comments

regarding #50 issue,

The same error comes up as below

points = scan.reshape((-1, 5))[:, : cls.nbr_dims()]
ValueError: cannot reshape array of size 265728 into shape (5)

I am informed from #50 that the latest version of the Lyft dataset should be OK with this issue.

However, I got the same issue with the newest version(downloaded in July 2020).

As far as I know, the previous version has its folder name as v1.01-train/lidar which is different from mine: train/train_lidar.

How can I resolve this? Any comments are welcome!

Hey!
I'm facing the same problem. I am also using the newest version of the dataset.
Do you have a solution for it?

Hi @tobii95

I have no idea about this issue.

Maybe we can skip some problematic frames for exporting.
(I remember this occurs only for some frames... not every frame)

Hey @tobii95 and @hcyoo93,

I just downloaded the dataset a few weeks ago, but I got the exact same error when trying to convert it to KITTI format. Have you been able to find a solution and if not is it possible to just skip the affected frames?

Hey @mnik17 ,

some time has pased, so I don't remember the issue in detail anymore. But as I remember it, I just skipped the affected frames and that worked for me

I just faced the problem, and I solved it in an easy way.. I modified the function "def from_file" in the following way:

      def from_file(cls, file_name: Path) -> "LidarPointCloud":
              """Loads LIDAR data from binary numpy format. Data is stored as (x, y, z, intensity, ring index).
      
              Args:
                  file_name: Path of the pointcloud file on disk.
      
              Returns: LidarPointCloud instance (x, y, z, intensity).
      
              """
      
              assert file_name.suffix == ".bin", "Unsupported filetype {}".format(file_name)
      
              scan = np.fromfile(str(file_name), dtype=np.float32)
              try:
                  points = scan.reshape((-1, 5))[:, : cls.nbr_dims()]
              except:
                  l = len(scan)//5
                  points = scan[:5*l].reshape((-1, 5))[:, : cls.nbr_dims()]
                  print("Error solved in {}".format(file_name))
              return cls(points.T)