??2019年8月21日,谷歌母公司Alphabet自动驾驶公司Waymo数据开放项目在其博客上公布(Waymo Open Dataset),包括Waymo motion和Waymo perception两部分。文件格式为tfrecord
,需要分析,这里介绍一下Waymo perception对数据集进行分析。 下载地址:https://waymo.com/open/ 论文:https://arxiv.org/abs/1912.04838 解析代码:https://download.csdn.net/download/qq_37591788/85313082
传感器配置
点云数据分析
从官网下载的数据是tfrecord为便于使用,将格式分析为KITTI数据集格式(解析代码)。LIDAR点云被分析为.bin文件有两种方式:
- 保留5个LIDAR点云融合它们
- 只保留top的LIDAR点云
假如下载了v1.3.0后的数据也增加了3D分析点云语义分割标签。
MMDetection3D
MMDetection3D中提供了waymo数据集向KITTI需要先安装数据集的转换工具waymo-open-dataset工具,通过pip安装即可:
pip3 install waymo-open-dataset-tf-2-6-0==1.4.5 # waymo-open-dataset1.3.以下版本不支持31D label解析
转换使用tools/data_conveter下的waymo_converter.py文件。但需要相应的修改。
waymo_converter.py的使用
我在这里修改waymo_converter.py,可输出不同的点云文件:
- 在代码中将ONLY_TOP如果设置为1,则只保留top的LIDAR点云
- 在代码中将ONLY_TOP如果设置为0,则生成5个LIDAR的融合点云
load_dir:waymo的tfrecord存储文件的位置 save_dir:生成的kitti格式存储位置
waymo v_1_3_0后版本有3D label,代码在MMDetection3D的tools/data_conveter/waymo_converter.py3的基础D点云语义分割label核心代码如下:
def convert_range_image_to_point_cloud_labels(frame, range_images, segmentation_labels, ri_index=0): """Convert segmentation labels from range images to point clouds. Args: frame: open dataset frame range_images: A dict of {laser_name, [range_image_first_return, range_image_second_return]}. segmentation_labels: A dict of {laser_name, [range_image_first_return, range_image_second_return]}. ri_index: 0 for the first return, 1 for the second return. Returns: point_labels: {[N, 2]} list of 3d lidar points's segmentation labels. 0 for points that are not labeled. """ calibrations = sorted(frame.context.laser_calibrations, key=lambda c: c.name) point_labels = [] for c in calibrations: range_image = range_images[c.name][ri_index] range_image_tensor = tf.reshape( tf.convert_to_tensor(range_image.data), range_image.shape.dims) range_image_mask = range_image_tensor
[
.
.
.
,
0
]
>
0
if c
.name
in segmentation_labels
: sl
= segmentation_labels
[c
.name
]
[ri_index
] sl_tensor
= tf
.reshape
(tf
.convert_to_tensor
(sl
.data
)
, sl
.shape
.dims
) sl_points_tensor
= tf
.gather_nd
(sl_tensor
, tf
.where
(range_image_mask
)
)
else
: num_valid_point
= tf
.math
.reduce_sum
(tf
.cast
(range_image_mask
, tf
.int32
)
) sl_points_tensor
= tf
.zeros
(
[num_valid_point
,
2
]
, dtype
=tf
.int32
) point_labels
.append
(sl_points_tensor
.numpy
(
)
)
return point_labels
得到的label大小为Nx2,N是点云的数量(但有部分文件解析出的label大小和点云大小略有不同,不知什么原因)。
- label的第一列为实例标签,区分每一个具体实例;
- 第二列为语义标签,只区分类别。
代码链接:https://download.csdn.net/download/qq_37591788/85313082