Complete reconstruction of surgical scenes is crucial for robot-assisted surgery (RAS). Deep depth estimation is promising but existing works struggle with depth discontinuities, resulting in noisy predictions at object boundaries and do not achieve complete reconstruction omitting occluded surfaces.
To address these issues we propose EndoLRMGS, that combines Large Reconstruction Modelling (LRM) and Gaussian Splatting (GS), for complete surgical scene reconstruction. GS reconstructs deformable tissues and LRM generates 3D models for surgical tools while position and scale are subsequently optimized by introducing orthogonal perspective joint projection optimization (OPjPO) to enhance accuracy.
- Python 3.10
- CUDA 12.1 compatible GPU (tested on NVIDIA RTX A6000)
- Docker (recommended)
- Conda or Miniconda
# Clone the repository
git clone https://github.com/your-username/EndoLRMGS.git
cd EndoLRMGS
# Create and activate Python environment
conda create -n endolrmgs python=3.10
conda activate endolrmgs
# Install PyTorch with CUDA 12.1 support
pip install torch==2.5.1 torchvision==0.20.1 --index-url https://download.pytorch.org/whl/cu121
# Install project dependencies
pip install -r requirements.txt
# Install Gaussian Splatting submodules
cd FMGaussianSplatting
pip install submodules/depth-diff-gaussian-rasterization
pip install submodules/simple-knn
cd ..
# If you encountered error, like "ModuleNotFoundError: No module named 'torch'",
# please try this : pip install submodules/depth-diff-gaussian-rasterization --no-build-isolationDownload the required surgical datasets:
Follow DEVA to generate the required annotations and binary masks for surgical instruments. Use text-prompted :
python demo/demo_with_text.py --chunk_size 4 --img_path ./stereomis/p2_6/left_finalpass --amp --temporal_setting semionline --size 480 --output ./output/stereomis/p2_6 --prompt instruments.toolsOrganize your dataset with the following structure:
endonerf/ # Root directory
βββ pulling/
β βββ Annotations/ # Surgical instruments color masks
β βββ binary_mask_deva/ # Surgical instruments binary masks
β βββ depth/ # Depth maps
β βββ images/ # Left rectified images
βββ cutting_tissues_twice/
βββ scared/
βββ stereomis/
For reproducing our work, we provide a pre-processed EndoNeRF dataset that includes:
- Surgical instrument mask annotations
- Binary segmentation masks
- Depth maps
- Our reconstruction results
Download from: EndoLRMGS_endonerf
For EndoNerf pulling dataset:
python -m openlrm.launch infer.lrm \
--infer ./configs/infer-b-endonerf-pulling.yaml \
--model_name zxhezexin/openlrm-mix-base-1.1 \
--image_input /workspace/datasets/endolrm_dataset/endonerf/pulling/images \
--export_mesh true \
--gaussian_config ./FMGaussianSplatting/arguments/endonerf/pulling.pyFor EndoNerf cutting dataset:
python -m openlrm.launch infer.lrm \
--infer ./configs/infer-b-endonerf-cutting.yaml \
--model_name zxhezexin/openlrm-mix-base-1.1 \
--image_input /workspace/datasets/endolrm_dataset/endonerf/cutting_tissues_twice/images \
--export_mesh true \
--gaussian_config ./FMGaussianSplatting/arguments/endonerf/cutting.pyFor Stereomis dataset:
python -m openlrm.launch infer.lrm \
--infer ./configs/infer-b-stereomis.yaml \
--model_name zxhezexin/openlrm-mix-base-1.1 \
--image_input /workspace/datasets/endolrm_dataset/stereomis/p2_6/left_finalpass \
--export_mesh true \
--gaussian_config ./FMGaussianSplatting/arguments/stereomis/stereomis_2_6.pyFor Scared dataset:
python -m openlrm.launch infer.lrm \
--infer ./configs/infer-b-scared.yaml \
--model_name zxhezexin/openlrm-mix-base-1.1 \
--image_input /workspace/datasets/endolrm_dataset/scared/dataset_6/data/left_finalpass \
--export_mesh true \
--gaussian_config ./FMGaussianSplatting/arguments/scared/d6k4.pyTo access LRM pretrained model "model.safetensors", please refer to https://huggingface.co/zxhezexin/openlrm-mix-small-1.1/tree/main and save the model in EndoLRMGS/checkpoint/mix-small For EndoNerf pulling dataset:
accelerate launch --config_file ./configs/accelerate-train.yaml \
-m openlrm.launch train.lrm \
--config ./configs/train-sample.yaml \
--no-freeze_gaussian \
--gaussian_config ./FMGaussianSplatting/arguments/endonerf/pulling.pyFor EndoNerf cutting dataset:
accelerate launch --config_file ./configs/accelerate-train.yaml \
-m openlrm.launch train.lrm \
--config ./configs/train-sample.yaml \
--no-freeze_gaussian \
--gaussian_config ./FMGaussianSplatting/arguments/endonerf/cutting.pyFor Stereomis dataset:
accelerate launch --config_file ./configs/accelerate-train.yaml \
-m openlrm.launch train.lrm \
--config ./configs/train-sample.yaml \
--no-freeze_gaussian \
--gaussian_config ./FMGaussianSplatting/arguments/stereomis/stereomis_2_6.pyFor Scared dataset:
accelerate launch --config_file ./configs/accelerate-train.yaml \
-m openlrm.launch train.lrm \
--config ./configs/train-sample.yaml \
--no-freeze_gaussian \
--gaussian_config ./FMGaussianSplatting/arguments/scared/d6k4.pypython postprocess_sequences_stereomis.pyTo evaluate the reconstructed tissues and surgical instruments, use the following scripts:
python ./evaluation/metrics.pypython postprocess_sequences_stereomis.py
python ./evaluation/tools_reprojection_loss.pyTo generate a spinning point cloud, please refer to another repo: https://github.com/MichaelWangGo/3D_spinning_visualization.git
If you are only interested in FMGS, please refer to another repo: https://github.com/MichaelWangGo/Frequency-Modulated-Gaussian-Splatting.git
This project builds upon the following works:

