Study: Artificial Intelligence(AI)/AI: Data Pipeline

[Dataset] Autonomous Driving Open Dataset: KITTI Dataset (Visual Odometry/SLAM, 3D Object Detection)

DrawingProcess 2023. 12. 26. 18:19
๋ฐ˜์‘ํ˜•
๐Ÿ’ก ๋ณธ ๋ฌธ์„œ๋Š” 'Autonomous Driving Open Dataset: KITTI Dataset (Visual Odometry, 3D Object Detection)'์— ๋Œ€ํ•ด ์ •๋ฆฌํ•ด๋†“์€ ๊ธ€์ž…๋‹ˆ๋‹ค.
์ž์œจ์ฃผํ–‰ ์ฐจ๋Ÿ‰์˜ ์„ผ์„œ ๋ฐ์ดํ„ฐ์…‹ ์ค‘ ํ•˜๋‚˜์ธ KITTI 360 Dataset์— ๋Œ€ํ•ด ์ •๋ฆฌํ•˜์˜€์œผ๋‹ˆ ์ฐธ๊ณ ํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

KITTI dataset ์†Œ๊ฐœ

๋ฐ์ดํ„ฐ์…‹ ์†Œ๊ฐœ(KITTI dataset)

  • Datasets collected with a car driving around rural areas of a city.
  • Lidar์™€ ์—ฌ๋Ÿฌ ๋Œ€์˜ Camera๋กœ ์ˆ˜์ง‘ํ•œ ๋ฐ์ดํ„ฐ์™€ ์ด์— ๋Œ€ํ•œ ์ผ๋ถ€์˜ ๋ผ๋ฒจ๋กœ ๋ฐ์ดํ„ฐ์…‹์€ ๊ตฌ์„ฑ
  • ์ œ์ž‘ ์—…์ฒด : KIT (Karlsruhe Institute oof Technology)
  • ๋ฐ์ดํ„ฐ์…‹ ๊ณต์‹ ๋งํฌ : https://www.cvlibs.net/datasets/kitti/

๋ฐ์ดํ„ฐ์…‹ ์†Œ๊ฐœ(KITTI Sensor)

์‚ฌ์šฉ ์„ผ์„œ ๋ชจ๋ธ๋ช…

  • Inertial Navigation System (GPS/IMU): OXTS RT 3003 (250Hz์˜ ๋น ๋ฅธ ์ฃผ๊ธฐ, cm๋‹จ์œ„์˜ ์˜ค์ฐจ๊ฐ€ ๋ฐœ์ƒํ•˜๊ธฐ์— ๋†’์€ ์„ฑ๋Šฅ)
  • Laserscanner: Velodyne HDL-64E (10๋งŒ๊ฐœ points/1sec ์ธก์ • ๊ฐ€๋Šฅ)
  • Camera (์ตœ๋Œ€ ์…”ํ„ฐ ์Šคํ”ผ๋“œ : 2ms Lidar์˜ ํŠธ๋ฆฌ๊ฑฐ์— ๋งž์ถ”์–ด ์ดฌ์˜)
    • Grayscale cameras, 1.4 Megapixels: Point Grey Flea 2 (FL2-14S3M-C)
    • Color cameras, 1.4 Megapixels: Point Grey Flea 2 (FL2-14S3C-C)
    • Varifocal lenses, 4-8 mm: Edmund Optics NT59-917 

๋ฐ์ดํ„ฐ์…‹ ๊ตฌ์„ฑ

  • Raw (unsynced+unrectified) and processed (synced+rectified) grayscale stereo sequences (0.5 Megapixels, stored in png format)
  • Raw (unsynced+unrectified) and processed (synced+rectified) color stereo sequences (0.5 Megapixels, stored in png format)
  • 3D Velodyne point clouds (100k points per frame, stored as binary float matrix)
  • 3D GPS/IMU data (location, speed, acceleration, meta information, stored as text file)
  • Calibration (Camera, Camera-to-GPS/IMU, Camera-to-Velodyne, stored as text file)
  • 3D object tracklet labels (cars, trucks, trams, pedestrians, cyclists, stored as xml file)

KITTI dataset ์ข…๋ฅ˜

Visual Odometry / SLAM Evaluation 2012

22๊ฐœ์˜ ์Šคํ…Œ๋ ˆ์˜ค ์‹œํ€€์Šค, ์ดํ•ฉ 39.2km ๊ธธ์ด.

GT: GPS/IMU localization unit์„ projection ์‹œ์ผœ์„œ ์–ป์Œ

๋ฐ์ดํ„ฐ์…‹ ๊ตฌ์„ฑ

โ”œโ”€โ”€ dataset
โ”‚   โ”œโ”€โ”€ poses
โ”‚   โ””โ”€โ”€ sequences
โ”‚       โ”œโ”€โ”€ 00
โ”‚       โ”‚   โ”œโ”€โ”€ image_0
โ”‚       โ”‚   โ”œโ”€โ”€ image_1
โ”‚       โ”‚   โ”œโ”€โ”€ image_2
โ”‚       โ”‚   โ”œโ”€โ”€ image_3
โ”‚       โ”‚   โ””โ”€โ”€ velodyne
โ”‚       โ”œโ”€โ”€ 01
โ”‚       โ”‚   โ”œโ”€โ”€ image_0
โ”‚       โ”‚   โ”œโ”€โ”€ image_1
โ”‚       โ”‚   โ”œโ”€โ”€ image_2
โ”‚       โ”‚   โ”œโ”€โ”€ image_3
โ”‚       โ”‚   โ””โ”€โ”€ velodyne
โ”‚       ...
โ”‚       โ””โ”€โ”€ 21
โ”‚           โ”œโ”€โ”€ image_0
โ”‚           โ”œโ”€โ”€ image_1
โ”‚           โ”œโ”€โ”€ image_2
โ”‚           โ”œโ”€โ”€ image_3
โ”‚           โ””โ”€โ”€ velodyne
โ”œโ”€โ”€ devkit
โ”‚   โ””โ”€โ”€ cpp

๋ฐ์ดํ„ฐ์…‹ ๋‹ค์šด๋กœ๋“œ

Visual Odometry / SLAM Evaluation 2012 https://www.cvlibs.net/datasets/kitti/eval_odometry.php

#!/bin/bash
wget https://s3.eu-central-1.amazonaws.com/avg-kitti/data_odometry_gray.zip
wget https://s3.eu-central-1.amazonaws.com/avg-kitti/data_odometry_color.zip
wget https://s3.eu-central-1.amazonaws.com/avg-kitti/data_odometry_velodyne.zip
wget https://s3.eu-central-1.amazonaws.com/avg-kitti/data_odometry_calib.zip
wget https://s3.eu-central-1.amazonaws.com/avg-kitti/data_odometry_poses.zip
wget https://s3.eu-central-1.amazonaws.com/avg-kitti/devkit_odometry.zip

unzip '*.zip'

์ถ”๊ฐ€ ์ž๋ฃŒ

3d object detection

cars, vans, trucks, pedestrians, cyclists and trams ๊ฐ™์€ ์˜ค๋ธŒ์ ํŠธ์— ๋Œ€ํ•ด์„œ 3D bbox๋ฅผ ์ œ๊ณตํ•˜๊ณ  ์žˆ์Œ.

Velodyne system์— ์˜ํ•ด์„œ 3D point clouds๋ฅผ ๋งŒ๋“ ๋‹ค์Œ์— ์ด๋ฏธ์ง€๋กœ projectionํ•˜๋Š” ์‹์œผ๋กœ ๋ ˆ์ด๋ธ”๋ง ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ์ •ํ™•. 

๋ฐ์ดํ„ฐ์…‹ ๊ตฌ์„ฑ

kitti
โ”œโ”€โ”€ ImageSets
โ”‚   โ”œโ”€โ”€ train.txt
โ”‚   โ””โ”€โ”€ val.txt
โ”œโ”€โ”€ training/
โ”‚   โ”œโ”€โ”€ 00/
โ”‚   โ”‚   โ”œโ”€โ”€ image_0
โ”‚   โ”‚   โ”œโ”€โ”€ image_1
โ”‚   โ”‚   โ”œโ”€โ”€ image_2
โ”‚   โ”‚   โ”œโ”€โ”€ image_3
โ”‚   โ”‚   โ”œโ”€โ”€ calib/
โ”‚   โ”‚   โ””โ”€โ”€ velodyne/
โ”‚   ...
โ”‚   โ””โ”€โ”€ 21
โ”‚       โ”œโ”€โ”€ image_0
โ”‚       โ”œโ”€โ”€ image_1
โ”‚       โ”œโ”€โ”€ image_2
โ”‚       โ”œโ”€โ”€ image_3
โ”‚       โ””โ”€โ”€ velodyne
โ””โ”€โ”€ testing/
    โ”œโ”€โ”€ 00/
    โ”‚   โ”œโ”€โ”€ image_0
    โ”‚   โ”œโ”€โ”€ image_1
    โ”‚   โ”œโ”€โ”€ image_2
    โ”‚   โ”œโ”€โ”€ image_3
    โ”‚   โ”œโ”€โ”€ calib/
    โ”‚   โ””โ”€โ”€ velodyne/
    ...
    โ””โ”€โ”€ 21
        โ”œโ”€โ”€ image_0
        โ”œโ”€โ”€ image_1
        โ”œโ”€โ”€ image_2
        โ”œโ”€โ”€ image_3
        โ””โ”€โ”€ velodyne

๋ฐ์ดํ„ฐ์…‹ ๋‹ค์šด๋กœ๋“œ

3D Object Detection Evaluation 2017: https://www.cvlibs.net/datasets/kitti/eval_object.php?obj_benchmark=3d

BASE_DIR="$1"/kitti

mkdir -p $BASE_DIR

url_velodyne="https://s3.eu-central-1.amazonaws.com/avg-kitti/data_object_velodyne.zip"
url_calib="https://s3.eu-central-1.amazonaws.com/avg-kitti/data_object_calib.zip"
url_label="https://s3.eu-central-1.amazonaws.com/avg-kitti/data_object_label_2.zip"

wget -c -N -O $BASE_DIR'/data_object_velodyne.zip' $url_velodyne
wget -c -N -O $BASE_DIR'/data_object_calib.zip' $url_calib
wget -c -N -O $BASE_DIR'/data_object_label_2.zip' $url_label

Calibration

Calibration Camera to Camera 

์นด๋ฉ”๋ผ Calibration ๊ด€๋ จ Metrix๋Š” ํ•ด๋‹น txt ํŒŒ์ผ(calib_cam_to_cam.txt)์„ ์ฐธ๊ณ ํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

The file calib_cam_to_cam.txt contains parameters for 3 cameras.

  • S_0x: is the image size. You do not really need it for anything.
  • K_0x: is the intrinsics matrix. You can use it to create a cameraParameters object in MATLAB, but you have to transpose it, and add 1 to the camera center, because of MATLAB's 1-based indexing.
  • D_0x: are the distortion coefficients in the form [k1, k2, p1, p2, k3]. k1, k2, and k3 are the radial coefficients, and p1 and p2 are the tangential distortion coefficients.
  • R_0x and T_0x are the camera extrinsics. They seem to be a transformation from a common world coordinate system into each of the cameras' coordinate system.
  • S_rect_0x, R_rect_0x, and P_rect_0x are the parameters of the rectified images.

Given all that, here's what you should do.

  • Pick two cameras of the three, that you want to use.
  • Create a cameraParameters object for each camera using the intrinsics and the distortion parameters (K_0x and D_0x). Don't forget to transpose K and adjust for 1-based indexing.
  • From the extrinsics of the two cameras (R_0x's and T_0x's) compute the rotation and translation between the two cameras. (R and t).
  • Use the two cameraParameters objects together with R and t to create a stereoParameters object.

Calibration Camera to Camera (Code)

# KITTI calib_cam_to_cam.txt
# S_02: 1.392000e+03 5.120000e+02
# K_02: 9.597910e+02 0.000000e+00 6.960217e+02 0.000000e+00 9.569251e+02 2.241806e+02 0.000000e+00 0.000000e+00 1.000000e+00
# D_02: -3.691481e-01 1.968681e-01 1.353473e-03 5.677587e-04 -6.770705e-02
# R_02: 9.999758e-01 -5.267463e-03 -4.552439e-03 5.251945e-03 9.999804e-01 -3.413835e-03 4.570332e-03 3.389843e-03 9.999838e-01
# T_02: 5.956621e-02 2.900141e-04 2.577209e-03

calibration_matrix =[[9.597910e+02, 0.000000e+00, 6.960217e+02],
    [0.000000e+00, 9.569251e+02, 2.241806e+02],
    [0.000000e+00, 0.000000e+00, 1.000000e+00]]

R = [[9.999758e-01, -5.267463e-03, -4.552439e-03],
    [5.251945e-03, 9.999804e-01, -3.413835e-03],
    [4.570332e-03, 3.389843e-03, 9.999838e-01]]
    
T = [5.956621e-02, 2.900141e-04, 2.577209e-03 ]

R_T = [[9.999758e-01, -5.267463e-03, -4.552439e-03, 5.956621e-02,],
    [5.251945e-03, 9.999804e-01, -3.413835e-03, 2.900141e-04],
    [4.570332e-03, 3.389843e-03, 9.999838e-01,  2.577209e-03]]
    
fx = calibration_matrix[0][0]
ox = calibration_matrix[0][2]
fy = calibration_matrix[1][1]
oy = calibration_matrix[1][2]

์ฐธ๊ณ 

๋ฐ˜์‘ํ˜•