1. 资源限制与算法选型

Jetson Orin Nano运行 VSLAM 适合构建中小规模场景(如小型园区)的地图和定位系统。

场景类型 推荐规模 实际验证案例 备注
室内房间/走廊 ≤ 200㎡ 六足机器人搜救、地面机器人室内导航 最擅长的场景,性能充裕
小型园区/建筑群 ≤ 10,000㎡ 无人机项目验证距离达 100米 以上 需要优化参数,建议使用VIO融合

内存限制

  • 限制:Jetson Orin Nano的内存是CPU+GPU共用8GB 统一内存。在大规模地图情况下,容易导致内存累积,长时间运行可能 OOM

  • 应对

    • 配置 NVMe SSD + 迁移 Docker 数据目录到 SSD

    • 使用轻量化 VSLAM 方案(如 DPVO,嵌入式首选)

    • 定期保存/重置地图

计算资源竞争

  • 限制:同时运行 VSLAM + 目标检测 + 控制,CPU/GPU 负载较高

  • 应对

    • 使用 TensorRT 量化模型(YOLO 量化后速度提升 5-6 倍)

    • 优先保证 VSLAM 实时性,其他任务可降频处理

VSLAM算法选型

根据 2026 年最新评测,不同 VSLAM 方案在 Jetson 上的表现:

算法类型 具体方案 适用场景 推荐度
深度学习型 DPVO 嵌入式部署首选,效率与鲁棒性平衡 ⭐⭐⭐⭐⭐
学习型 MASt3R / DUSt3R 精度最高,但算力需求大 ⭐⭐⭐
传统型 ORB-SLAM3 在视觉退化环境中失效 ⭐⭐

DPVO(Deep Patch Visual Odometry深度块视觉里程计),由普林斯顿大学的研究者在 2022 年提出,并被顶级人工智能会议 NeurIPS 接收。它的核心任务是:仅凭单目相机的视频输入,实时地估算出相机的运动轨迹(6自由度位姿),同时稀疏地重建出周围环境的3D结构。

DPVO 是一个在视觉里程计(VO)领域非常有代表性的深度学习系统。简单来说,它的核心优势是在不牺牲精度的前提下,通过基于稀疏图像块的匹配替代传统方法中计算量巨大的“密集流”方法,从而实现了极高的运行效率

特点 说明
稀疏匹配 (Sparse Matching) 每帧图像只随机采样少量图像块(如 64 个)进行跟踪,极大地减少了需要处理的数据量。
深度补丁表示 (Deep Patch Representation) 并非直接使用像素,而是用一个轻量级的神经网络为每个图像块提取一个“特征向量”,这能更好地描述该区域的纹理和结构,提高了匹配的鲁棒性。
循环迭代更新 (Recurrent Updates) 设计了一个循环网络架构,不断在“调整轨迹”和“优化相机姿态”之间迭代,逐步求精,确保了最终结果的精度。
可微BA (Differentiable BA) 将传统的“光束法平差 (Bundle Adjustment)”优化步骤设计成网络的一部分,可以进行端到端训练,让整个系统更智能地学习如何进行几何优化。

根据论文中的基准测试,在高端 GPU(如 NVIDIA RTX 3090)上,DPVO 的表现令人印象深刻:

性能指标 DPVO 对比方法 (DROID-SLAM) 结论
运行速度 60 帧/秒 (FPS) 40 FPS 快 1.5 倍
内存占用 4.9 GB 8.7 GB 节省约 44% 内存
极限速度 (EuRoC数据集) 120 FPS - 速度极快
准确性 优于所有先前方法 - 精度更高

DPVO 证明了“稀疏”方法在效率和准确性上可以全面超越“密集”方法,是当时该领域的 state-of-the-art(最先进水平)。DPVO 不仅自身性能卓越,其思想和代码也为后续研究提供了绝佳的平台。

  • CL-DPVO (Curriculum Learning DPVO):这是 2024 年的一项工作。研究者通过“课程学习”的方法,让模型先从简单的运动场景学起,再逐步学习更复杂的动态,成功提升了 DPVO 在极具挑战性的场景(如快速旋转、剧烈抖动)下的鲁棒性

  • 客观评价:根据一篇 2024 年发表的、专门针对室内移动机器人定位的综合性研究,在对比了多种深度学习视觉里程计方法后,研究者认为 DPVO 是其中最高效、最有效的选择


2. DPVO版本介绍

基础版本:原版 DPVO 论文中的数据是在 RTX 3090(24GB 显存)上测得的,内存占用为 4.9GB,速度可达 60 FPS。对于 Jetson Orin Nano 8GB:8GB 的统一内存是最大的限制。原版 DPVO 需要约 5GB 内存,留给系统和其它程序的空间较小。可以运行,但可能需要牺牲一些性能(例如降低处理帧率)。

进阶版本:DPVO-QAT++是 2025 年底提出的一个新框架,专门为 DPVO嵌入式优化设计,旨在让它能在资源受限的平台上高效运行。它的核心优化思路非常值得关注:

优化技术 作用 在 Jetson Orin 上的收益
异构精度设计 前端(特征提取)用 INT8 模拟,后端(优化)保持 FP32 精度 在保持精度的前提下,大幅减少计算量和内存带宽压力
量化感知训练 (QAT) 在训练时就模拟量化误差,让模型适应低精度 避免了部署后单纯量化带来的精度大幅下降问题
CUDA 核函数融合 将多个简单的、连续的操作合并成一个复杂的CUDA核 减少内核启动和数据搬运的开销,显著降低延迟

根据论文,在 TartanAir 数据集上,DPVO-QAT++ 实现了:

  • 平均 FPS 提升 52.1%

  • 中位延迟降低 29.1%

  • 峰值 GPU 内存减少 64.9%

3. 基础版DPVO安装

对于 Jetson Orin  Nano 8GB 版本,DPVO-QAT++ 是理想的部署方案。但是为了简单起见,本文还是先从基础版本入手,避免一上来搞得难度太大。

1. 克隆项目

git clone https://gitcode.com/gh_mirrors/dp/DPVO.git

2. 安装DPVO依赖的环境

通过Miniconda安装环境。注意:Jetson 是 ARM 架构,下载 aarch64 版本

wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-aarch64.sh

bash Miniconda3-latest-Linux-x86_64.sh

建议配置清华镜像源加速下载:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --set show_channel_urls yes


3. 按照README提示安装

cd DPVO/
conda env create -f environment.yml

结果频频报错。可以打开environment.yml看一下。

自此以下主要是记录安装过程中的报错和解决。不感兴趣的可以划走了

----------------------------------------------------------分割线----------------------------------------------------------

最后,我选择了逐步安装。

首先,创建虚拟环境:

conda create -n py310_env python=3.10.20

接下来安装torch:

先贴出来检验是否安装成功的方法:

python -c "import torch; print('PyTorch version:', torch.__version__); print('CUDA available:', torch.cuda.is_available())"

如果能正常打印CUDA available: True,则安装OK。

如下是一些安装尝试:

# 尝试1:
pip3 install --no-cache https://developer.download.nvidia.com/compute/redist/jp/v60dp/pytorch/torch-2.3.0a0+40ec155e58.nv24.03.13384722-cp310-cp310-linux_aarch64.whl
# 报错缺少依赖

# 尝试2: 先安装依赖
pip install sympy -i https://mirrors.aliyun.com/pypi/simple/
pip install jinja2 fsspec networkx typing-extensions -i https://mirrors.aliyun.com/pypi/simple/

pip install -i https://mirrors.aliyun.com/pypi/simple/ torch==2.3.1
# 仍然报错,找不到cudnn.so.8
# 但我的硬件适配的比较好的是cudnn.so.9,还是不要轻易动这个。那就只能升级torch了。

# 尝试3: 安装torch2.5
wget https://developer.nvidia.cn/w/compute/redist/jp/v61/pytorch/torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl

# 需先安装依赖
pip install sympy==1.13.1 -i https://mirrors.aliyun.com/pypi/simple/

wget https://developer.download.nvidia.com/compute/cusparselt/0.7.0/local_installers/cusparselt-local-tegra-repo-ubuntu2204-0.7.0_1.0-1_arm64.deb

sudo dpkg -i cusparselt-local-tegra-repo-ubuntu2204-0.7.0_1.0-1_arm64.deb

sudo cp /var/cusparselt-local-tegra-repo-ubuntu2204-0.7.0/cusparselt-*-keyring.gpg /usr/share/keyrings/

sudo apt-get update

sudo apt-get -y install libcusparselt0 libcusparselt-dev

pip install torch-2.5.0a0+872d972e41.nv24.08.17622132-cp310-cp310-linux_aarch64.whl

最终安装torch==2.5成功。


另外,torch-scatter安装多次报错。

解决方法:屏蔽,先安装其他的包

pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt

如下是一些导致报错的安装:

pip install torch-scatter==2.1.2 -i https://mirrors.aliyun.com/pypi/simple/
pip install torch-scatter -f https://data.pyg.org/whl/torch-2.5.0.html
pip install torch-scatter -f https://data.pyg.org/whl/torch-2.5.0+cu121.html
pip install torch-scatter==2.1.2 -v -i https://mirrors.aliyun.com/pypi/simple/
pip install torch-scatter -v -i https://mirrors.aliyun.com/pypi/simple/
pip install torch-scatter==2.1.2 -f https://data.pyg.org/whl/torch-2.5.0+cu121.html

最后通过如下命令安装成功:

pip install torch-scatter==2.1.2 --no-build-isolation -i https://mirrors.aliyun.com/pypi/simple/

附上最终的requirements.txt

numpy==1.26.4
#torch==2.5.0, 下载安装
#torch-scatter==2.1.2,详细安装方法在文中
#torch-cuda==12.1, 不用去管这个
torchvision==0.27  # 与torch==2.5.0对应
tensorboard
numba
tqdm
einops
pypose
kornia
plyfile
evo
opencv-python
yacs

安装补充:

README中安装DPVO

# install DPVO
pip install .

这个命令在conda环境中运行会报错:找不到torch,通过如下的命令解决:

pip install . --no-build-isolation -i https://mirrors.aliyun.com/pypi/simple/

同理:

pip install ./DPViewer

# 替换为如下命令
pip install ./DPViewer -i https://mirrors.aliyun.com/pypi/simple/ --no-build-isolation

安装图像检索系统DPRetrieval

原安装命令-改进版:

pip install ./DPRetrieval --no-build-isolation -i https://mirrors.aliyun.com/pypi/simple/

报错:

  Building wheel for dpretrieval (pyproject.toml) ... error
  error: subprocess-exited-with-error
        File "/tmp/pip-build-env-21eignu4/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 509, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 121, in build_extension
        File "/home/pi/miniconda3/envs/py310_env/lib/python3.10/subprocess.py", line 526, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['cmake', '--build', '.']' returned non-zero exit status 2.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for dpretrieval
Failed to build dpretrieval
error: failed-wheel-build-for-install

× Failed to build installable wheels for some pyproject.toml based projects
╰─> dpretrieval

在 Jetson ARM64 架构上编译包含 C++/CUDA 扩展的包经常遇到问题,需要从源码手动编译

cd DPRetrieval
python setup.py build_ext --inplace
python setup.py install

继续报错如下:

python setup.py build_ext --inplace
running build_ext
-- pybind11 v2.9.2
-- Found PythonInterp: /home/pi/miniconda3/envs/py310_env/bin/python (found version "3.10.20")
-- Found PythonLibs: /home/pi/miniconda3/envs/py310_env/lib/libpython3.10.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/projects/DPVO/DPRetrieval/build/temp.linux-aarch64-cpython-310/dpretrieval
Consolidate compiler generated dependencies of target dpretrieval
[ 50%] Building CXX object CMakeFiles/dpretrieval.dir/src/main.cpp.o
/home/pi/projects/DPVO/DPRetrieval/src/main.cpp: In constructor ‘DPRetrieval::DPRetrieval(std::string, int)’:
/home/pi/projects/DPVO/DPRetrieval/src/main.cpp:55:11: error: ‘OrbVocabulary’ {aka ‘class DBoW2::TemplatedVocabulary<cv::Mat, DBoW2::FORB>’} has no member named ‘loadFromTextFile’
   55 |       voc.loadFromTextFile(vocab_path);
      |           ^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/c++/11/math.h:36,
                 from /home/pi/miniconda3/envs/py310_env/include/python3.10/pyport.h:210,
                 from /home/pi/miniconda3/envs/py310_env/include/python3.10/Python.h:50,
                 from /home/pi/projects/DPVO/DPRetrieval/pybind11/include/pybind11/detail/common.h:213,
                 from /home/pi/projects/DPVO/DPRetrieval/pybind11/include/pybind11/cast.h:13,
                 from /home/pi/projects/DPVO/DPRetrieval/pybind11/include/pybind11/attr.h:13,
                 from /home/pi/projects/DPVO/DPRetrieval/pybind11/include/pybind11/detail/class.h:12,
                 from /home/pi/projects/DPVO/DPRetrieval/pybind11/include/pybind11/pybind11.h:13,
                 from /home/pi/projects/DPVO/DPRetrieval/src/main.cpp:1:
/usr/include/c++/11/bits/stl_pair.h: In instantiation of ‘constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = const double&; _T2 = const double&; typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type = double; typename std::decay<_Tp2>::type = double; typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type = double; typename std::decay<_Tp>::type = double]’:
/usr/local/include/DBoW2/TemplatedDatabase.h:835:29:   required from ‘void DBoW2::TemplatedDatabase<TDescriptor, F>::queryChiSquare(const DBoW2::BowVector&, DBoW2::QueryResults&, int, int) const [with TDescriptor = cv::Mat; F = DBoW2::FORB]’
/usr/local/include/DBoW2/TemplatedDatabase.h:595:7:   required from ‘void DBoW2::TemplatedDatabase<TDescriptor, F>::query(const DBoW2::BowVector&, DBoW2::QueryResults&, int, int) const [with TDescriptor = cv::Mat; F = DBoW2::FORB]’
/usr/local/include/DBoW2/TemplatedDatabase.h:572:8:   required from ‘void DBoW2::TemplatedDatabase<TDescriptor, F>::query(const std::vector<T>&, DBoW2::QueryResults&, int, int) const [with TDescriptor = cv::Mat; F = DBoW2::FORB]’
/home/pi/projects/DPVO/DPRetrieval/src/main.cpp:127:15:   required from here
/usr/include/c++/11/bits/stl_pair.h:567:5: note: parameter passing for argument of type ‘std::pair<double, double>’ when C++17 is enabled changed to match C++14 in GCC 10.1
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
gmake[2]: *** [CMakeFiles/dpretrieval.dir/build.make:76: CMakeFiles/dpretrieval.dir/src/main.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/dpretrieval.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2
Traceback (most recent call last):
  File "/home/pi/miniconda3/envs/py310_env/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['cmake', '--build', '.']' returned non-zero exit status 2.

这个编译错误非常明确,问题出在 DBoW2 库的 API 变更上。DPRetrieval调用了 voc.loadFromTextFile(),但系统里安装的 DBoW2 版本已经不再支持这个函数了。

解决方法:修改源码适配新版 API

编辑 /home/pi/projects/DPVO/DPRetrieval/src/main.cpp,找到第 55 行附近的代码:

// 把这行:
voc.loadFromTextFile(vocab_path);

// 改为:
voc.load(vocab_path);

保存后,重新编译并安装,成功

-----------------------------------------------------------------------------------------------------

至此,安装流程完成。用了两天的功夫,真是折腾啊!!!

Logo

智能硬件社区聚焦AI智能硬件技术生态,汇聚嵌入式AI、物联网硬件开发者,打造交流分享平台,同步全国赛事资讯、开展 OPC 核心人才招募,助力技术落地与开发者成长。

更多推荐