jadouse5/SLAM3R_MAC

This repository contains a modified version of the original SLAM3R project, adapted to run on Apple Silicon (M1/M2/M3) Macs using Metal Performance Shaders (MPS) for GPU acceleration instead of NVIDIA CUDA.

0

stars

17

commits

Python

primary language

Aug 23, 2025

updated

github.com/PKU-VCL-3DV/SLAM3R

README

SLAM3R for macOS (Apple Silicon)

This repository contains a modified version of the original SLAM3R project, adapted to run on Apple Silicon (M1/M2/M3) Macs using Metal Performance Shaders (MPS) for GPU acceleration instead of NVIDIA CUDA.


Acknowledgments & Credit

This project would not be possible without the incredible work of the original authors. This repository is a direct fork and adaptation of their research and code. Please be sure to cite their original work.

  • Primary Source: PKU-VCL-3DV/SLAM3R
    • Paper: SLAM3R: Real-Time Dense Scene Reconstruction from Monocular RGB Videos by Yuzheng Liu, Siyan Dong, et al.
  • Influential Work: The authors also credit cvg/nicer-slam.

This fork is intended solely to make this powerful tool accessible to users on Apple hardware.


macOS Adaptation

The original SLAM3R codebase contains hardcoded calls to the NVIDIA CUDA API, which is not available on macOS. The following key modifications were made to enable compatibility:

  1. Modified recon.py:

    • Removed hardcoded CUDA device selection (torch.cuda.set_device).
    • Added logic to auto-detect the available hardware, prioritizing mps (Apple GPU), then cuda, and falling back to cpu.
    • The selected device is passed as an argument to the model loading and pipeline functions.
  2. Modified slam3r/utils/device.py:

    • The MyNvtxRange class, used for profiling, was wrapped in a conditional check (if torch.cuda.is_available():) to prevent CUDA-specific calls on non-NVIDIA hardware.
    • Helper functions that were accidentally removed in previous edits have been restored to ensure the script runs correctly.

These changes make the codebase hardware-agnostic, allowing it to run on both the original NVIDIA platform and on Apple Silicon Macs.


Installation on macOS

This guide assumes you have Homebrew and Python 3.11 installed.

  1. Clone the Repository:

    git clone [https://github.com/jadouse5/SLAM3R_MAC]
    cd SLAM3R_MAC 
    
  2. Create a Python Virtual Environment:

    python3.11 -m venv myenv
    source myenv/bin/activate
    
  3. Install Dependencies in Order: The installation order is important to ensure compatibility.

    # Upgrade pip
    pip install --upgrade pip
    
    # Install the correct PyTorch version for Apple Silicon
    pip install torch torchvision torchaudio
    
    # Install the remaining packages from requirements.txt
    pip install -r requirements.txt
    

Usage

This repository includes a Gradio web interface for easy use.

  1. Launch the App: Make sure your (myenv) is active and you are in the main project directory.

    python app.py
    
  2. Use the Interface: Open the provided URL in your web browser. You can upload a video to generate a new 3D point cloud (.ply) file or upload an existing .ply file to view it.

Citations

@article{slam3r, title={SLAM3R: Real-Time Dense Scene Reconstruction from Monocular RGB Videos}, author={Liu, Yuzheng and Dong, Siyan and Wang, Shuzhe and Yin, Yingda and Yang, Yanchao and Fan, Qingnan and Chen, Baoquan}, journal={arXiv preprint arXiv:2412.09401}, year={2024} }

Contributors

Ly-kc

7 commits

siyandong

6 commits

jadouse5

4 commits

jadouse5/SLAM3R_MAC

This repository contains a modified version of the original SLAM3R project, adapted to run on Apple Silicon (M1/M2/M3) Macs using Metal Performance Shaders (MPS) for GPU acceleration instead of NVIDIA CUDA.

0

stars

17

commits

Python

primary language

Aug 23, 2025

updated

github.com/PKU-VCL-3DV/SLAM3R

README

SLAM3R for macOS (Apple Silicon)

This repository contains a modified version of the original SLAM3R project, adapted to run on Apple Silicon (M1/M2/M3) Macs using Metal Performance Shaders (MPS) for GPU acceleration instead of NVIDIA CUDA.


Acknowledgments & Credit

This project would not be possible without the incredible work of the original authors. This repository is a direct fork and adaptation of their research and code. Please be sure to cite their original work.

  • Primary Source: PKU-VCL-3DV/SLAM3R
    • Paper: SLAM3R: Real-Time Dense Scene Reconstruction from Monocular RGB Videos by Yuzheng Liu, Siyan Dong, et al.
  • Influential Work: The authors also credit cvg/nicer-slam.

This fork is intended solely to make this powerful tool accessible to users on Apple hardware.


macOS Adaptation

The original SLAM3R codebase contains hardcoded calls to the NVIDIA CUDA API, which is not available on macOS. The following key modifications were made to enable compatibility:

  1. Modified recon.py:

    • Removed hardcoded CUDA device selection (torch.cuda.set_device).
    • Added logic to auto-detect the available hardware, prioritizing mps (Apple GPU), then cuda, and falling back to cpu.
    • The selected device is passed as an argument to the model loading and pipeline functions.
  2. Modified slam3r/utils/device.py:

    • The MyNvtxRange class, used for profiling, was wrapped in a conditional check (if torch.cuda.is_available():) to prevent CUDA-specific calls on non-NVIDIA hardware.
    • Helper functions that were accidentally removed in previous edits have been restored to ensure the script runs correctly.

These changes make the codebase hardware-agnostic, allowing it to run on both the original NVIDIA platform and on Apple Silicon Macs.


Installation on macOS

This guide assumes you have Homebrew and Python 3.11 installed.

  1. Clone the Repository:

    git clone [https://github.com/jadouse5/SLAM3R_MAC]
    cd SLAM3R_MAC 
    
  2. Create a Python Virtual Environment:

    python3.11 -m venv myenv
    source myenv/bin/activate
    
  3. Install Dependencies in Order: The installation order is important to ensure compatibility.

    # Upgrade pip
    pip install --upgrade pip
    
    # Install the correct PyTorch version for Apple Silicon
    pip install torch torchvision torchaudio
    
    # Install the remaining packages from requirements.txt
    pip install -r requirements.txt
    

Usage

This repository includes a Gradio web interface for easy use.

  1. Launch the App: Make sure your (myenv) is active and you are in the main project directory.

    python app.py
    
  2. Use the Interface: Open the provided URL in your web browser. You can upload a video to generate a new 3D point cloud (.ply) file or upload an existing .ply file to view it.

Citations

@article{slam3r, title={SLAM3R: Real-Time Dense Scene Reconstruction from Monocular RGB Videos}, author={Liu, Yuzheng and Dong, Siyan and Wang, Shuzhe and Yin, Yingda and Yang, Yanchao and Fan, Qingnan and Chen, Baoquan}, journal={arXiv preprint arXiv:2412.09401}, year={2024} }

Contributors

Ly-kc

7 commits

siyandong

6 commits

jadouse5

4 commits

Languages

Python

95.8%

Shell

2.5%

Cuda

1.0%