Skip to content

Commit

Permalink
Add docker to the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
caioviturinofs committed Oct 7, 2024
1 parent 3c8009b commit 960d35c
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"workbench.colorCustomizations": {
"activityBar.background": "#22312D",
"titleBar.activeBackground": "#30443F",
"titleBar.activeForeground": "#F8FAF9"
}
}
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@ pip install ./submodules/Propagation
```

#### Docker install

To build the GaussianPro using docker, execute the following commands:
```bash
sh docker/build_gaussian_pro_docker.sh
```

To execute the container, run:
```bash
# Please remember to substitute the dataset path to your desired path
sh docker/run_gaussian_pro_docker.sh
```

#### Download the demo Waymo scene: Segment-102751
```
wget https://drive.google.com/file/d/1DXQRBcUIrnIC33WNq8pVLKZ_W1VwON3k/view?usp=sharing
Expand Down
70 changes: 70 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Use an official CUDA runtime as the base image
FROM nvidia/cuda:11.7.1-cudnn8-devel-ubuntu20.04

# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive \
CONDA_DIR=/opt/conda \
CUDA_HOME=/usr/local/cuda \
TORCH_CUDA_ARCH_LIST="7.5"

# Add Conda to PATH
ENV PATH=$CONDA_DIR/bin:$PATH

# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
wget \
build-essential \
libgl1-mesa-glx \
libglib2.0-0 \
python3-dev \
python3-pip \
&& rm -rf /var/lib/apt/lists/*

# 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 $CONDA_DIR && \
rm /tmp/miniconda.sh && \
$CONDA_DIR/bin/conda clean -afy

# Initialize Conda
RUN $CONDA_DIR/bin/conda init bash

# Clone the GaussianPro repository
RUN git clone https://github.com/kcheng1021/GaussianPro.git --recursive

# Set the working directory
WORKDIR /GaussianPro

# Copy environment.yml into the Docker image
COPY environment.yml .

# Create the Conda environment and install additional packages
# RUN /opt/conda/bin/conda env create -f environment.yml

# Activate the environment
RUN echo "source /opt/conda/etc/profile.d/conda.sh" >> /root/.bashrc && \
echo "conda activate gaussianpro" >> /root/.bashrc

# Create the Conda environment, install packages, and clean up in one RUN command
RUN /bin/bash -c "source $CONDA_DIR/etc/profile.d/conda.sh && \
conda env create -f environment.yml && \
conda activate gaussianpro && \
conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.6 -c pytorch -c conda-forge && \
pip install --upgrade pip && \
pip install ./submodules/Propagation && \
pip install ./submodules/diff-gaussian-rasterization && \
pip install ./submodules/simple-knn && \
conda clean -afy"

# Copy the entrypoint script into the Docker image
COPY entrypoint.sh /entrypoint.sh

# Make the entrypoint script executable
RUN chmod +x /entrypoint.sh

# Set the entrypoint to the script that activates the Conda environment
ENTRYPOINT ["/entrypoint.sh"]

# Set the default command to bash to keep the container running
CMD ["/bin/bash"]
1 change: 1 addition & 0 deletions docker/build_gaussian_pro_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker build --no-cache -t gaussian-pro .
18 changes: 18 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -e

echo "Initializing Conda..."
source /opt/conda/etc/profile.d/conda.sh

echo "Activating Conda environment 'gaussianpro'..."
conda activate gaussianpro

echo "Conda environment activated: $(conda info --envs | grep '*' )"

if [ "$#" -gt 0 ]; then
echo "Executing command: $@"
exec "$@"
else
echo "Starting interactive bash shell..."
exec bash
fi
16 changes: 16 additions & 0 deletions docker/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: gaussianpro
channels:
- pytorch
- conda-forge
- defaults
dependencies:
- cudatoolkit=11.7
- plyfile=0.8.1
- python=3.7.13
- pip=22.3.1
- tqdm
- ninja
- opencv-python=4.10.0.84
- matplotlib=3.5.3
- open3d=0.17.0
- imageio=2.31.2
4 changes: 4 additions & 0 deletions docker/run_gaussian_pro_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
docker run --rm --gpus all -it \
--entrypoint /bin/bash \
-v your_dataset_path:/GaussianPro/datasets \
gaussian-pro

0 comments on commit 960d35c

Please sign in to comment.