diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b6c1da7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,26 @@ +# Ignore the following files and directories when building the Docker image +*.pyc +__pycache__/ +*.ipynb_checkpoints +*.log +*.csv +*.tsv +*.h5 +*.pth +*.pt +*.zip +*.tar.gz +*.egg-info/ +dist/ +build/ +.env +venv/ +.env.local +*.DS_Store +*.egg +*.whl +*.pkl +*.json +*.yaml +*.yml +submodules/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index a05a2b7..c38a86d 100644 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,6 @@ dmypy.json # Pyre type checker .pyre/ learnableearthparser/fast_sampler/_sampler.c + +# data +data/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..aa2d20a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,60 @@ +FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 + +# Set the working directory +WORKDIR /EDGS + +# Install system dependencies first, including git, build-essential, and cmake +RUN apt-get update && apt-get install -y \ + git \ + wget \ + build-essential \ + cmake \ + ninja-build \ + libgl1-mesa-glx \ + libglib2.0-0 \ + && rm -rf /var/lib/apt/lists/* + +# Copy only essential files for cloning submodules first (e.g., .gitmodules) +# Or, if submodules are public, you might not need to copy anything specific for this step +# For simplicity, we'll copy everything, but this could be optimized +COPY . . + +# Initialize and update submodules +RUN git submodule init && git submodule update --recursive + +# Install Miniconda +RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && \ + bash /tmp/miniconda.sh -b -p /opt/conda && \ + rm /tmp/miniconda.sh +ENV PATH="/opt/conda/bin:${PATH}" + +# Create the conda environment and install dependencies +# Accept Anaconda TOS before using conda +RUN conda init bash && \ + conda config --set always_yes yes --set changeps1 no && \ + conda config --add channels defaults && \ + conda config --set channel_priority strict && \ + conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \ + conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r +# Now you can safely create your environment +RUN conda create -y -n edgs python=3.10 pip && \ + conda clean -afy && \ + echo "source activate edgs" > ~/.bashrc + +# Set CUDA architectures to compile for +ENV TORCH_CUDA_ARCH_LIST="7.5;8.0;8.6;8.9;9.0+PTX" + +# Activate the environment and install Python dependencies +RUN /bin/bash -c "source activate edgs && \ + pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 && \ + pip install -e ./submodules/gaussian-splatting/submodules/diff-gaussian-rasterization && \ + pip install -e ./submodules/gaussian-splatting/submodules/simple-knn && \ + pip install pycolmap wandb hydra-core tqdm torchmetrics lpips matplotlib rich plyfile imageio imageio-ffmpeg && \ + pip install -e ./submodules/RoMa && \ + pip install gradio plotly scikit-learn moviepy==2.1.1 ffmpeg open3d jupyterlab matplotlib" + +# Expose the port for Gradio +EXPOSE 7862 + +# Keep the container running in detached mode +CMD ["tail", "-f", "/dev/null"] \ No newline at end of file diff --git a/README.md b/README.md index 8c40427..8a18fd0 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Renderings become nearly indistinguishable from ground truth after only - [šŸš€ Quickstart](#sec-quickstart) - [šŸ› ļø Installation](#sec-install) - [šŸ“¦ Data](#sec-data) - +- [šŸŽ¬ Video Processing Improvements](#video-processing-improvements) - [šŸ‹ļø Training](#sec-training) - [šŸ—ļø Reusing Our Model](#sec-reuse) - [šŸ“„ Citation](#sec-citation) @@ -69,55 +69,121 @@ Alternatively, check our [Colab notebook](https://colab.research.google.com/gith ## šŸ› ļø Installation -You can either run `install.sh` or manually install using the following: +You can install it just: ```bash -git clone git@github.com:CompVis/EDGS.git --recursive -cd EDGS -git submodule update --init --recursive +docker compose up -d +``` -conda create -y -n edgs python=3.10 pip -conda activate edgs +or you can install with running `script/install.sh`. -# Set up path to your CUDA. In our experience similar versions like 12.2 also work well -export CUDA_HOME=/usr/local/cuda-12.1 -export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH -export PATH=$CUDA_HOME/bin:$PATH + +## šŸ“¦ Data -conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia -y -conda install nvidia/label/cuda-12.1.0::cuda-toolkit -y +We evaluated on the following datasets: -pip install -e submodules/gaussian-splatting/submodules/diff-gaussian-rasterization -pip install -e submodules/gaussian-splatting/submodules/simple-knn +- **MipNeRF360** — download [here](https://jonbarron.info/mipnerf360/). Unzip "Dataset Pt. 1" and "Dataset Pt. 2", then merge scenes. +- **Tanks & Temples + Deep Blending** — from the [original 3DGS repo](https://repo-sam.inria.fr/fungraph/3d-gaussian-splatting/datasets/input/tandt_db.zip). + +### Using Your Own Dataset -# For COLMAP and pycolmap -# Optionally install original colmap but probably pycolmap suffices -# conda install conda-forge/label/colmap_dev::colmap -pip install pycolmap +#### Option A +Use gradle demo. +After running `docker compose up -d`, +``` +docker compose exec edgs-app bash +python script/gradio_demo.py --port 7862 +``` +#### Option B +From command line. +``` +docker compose exec edgs-app bash +python script/fit_model_to_scene_full.py --video_path [--output_dir ] +``` -pip install wandb hydra-core tqdm torchmetrics lpips matplotlib rich plyfile imageio imageio-ffmpeg -conda install numpy=1.26.4 -y -c conda-forge --override-channels +> **šŸ”§ Enhanced Video Processing**: The video processing pipeline now includes improved frame extraction with ffmpeg support, automatic handling of problematic video formats, and optimized COLMAP settings to ensure single unified reconstructions instead of fragmented models. -pip install -e submodules/RoMa -conda install anaconda::jupyter --yes +**Additinal features:** -# Stuff necessary for gradio and visualizations -pip install gradio -pip install plotly scikit-learn moviepy==2.1.1 ffmpeg -pip install open3d +1. **Skip COLMAP reconstruction** - Use existing COLMAP results to save time: +```bash +python script/fit_model_to_scene_full.py --colmap_scene_dir ``` - -## šŸ“¦ Data +2. **Separate output directory** - Keep COLMAP input and EDGS output separate: +```bash +python script/fit_model_to_scene_full.py \ + --colmap_scene_dir \ + --output_dir +``` -We evaluated on the following datasets: +3. **Memory-efficient configurations** - For GPUs with limited memory: +```bash +# Low memory mode (recommended for 12GB GPUs) +python script/fit_model_to_scene_full.py --video_path