Skip to content

Commit 988cd99

Browse files
committed
Merge branch 'master' of github.com:cre185/InstantSfM
2 parents e8187c9 + 9c5a6ea commit 988cd99

33 files changed

Lines changed: 130 additions & 35 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,5 @@ debug_dir/*
186186
debug_output/*
187187
test
188188
tmp/*
189-
demo_tmp/
189+
demo_tmp/
190+
examples/*

Dockerfile

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
FROM nvcr.io/nvidia/pytorch:25.11-py3
2+
3+
ARG TARGETARCH
4+
ARG DEBIAN_FRONTEND=noninteractive
5+
6+
# Core build tooling and runtime libs needed by scikit-sparse / OpenCV / fused-ssim
7+
RUN apt-get update && apt-get install -y --no-install-recommends \
8+
build-essential cmake ninja-build git wget ca-certificates xz-utils \
9+
libgoogle-glog-dev libgflags-dev libatlas-base-dev libeigen3-dev \
10+
libsuitesparse-dev libmetis-dev liblapack-dev libblas-dev \
11+
libgl1 libglib2.0-0 colmap \
12+
&& rm -rf /var/lib/apt/lists/*
13+
14+
# Install cuDSS for CUDA 13 (arch-aware)
15+
ARG CUDSS_VERSION=0.7.1.4
16+
ENV CUDSS_ROOT=/opt/cudss-${CUDSS_VERSION}
17+
RUN set -euo pipefail; \
18+
arch="${TARGETARCH:-$(uname -m)}"; \
19+
case "${arch}" in \
20+
amd64|x86_64) cudss_arch="x86_64"; deb_arch_dir="x86_64-linux-gnu";; \
21+
arm64|aarch64) cudss_arch="aarch64"; deb_arch_dir="aarch64-linux-gnu";; \
22+
*) echo "Unsupported architecture: ${arch}"; exit 1;; \
23+
esac; \
24+
CUDSS_TARBALL="libcudss-linux-${cudss_arch}-${CUDSS_VERSION}_cuda13-archive.tar.xz"; \
25+
CUDSS_URL_BASE="https://developer.download.nvidia.com/compute/cudss/redist/libcudss/linux-${cudss_arch}"; \
26+
wget -q "${CUDSS_URL_BASE}/${CUDSS_TARBALL}" -O /tmp/cudss.tar.xz; \
27+
tar -xJf /tmp/cudss.tar.xz -C /opt; \
28+
ln -s "/opt/libcudss-linux-${cudss_arch}-${CUDSS_VERSION}_cuda13-archive" "${CUDSS_ROOT}"; \
29+
mkdir -p /usr/include/libcudss/12 "/usr/lib/${deb_arch_dir}/libcudss/12"; \
30+
cp -r "${CUDSS_ROOT}/include/"* /usr/include/libcudss/12/; \
31+
cp -r "${CUDSS_ROOT}/lib/"* "/usr/lib/${deb_arch_dir}/libcudss/12/"; \
32+
ldconfig; \
33+
rm /tmp/cudss.tar.xz
34+
35+
# cuDSS toolchain paths
36+
ENV CUDSS_LIBCUDSS_PATHS=/usr/lib/aarch64-linux-gnu/libcudss/12:/usr/lib/x86_64-linux-gnu/libcudss/12
37+
ENV LD_LIBRARY_PATH=${CUDSS_ROOT}/lib:${CUDSS_LIBCUDSS_PATHS}:${LD_LIBRARY_PATH}
38+
ENV LIBRARY_PATH=${CUDSS_ROOT}/lib:${CUDSS_LIBCUDSS_PATHS}:${LIBRARY_PATH}
39+
ENV CPATH=${CUDSS_ROOT}/include
40+
ENV CUDA_HOME=/usr/local/cuda
41+
ENV FUSED_SSIM_FORCE_CUDA=1
42+
ENV TORCH_CUDA_ARCH_LIST="8.0;9.0;8.6;8.9;11.0"
43+
44+
# Build and install Ceres Solver (needed by pyceres)
45+
ARG CERES_VERSION=2.1.0
46+
RUN wget -q http://ceres-solver.org/ceres-solver-${CERES_VERSION}.tar.gz \
47+
&& tar zxf ceres-solver-${CERES_VERSION}.tar.gz \
48+
&& mkdir ceres-build \
49+
&& cd ceres-build \
50+
&& cmake ../ceres-solver-${CERES_VERSION} -GNinja \
51+
-DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=ON \
52+
-DMINIGLOG=OFF -DSUITESPARSE=OFF -DCXSPARSE=OFF \
53+
&& ninja install \
54+
&& cd / \
55+
&& rm -rf ceres-build ceres-solver-${CERES_VERSION} ceres-solver-${CERES_VERSION}.tar.gz
56+
57+
WORKDIR /workspace/InstantSfM
58+
59+
# Install Python dependencies (including external git deps) first for better layer caching
60+
COPY pyproject.toml README.md ./
61+
COPY instantsfm instantsfm
62+
COPY demo.py demo.py
63+
RUN pip install --no-cache-dir numpy==1.26.4 \
64+
&& git clone --depth=1 https://github.com/rahul-goel/fused-ssim /tmp/fused-ssim \
65+
&& python -c "from pathlib import Path; p=Path('/tmp/fused-ssim/setup.py'); t=p.read_text(); t=t.replace('elif torch.mps.is_available():','elif False and torch.mps.is_available():'); t=t.replace('elif hasattr(torch, \\'xpu\\'):', 'elif False and hasattr(torch, \\'xpu\\'):'); p.write_text(t)" \
66+
&& pip install --no-cache-dir --no-build-isolation /tmp/fused-ssim \
67+
&& pip install --no-cache-dir --upgrade pip \
68+
&& MAX_JOBS=$(nproc) pip install --no-cache-dir --no-build-isolation git+https://github.com/zitongzhan/bae.git \
69+
&& pip install --no-cache-dir .
70+
71+
# Bring in the rest of the project (assets, configs, etc.)
72+
COPY . .
73+
74+
CMD ["/bin/bash"]

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<img src="img/USC-Logos.png" width=120px /><img src="img/University_at_Buffalo_logo.png" width=120px /><img src="img/Tsinghua_University_Logo.png" width=50px />
1+
<img src="https://github.com/cre185/InstantSfM/blob/gh-pages/static/images/USC-Logos.png?raw=true" width=120px /><img src="https://github.com/cre185/InstantSfM/blob/gh-pages/static/images/University_at_Buffalo_logo.png?raw=true" width=120px /><img src="https://github.com/cre185/InstantSfM/blob/gh-pages/static/images/Tsinghua_University_Logo.png?raw=true" width=50px />
22

33
<div align="center">
44

@@ -36,6 +36,7 @@
3636
**⚠️Please note that this repository is still under active development. We will keep updating it regularly. Feel free to open an issue if you encounter any problem.**
3737

3838
## News📰
39+
- **2025/12/02**: Added a Dockerfile and quick test command to run the bundled `examples/kitchen` dataset.
3940
- **2025/11/27**: We changed the data structure into a more SIMD-friendly format, which further speeds up the whole pipeline by around 10%.
4041

4142
## 1. Installation
@@ -102,6 +103,21 @@ To run the demo, simply try the command `python demo.py`. In the demo, you can c
102103
```
103104
In both cases, the output will be saved in the corresponding folder(`demo_output/` or your specified folder), and the results will be displayed directly in the web viewer.
104105

106+
## Docker quick test (kitchen example)
107+
If you built the provided `Dockerfile` into an image tagged `instantsfm`,
108+
you can sanity‑check the pipeline on the bundled `examples/kitchen` data with a single container run. This Dockerfile supports both arm64 and x86_64 architectures. Build the Docker image with:
109+
```bash
110+
docker build -t instantsfm .
111+
```
112+
The command below mounts the repo so results persist to your host and uses `--rm` for a clean exit:
113+
```bash
114+
docker run --rm --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 \
115+
-v "$PWD":/workspace/InstantSfM -w /workspace/InstantSfM instantsfm \
116+
bash -lc "ins-feat --data_path examples/kitchen --feature_handler colmap --manual_config_name colmap && \
117+
ins-sfm --data_path examples/kitchen --manual_config_name colmap --export_txt"
118+
```
119+
Outputs will appear under `examples/kitchen/sparse` on the host.
120+
105121
## 3. Command Line Usage
106122
The whole pipeline consists of three main steps: feature extraction and matching, global structure from motion (SfM), and 3DGS training.
107123
Before performing these steps, prepair your dataset (a collection of images) in a folder structure like mentioned in the demo section, that is, a folder containing a subfolder `images/` with all the images inside.

examples/kitchen/images/00.png

675 KB
Loading

examples/kitchen/images/01.png

709 KB
Loading

examples/kitchen/images/02.png

771 KB
Loading

examples/kitchen/images/03.png

809 KB
Loading

examples/kitchen/images/04.png

707 KB
Loading

examples/kitchen/images/05.png

742 KB
Loading

examples/kitchen/images/06.png

658 KB
Loading

0 commit comments

Comments
 (0)