diff --git a/README.md b/README.md
index 54b76e9a5..d490350b4 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,41 @@
# 3D Gaussian Splatting as Markov Chain Monte Carlo
+[](https://ubc-vision.github.io/3dgs-mcmc/)
+[](https://arxiv.org/abs/2404.09591)
+
+
+ Shakiba Kheradmand,
+
+
+ Daniel Rebain,
+
+
+ Gopal Sharma,
+
+
+ Weiwei Sun,
+
+
+ Yang-Che Tseng,
+
+
+ Hossam Isack,
+
+
+ Abhishek Kar,
+
+
+ Andrea Tagliasacchi,
+
+
+ Kwang Moo Yi
+
+
+
@@ -15,12 +51,42 @@
-## How to install
+## How to Install
-Please refer to [Original 3DGS code base](https://github.com/graphdeco-inria/gaussian-splatting) for installation instructions. Make sure to reinstall diff-gaussian-rasterization with the following command on an available 3DGS environment as this library has been modified:
-```
-pip install submodules/diff-gaussian-rasterization
-```
+This project is built on top of the [Original 3DGS code base](https://github.com/graphdeco-inria/gaussian-splatting) and has been tested only on Ubuntu 20.04. If you encounter any issues, please refer to the [Original 3DGS code base](https://github.com/graphdeco-inria/gaussian-splatting) for installation instructions.
+
+### Installation Steps
+
+1. **Clone the Repository:**
+ ```sh
+ git clone --recursive git@github.com:ubc-vision/3dgs-mcmc.git
+ cd 3dgs-mcmc
+ ```
+2. **Set Up the Conda Environment:**
+ ```sh
+ conda create -y -n 3dgs-mcmc-env python=3.8
+ conda activate 3dgs-mcmc-env
+ ```
+3. **Install Dependencies:**
+ ```sh
+ pip install plyfile tqdm torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
+ conda install cudatoolkit-dev=11.7 -c conda-forge
+ ```
+4. **Install Submodules:**
+ ```sh
+ CUDA_HOME=PATH/TO/CONDA/envs/3dgs-mcmc-env/pkgs/cuda-toolkit/ pip install submodules/diff-gaussian-rasterization submodules/simple-knn/
+ ```
+### Common Issues:
+1. **Access Error During Cloning:**
+If you encounter an access error when cloning the repository, ensure you have your SSH key set up correctly. Alternatively, you can clone using HTTPS.
+2. **Running diff-gaussian-rasterization Fails:**
+You may need to change the compiler options in the setup.py file to run both the original and this code. Update the setup.py with the following extra_compile_args:
+ ```sh
+ extra_compile_args={"nvcc": ["-Xcompiler", "-fno-gnu-unique", "-I" + os.path.join(os.path.dirname(os.path.abspath(__file__)), "third_party/glm/")]}
+ ```
+ Afterwards, you need to reinstall diff-gaussian-rasterization. This is mentioned in [3DGS-issue-#41](https://github.com/graphdeco-inria/gaussian-splatting/issues/41).
+
+By following these steps, you should be able to install the project and reproduce the results. If you encounter any issues, refer to the original 3DGS code base for further guidance.
## How to run
Running code is similar to the [Original 3DGS code base](https://github.com/graphdeco-inria/gaussian-splatting) with the following differences:
@@ -30,6 +96,11 @@ Running code is similar to the [Original 3DGS code base](https://github.com/grap
- You need to specify the noise learning rate. This is performed using --noise_lr argument. For all the experiments in the paper, we use 5e5.
- You need to specify the initialization type. This is performed using --init_type argument. Options are random (to initialize randomly) or sfm (to initialize using a pointcloud).
+## How to Reproduce the Results in the Paper
+```sh
+python train.py --source_path PATH/TO/Shape --config configs/shape.json --eval
+```
+
diff --git a/arguments/__init__.py b/arguments/__init__.py
index c235ec601..e834d365d 100644
--- a/arguments/__init__.py
+++ b/arguments/__init__.py
@@ -53,7 +53,7 @@ def __init__(self, parser, sentinel=False):
self._resolution = -1
self._white_background = False
self.data_device = "cuda"
- self.eval = True
+ self.eval = False
self.cap_max = -1
self.init_type = "random"
super().__init__(parser, "Loading Parameters", sentinel)
diff --git a/configs/bicycle.json b/configs/bicycle.json
new file mode 100644
index 000000000..403c307c9
--- /dev/null
+++ b/configs/bicycle.json
@@ -0,0 +1,4 @@
+{
+ "resolution": 4,
+ "cap_max": 5900000
+}
\ No newline at end of file
diff --git a/configs/bonsai.json b/configs/bonsai.json
new file mode 100644
index 000000000..89d56d6ed
--- /dev/null
+++ b/configs/bonsai.json
@@ -0,0 +1,4 @@
+{
+ "resolution": 2,
+ "cap_max": 1300000
+}
\ No newline at end of file
diff --git a/configs/counter.json b/configs/counter.json
new file mode 100644
index 000000000..61137292c
--- /dev/null
+++ b/configs/counter.json
@@ -0,0 +1,4 @@
+{
+ "resolution": 2,
+ "cap_max": 1200000
+}
\ No newline at end of file
diff --git a/configs/garden.json b/configs/garden.json
new file mode 100644
index 000000000..680962102
--- /dev/null
+++ b/configs/garden.json
@@ -0,0 +1,4 @@
+{
+ "resolution": 4,
+ "cap_max": 5200000
+}
\ No newline at end of file
diff --git a/configs/kitchen.json b/configs/kitchen.json
new file mode 100644
index 000000000..308f52e8a
--- /dev/null
+++ b/configs/kitchen.json
@@ -0,0 +1,4 @@
+{
+ "resolution": 2,
+ "cap_max": 1800000
+}
\ No newline at end of file
diff --git a/configs/room.json b/configs/room.json
new file mode 100644
index 000000000..2dceb4688
--- /dev/null
+++ b/configs/room.json
@@ -0,0 +1,4 @@
+{
+ "resolution": 2,
+ "cap_max": 1500000
+}
\ No newline at end of file
diff --git a/configs/stump.json b/configs/stump.json
new file mode 100644
index 000000000..bc16126c0
--- /dev/null
+++ b/configs/stump.json
@@ -0,0 +1,4 @@
+{
+ "resolution": 4,
+ "cap_max": 4750000
+}
\ No newline at end of file
diff --git a/environment.yml b/environment.yml
index d479ec715..9c5dd6058 100644
--- a/environment.yml
+++ b/environment.yml
@@ -4,13 +4,12 @@ channels:
- conda-forge
- defaults
dependencies:
- - cudatoolkit=11.6
+ - cudatoolkit=11.7
- plyfile
- - python=3.7.13
- - pip=22.3.1
- - pytorch=1.12.1
- - torchaudio=0.12.1
- - torchvision=0.13.1
+ - python=3.8
+ - pytorch=1.13.1
+ - torchaudio=0.13.1
+ - torchvision=0.14.1
- tqdm
- pip:
- submodules/diff-gaussian-rasterization
diff --git a/train.py b/train.py
index 319a72473..7a2225e88 100644
--- a/train.py
+++ b/train.py
@@ -10,6 +10,7 @@
#
import os
+import json
import torch
from random import randint
from utils.loss_utils import l1_loss, ssim
@@ -203,14 +204,18 @@ def training_report(tb_writer, iteration, Ll1, loss, l1_loss, elapsed, testing_i
tb_writer.add_scalar('total_points', scene.gaussians.get_xyz.shape[0], iteration)
torch.cuda.empty_cache()
+def load_config(config_file):
+ with open(config_file, 'r') as file:
+ config = json.load(file)
+ return config
+
if __name__ == "__main__":
# Set up command line argument parser
parser = ArgumentParser(description="Training script parameters")
lp = ModelParams(parser)
op = OptimizationParams(parser)
pp = PipelineParams(parser)
- parser.add_argument('--ip', type=str, default="127.0.0.1")
- parser.add_argument('--port', type=int, default=6009)
+ parser.add_argument('--config', type=str, default=None)
parser.add_argument('--debug_from', type=int, default=-1)
parser.add_argument('--detect_anomaly', action='store_true', default=False)
parser.add_argument("--test_iterations", nargs="+", type=int, default=[7_000, 30_000])
@@ -219,6 +224,14 @@ def training_report(tb_writer, iteration, Ll1, loss, l1_loss, elapsed, testing_i
parser.add_argument("--checkpoint_iterations", nargs="+", type=int, default=[])
parser.add_argument("--start_checkpoint", type=str, default = None)
args = parser.parse_args(sys.argv[1:])
+
+ if args.config is not None:
+ # Load the configuration file
+ config = load_config(args.config)
+ # Set the configuration parameters on args, if they are not already set by command line arguments
+ for key, value in config.items():
+ setattr(args, key, value)
+
args.save_iterations.append(args.iterations)
print("Optimizing " + args.model_path)