引言
在博客Paper Survey之——Deep IMU-Bias Inference中,对基于learning的IMU odometry进行了调研及学习,其中论文《AirIMU: Learning uncertainty propagation for inertial odometry》非常具备代表性,且代码也开源了,为此写下本博客记录本人学习及复现的过程。
本博客仅供本人学习记录用~
理论解读

Inertial odometry(IO)中对于IMU的建模可以分为两种:kinematic motion model-based (也就是传统的使用基于kinematics模型的IMU预积分paper) 和 data-driven method(也就是基于learning的)。 而本文则是提出混合两者的方法,用data-driven methods来估算不确定性(特别是 non-deterministic errors),而model-based methods可以提升系统的泛化能力(就是结合版)。 如下图所示。通过利用data-driven method对非确定性噪声和运动模型进行建模,以确保在新环境中的泛化能力。 为了使AirIMU能够学习不确定性和噪声模型,构建了一个可微IMU积分器(differentiable IMU integrator)和一个可微分协方差传播器(differentiable covariance propagator)。 可以预测长时间IMU预积分的累积协方差。 此外,通过将不确定性模块(uncertainty module)与噪声校正模块( noise correction module)联合训练,可以捕获更好的IMU特征,并使两项任务都受益。

PS:虽然网络输出的看似是IMU的motion model,但是训练监督的是related pose(或者说是related position和orientation)因此最终网络是否真的学到正确的IMU测量量是不被关注的,网络仅仅学习的是motion model因此会影响泛化能力~
论文的贡献点如下:
- the first to train a deep neural network that models IMU sensor uncertainty through differentiable covariance propagation。也就是网络可以预测IMU的不确定性(协方差)
- kinematic motion model-based 和 data-driven method混合imu-建模;
- 将不确定性模块(uncertainty module)与噪声校正模块( noise correction module)联合训练
Data-driven module
如上面图(Fig. 4)中所示。采用encoder-decoder网络结构处理原始的IMU数据(加速度和角速度)。 网络输出加速度和角速度的校正,此外,也输出对应的uncertainty。
对于encoder network
首先采用 1D CNN network来学习lower-level features,然后通过一个 gated recurrent unit (GRU)来学习时间维度的关联。
两个task都(correction和uncertainty)采用相同的encoder网络(shared encoder network)来处理原始的IMU。
对于decoder network
,如下:

最终的网络输出的IMU观测量可以表达如下:

Differentiable Integration and Covariance Module
基于获得的网络输出的IMU数据,再采用IMU kinematic model(也就是IMU预积分)来估算系统的状态:
![]() |
![]() |
并基于预积分的结果来supervise data-driven module而不是对上面的IMU原始输出做监督,也就是Differentiable Integration and Covariance Module(其实跟DPVO和Droid-SLAM中的Differentiable BA的概念是很像的~)
Loss Function and Training strategy
论文定义了noise correction的state loss以及covariance loss如下
![]() |
![]() |
最终联合优化的loss如下

IMU-GPS PGO system
虽然采用了强大的learning来估算IMU的模型,但仍然需要外部校正来避免累积误差,而作者采用的是GPS+IMU~ 最终refined的状态及协方差则跟GPS一起通过pose graph optimization来进行融合。如下图所示

代码复现
论文的实验是非常惊艳的,比如下面的,展示了在直升机上估算的轨迹明显比原始IMU预积分的要更接近ground truth
接下来通过代码复现来看看真实的效果如何~
- AirIMU_comment
- 其中的环境依赖是基于pypose
- pypose: a robotics-oriented, PyTorch-based library that combines deep perceptual models with physics-based optimization techniques.
- 运行
pip install pypose
后可以看到conda环境自动安装了系列依赖

安装配置
- 安装pypose
- pypose is a PyTorch-based library that combines deep perceptual models with physics-based optimization techniques.
conda create -n airIMU python=3.10.11
conda activate airIMU
pip install pypose
# 安装系列依赖
pip install "numpy<2"
pip install tqdm
pip install pyproj
pip install scipy
pip install matplotlib
pip install pyhocon
pip install pykitti
pip install opencv-python==4.7.0.72
实验验证
- 下载预训练模型(For EuRoC)并放置于
experiments/EuRoC/codenet/ckpt/
wget https://github.com/sleepycan/AirIMU/releases/download/pretrained_model_euroc/EuRoCWholeaug.zip
-
下载数据集Euroc:Note: Remember to reset the
data_root
inconfigs/datasets/${DATASET}/${DATASET}.conf
. -
generate network inference file net_output.pickle(这应该是网络估算出来的IMU结果)
python inference.py --config configs/exp/EuRoC/codenet.conf --load EuRoCWholeaug/ckpt/best_model.ckpt
网络的输出(应该也就是每个序列的网络估算的IMU以及协方差)保存出来

- 基于网络输出的结果来验证系统的系统
python evaluation/evaluate_state.py --dataconf configs/datasets/BaselineEuroc/Euroc_1000.conf --exp experiments/EuRoC/codenet/
- 结果如下:
从实验效果来看还是比较惊艳的,但是作者在原文也提到这篇工作的limitation,
AirIMU model trained on a single IMU does not readily generalize to a different IMU with different specifications and operating frequencies
换言之就是泛化能力是有限的,需要在特定数据集下训练才可~
- MH_02_easy
![]() |
![]() |
![]() |
![]() |
- MH_03_medium
![]() |
![]() |
![]() |
- MH_04_difficult
![]() |
![]() |
![]() |
![]() |
- MH_01_easy
![]() |
![]() |
![]() |
- MH_05_difficult
![]() |
![]() |
![]() |
- V1_03_difficult
![]() |
![]() |
![]() |
![]() |
- V1_01_easy
![]() |
![]() |
![]() |
- V1_02_medium
![]() |
![]() |
![]() |
- V1_03_difficult
![]() |
![]() |
![]() |
- V2_01_easy
![]() |
![]() |
![]() |
- V2_02_medium
![]() |
![]() |
![]() |