一、参考资料
kitti数据集官网
kitti数据集简介、百度网盘分享 kitti-object、kitti-tracking 全套数据集 自动驾驶
KITTI数据集(概念版)
二、KITTI目录结构
E:\DATASETS\KITTI
|
\---2011_09_26
\---2011_09_26_drive_0001_sync
+---image_00 # left_image左视图(灰度图)
| | timestamps.txt
| |
| \---data
| 0000000000.png
| 0000000001.png
|
+---image_01 # right_image右视图(灰度图)
| | timestamps.txt
| |
| \---data
| 0000000000.png
| 0000000001.png
|
+---image_02 # left_image左视图(彩色图)
| | timestamps.txt
| |
| \---data
| 0000000000.png
| 0000000001.png
|
+---image_03 # right_image右视图(彩色图)
| | timestamps.txt
| |
| \---data
| 0000000000.png
| 0000000001.png
|
+---oxts
| | dataformat.txt
| | timestamps.txt
| |
| \---data
| 0000000000.txt
| 0000000001.txt
|
\---velodyne_points
| timestamps.txt
| timestamps_end.txt
| timestamps_start.txt
|
\---data
0000000000.bin
0000000001.bin
三、下载KITTI数据集
1. KITTI官网下载
官网下载 KITTI 官网
需要先登录KITTI帐号,准备好edu结尾的教育邮箱注册KITTI帐号,然后登录即可下载。以3D多目标跟踪(tracking)数据集为例,其下载流程如下:
-
Download left color images of tracking data set (15 GB):
data_tracking_image_2.zip -
Download right color images, if you want to use stereo information (15 GB):
data_tracking_image_3.zip -
Download Velodyne point clouds, if you want to use laser information (35 GB):
data_tracking_velodyne.zip -
Download GPS/IMU data, if you want to use map information (8 MB):
-
Download camera calibration matrices of tracking data set (1 MB):data_tracking_calib.zip
-
data_tracking_oxts.zip
-
Download training labels of tracking data set (9 MB):
data_tracking_label_2.zip
重要说明:对于多目标跟踪任务,如果是双目,则需要下载 left-camera和right-camera 的图片;如果是单目,则需要下载 left-camera 的图片即可。
2. 百度网盘下载
3. google Colab下载
如果网络不稳定,直接在官网下载经常断线,可以选择google Colab中转下载。
Colab使用教程,请参阅博客:google colab教程
总体流程如下:
-
找到数据集下载链接。在KITTI官网找到下载链接,例如下载链接为:
https://s3.eu-central-1.amazonaws.com/avg-kitti/data_scene_flow.zip -
在Colab中用wget指令下载。
!wget -c https://s3.eu-central-1.amazonaws.com/avg-kitti/data_scene_flow.zip # 参数解释:-c:表示支持断点续传。
--2021-08-19 02:37:43-- https://s3.eu-central-1.amazonaws.com/avg-kitti/data_scene_flow.zip Resolving s3.eu-central-1.amazonaws.com (s3.eu-central-1.amazonaws.com)... 52.219.47.203 Connecting to s3.eu-central-1.amazonaws.com (s3.eu-central-1.amazonaws.com)|52.219.47.203|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 1681488619 (1.6G) [application/zip] Saving to: ‘data_scene_flow.zip’ data_scene_flow.zip 100%[===================>] 1.57G 20.6MB/s in 82s 2021-08-19 02:39:06 (19.6 MB/s) - ‘data_scene_flow.zip’ saved [1681488619/1681488619]
-
从google Colab下载数据集到本地(网络有点慢…)。
4. 格物钛平台下载(已失效)
博主尝试过下载,速度快,很稳定。
补充说明:2022年10月1日,格物钛暂不支持KITTI数据集下载。
四、相关经验
KITTI数据集bin点云可视化
kitti_object_vis
kitti数据集bin点云可视化
3D目标检测数据集 KITTI(标签格式解析、3D框可视化、点云转图像、BEV鸟瞰图)
kitti提供了bin二进制格式的点云数据,想可视化看看效果,首先解析二进制文件,转为numpy格式,再使用open3d进行可视化。也可以用numpy直接读取二进制文件。
import numpy as np
import struct
import open3d
def read_bin_velodyne(bin_path):
'''read bin file and transfer to array data'''
pc_list = []
with open(bin_path, 'rb') as f:
content = f.read()
pc_iter = struct.iter_unpack('ffff', content)
for idx, point in enumerate(pc_iter):
pc_list.append([point[0], point[1], point[2]]) # x,y,z坐标
return np.asarray(pc_list, dtype=np.float32)
def main():
bin_path = '/PATH/TO/KITTI/2011_09_29/2011_09_29_drive_0004_sync/velodyne_points/data/0000000000.bin' # 深度图像的二进制文件路径
# example = read_bin_velodyne(bin_path) # struct 方式读取bin文件
example = np.fromfile(bin_path, dtype=np.float32, count=-1).reshape(-1, 4) # numpy 方式读取bin文件
example_xyz = example[:, :3]
example_xyz = example_xyz[example_xyz[:, 2] > -3]
# From numpy to Open3D
pcd = open3d.open3d.geometry.PointCloud()
pcd.points = open3d.open3d.utility.Vector3dVector(example_xyz)
vis_ = open3d.visualization.Visualizer()
vis_.create_window()
vis_.add_geometry(pcd)
render_options = vis_.get_render_option()
render_options.point_size = 1
render_options.background_color = np.array([0, 0, 0])
vis_.run()
vis_.destroy_window()
# pcd.points = open3d.open3d.utility.Vector3dVector(example)
# open3d.open3d.visualization.draw_geometries([pcd])
if __name__ == "__main__":
main()
import os
import numpy as np
import struct
import open3d
def read_bin_velodyne(path):
pc_list = []
with open(path, 'rb') as f:
content = f.read()
pc_iter = struct.iter_unpack('ffff', content)
for idx, point in enumerate(pc_iter):
pc_list.append([point[0], point[1], point[2]]) # x,y,z坐标
return np.asarray(pc_list, dtype=np.float32)
def main():
root_dir = '/PATH/TO/KITTI/2011_09_29/2011_09_29_drive_0004_sync/velodyne_points/data/'
filename = os.listdir(root_dir)
file_number = len(filename)
pcd = open3d.open3d.geometry.PointCloud()
for i in range(file_number):
path = os.path.join(root_dir, filename[i])
print(path)
example = read_bin_velodyne(path)
# From numpy to Open3D
pcd.points = open3d.open3d.utility.Vector3dVector(example)
open3d.open3d.visualization.draw_geometries([pcd])
if __name__ == "__main__":
main()