Skip to content

Commit 093a638

Browse files
committed
fVDB: Added 'projects' directory to include more fully-featured example 'batteries included' projects
Added panoptic segmentation project with MaskPLS implementation Fixed install issue not including `fvdb.optim` Re-introduced support for Volta&Turing but added errors for use of certain conv backends Added interpolation functions to VDBTensor Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
1 parent 11836ad commit 093a638

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2199
-63
lines changed

fvdb/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ RUN pip install --no-cache-dir -r env/build_requirements.txt
1212

1313
RUN if [ "$MODE" = "production" ]; then \
1414
MAX_JOBS=$(free -g | awk '/^Mem:/{jobs=int($4/2.5); if(jobs<1) jobs=1; print jobs}') \
15-
TORCH_CUDA_ARCH_LIST="8.0;8.6;8.9+PTX" \
15+
TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6+PTX" \
1616
python setup.py install; \
1717
fi

fvdb/README.md

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ During the project's initial stage of release, it is necessary to [run the build
2929

3030
** Notes:**
3131
* Linux is the only platform currently supported (Ubuntu >= 20.04 recommended).
32-
* A CUDA-capable GPU with Ampere architecture or newer (i.e. compute capability >=8.0) is required to run the CUDA-accelerated operations in ƒVDB.
32+
* A CUDA-capable GPU with Ampere architecture or newer (i.e. compute capability >=8.0) is recommended to run the CUDA-accelerated operations in ƒVDB. A GPU with compute capabililty >=7.0 (Volta architecture) is the minimum requirement but some operations and data types are not supported.
3333

3434

3535
## Building *f*VDB from Source
@@ -60,65 +60,50 @@ docker build --build-arg MODE=dev -t fvdb/dev .
6060
Running the docker container is done with the following command:
6161
```shell
6262
# Run an interactive bash shell (or replace with your command)
63-
docker run -it --gpus all --rm \
63+
docker run -it --ipc=host --gpus all --rm \
6464
fvdb/dev:latest \
6565
/bin/bash
6666
```
6767

6868
When running the docker container in `dev` mode and when you are ready to build ƒVDB, you can run the following command to build ƒVDB for the recommended set of CUDA architectures:
6969
```shell
7070
MAX_JOBS=$(free -g | awk '/^Mem:/{jobs=int($4/2.5); if(jobs<1) jobs=1; print jobs}') \
71-
TORCH_CUDA_ARCH_LIST="8.0;8.6;8.9+PTX" \
71+
TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6+PTX" \
7272
python setup.py install
7373
```
7474

7575
#### Setting up a Conda Environment
7676

77-
In order to get resolved package versions in your conda environment consistent with our testing, it is necessary to configure your `.condarc` since not all package resolving behaviour can be controlled with an `environment.yml` file. We recommend using `strict` channel priority in your conda configuration. This can be done by running the following command:
77+
*f*VDB can be used with any Conda distribution. Below is an installation guide using
78+
[miniforge](https://github.com/conda-forge/miniforge). You can skip steps 1-3 if you already have a Conda installation.
7879

79-
```shell
80-
conda config --set channel_priority strict
81-
```
82-
83-
Further, it is recommend to not mix the `defaults` and `conda-forge` package channels when resolving environments. We have generally used `conda-forge` as the primary channel for our dependencies. You can remove the `defaults` channel and add `conda-forge` with the following command:
80+
1. Download and Run Install Script. Copy the command below to download and run the [miniforge install script](https://github.com/conda-forge/miniforge?tab=readme-ov-file#unix-like-platforms-macos--linux):
8481

8582
```shell
86-
conda config --remove channels defaults
87-
conda config --add channels conda-forge
88-
```
89-
90-
With these changes, it is recommended that your `.condarc` file looks like the following:
91-
92-
```yaml
93-
channel_priority: strict
94-
channels:
95-
- conda-forge
83+
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
84+
bash Miniforge3-$(uname)-$(uname -m).sh
9685
```
9786

87+
2. Follow the prompts to customize Conda and run the install. Note, we recommend saying yes to enable `conda-init`.
9888

99-
**(Optional) Install libMamba for a huge quality of life improvement when using Conda**
100-
```
101-
conda update -n base conda
102-
conda install -n base conda-libmamba-solver
103-
conda config --set solver libmamba
104-
```
89+
3. Start Conda. Open a new terminal window, which should now show Conda initialized to the `(base)` environment.
10590

91+
4. Create the `fvdb` conda environment. Run the following command from the root of this repository:
10692

107-
Next, create the `fvdb` conda environment by running the following command from the root of this repository, and then grabbing a ☕:
10893
```shell
10994
conda env create -f env/dev_environment.yml
11095
```
11196

112-
**Notes:**
113-
* You can optionally use the `env/build_environment.yml` environment file if you want a minimum set of dependencies needed just to build/package *f*VDB (note this environment won't have all the runtime dependencies needed to `import fvdb`).
114-
* If you would like a runtime environment which has only the packages required to run the unit tests after building ƒVDB, you can use the `env/test_environment.yml`. This is the environment used by the CI pipeline to run the tests after building ƒVDB in the `fvdb_build` environment.
115-
* Use the `fvdb_learn` environment defined in `env/learn_environment.yml` if you would like an environment with the runtime requirements and the additional packages needed to run the [notebooks](notebooks) or [examples](examples) and view their visualizations.
97+
5. Activate the *f*VDB environment:
11698

117-
Now activate the environment:
11899
```shell
119100
conda activate fvdb
120101
```
121102

103+
#### Other available environments
104+
* `fvdb_build`: Use `env/build_environment.yml` for a minimum set of dependencies needed just to build/package *f*VDB (note this environment won't have all the runtime dependencies needed to `import fvdb`).
105+
* `fvdb_test`: Use `env/test_environment.yml` for a runtime environment which has only the packages required to run the unit tests after building ƒVDB. This is the environment used by the CI pipeline to run the tests after building ƒVDB in the `fvdb_build` environment.
106+
* `fvdb_learn`: Use `env/learn_environment.yml` for additional runtime requirements and packages needed to run the [notebooks](notebooks) or [examples](examples) and view their visualizations.
122107

123108
### Building *f*VDB
124109

@@ -254,4 +239,4 @@ Please consider citing this when using *f*VDB in a project. You can use the cita
254239
}
255240
```
256241

257-
## Contact
242+
## Contact

fvdb/ci/main.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
14
# Running a Github Action Runner, the first argument
25

36
# Starting a dockerd

fvdb/examples/3dgs/accumulate_depths.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import matplotlib.pyplot as plt
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
24
import numpy as np
35
import point_cloud_utils as pcu
46
import torch

fvdb/examples/3dgs/download_example_data.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env python
2+
# Copyright Contributors to the OpenVDB Project
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
25
"""Script to download benchmark dataset(s)"""
36

47
import os

fvdb/examples/3dgs/evaluate_colmap.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
14
import time
25
from typing import Optional, Union
36

fvdb/examples/3dgs/make_segmentation_dataset.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
14
import torch
25
import torch.utils.data
36
import tqdm

fvdb/examples/3dgs/resume_colmap.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
14
from typing import Optional, Union
25

36
import torch

fvdb/examples/3dgs/train_colmap.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
14
import itertools
25
import json
36
import logging

fvdb/examples/3dgs/train_segmentation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
15
import itertools
26
import time
37
from dataclasses import dataclass
48
from typing import Union
59

6-
import matplotlib.pyplot as plt
710
import torch
811
import tqdm
912
import tyro

fvdb/examples/3dgs/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
14
import torch
25
import torch.nn.functional as F
36

fvdb/examples/3dgs/viz.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
14
import dataclasses
25
import os
36
import sys

fvdb/fvdb/nn/modules.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,27 @@ def _dispatch_conv(self, in_feature, in_grid, in_kmap, out_grid):
268268

269269
backend = self.backend
270270

271+
sm_arch = torch.cuda.get_device_capability()[0] + torch.cuda.get_device_capability()[1] / 10
272+
# tf32 requires compute capability >= 8.0 (Ampere)
271273
if self.allow_tf32 and self.weight.is_cuda:
272274
assert (
273-
torch.cuda.get_device_capability()[0] >= 8
275+
sm_arch >= 8
274276
), "TF32 requires GPU with compute capability >= 8.0. Please set fvdb.nn.SparseConv3d.allow_tf32 = False."
275277

278+
# bf16 requires compute capability >= 8.0 (Ampere)
279+
if self.weight.is_cuda and self.weight.dtype == torch.bfloat16:
280+
assert sm_arch >= 8, "BF16 requires GPU with compute capability >= 8.0."
281+
282+
# float16 requires compute capability >= 7.5 (Turing)
283+
if self.weight.is_cuda and self.weight.dtype == torch.float16:
284+
assert sm_arch >= 7.5, "FP16 requires GPU with compute capability >= 7.5."
285+
286+
# cutlass, lggs, halo backends require compute capability >= 8.0 (Ampere)
287+
if backend in ["cutlass", "lggs", "halo"]:
288+
assert (
289+
torch.cuda.get_device_capability()[0] >= 8
290+
), "cutlass, LGGS and Halo backends require GPU with compute capability >= 8.0."
291+
276292
if backend == "cutlass" and (
277293
(not self.weight.is_cuda) or (self.in_channels, self.out_channels) not in self.CUTLASS_SUPPORTED_CHANNELS
278294
):

fvdb/fvdb/nn/vdbtensor.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
# SPDX-License-Identifier: Apache-2.0
33
#
44
from dataclasses import dataclass
5-
from typing import Any, Optional, Union
5+
from typing import Any, Optional, Tuple, Union
66

77
import torch
88

99
import fvdb
1010
from fvdb import GridBatch, JaggedTensor, SparseConvPackInfo
1111
from fvdb.types import Vec3dBatch, Vec3dBatchOrScalar, Vec3i
1212

13+
JaggedTensorOrTensor = Union[torch.Tensor, JaggedTensor]
14+
1315

1416
@dataclass
1517
class VDBTensor:
@@ -204,6 +206,22 @@ def _binop_inplace(self, other, op):
204206
op(self.data, other)
205207
return self
206208

209+
# -----------------------
210+
# Interpolation functions
211+
# -----------------------
212+
213+
def sample_bezier(self, points: JaggedTensorOrTensor) -> JaggedTensor:
214+
return self.grid.sample_bezier(points, self.data)
215+
216+
def sample_bezier_with_grad(self, points: JaggedTensorOrTensor) -> Tuple[JaggedTensor, JaggedTensor]:
217+
return self.grid.sample_bezier_with_grad(points, self.data)
218+
219+
def sample_trilinear(self, points: JaggedTensorOrTensor) -> JaggedTensor:
220+
return self.grid.sample_trilinear(points, self.data)
221+
222+
def sample_trilinear_with_grad(self, points: JaggedTensorOrTensor) -> Tuple[JaggedTensor, JaggedTensor]:
223+
return self.grid.sample_trilinear_with_grad(points, self.data)
224+
207225
def cpu(self):
208226
return VDBTensor(self.grid.to("cpu"), self.data.cpu(), self.kmap.cpu() if self.kmap is not None else None)
209227

fvdb/fvdb/types.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
15
from __future__ import annotations
2-
from typing import List, Tuple, Union, Iterable
6+
7+
from typing import Iterable, List, Tuple, Union
38

49
import numpy
510
import torch

fvdb/fvdb/utils/data/_colmap_utils/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
14
from .camera import Camera
25
from .database import COLMAPDatabase
36
from .image import Image

fvdb/fvdb/utils/data/_colmap_utils/camera.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Author: True Price <jtprice at cs.unc.edu>
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
24

35
import numpy as np
46
from scipy.optimize import root

fvdb/fvdb/utils/data/_colmap_utils/database.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import os
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
24
import sqlite3
35

46
import numpy as np

fvdb/fvdb/utils/data/_colmap_utils/image.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
# SPDX-License-Identifier: Apache-2.0
12
# Author: True Price <jtprice at cs.unc.edu>
2-
3+
#
34
import numpy as np
45

56
# -------------------------------------------------------------------------------

fvdb/fvdb/utils/data/_colmap_utils/rotation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
# SPDX-License-Identifier: Apache-2.0
12
# Author: True Price <jtprice at cs.unc.edu>
3+
#
24

35
import numpy as np
46

fvdb/fvdb/utils/data/_colmap_utils/scene_manager.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
# SPDX-License-Identifier: Apache-2.0
12
# Author: True Price <jtprice at cs.unc.edu>
3+
#
24

35
import array
46
import os

fvdb/fvdb/utils/data/_colmap_utils/tools/colmap_to_nvm.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
15
import itertools
26
import sys
37

48
sys.path.append("..")
59

6-
import numpy as np
7-
810
from .. import Quaternion, SceneManager
911

1012
# -------------------------------------------------------------------------------

fvdb/fvdb/utils/data/_colmap_utils/tools/delete_images.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
15
import sys
26

37
sys.path.append("..")
48

5-
import numpy as np
6-
79
from .. import DualQuaternion, Image, SceneManager
810

911
# -------------------------------------------------------------------------------

fvdb/fvdb/utils/data/_colmap_utils/tools/impute_missing_cameras.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
15
import sys
26

37
sys.path.append("..")
48

5-
import numpy as np
6-
79
from .. import DualQuaternion, Image, SceneManager
810

911
# -------------------------------------------------------------------------------

fvdb/fvdb/utils/data/_colmap_utils/tools/save_cameras_as_ply.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
15
import sys
26

37
sys.path.append("..")
48

5-
import os
6-
79
import numpy as np
810

911
from .. import SceneManager

fvdb/fvdb/utils/data/_colmap_utils/tools/transform_model.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
15
import sys
26

37
sys.path.append("..")

fvdb/fvdb/utils/data/_colmap_utils/tools/write_camera_track_to_bundler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
15
import sys
26

37
sys.path.append("..")
48

5-
import numpy as np
6-
79
from .. import SceneManager
810

911
# -------------------------------------------------------------------------------

fvdb/fvdb/utils/data/_colmap_utils/tools/write_depthmap_to_ply.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright Contributors to the OpenVDB Project
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
14
import sys
25

36
sys.path.append("..")

0 commit comments

Comments
 (0)