denoise-imu-gyro icon indicating copy to clipboard operation
denoise-imu-gyro copied to clipboard

Cannot validate results on new dataset.

Open Ravi-Agrawal-Bose opened this issue 4 years ago • 7 comments

Hey, I tried to validate the results on two other datasets, the StructVIO dataset, and the ADVIO dataset. Have you guys tried to validate the results on any other datasets?

Attaching code of the Struct VIO data preparation.

` class CustomDataset(BaseDataset): def init(self, data_dir, predata_dir, train_seqs, val_seqs, test_seqs, mode, N, min_train_freq, max_train_freq, dt=0.005): super().init(predata_dir, train_seqs, val_seqs, test_seqs, mode, N, min_train_freq, max_train_freq, dt) # convert raw data to pre loaded data self.read_data(data_dir)

def read_data(self, data_dir):
    r"""Read the data from the dataset"""

    f = os.path.join(self.predata_dir, 'Mech-01.p') # if processed data exist
    if True and os.path.exists(f):
        print("Processed data found")
        return

    print("Start read_data, be patient please")

    # change this to support advio dataset
    def set_path(seq):
        path_imu = os.path.join(data_dir, seq, seq, "imu0", "data.csv")
        path_gt = os.path.join(data_dir, seq,  seq+"-ArUco-a.txt")
        path_gt1 = os.path.join(data_dir, seq, "vicon.txt")
        return path_imu, path_gt, path_gt1

    sequences = os.listdir(data_dir)
    # read each sequence
    for sequence in sequences:
        print("\nSequence name: " + sequence)
        path_imu, path_gt, path_gt1 = set_path(sequence)
        imu = np.genfromtxt(path_imu, delimiter=",", skip_header=1)
        try:
            gt = np.genfromtxt(path_gt, delimiter="", skip_header=0)
            print("Ground Truth File: %s" %path_gt)
        except:
            gt = np.genfromtxt(path_gt1, delimiter="", skip_header=0)
            print("Ground Truth File: %s" % path_gt1)
        # import ipdb; ipdb.set_trace()
        imu[:, 0] = imu[:, 0]/1e9 # converting to second

        # time synchronization between IMU and ground truth
        t0 = np.max([gt[0, 0], imu[0, 0]])
        t_end = np.min([gt[-1, 0], imu[-1, 0]])

        # start index
        idx0_imu = np.searchsorted(imu[:, 0], t0)
        idx0_gt = np.searchsorted(gt[:, 0], t0)

        # end index
        idx_end_imu = np.searchsorted(imu[:, 0], t_end, 'right')
        idx_end_gt = np.searchsorted(gt[:, 0], t_end, 'right')

        # subsample
        imu = imu[idx0_imu: idx_end_imu]
        gt = gt[idx0_gt: idx_end_gt]

        # printing the shape of the data

        ts = np.array(imu[:, 0], dtype="float64")

        # # interpolate
        t_gt = gt[:, 0]
        gt = self.interpolate(np.array(gt, dtype="float64"), np.array(gt[:, 0], dtype="float64"), ts)

        imu[:, 1:4] = imu[:, 1:4] - imu[0, 1:4]
        print(imu.shape)
        print(gt.shape)
        # import ipdb; ipdb.set_trace()
        # take ground truth position
        p_gt = gt[:, 1:4] #p_gt = gt[:, 1:4]
        p_gt = p_gt - p_gt[0]

        # take ground true quaternion pose
        # q_gt = torch.Tensor(gt[:, 4:8]).double()
        q_gt = SO3.qnorm(torch.Tensor(gt[:, 4:8]).double())
        # q_gt = q_gt / q_gt.norm(dim=1, keepdim=True)
        Rot_gt = SO3.from_quaternion(q_gt.cuda(), ordering='wxyz').cpu()

        # convert from numpy
        p_gt = torch.Tensor(p_gt).double()
        v_gt = torch.zeros_like(p_gt).double()
        v_gt[1:] = (p_gt[1:] - p_gt[:-1]) / self.dt
        imu = torch.Tensor(imu[:, 1:]).double()

        # compute pre-integration factors for all training
        mtf = self.min_train_freq
        dRot_ij = bmtm(Rot_gt[:-mtf], Rot_gt[mtf:])
        dRot_ij = SO3.dnormalize(dRot_ij.cuda())
        dxi_ij = SO3.log(dRot_ij).cpu()

        # masks with 1 when ground truth is available, 0 otherwise
        masks = dxi_ij.new_ones(dxi_ij.shape[0])
        tmp = np.searchsorted(t_gt, ts[:-mtf])
        diff_t = ts[:-mtf] - t_gt[tmp]
        masks[np.abs(diff_t) > 0.01] = 0


        # save for all training
        mondict = {
            'xs': torch.cat((dxi_ij, masks.unsqueeze(1)), 1).float(),
            'us': imu.float(),
        }
        # print(mondict["xs"].shape)
        # print(mondict["us"].shape)
        pdump(mondict, self.predata_dir, sequence + ".p")
        # save ground truth
        mondict = {
            'ts': ts,
            'qs': q_gt.float(),
            'vs': v_gt.float(),
            'ps': p_gt.float(),
        }
        pdump(mondict, self.predata_dir, sequence + "_gt.p")

`

Ravi-Agrawal-Bose avatar Jul 16 '20 13:07 Ravi-Agrawal-Bose

I have not tried to validate on the StructVIO or ADVIO datasets.

mbrossar avatar Jul 19 '20 10:07 mbrossar

Hello Ravi-Agrawal-Bose,have you solved the problem? I tried to validate the results on myself collected dataset and face the same problem as you. The raw IMU and net IMU are almostly same such as following: 捕获 I fine-tuned the parameter 'gyro_std‘ but it doesn't work. So could you please give me some advice? Thanks!

jay80253504 avatar Jan 12 '21 06:01 jay80253504

Hello Ravi-Agrawal-Bose,have you solved the problem? I tried to validate the results on myself collected dataset and face the same problem as you. The raw IMU and net IMU are almostly same such as following: 捕获 I fine-tuned the parameter 'gyro_std‘ but it doesn't work. So could you please give me some advice? Thanks!

Hello, the author's data set link in this code has expired, can you resend me a copy of the data set used in it? Thank you so much!

yafeiliu666 avatar May 09 '23 14:05 yafeiliu666

Hello Ravi-Agrawal-Bose,have you solved the problem? I tried to validate the results on myself collected dataset and face the same problem as you. The raw IMU and net IMU are almostly same such as following: 捕获 I fine-tuned the parameter 'gyro_std‘ but it doesn't work. So could you please give me some advice? Thanks!

hello! the author's dataset link and parameters link is not avaliable,could you send the downloaded file to me ? thank you ver much!!! My email address: [email protected]

dreamer1031 avatar Jul 24 '23 09:07 dreamer1031

你好Ravi-Agrawal-Bose,你解决了问题吗?我试图在自己收集的数据集上验证结果,并面临与您相同的问题。原始 IMU 和网络 IMU 基本相同,如下所示: 捕获 我微调了参数“gyro_std”,但它不起作用。那么你能给我一些建议吗?谢谢!

您好,此代码中作者的数据集链接已过期,您能给我重新发送其中使用的数据集的副本吗?非常感谢!

hello! the author's dataset link and parameters link is not avaliable,could you send the downloaded file to me ? thank you My email address: [email protected]

alun9258 avatar Mar 25 '24 01:03 alun9258

Hello Ravi-Agrawal-Bose,have you solved the problem? I tried to validate the results on myself collected dataset and face the same problem as you. The raw IMU and net IMU are almostly same such as following: 捕获 I fine-tuned the parameter 'gyro_std‘ but it doesn't work. So could you please give me some advice? Thanks!

hello! the author's dataset link and parameters link is not avaliable,could you send the downloaded file to me ? thank you ver much!!! My email address: [email protected]

hello! the author's dataset link and parameters link is not avaliable,could you send the downloaded file to me ? thank you My email address: [email protected]

alun9258 avatar Mar 25 '24 01:03 alun9258

Hello Ravi-Agrawal-Bose,have you solved the problem? I tried to validate the results on myself collected dataset and face the same problem as you. The raw IMU and net IMU are almostly same such as following: 捕获 I fine-tuned the parameter 'gyro_std‘ but it doesn't work. So could you please give me some advice? Thanks!

Hello jay80253504!, did you ever solve this problem?

chi-chien avatar Apr 09 '24 14:04 chi-chien