qinzheng93 / GeoTransformer

[CVPR2022] Geometric Transformer for Fast and Robust Point Cloud Registration
MIT License
617 stars 66 forks source link

The ground truth does not match the KITTI dataset. #105

Open iifeve opened 3 months ago

iifeve commented 3 months ago

I would like to replicate this model on the KITTI dataset. During the data preparation phase, I discovered that the ground truth does not match the pose in the dataset. The dataset was downloaded from kitti odometry. I would like to inquire how the ground truth was obtained and whether it underwent any processing.

import pickle, numpy as np

with open('/GeoTransformer/data/Kitti/metadata/train.pkl', 'rb') as file:
    meta_data = pickle.load(file)

poses = []
with open('/GeoTransformer/data/Kitti/00.txt', 'r') as file:
    for line in file:
        eles = line.split(' ')
        eles = [float(ele) for ele in eles]
        eles += [0.0, 0.0, 0.0, 1.0]
        pose = np.array(eles).reshape((4,4))
        poses.append(pose)

idx_0 = meta_data[0]['frame0']
idx_1 = meta_data[0]['frame1']
trans = meta_data[0]['transform']

print(f'poses_{idx_0} is : \n {poses[idx_0]}')
print(f'poses_{idx_1} is : \n {poses[idx_1]}')

poses_11 is : [[ 9.997264e-01 5.527315e-03 -2.272922e-02 -5.155474e-01] [-5.816781e-03 9.999025e-01 -1.268908e-02 -3.121547e-01] [ 2.265686e-02 1.281782e-02 9.996611e-01 9.440275e+00] [ 0.000000e+00 0.000000e+00 0.000000e+00 1.000000e+00]] poses_0 is : [[ 1.000000e+00 9.043680e-12 2.326809e-11 5.551115e-17] [ 9.043683e-12 1.000000e+00 2.392370e-10 3.330669e-16] [ 2.326810e-11 2.392370e-10 9.999999e-01 -4.440892e-16] [ 0.000000e+00 0.000000e+00 0.000000e+00 1.000000e+00]]

print(f'poses_{idx_0} is : \n {poses[idx_0] @ trans}')
print(f'poses_{idx_1} is : \n {poses[idx_1] @ trans}')
print(f'poses_{idx_0} is : \n {trans @ poses[idx_0]}')
print(f'poses_{idx_1} is : \n {trans @ poses[idx_1]}')

poses_11 is : [[ 0.99854881 0.04903782 -0.02225916 -9.64195803] [-0.04940388 0.99864733 -0.0162043 -0.39138505] [ 0.02143442 0.01728048 0.99962095 9.26892439] [ 0. 0. 0. 1. ]] poses_0 is : [[ 9.99048570e-01 4.36070063e-02 4.89464258e-04 -9.12733465e+00] [-4.36050367e-02 9.99042651e-01 -3.51279718e-03 -1.31863528e-01] [-6.42179162e-04 3.48811129e-03 9.99993682e-01 3.71489208e-02] [ 0.00000000e+00 0.00000000e+00 0.00000000e+00 1.00000000e+00]] poses_11 is : [[ 0.99853267 0.04913108 -0.02277163 -9.651383 ] [-0.04948391 0.9986592 -0.01519743 -0.4544007 ] [ 0.02199443 0.01630196 0.99962522 9.47660747] [ 0. 0. 0. 1. ]] poses_0 is : [[ 9.99048570e-01 4.36070063e-02 4.89464220e-04 -9.12733465e+00] [-4.36050367e-02 9.99042651e-01 -3.51279683e-03 -1.31863528e-01] [-6.42179216e-04 3.48811164e-03 9.99993682e-01 3.71489248e-02] [ 0.00000000e+00 0.00000000e+00 0.00000000e+00 1.00000000e+00]]

def getIdx(idx):
    if(meta_data[idx]['seq_id'] != 0):
        print('seq_id is not zero')
    trans = meta_data[idx]['transform']
    return(meta_data[idx]['frame0'], meta_data[idx]['frame1'], trans)

def calPoseAndTransPose(idx_0, idx_1, trans):

    print(f'poses_{idx_0} is : \n {poses[idx_0]}')
    print(f'poses_{idx_0} is : \n {trans @ poses[idx_0]}')

idx_0, idx_1, trans = getIdx(300)
calPoseAndTransPose(idx_0, idx_1, trans)

poses_4019 is : [[-9.975340e-01 6.942821e-02 1.028616e-02 -2.712806e+02] [ 6.988797e-02 9.960649e-01 5.450084e-02 2.268718e-01] [-6.461783e-03 5.508530e-02 -9.984607e-01 3.192394e+02] [ 0.000000e+00 0.000000e+00 0.000000e+00 1.000000e+00]] poses_4019 is : [[-9.93526303e-01 1.09620689e-01 2.98137300e-02 -2.85965646e+02] [ 1.11087840e-01 9.92393181e-01 5.30573043e-02 1.19501576e+01] [-2.37707708e-02 5.60257701e-02 -9.98146311e-01 3.14343969e+02] [ 0.00000000e+00 0.00000000e+00 0.00000000e+00 1.00000000e+00]]

JasonLeeUT commented 3 months ago

Hello, can I ask how you get the pkl files? The downsamplepcd only generate the npy file.

iifeve commented 2 months ago

Hello, can I ask how you get the pkl files? The downsamplepcd only generate the npy file.

yeah… Author calculated the ground truth by ICP, and saved in pkl file, which saved in data/Kitti/metadata, Actually, it should be calculated by ground truth given by kitti, but, a grate work.