MATLAB Answers

How can I export Ground Truth in KITTI format (.txt) using Ground Truth Labeler App

28 views (last 30 days)
Arghya Chatterjee
Arghya Chatterjee on 12 Mar 2021
Commented: Arghya Chatterjee on 29 Mar 2021
Hello, I am working on Lidar based 3D Bounding Box Detection. I am using matlab for labeling the ground truth data as I am working with custom dataset. However, after labeling and during export, I can only see the option export as ".mat" format. I was wondering if I can export the data as ".txt" format or at least export as ".mat format and convert it in ". txt" format later using some matlab commands. Can I do that? And if yes, How?? N.B: I am working on developing a new detection model and so, I need to benchmark my model against the SOTA models. The problem is, not all models are supported inside matlab. So, I have to manually run these detection models on my dataset with their git-hub release code which mostly follows KITTI (.txt) format ground truth labels.

Answers (1)

Shubham Rawat
Shubham Rawat on 16 Mar 2021
Hi Arghya,
Here what are you exporting as '.mat' file is of groundTruthLidar object. You can export only content of Labels and xyzCoordinates according to the properties of this object.
You may look into the groundtruthLidar object.
For converting .mat files into .txt files you may use this: https://www.mathworks.com/matlabcentral/answers/8902-from-mat-to-txt
Hope this Helps!
  1 Comment
Arghya Chatterjee
Arghya Chatterjee on 29 Mar 2021
Hello, thanks for your answer. It worked but I got another problem.
The way I did this was as follows:
Data = load('/home/arghya/labels.mat');
DataTruth = Data.gTruth.ROILabelData.velodyne.Car;
dlmwrite('000000.txt', DataTruth, 'precision','%.2f', 'delimiter',' ');
After writing the data to the text file, currently it looks like:
1.8 0.2 .... 180
But according to KITTI format, It should look like:
Car 1.8 0.2 .... 1.57
So, questions are now these:
1. I want to write label name along with the data(coordinates). How can I do that?
2. Is there any way to convert the last value (yaw-angle) from degrees to radians during labeling or exporting from ground truth labeler?
N.B : Say I have made 3 classes of GT objects and corresponding bounding box from lidar data (here I have shown 2 sequence) inside matlab gt labeler. So matlab stores it like:
Time Car Tree Pedestrian
0.000000 3x9 1x9 4x9
0.117534 [] [] []
So, the 000000.txt file should look like:
Car 1.8 7.2 .... 0
Car ......
Car .....
Tree 5.6 3.5 .... 1.57
Pedestrian 3.5 5.6.... 3.14
Pedestrian .........
Pedestrian .........
Pedestrian .........
Hope this helps you to answer the question more precisely!!

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by