项目包:

「2026 SGAD-SLAM 部署项目」
/~4dff3YW018~:/
链接:https://pan.quark.cn/s/caa78d7aa678

环境信息

  • 设备: Jetson Orin NX

  • 内存: 15GB RAM + 7.5GB Swap

  • 数据集: Replica room0 (2000 帧)

  • 状态: ✅ 成功运行,无 OOM

1. conda 环境创建

conda create -n sgadslam python=3.8 -y
conda activate sgadslam

2. PyTorch 安装

编译安装
  • ✅ 版本: torch==1.12.0a0, torchvision==0.13.0a0

  • 可以用我编译好的

3. 基础依赖安装

pip install wandb trimesh==4.0.10 pytorch_msssim torchmetrics tqdm imageio==2.35.1 scipy plyfile roma einops matplotlib evo==1.11.0

4. Open3D + OpenCV

pip install open3d==0.18.0
pip install opencv-python==4.7.0.72

接下来需要编译安装( 相关包 也在项目链接里面)

5. faiss-gpu 编译安装  

# 改为编译 GPU 版本
cd /home/jetson/aaa-Point-SLAM/faiss-1.7.2
export PATH=/home/jetson/aaa-Point-SLAM/cmake-3.25.1-linux-aarch64/bin:$PATH
mkdir -p build && cd build
cmake -DFAISS_ENABLE_GPU=ON -DFAISS_ENABLE_PYTHON=ON -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release ..
make -j$(nproc)
cd ../python
pip install -e .
  • ✅ faiss 1.7.2 GPU 版本编译成功

6. simple-knn 编译

cd ~/aaa-SGAD-SLAM/SGAD-SLAM-main/submodules/simple-knn
sed -i 's/"sm_86",/"sm_86", "sm_8.7",/g' setup.py
pip install -e .

7. fast_gicp 编译

export PATH=/home/jetson/aaa-Point-SLAM/cmake-3.25.1-linux-aarch64/bin:$PATH
pip install empy catkin_pkg rospkg
cd ~/aaa-SGAD-SLAM/SGAD-SLAM-main/submodules/fast_gicp/build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
cd ..
python setup.py install 

8. git 依赖安装

# 方式1: pip install git+ (网络不稳定)
# 方式2: 下载后本地安装
pip install -e /home/jetson/aaa-SGAD-SLAM/evaluate_3d_reconstruction_lib-main
pip install -e /home/jetson/aaa-SGAD-SLAM/gaussian_rasterizer_smallerGSradii-master

9. rerun 安装

# 新版 rerun 不支持 Python 3.8
pip install 'rerun-sdk==0.16.0'

📂 数据集准备

Replica 数据集整理

/home/jetson/aaa-SGAD-SLAM/Replica-room0/
├── images/          # RGB: frame_0.jpg, frame_1.jpg, ...
├── depth_images/    # 深度: depth_0.png, depth_1.png, ...
└── traj.txt

## 📦 依赖版本清单

| 依赖                       | 版本         | 状态 |
| -------------------------- | ------------ | ---- |
| torch                      | 1.12.0a0     | ✅    |
| torchvision                | 0.13.0a0     | ✅    |
| numpy                      | 1.24.4       | ✅    |
| open3d                     | 0.18.0       | ✅    |
| opencv-python              | 4.7.0        | ✅    |
| faiss                      | 1.7.2 (GPU)  | ✅    |
| simple-knn                 | 0.0.0 (编译) | ✅    |
| pygicp                     | 0.0.1 (编译) | ✅    |
| gaussian_rasterizer        | - (编译)     | ✅    |
| evaluate_3d_reconstruction | -            | ✅    |
| rerun-sdk                  | 0.16.0       | ✅    |

---

## 

修改数据集路径

configs_map/Replica/room0.yaml
input_path: /home/jetson/aaa-SGAD-SLAM/Replica-room0

运行

python3 slam_single.py \
    --dataset_path /home/jetson/aaa-SGAD-SLAM/Replica-room0 \
    --config configs/Replica/caminfo.txt \
    --output_path output/room0_jetson \
    --save_results \
    --config_map_path configs_map/Replica/room0.yaml

预期内存占用

  • Tracker: ~500 MB

  • Mapper: ~1-1.5 GB

  • 峰值总计: < 2 GB

在 Jetson Orin Nano (15GB RAM + 7.5GB Swap) 上稳定运行。

🔍 问题排查记录

faiss-cpu libstdc++ 问题

ImportError: /lib/aarch64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found

解决: 编译安装 faiss-gpu 1.7.2

rerun TypeError

TypeError: 'type' object is not subscriptable (Python 3.8)

解决: 降级到 rerun-sdk==0.16.0

Open3D 读取深度图失败

Image has unrecognized bytes_per_channel

解决: 改用 imageio.imread() 读取 16-bit PNG

FileNotFoundError 深度图

No such file: '.../depth_0.png' (实际是 depthframe_0.png)

解决: 重命名文件格式

最终配置

configs_map/Replica/replica.yaml
project_name: "SGADSLAM_replica"
dataset_name: "replica"
checkpoint_path: null
use_wandb: False
frame_limit: 200  # 限制处理帧数
seed: 1
mapping:
  new_submap_every: 1
  map_every: 10  # 每 10 帧映射一次
  iterations: 30  # 减少迭代次数
  new_submap_iterations: 30
  new_submap_points_num: 50000  # 关键!限制高斯点数
  new_submap_gradient_points_num: 5000
  new_frame_sample_size: -1
  new_points_radius: 0.0000001
  current_view_opt_iterations: 0.4
  alpha_thre: 0.6
  pruning_thre: 0.1
  submap_using_motion_heuristic: False
  scaling_lr: 0.075
tracking:
  gt_camera: False
  gicp_camera: True
  w_color_loss: 0.95
  iterations: 200
  cam_rot_lr: 0.0002
  cam_trans_lr: 0.002
  odometry_type: "const_speed"
  help_camera_initialization: False
  init_err_ratio: 5
  odometer_method: "point_to_plane"
  filter_alpha: True
  filter_outlier_depth: True
  alpha_thre: 0.98
  soft_alpha: True
  mask_invalid_depth: False
  enable_exposure: False
cam:
  H: 680
  W: 1200
  fx: 600.0
  fy: 600.0
  cx: 599.5
  cy: 339.5
  depth_scale: 6553.5

性能指标

Tracker 阶段

  • 处理帧数: 2000 帧

  • 耗时: 约 7.5 分钟 (439 秒)

  • FPS: ~5.68

  • ATE RMSE: 114.29 cm

  • 关键帧数: 399 个

Mapper 阶段

  • 每帧高斯点数: 5-19 万(受 new_submap_points_num 限制)

  • 每帧处理时间: 13-15 秒

  • PSNR: 23-26 dB

关键修改说明

1. 单进程架构 (slam_single.py)

  • 移除 torch.multiprocessing,顺序执行 Tracker → Mapper

  • 避免多进程带来的内存开销(约节省 2/3 内存)

2. 减少共享内存 (slam_single.py:103)

# 原始: SharedTargetPoints(1000000000)  # 40 GB
# 修改: SharedTargetPoints(100000)      # ~4 MB

3. 限制高斯点数 (关键!)

new_submap_points_num: 50000  # 原始: -1 (无限制)

4. 减少映射频率

map_every: 10   # 原始: 5
iterations: 30  # 原始: 100

故障排除

问题 1: OOM - Killed

解决方案: 减少 new_submap_points_num 到 50000 或更低

问题 2: 配置不生效

解决方案:

  • 确认修改的是 configs_map/Replica/replica.yaml(基础配置)

  • 而不是 configs_map/Replica/room0.yaml(继承基础配置)

Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐