mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2026-03-01 01:35:58 +08:00
Compare commits
1 Commits
V0.7.8
...
bottler-pa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9a23bb832 |
@@ -64,7 +64,7 @@ jobs:
|
|||||||
CUDA_VERSION: "11.3"
|
CUDA_VERSION: "11.3"
|
||||||
resource_class: gpu.nvidia.small.multi
|
resource_class: gpu.nvidia.small.multi
|
||||||
machine:
|
machine:
|
||||||
image: linux-cuda-11:default
|
image: ubuntu-2004:202101-01
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- <<: *setupcuda
|
- <<: *setupcuda
|
||||||
@@ -116,7 +116,7 @@ jobs:
|
|||||||
# so we aren't running the tests.
|
# so we aren't running the tests.
|
||||||
- run:
|
- run:
|
||||||
name: build
|
name: build
|
||||||
no_output_timeout: 40m
|
no_output_timeout: 20m
|
||||||
command: MAX_JOBS=15 TEST_FLAG=--no-test python3 packaging/build_conda.py
|
command: MAX_JOBS=15 TEST_FLAG=--no-test python3 packaging/build_conda.py
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: /opt/conda/conda-bld/linux-64
|
path: /opt/conda/conda-bld/linux-64
|
||||||
@@ -128,7 +128,7 @@ jobs:
|
|||||||
binary_linux_conda_cuda:
|
binary_linux_conda_cuda:
|
||||||
<<: *binary_common
|
<<: *binary_common
|
||||||
machine:
|
machine:
|
||||||
image: linux-cuda-11:default
|
image: ubuntu-1604-cuda-10.2:202012-01
|
||||||
resource_class: gpu.nvidia.small.multi
|
resource_class: gpu.nvidia.small.multi
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
@@ -145,7 +145,7 @@ jobs:
|
|||||||
docker pull $TESTRUN_DOCKER_IMAGE
|
docker pull $TESTRUN_DOCKER_IMAGE
|
||||||
- run:
|
- run:
|
||||||
name: Build and run tests
|
name: Build and run tests
|
||||||
no_output_timeout: 40m
|
no_output_timeout: 20m
|
||||||
command: |
|
command: |
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -156,6 +156,24 @@ jobs:
|
|||||||
|
|
||||||
docker run --gpus all --ipc=host -v $(pwd):/remote -w /remote ${VARS_TO_PASS} ${TESTRUN_DOCKER_IMAGE} python3 ./packaging/build_conda.py
|
docker run --gpus all --ipc=host -v $(pwd):/remote -w /remote ${VARS_TO_PASS} ${TESTRUN_DOCKER_IMAGE} python3 ./packaging/build_conda.py
|
||||||
|
|
||||||
|
binary_macos_wheel:
|
||||||
|
<<: *binary_common
|
||||||
|
macos:
|
||||||
|
xcode: "13.4.1"
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
# Cannot easily deduplicate this as source'ing activate
|
||||||
|
# will set environment variables which we need to propagate
|
||||||
|
# to build_wheel.sh
|
||||||
|
command: |
|
||||||
|
curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
|
||||||
|
sh conda.sh -b
|
||||||
|
source $HOME/miniconda3/bin/activate
|
||||||
|
packaging/build_wheel.sh
|
||||||
|
- store_artifacts:
|
||||||
|
path: dist
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build_and_test:
|
build_and_test:
|
||||||
@@ -164,8 +182,23 @@ workflows:
|
|||||||
# context: DOCKERHUB_TOKEN
|
# context: DOCKERHUB_TOKEN
|
||||||
{{workflows()}}
|
{{workflows()}}
|
||||||
- binary_linux_conda_cuda:
|
- binary_linux_conda_cuda:
|
||||||
name: testrun_conda_cuda_py310_cu117_pyt201
|
name: testrun_conda_cuda_py38_cu102_pyt190
|
||||||
context: DOCKERHUB_TOKEN
|
context: DOCKERHUB_TOKEN
|
||||||
python_version: "3.10"
|
python_version: "3.8"
|
||||||
pytorch_version: '2.0.1'
|
pytorch_version: '1.9.0'
|
||||||
cu_version: "cu117"
|
cu_version: "cu102"
|
||||||
|
- binary_macos_wheel:
|
||||||
|
cu_version: cpu
|
||||||
|
name: macos_wheel_py3.8_cpu
|
||||||
|
python_version: '3.8'
|
||||||
|
pytorch_version: '1.13.0'
|
||||||
|
- binary_macos_wheel:
|
||||||
|
cu_version: cpu
|
||||||
|
name: macos_wheel_py3.9_cpu
|
||||||
|
python_version: '3.9'
|
||||||
|
pytorch_version: '1.13.0'
|
||||||
|
- binary_macos_wheel:
|
||||||
|
cu_version: cpu
|
||||||
|
name: macos_wheel_py3.10_cpu
|
||||||
|
python_version: '3.10'
|
||||||
|
pytorch_version: '1.13.0'
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ jobs:
|
|||||||
CUDA_VERSION: "11.3"
|
CUDA_VERSION: "11.3"
|
||||||
resource_class: gpu.nvidia.small.multi
|
resource_class: gpu.nvidia.small.multi
|
||||||
machine:
|
machine:
|
||||||
image: linux-cuda-11:default
|
image: ubuntu-2004:202101-01
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- <<: *setupcuda
|
- <<: *setupcuda
|
||||||
@@ -116,7 +116,7 @@ jobs:
|
|||||||
# so we aren't running the tests.
|
# so we aren't running the tests.
|
||||||
- run:
|
- run:
|
||||||
name: build
|
name: build
|
||||||
no_output_timeout: 40m
|
no_output_timeout: 20m
|
||||||
command: MAX_JOBS=15 TEST_FLAG=--no-test python3 packaging/build_conda.py
|
command: MAX_JOBS=15 TEST_FLAG=--no-test python3 packaging/build_conda.py
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: /opt/conda/conda-bld/linux-64
|
path: /opt/conda/conda-bld/linux-64
|
||||||
@@ -128,7 +128,7 @@ jobs:
|
|||||||
binary_linux_conda_cuda:
|
binary_linux_conda_cuda:
|
||||||
<<: *binary_common
|
<<: *binary_common
|
||||||
machine:
|
machine:
|
||||||
image: linux-cuda-11:default
|
image: ubuntu-1604-cuda-10.2:202012-01
|
||||||
resource_class: gpu.nvidia.small.multi
|
resource_class: gpu.nvidia.small.multi
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
@@ -145,7 +145,7 @@ jobs:
|
|||||||
docker pull $TESTRUN_DOCKER_IMAGE
|
docker pull $TESTRUN_DOCKER_IMAGE
|
||||||
- run:
|
- run:
|
||||||
name: Build and run tests
|
name: Build and run tests
|
||||||
no_output_timeout: 40m
|
no_output_timeout: 20m
|
||||||
command: |
|
command: |
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -156,533 +156,67 @@ jobs:
|
|||||||
|
|
||||||
docker run --gpus all --ipc=host -v $(pwd):/remote -w /remote ${VARS_TO_PASS} ${TESTRUN_DOCKER_IMAGE} python3 ./packaging/build_conda.py
|
docker run --gpus all --ipc=host -v $(pwd):/remote -w /remote ${VARS_TO_PASS} ${TESTRUN_DOCKER_IMAGE} python3 ./packaging/build_conda.py
|
||||||
|
|
||||||
|
binary_macos_wheel:
|
||||||
|
<<: *binary_common
|
||||||
|
macos:
|
||||||
|
xcode: "13.4.1"
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
# Cannot easily deduplicate this as source'ing activate
|
||||||
|
# will set environment variables which we need to propagate
|
||||||
|
# to build_wheel.sh
|
||||||
|
command: |
|
||||||
|
curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
|
||||||
|
sh conda.sh -b
|
||||||
|
source $HOME/miniconda3/bin/activate
|
||||||
|
packaging/build_wheel.sh
|
||||||
|
- store_artifacts:
|
||||||
|
path: dist
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build_and_test:
|
build_and_test:
|
||||||
jobs:
|
jobs:
|
||||||
# - main:
|
|
||||||
# context: DOCKERHUB_TOKEN
|
|
||||||
- binary_linux_conda:
|
- binary_linux_conda:
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
conda_docker_image: pytorch/conda-builder:cuda116
|
||||||
context: DOCKERHUB_TOKEN
|
context: DOCKERHUB_TOKEN
|
||||||
cu_version: cu118
|
cu_version: cu116
|
||||||
name: linux_conda_py38_cu118_pyt210
|
name: linux_conda_py38_cu116_pyt1131
|
||||||
python_version: '3.8'
|
python_version: '3.8'
|
||||||
pytorch_version: 2.1.0
|
pytorch_version: 1.13.1
|
||||||
- binary_linux_conda:
|
- binary_linux_conda:
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
conda_docker_image: pytorch/conda-builder:cuda117
|
||||||
context: DOCKERHUB_TOKEN
|
context: DOCKERHUB_TOKEN
|
||||||
cu_version: cu121
|
cu_version: cu117
|
||||||
name: linux_conda_py38_cu121_pyt210
|
name: linux_conda_py38_cu117_pyt1131
|
||||||
python_version: '3.8'
|
python_version: '3.8'
|
||||||
pytorch_version: 2.1.0
|
pytorch_version: 1.13.1
|
||||||
- binary_linux_conda:
|
- binary_linux_conda:
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
conda_docker_image: pytorch/conda-builder:cuda116
|
||||||
context: DOCKERHUB_TOKEN
|
context: DOCKERHUB_TOKEN
|
||||||
cu_version: cu118
|
cu_version: cu116
|
||||||
name: linux_conda_py38_cu118_pyt211
|
name: linux_conda_py39_cu116_pyt1131
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.1.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py38_cu121_pyt211
|
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.1.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py38_cu118_pyt212
|
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.1.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py38_cu121_pyt212
|
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.1.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py38_cu118_pyt220
|
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.2.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py38_cu121_pyt220
|
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.2.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py38_cu118_pyt222
|
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.2.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py38_cu121_pyt222
|
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.2.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py38_cu118_pyt231
|
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.3.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py38_cu121_pyt231
|
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.3.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py38_cu118_pyt240
|
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.4.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py38_cu121_pyt240
|
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.4.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py38_cu118_pyt241
|
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.4.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py38_cu121_pyt241
|
|
||||||
python_version: '3.8'
|
|
||||||
pytorch_version: 2.4.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py39_cu118_pyt210
|
|
||||||
python_version: '3.9'
|
python_version: '3.9'
|
||||||
pytorch_version: 2.1.0
|
pytorch_version: 1.13.1
|
||||||
- binary_linux_conda:
|
- binary_linux_conda:
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
conda_docker_image: pytorch/conda-builder:cuda117
|
||||||
context: DOCKERHUB_TOKEN
|
context: DOCKERHUB_TOKEN
|
||||||
cu_version: cu121
|
cu_version: cu117
|
||||||
name: linux_conda_py39_cu121_pyt210
|
name: linux_conda_py39_cu117_pyt1131
|
||||||
python_version: '3.9'
|
python_version: '3.9'
|
||||||
pytorch_version: 2.1.0
|
pytorch_version: 1.13.1
|
||||||
- binary_linux_conda:
|
- binary_linux_conda:
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
conda_docker_image: pytorch/conda-builder:cuda116
|
||||||
context: DOCKERHUB_TOKEN
|
context: DOCKERHUB_TOKEN
|
||||||
cu_version: cu118
|
cu_version: cu116
|
||||||
name: linux_conda_py39_cu118_pyt211
|
name: linux_conda_py310_cu116_pyt1131
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.1.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py39_cu121_pyt211
|
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.1.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py39_cu118_pyt212
|
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.1.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py39_cu121_pyt212
|
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.1.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py39_cu118_pyt220
|
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.2.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py39_cu121_pyt220
|
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.2.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py39_cu118_pyt222
|
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.2.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py39_cu121_pyt222
|
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.2.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py39_cu118_pyt231
|
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.3.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py39_cu121_pyt231
|
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.3.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py39_cu118_pyt240
|
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.4.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py39_cu121_pyt240
|
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.4.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py39_cu118_pyt241
|
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.4.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py39_cu121_pyt241
|
|
||||||
python_version: '3.9'
|
|
||||||
pytorch_version: 2.4.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py310_cu118_pyt210
|
|
||||||
python_version: '3.10'
|
python_version: '3.10'
|
||||||
pytorch_version: 2.1.0
|
pytorch_version: 1.13.1
|
||||||
- binary_linux_conda:
|
- binary_linux_conda:
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
conda_docker_image: pytorch/conda-builder:cuda117
|
||||||
context: DOCKERHUB_TOKEN
|
context: DOCKERHUB_TOKEN
|
||||||
cu_version: cu121
|
cu_version: cu117
|
||||||
name: linux_conda_py310_cu121_pyt210
|
name: linux_conda_py310_cu117_pyt1131
|
||||||
python_version: '3.10'
|
python_version: '3.10'
|
||||||
pytorch_version: 2.1.0
|
pytorch_version: 1.13.1
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py310_cu118_pyt211
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.1.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py310_cu121_pyt211
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.1.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py310_cu118_pyt212
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.1.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py310_cu121_pyt212
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.1.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py310_cu118_pyt220
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.2.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py310_cu121_pyt220
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.2.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py310_cu118_pyt222
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.2.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py310_cu121_pyt222
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.2.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py310_cu118_pyt231
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.3.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py310_cu121_pyt231
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.3.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py310_cu118_pyt240
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.4.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py310_cu121_pyt240
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.4.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py310_cu118_pyt241
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.4.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py310_cu121_pyt241
|
|
||||||
python_version: '3.10'
|
|
||||||
pytorch_version: 2.4.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py311_cu118_pyt210
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.1.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py311_cu121_pyt210
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.1.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py311_cu118_pyt211
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.1.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py311_cu121_pyt211
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.1.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py311_cu118_pyt212
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.1.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py311_cu121_pyt212
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.1.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py311_cu118_pyt220
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.2.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py311_cu121_pyt220
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.2.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py311_cu118_pyt222
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.2.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py311_cu121_pyt222
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.2.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py311_cu118_pyt231
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.3.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py311_cu121_pyt231
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.3.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py311_cu118_pyt240
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.4.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py311_cu121_pyt240
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.4.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py311_cu118_pyt241
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.4.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py311_cu121_pyt241
|
|
||||||
python_version: '3.11'
|
|
||||||
pytorch_version: 2.4.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py312_cu118_pyt220
|
|
||||||
python_version: '3.12'
|
|
||||||
pytorch_version: 2.2.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py312_cu121_pyt220
|
|
||||||
python_version: '3.12'
|
|
||||||
pytorch_version: 2.2.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py312_cu118_pyt222
|
|
||||||
python_version: '3.12'
|
|
||||||
pytorch_version: 2.2.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py312_cu121_pyt222
|
|
||||||
python_version: '3.12'
|
|
||||||
pytorch_version: 2.2.2
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py312_cu118_pyt231
|
|
||||||
python_version: '3.12'
|
|
||||||
pytorch_version: 2.3.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py312_cu121_pyt231
|
|
||||||
python_version: '3.12'
|
|
||||||
pytorch_version: 2.3.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py312_cu118_pyt240
|
|
||||||
python_version: '3.12'
|
|
||||||
pytorch_version: 2.4.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py312_cu121_pyt240
|
|
||||||
python_version: '3.12'
|
|
||||||
pytorch_version: 2.4.0
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda118
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu118
|
|
||||||
name: linux_conda_py312_cu118_pyt241
|
|
||||||
python_version: '3.12'
|
|
||||||
pytorch_version: 2.4.1
|
|
||||||
- binary_linux_conda:
|
|
||||||
conda_docker_image: pytorch/conda-builder:cuda121
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
cu_version: cu121
|
|
||||||
name: linux_conda_py312_cu121_pyt241
|
|
||||||
python_version: '3.12'
|
|
||||||
pytorch_version: 2.4.1
|
|
||||||
- binary_linux_conda_cuda:
|
|
||||||
name: testrun_conda_cuda_py310_cu117_pyt201
|
|
||||||
context: DOCKERHUB_TOKEN
|
|
||||||
python_version: "3.10"
|
|
||||||
pytorch_version: '2.0.1'
|
|
||||||
cu_version: "cu117"
|
|
||||||
|
|||||||
@@ -18,51 +18,55 @@ from packaging import version
|
|||||||
|
|
||||||
# The CUDA versions which have pytorch conda packages available for linux for each
|
# The CUDA versions which have pytorch conda packages available for linux for each
|
||||||
# version of pytorch.
|
# version of pytorch.
|
||||||
|
# Pytorch 1.4 also supports cuda 10.0 but we no longer build for cuda 10.0 at all.
|
||||||
CONDA_CUDA_VERSIONS = {
|
CONDA_CUDA_VERSIONS = {
|
||||||
"2.1.0": ["cu118", "cu121"],
|
"1.9.0": ["cu102", "cu111"],
|
||||||
"2.1.1": ["cu118", "cu121"],
|
"1.9.1": ["cu102", "cu111"],
|
||||||
"2.1.2": ["cu118", "cu121"],
|
"1.10.0": ["cu102", "cu111", "cu113"],
|
||||||
"2.2.0": ["cu118", "cu121"],
|
"1.10.1": ["cu102", "cu111", "cu113"],
|
||||||
"2.2.2": ["cu118", "cu121"],
|
"1.10.2": ["cu102", "cu111", "cu113"],
|
||||||
"2.3.1": ["cu118", "cu121"],
|
"1.11.0": ["cu102", "cu111", "cu113", "cu115"],
|
||||||
"2.4.0": ["cu118", "cu121"],
|
"1.12.0": ["cu102", "cu113", "cu116"],
|
||||||
"2.4.1": ["cu118", "cu121"],
|
"1.12.1": ["cu102", "cu113", "cu116"],
|
||||||
|
"1.13.0": ["cu116", "cu117"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def conda_docker_image_for_cuda(cuda_version):
|
def conda_docker_image_for_cuda(cuda_version):
|
||||||
if len(cuda_version) != 5:
|
if cuda_version in ("cu101", "cu102", "cu111"):
|
||||||
raise ValueError("Unknown cuda version")
|
return None
|
||||||
return "pytorch/conda-builder:cuda" + cuda_version[2:]
|
if cuda_version == "cu113":
|
||||||
|
return "pytorch/conda-builder:cuda113"
|
||||||
|
if cuda_version == "cu115":
|
||||||
|
return "pytorch/conda-builder:cuda115"
|
||||||
|
if cuda_version == "cu116":
|
||||||
|
return "pytorch/conda-builder:cuda116"
|
||||||
|
if cuda_version == "cu117":
|
||||||
|
return "pytorch/conda-builder:cuda117"
|
||||||
|
raise ValueError("Unknown cuda version")
|
||||||
|
|
||||||
|
|
||||||
def pytorch_versions_for_python(python_version):
|
def pytorch_versions_for_python(python_version):
|
||||||
if python_version in ["3.8", "3.9"]:
|
if python_version in ["3.7", "3.8"]:
|
||||||
return list(CONDA_CUDA_VERSIONS)
|
return list(CONDA_CUDA_VERSIONS)
|
||||||
|
if python_version == "3.9":
|
||||||
|
return [
|
||||||
|
i
|
||||||
|
for i in CONDA_CUDA_VERSIONS
|
||||||
|
if version.Version(i) > version.Version("1.7.0")
|
||||||
|
]
|
||||||
if python_version == "3.10":
|
if python_version == "3.10":
|
||||||
return [
|
return [
|
||||||
i
|
i
|
||||||
for i in CONDA_CUDA_VERSIONS
|
for i in CONDA_CUDA_VERSIONS
|
||||||
if version.Version(i) >= version.Version("1.11.0")
|
if version.Version(i) >= version.Version("1.11.0")
|
||||||
]
|
]
|
||||||
if python_version == "3.11":
|
|
||||||
return [
|
|
||||||
i
|
|
||||||
for i in CONDA_CUDA_VERSIONS
|
|
||||||
if version.Version(i) >= version.Version("2.1.0")
|
|
||||||
]
|
|
||||||
if python_version == "3.12":
|
|
||||||
return [
|
|
||||||
i
|
|
||||||
for i in CONDA_CUDA_VERSIONS
|
|
||||||
if version.Version(i) >= version.Version("2.2.0")
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def workflows(prefix="", filter_branch=None, upload=False, indentation=6):
|
def workflows(prefix="", filter_branch=None, upload=False, indentation=6):
|
||||||
w = []
|
w = []
|
||||||
for btype in ["conda"]:
|
for btype in ["conda"]:
|
||||||
for python_version in ["3.8", "3.9", "3.10", "3.11", "3.12"]:
|
for python_version in ["3.8", "3.9", "3.10"]:
|
||||||
for pytorch_version in pytorch_versions_for_python(python_version):
|
for pytorch_version in pytorch_versions_for_python(python_version):
|
||||||
for cu_version in CONDA_CUDA_VERSIONS[pytorch_version]:
|
for cu_version in CONDA_CUDA_VERSIONS[pytorch_version]:
|
||||||
w += workflow_pair(
|
w += workflow_pair(
|
||||||
|
|||||||
5
.flake8
5
.flake8
@@ -1,8 +1,5 @@
|
|||||||
[flake8]
|
[flake8]
|
||||||
# B028 No explicit stacklevel argument found.
|
ignore = E203, E266, E501, W503, E221
|
||||||
# B907 'foo' is manually surrounded by quotes, consider using the `!r` conversion flag.
|
|
||||||
# B905 `zip()` without an explicit `strict=` parameter.
|
|
||||||
ignore = E203, E266, E501, W503, E221, B028, B905, B907
|
|
||||||
max-line-length = 88
|
max-line-length = 88
|
||||||
max-complexity = 18
|
max-complexity = 18
|
||||||
select = B,C,E,F,W,T4,B9
|
select = B,C,E,F,W,T4,B9
|
||||||
|
|||||||
21
INSTALL.md
21
INSTALL.md
@@ -8,20 +8,21 @@
|
|||||||
The core library is written in PyTorch. Several components have underlying implementation in CUDA for improved performance. A subset of these components have CPU implementations in C++/PyTorch. It is advised to use PyTorch3D with GPU support in order to use all the features.
|
The core library is written in PyTorch. Several components have underlying implementation in CUDA for improved performance. A subset of these components have CPU implementations in C++/PyTorch. It is advised to use PyTorch3D with GPU support in order to use all the features.
|
||||||
|
|
||||||
- Linux or macOS or Windows
|
- Linux or macOS or Windows
|
||||||
- Python
|
- Python 3.8, 3.9 or 3.10
|
||||||
- PyTorch 2.1.0, 2.1.1, 2.1.2, 2.2.0, 2.2.1, 2.2.2, 2.3.0, 2.3.1, 2.4.0 or 2.4.1.
|
- PyTorch 1.9.0, 1.9.1, 1.10.0, 1.10.1, 1.10.2, 1.11.0, 1.12.0, 1.12.1 or 1.13.0.
|
||||||
- torchvision that matches the PyTorch installation. You can install them together as explained at pytorch.org to make sure of this.
|
- torchvision that matches the PyTorch installation. You can install them together as explained at pytorch.org to make sure of this.
|
||||||
- gcc & g++ ≥ 4.9
|
- gcc & g++ ≥ 4.9
|
||||||
|
- [fvcore](https://github.com/facebookresearch/fvcore)
|
||||||
- [ioPath](https://github.com/facebookresearch/iopath)
|
- [ioPath](https://github.com/facebookresearch/iopath)
|
||||||
- If CUDA is to be used, use a version which is supported by the corresponding pytorch version and at least version 9.2.
|
- If CUDA is to be used, use a version which is supported by the corresponding pytorch version and at least version 9.2.
|
||||||
- If CUDA older than 11.7 is to be used and you are building from source, the CUB library must be available. We recommend version 1.10.0.
|
- If CUDA is to be used and you are building from source, the CUB library must be available. We recommend version 1.10.0.
|
||||||
|
|
||||||
The runtime dependencies can be installed by running:
|
The runtime dependencies can be installed by running:
|
||||||
```
|
```
|
||||||
conda create -n pytorch3d python=3.9
|
conda create -n pytorch3d python=3.9
|
||||||
conda activate pytorch3d
|
conda activate pytorch3d
|
||||||
conda install pytorch=1.13.0 torchvision pytorch-cuda=11.6 -c pytorch -c nvidia
|
conda install -c pytorch pytorch=1.9.1 torchvision cudatoolkit=11.6
|
||||||
conda install -c iopath iopath
|
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
|
||||||
```
|
```
|
||||||
|
|
||||||
For the CUB build time dependency, which you only need if you have CUDA older than 11.7, if you are using conda, you can continue with
|
For the CUB build time dependency, which you only need if you have CUDA older than 11.7, if you are using conda, you can continue with
|
||||||
@@ -48,7 +49,6 @@ For developing on top of PyTorch3D or contributing, you will need to run the lin
|
|||||||
- tdqm
|
- tdqm
|
||||||
- jupyter
|
- jupyter
|
||||||
- imageio
|
- imageio
|
||||||
- fvcore
|
|
||||||
- plotly
|
- plotly
|
||||||
- opencv-python
|
- opencv-python
|
||||||
|
|
||||||
@@ -59,7 +59,6 @@ conda install jupyter
|
|||||||
pip install scikit-image matplotlib imageio plotly opencv-python
|
pip install scikit-image matplotlib imageio plotly opencv-python
|
||||||
|
|
||||||
# Tests/Linting
|
# Tests/Linting
|
||||||
conda install -c fvcore -c conda-forge fvcore
|
|
||||||
pip install black usort flake8 flake8-bugbear flake8-comprehensions
|
pip install black usort flake8 flake8-bugbear flake8-comprehensions
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -78,8 +77,13 @@ Or, to install a nightly (non-official, alpha) build:
|
|||||||
# Anaconda Cloud
|
# Anaconda Cloud
|
||||||
conda install pytorch3d -c pytorch3d-nightly
|
conda install pytorch3d -c pytorch3d-nightly
|
||||||
```
|
```
|
||||||
|
### 2. Install from PyPI, on Mac only.
|
||||||
|
This works with pytorch 1.13.0 only. The build is CPU only.
|
||||||
|
```
|
||||||
|
pip install pytorch3d
|
||||||
|
```
|
||||||
|
|
||||||
### 2. Install wheels for Linux
|
### 3. Install wheels for Linux
|
||||||
We have prebuilt wheels with CUDA for Linux for PyTorch 1.11.0, for each of the supported CUDA versions,
|
We have prebuilt wheels with CUDA for Linux for PyTorch 1.11.0, for each of the supported CUDA versions,
|
||||||
for Python 3.8 and 3.9. This is for ease of use on Google Colab.
|
for Python 3.8 and 3.9. This is for ease of use on Google Colab.
|
||||||
These are installed in a special way.
|
These are installed in a special way.
|
||||||
@@ -98,7 +102,6 @@ version_str="".join([
|
|||||||
torch.version.cuda.replace(".",""),
|
torch.version.cuda.replace(".",""),
|
||||||
f"_pyt{pyt_version_str}"
|
f"_pyt{pyt_version_str}"
|
||||||
])
|
])
|
||||||
!pip install iopath
|
|
||||||
!pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html
|
!pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -12,7 +12,7 @@ Key features include:
|
|||||||
- Data structure for storing and manipulating triangle meshes
|
- Data structure for storing and manipulating triangle meshes
|
||||||
- Efficient operations on triangle meshes (projective transformations, graph convolution, sampling, loss functions)
|
- Efficient operations on triangle meshes (projective transformations, graph convolution, sampling, loss functions)
|
||||||
- A differentiable mesh renderer
|
- A differentiable mesh renderer
|
||||||
- Implicitron, see [its README](projects/implicitron_trainer), a framework for new-view synthesis via implicit representations. ([blog post](https://ai.facebook.com/blog/implicitron-a-new-modular-extensible-framework-for-neural-implicit-representations-in-pytorch3d/))
|
- Implicitron, see [its README](projects/implicitron_trainer), a framework for new-view synthesis via implicit representations.
|
||||||
|
|
||||||
PyTorch3D is designed to integrate smoothly with deep learning methods for predicting and manipulating 3D data.
|
PyTorch3D is designed to integrate smoothly with deep learning methods for predicting and manipulating 3D data.
|
||||||
For this reason, all operators in PyTorch3D:
|
For this reason, all operators in PyTorch3D:
|
||||||
@@ -24,8 +24,6 @@ For this reason, all operators in PyTorch3D:
|
|||||||
|
|
||||||
Within FAIR, PyTorch3D has been used to power research projects such as [Mesh R-CNN](https://arxiv.org/abs/1906.02739).
|
Within FAIR, PyTorch3D has been used to power research projects such as [Mesh R-CNN](https://arxiv.org/abs/1906.02739).
|
||||||
|
|
||||||
See our [blog post](https://ai.facebook.com/blog/-introducing-pytorch3d-an-open-source-library-for-3d-deep-learning/) to see more demos and learn about PyTorch3D.
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
For detailed instructions refer to [INSTALL.md](INSTALL.md).
|
For detailed instructions refer to [INSTALL.md](INSTALL.md).
|
||||||
@@ -146,14 +144,6 @@ If you are using the pulsar backend for sphere-rendering (the `PulsarPointRender
|
|||||||
|
|
||||||
Please see below for a timeline of the codebase updates in reverse chronological order. We are sharing updates on the releases as well as research projects which are built with PyTorch3D. The changelogs for the releases are available under [`Releases`](https://github.com/facebookresearch/pytorch3d/releases), and the builds can be installed using `conda` as per the instructions in [INSTALL.md](INSTALL.md).
|
Please see below for a timeline of the codebase updates in reverse chronological order. We are sharing updates on the releases as well as research projects which are built with PyTorch3D. The changelogs for the releases are available under [`Releases`](https://github.com/facebookresearch/pytorch3d/releases), and the builds can be installed using `conda` as per the instructions in [INSTALL.md](INSTALL.md).
|
||||||
|
|
||||||
**[Oct 31st 2023]:** PyTorch3D [v0.7.5](https://github.com/facebookresearch/pytorch3d/releases/tag/v0.7.5) released.
|
|
||||||
|
|
||||||
**[May 10th 2023]:** PyTorch3D [v0.7.4](https://github.com/facebookresearch/pytorch3d/releases/tag/v0.7.4) released.
|
|
||||||
|
|
||||||
**[Apr 5th 2023]:** PyTorch3D [v0.7.3](https://github.com/facebookresearch/pytorch3d/releases/tag/v0.7.3) released.
|
|
||||||
|
|
||||||
**[Dec 19th 2022]:** PyTorch3D [v0.7.2](https://github.com/facebookresearch/pytorch3d/releases/tag/v0.7.2) released.
|
|
||||||
|
|
||||||
**[Oct 23rd 2022]:** PyTorch3D [v0.7.1](https://github.com/facebookresearch/pytorch3d/releases/tag/v0.7.1) released.
|
**[Oct 23rd 2022]:** PyTorch3D [v0.7.1](https://github.com/facebookresearch/pytorch3d/releases/tag/v0.7.1) released.
|
||||||
|
|
||||||
**[Aug 10th 2022]:** PyTorch3D [v0.7.0](https://github.com/facebookresearch/pytorch3d/releases/tag/v0.7.0) released with Implicitron and MeshRasterizerOpenGL.
|
**[Aug 10th 2022]:** PyTorch3D [v0.7.0](https://github.com/facebookresearch/pytorch3d/releases/tag/v0.7.0) released with Implicitron and MeshRasterizerOpenGL.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ conda init bash
|
|||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
conda create -y -n myenv python=3.8 matplotlib ipython ipywidgets nbconvert
|
conda create -y -n myenv python=3.8 matplotlib ipython ipywidgets nbconvert
|
||||||
conda activate myenv
|
conda activate myenv
|
||||||
conda install -y -c iopath iopath
|
conda install -y -c fvcore -c iopath -c conda-forge fvcore iopath
|
||||||
conda install -y -c pytorch pytorch=1.6.0 cudatoolkit=10.1 torchvision
|
conda install -y -c pytorch pytorch=1.6.0 cudatoolkit=10.1 torchvision
|
||||||
conda install -y -c pytorch3d-nightly pytorch3d
|
conda install -y -c pytorch3d-nightly pytorch3d
|
||||||
pip install plotly scikit-image
|
pip install plotly scikit-image
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the BSD-style license found in the
|
|
||||||
# LICENSE file in the root directory of this source tree.
|
|
||||||
|
|
||||||
# Read the Docs configuration file
|
|
||||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
|
||||||
|
|
||||||
# Required
|
|
||||||
version: 2
|
|
||||||
|
|
||||||
# Set the version of Python and other tools you might need
|
|
||||||
build:
|
|
||||||
os: ubuntu-22.04
|
|
||||||
tools:
|
|
||||||
python: "3.11"
|
|
||||||
|
|
||||||
# Build documentation in the docs/ directory with Sphinx
|
|
||||||
sphinx:
|
|
||||||
configuration: docs/conf.py
|
|
||||||
|
|
||||||
# We recommend specifying your dependencies to enable reproducible builds:
|
|
||||||
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
|
|
||||||
python:
|
|
||||||
install:
|
|
||||||
- requirements: docs/requirements.txt
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
### Install dependencies
|
### Install dependencies
|
||||||
|
|
||||||
```
|
```
|
||||||
pip install -U recommonmark sphinx sphinx_rtd_theme sphinx_markdown_tables
|
pip install -U recommonmark mock sphinx sphinx_rtd_theme sphinx_markdown_tables
|
||||||
```
|
```
|
||||||
|
|
||||||
### Add symlink to the root README.md
|
### Add symlink to the root README.md
|
||||||
|
|||||||
@@ -20,8 +20,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import unittest.mock as mock
|
import mock
|
||||||
|
|
||||||
from recommonmark.parser import CommonMarkParser
|
from recommonmark.parser import CommonMarkParser
|
||||||
from recommonmark.states import DummyStateMachine
|
from recommonmark.states import DummyStateMachine
|
||||||
from sphinx.builders.html import StandaloneHTMLBuilder
|
from sphinx.builders.html import StandaloneHTMLBuilder
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ cameras_ndc = PerspectiveCameras(focal_length=fcl_ndc, principal_point=prp_ndc)
|
|||||||
# Screen space camera
|
# Screen space camera
|
||||||
image_size = ((128, 256),) # (h, w)
|
image_size = ((128, 256),) # (h, w)
|
||||||
fcl_screen = (76.8,) # fcl_ndc * min(image_size) / 2
|
fcl_screen = (76.8,) # fcl_ndc * min(image_size) / 2
|
||||||
prp_screen = ((115.2, 32), ) # w / 2 - px_ndc * min(image_size) / 2, h / 2 - py_ndc * min(image_size) / 2
|
prp_screen = ((115.2, 48), ) # w / 2 - px_ndc * min(image_size) / 2, h / 2 - py_ndc * min(image_size) / 2
|
||||||
cameras_screen = PerspectiveCameras(focal_length=fcl_screen, principal_point=prp_screen, in_ndc=False, image_size=image_size)
|
cameras_screen = PerspectiveCameras(focal_length=fcl_screen, principal_point=prp_screen, in_ndc=False, image_size=image_size)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -7,20 +7,20 @@ sidebar_label: File IO
|
|||||||
There is a flexible interface for loading and saving point clouds and meshes from different formats.
|
There is a flexible interface for loading and saving point clouds and meshes from different formats.
|
||||||
|
|
||||||
The main usage is via the `pytorch3d.io.IO` object, and its methods
|
The main usage is via the `pytorch3d.io.IO` object, and its methods
|
||||||
`load_mesh`, `save_mesh`, `load_pointcloud` and `save_pointcloud`.
|
`load_mesh`, `save_mesh`, `load_point_cloud` and `save_point_cloud`.
|
||||||
|
|
||||||
For example, to load a mesh you might do
|
For example, to load a mesh you might do
|
||||||
```
|
```
|
||||||
from pytorch3d.io import IO
|
from pytorch3d.io import IO
|
||||||
|
|
||||||
device=torch.device("cuda:0")
|
device=torch.device("cuda:0")
|
||||||
mesh = IO().load_mesh("mymesh.obj", device=device)
|
mesh = IO().load_mesh("mymesh.ply", device=device)
|
||||||
```
|
```
|
||||||
|
|
||||||
and to save a pointcloud you might do
|
and to save a pointcloud you might do
|
||||||
```
|
```
|
||||||
pcl = Pointclouds(...)
|
pcl = Pointclouds(...)
|
||||||
IO().save_pointcloud(pcl, "output_pointcloud.ply")
|
IO().save_point_cloud(pcl, "output_pointcloud.obj")
|
||||||
```
|
```
|
||||||
|
|
||||||
For meshes, this supports OBJ, PLY and OFF files.
|
For meshes, this supports OBJ, PLY and OFF files.
|
||||||
@@ -31,4 +31,4 @@ In addition, there is experimental support for loading meshes from
|
|||||||
[glTF 2 assets](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0)
|
[glTF 2 assets](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0)
|
||||||
stored either in a GLB container file or a glTF JSON file with embedded binary data.
|
stored either in a GLB container file or a glTF JSON file with embedded binary data.
|
||||||
This must be enabled explicitly, as described in
|
This must be enabled explicitly, as described in
|
||||||
`pytorch3d/io/experimental_gltf_io.py`.
|
`pytorch3d/io/experimental_gltf_io.ply`.
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
docutils>=0.14
|
docutils>=0.14
|
||||||
Sphinx>=1.7
|
Sphinx>=1.7
|
||||||
recommonmark
|
recommonmark==0.4.0
|
||||||
sphinx_rtd_theme
|
sphinx_rtd_theme
|
||||||
sphinx_markdown_tables
|
sphinx_markdown_tables
|
||||||
|
mock
|
||||||
numpy
|
numpy
|
||||||
iopath
|
iopath
|
||||||
https://download.pytorch.org/whl/cpu/torchvision-0.15.2%2Bcpu-cp311-cp311-linux_x86_64.whl
|
fvcore
|
||||||
https://download.pytorch.org/whl/cpu/torch-2.0.1%2Bcpu-cp311-cp311-linux_x86_64.whl
|
https://download.pytorch.org/whl/cpu/torchvision-0.8.2%2Bcpu-cp37-cp37m-linux_x86_64.whl
|
||||||
|
https://download.pytorch.org/whl/cpu/torch-1.7.1%2Bcpu-cp37-cp37m-linux_x86_64.whl
|
||||||
omegaconf
|
omegaconf
|
||||||
|
|||||||
@@ -83,31 +83,28 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
"import subprocess\n",
|
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" if torch.__version__.startswith(\"1.13.\") and sys.platform.startswith(\"linux\"):\n",
|
||||||
" version_str=\"\".join([\n",
|
" # We try to install PyTorch3D via a released wheel.\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" version_str=\"\".join([\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" ])\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" !pip install iopath\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" if sys.platform.startswith(\"linux\"):\n",
|
" ])\n",
|
||||||
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
" !pip install fvcore iopath\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" pip_list = !pip freeze\n",
|
" else:\n",
|
||||||
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
" # We try to install PyTorch3D from source.\n",
|
||||||
" if need_pytorch3d:\n",
|
" !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
|
||||||
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
" !tar xzf 1.10.0.tar.gz\n",
|
||||||
"if need_pytorch3d:\n",
|
" os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
|
||||||
" print(\"Installing PyTorch3D from source\")\n",
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
" !pip install ninja\n",
|
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -70,31 +70,28 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
"import subprocess\n",
|
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" if torch.__version__.startswith(\"1.13.\") and sys.platform.startswith(\"linux\"):\n",
|
||||||
" version_str=\"\".join([\n",
|
" # We try to install PyTorch3D via a released wheel.\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" version_str=\"\".join([\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" ])\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" !pip install iopath\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" if sys.platform.startswith(\"linux\"):\n",
|
" ])\n",
|
||||||
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
" !pip install fvcore iopath\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" pip_list = !pip freeze\n",
|
" else:\n",
|
||||||
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
" # We try to install PyTorch3D from source.\n",
|
||||||
" if need_pytorch3d:\n",
|
" !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
|
||||||
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
" !tar xzf 1.10.0.tar.gz\n",
|
||||||
"if need_pytorch3d:\n",
|
" os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
|
||||||
" print(\"Installing PyTorch3D from source\")\n",
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
" !pip install ninja\n",
|
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,31 +45,28 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
"import subprocess\n",
|
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" if torch.__version__.startswith(\"1.13.\") and sys.platform.startswith(\"linux\"):\n",
|
||||||
" version_str=\"\".join([\n",
|
" # We try to install PyTorch3D via a released wheel.\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" version_str=\"\".join([\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" ])\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" !pip install iopath\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" if sys.platform.startswith(\"linux\"):\n",
|
" ])\n",
|
||||||
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
" !pip install fvcore iopath\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" pip_list = !pip freeze\n",
|
" else:\n",
|
||||||
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
" # We try to install PyTorch3D from source.\n",
|
||||||
" if need_pytorch3d:\n",
|
" !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
|
||||||
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
" !tar xzf 1.10.0.tar.gz\n",
|
||||||
"if need_pytorch3d:\n",
|
" os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
|
||||||
" print(\"Installing PyTorch3D from source\")\n",
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
" !pip install ninja\n",
|
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -411,7 +408,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"random_model_images = shapenet_dataset.render(\n",
|
"random_model_images = shapenet_dataset.render(\n",
|
||||||
" sample_nums=[5],\n",
|
" sample_nums=[3],\n",
|
||||||
" device=device,\n",
|
" device=device,\n",
|
||||||
" cameras=cameras,\n",
|
" cameras=cameras,\n",
|
||||||
" raster_settings=raster_settings,\n",
|
" raster_settings=raster_settings,\n",
|
||||||
|
|||||||
@@ -84,31 +84,28 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
"import subprocess\n",
|
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" if torch.__version__.startswith(\"1.13.\") and sys.platform.startswith(\"linux\"):\n",
|
||||||
" version_str=\"\".join([\n",
|
" # We try to install PyTorch3D via a released wheel.\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" version_str=\"\".join([\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" ])\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" !pip install iopath\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" if sys.platform.startswith(\"linux\"):\n",
|
" ])\n",
|
||||||
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
" !pip install fvcore iopath\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" pip_list = !pip freeze\n",
|
" else:\n",
|
||||||
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
" # We try to install PyTorch3D from source.\n",
|
||||||
" if need_pytorch3d:\n",
|
" !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
|
||||||
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
" !tar xzf 1.10.0.tar.gz\n",
|
||||||
"if need_pytorch3d:\n",
|
" os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
|
||||||
" print(\"Installing PyTorch3D from source\")\n",
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
" !pip install ninja\n",
|
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -195,7 +192,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# Load the dolphin mesh.\n",
|
"# Load the dolphin mesh.\n",
|
||||||
"trg_obj = 'dolphin.obj'"
|
"trg_obj = os.path.join('dolphin.obj')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -250,7 +247,7 @@
|
|||||||
"id": "dYWDl4VGWHRK"
|
"id": "dYWDl4VGWHRK"
|
||||||
},
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"## 2. Visualize the source and target meshes"
|
"### Visualize the source and target meshes"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -268,7 +265,7 @@
|
|||||||
" points = sample_points_from_meshes(mesh, 5000)\n",
|
" points = sample_points_from_meshes(mesh, 5000)\n",
|
||||||
" x, y, z = points.clone().detach().cpu().squeeze().unbind(1) \n",
|
" x, y, z = points.clone().detach().cpu().squeeze().unbind(1) \n",
|
||||||
" fig = plt.figure(figsize=(5, 5))\n",
|
" fig = plt.figure(figsize=(5, 5))\n",
|
||||||
" ax = fig.add_subplot(111, projection='3d')\n",
|
" ax = Axes3D(fig)\n",
|
||||||
" ax.scatter3D(x, z, -y)\n",
|
" ax.scatter3D(x, z, -y)\n",
|
||||||
" ax.set_xlabel('x')\n",
|
" ax.set_xlabel('x')\n",
|
||||||
" ax.set_ylabel('z')\n",
|
" ax.set_ylabel('z')\n",
|
||||||
@@ -488,7 +485,7 @@
|
|||||||
"final_verts = final_verts * scale + center\n",
|
"final_verts = final_verts * scale + center\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Store the predicted mesh using save_obj\n",
|
"# Store the predicted mesh using save_obj\n",
|
||||||
"final_obj = 'final_model.obj'\n",
|
"final_obj = os.path.join('./', 'final_model.obj')\n",
|
||||||
"save_obj(final_obj, final_verts, final_faces)"
|
"save_obj(final_obj, final_verts, final_faces)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -50,31 +50,28 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
"import subprocess\n",
|
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" if torch.__version__.startswith(\"1.13.\") and sys.platform.startswith(\"linux\"):\n",
|
||||||
" version_str=\"\".join([\n",
|
" # We try to install PyTorch3D via a released wheel.\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" version_str=\"\".join([\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" ])\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" !pip install iopath\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" if sys.platform.startswith(\"linux\"):\n",
|
" ])\n",
|
||||||
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
" !pip install fvcore iopath\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" pip_list = !pip freeze\n",
|
" else:\n",
|
||||||
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
" # We try to install PyTorch3D from source.\n",
|
||||||
" if need_pytorch3d:\n",
|
" !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
|
||||||
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
" !tar xzf 1.10.0.tar.gz\n",
|
||||||
"if need_pytorch3d:\n",
|
" os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
|
||||||
" print(\"Installing PyTorch3D from source\")\n",
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
" !pip install ninja\n",
|
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,31 +62,28 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
"import subprocess\n",
|
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" if torch.__version__.startswith(\"1.13.\") and sys.platform.startswith(\"linux\"):\n",
|
||||||
" version_str=\"\".join([\n",
|
" # We try to install PyTorch3D via a released wheel.\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" version_str=\"\".join([\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" ])\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" !pip install iopath\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" if sys.platform.startswith(\"linux\"):\n",
|
" ])\n",
|
||||||
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
" !pip install fvcore iopath\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" pip_list = !pip freeze\n",
|
" else:\n",
|
||||||
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
" # We try to install PyTorch3D from source.\n",
|
||||||
" if need_pytorch3d:\n",
|
" !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
|
||||||
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
" !tar xzf 1.10.0.tar.gz\n",
|
||||||
"if need_pytorch3d:\n",
|
" os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
|
||||||
" print(\"Installing PyTorch3D from source\")\n",
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
" !pip install ninja\n",
|
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,31 +41,28 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
"import subprocess\n",
|
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" if torch.__version__.startswith(\"1.13.\") and sys.platform.startswith(\"linux\"):\n",
|
||||||
" version_str=\"\".join([\n",
|
" # We try to install PyTorch3D via a released wheel.\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" version_str=\"\".join([\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" ])\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" !pip install iopath\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" if sys.platform.startswith(\"linux\"):\n",
|
" ])\n",
|
||||||
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
" !pip install fvcore iopath\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" pip_list = !pip freeze\n",
|
" else:\n",
|
||||||
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
" # We try to install PyTorch3D from source.\n",
|
||||||
" if need_pytorch3d:\n",
|
" !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
|
||||||
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
" !tar xzf 1.10.0.tar.gz\n",
|
||||||
"if need_pytorch3d:\n",
|
" os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
|
||||||
" print(\"Installing PyTorch3D from source\")\n",
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
" !pip install ninja\n",
|
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -72,31 +72,28 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
"import subprocess\n",
|
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" if torch.__version__.startswith(\"1.13.\") and sys.platform.startswith(\"linux\"):\n",
|
||||||
" version_str=\"\".join([\n",
|
" # We try to install PyTorch3D via a released wheel.\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" version_str=\"\".join([\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" ])\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" !pip install iopath\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" if sys.platform.startswith(\"linux\"):\n",
|
" ])\n",
|
||||||
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
" !pip install fvcore iopath\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" pip_list = !pip freeze\n",
|
" else:\n",
|
||||||
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
" # We try to install PyTorch3D from source.\n",
|
||||||
" if need_pytorch3d:\n",
|
" !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
|
||||||
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
" !tar xzf 1.10.0.tar.gz\n",
|
||||||
"if need_pytorch3d:\n",
|
" os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
|
||||||
" print(\"Installing PyTorch3D from source\")\n",
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
" !pip install ninja\n",
|
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -66,31 +66,28 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
"import subprocess\n",
|
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" if torch.__version__.startswith(\"1.13.\") and sys.platform.startswith(\"linux\"):\n",
|
||||||
" version_str=\"\".join([\n",
|
" # We try to install PyTorch3D via a released wheel.\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" version_str=\"\".join([\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" ])\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" !pip install iopath\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" if sys.platform.startswith(\"linux\"):\n",
|
" ])\n",
|
||||||
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
" !pip install fvcore iopath\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" pip_list = !pip freeze\n",
|
" else:\n",
|
||||||
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
" # We try to install PyTorch3D from source.\n",
|
||||||
" if need_pytorch3d:\n",
|
" !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
|
||||||
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
" !tar xzf 1.10.0.tar.gz\n",
|
||||||
"if need_pytorch3d:\n",
|
" os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
|
||||||
" print(\"Installing PyTorch3D from source\")\n",
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
" !pip install ninja\n",
|
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,31 +44,28 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
"import subprocess\n",
|
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" if torch.__version__.startswith(\"1.13.\") and sys.platform.startswith(\"linux\"):\n",
|
||||||
" version_str=\"\".join([\n",
|
" # We try to install PyTorch3D via a released wheel.\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" version_str=\"\".join([\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" ])\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" !pip install iopath\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" if sys.platform.startswith(\"linux\"):\n",
|
" ])\n",
|
||||||
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
" !pip install fvcore iopath\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" pip_list = !pip freeze\n",
|
" else:\n",
|
||||||
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
" # We try to install PyTorch3D from source.\n",
|
||||||
" if need_pytorch3d:\n",
|
" !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
|
||||||
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
" !tar xzf 1.10.0.tar.gz\n",
|
||||||
"if need_pytorch3d:\n",
|
" os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
|
||||||
" print(\"Installing PyTorch3D from source\")\n",
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
" !pip install ninja\n",
|
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,31 +51,28 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
"import subprocess\n",
|
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" if torch.__version__.startswith(\"1.13.\") and sys.platform.startswith(\"linux\"):\n",
|
||||||
" version_str=\"\".join([\n",
|
" # We try to install PyTorch3D via a released wheel.\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" version_str=\"\".join([\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" ])\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" !pip install iopath\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" if sys.platform.startswith(\"linux\"):\n",
|
" ])\n",
|
||||||
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
" !pip install fvcore iopath\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" pip_list = !pip freeze\n",
|
" else:\n",
|
||||||
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
" # We try to install PyTorch3D from source.\n",
|
||||||
" if need_pytorch3d:\n",
|
" !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
|
||||||
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
" !tar xzf 1.10.0.tar.gz\n",
|
||||||
"if need_pytorch3d:\n",
|
" os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
|
||||||
" print(\"Installing PyTorch3D from source\")\n",
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
" !pip install ninja\n",
|
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,31 +67,28 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
"import subprocess\n",
|
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" if torch.__version__.startswith(\"1.13.\") and sys.platform.startswith(\"linux\"):\n",
|
||||||
" version_str=\"\".join([\n",
|
" # We try to install PyTorch3D via a released wheel.\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" version_str=\"\".join([\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" ])\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" !pip install iopath\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" if sys.platform.startswith(\"linux\"):\n",
|
" ])\n",
|
||||||
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
" !pip install fvcore iopath\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" pip_list = !pip freeze\n",
|
" else:\n",
|
||||||
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
" # We try to install PyTorch3D from source.\n",
|
||||||
" if need_pytorch3d:\n",
|
" !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
|
||||||
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
" !tar xzf 1.10.0.tar.gz\n",
|
||||||
"if need_pytorch3d:\n",
|
" os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
|
||||||
" print(\"Installing PyTorch3D from source\")\n",
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
" !pip install ninja\n",
|
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ def plot_camera_scene(cameras, cameras_gt, status: str):
|
|||||||
a string passed inside the `status` argument.
|
a string passed inside the `status` argument.
|
||||||
"""
|
"""
|
||||||
fig = plt.figure()
|
fig = plt.figure()
|
||||||
ax = fig.add_subplot(projection="3d")
|
ax = fig.gca(projection="3d")
|
||||||
ax.clear()
|
ax.clear()
|
||||||
ax.set_title(status)
|
ax.set_title(status)
|
||||||
handle_cam = plot_cameras(ax, cameras, color="#FF7D1E")
|
handle_cam = plot_cameras(ax, cameras, color="#FF7D1E")
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ def setup_cuda():
|
|||||||
os.environ["FORCE_CUDA"] = "1"
|
os.environ["FORCE_CUDA"] = "1"
|
||||||
|
|
||||||
basic_nvcc_flags = (
|
basic_nvcc_flags = (
|
||||||
|
"-gencode=arch=compute_35,code=sm_35 "
|
||||||
"-gencode=arch=compute_50,code=sm_50 "
|
"-gencode=arch=compute_50,code=sm_50 "
|
||||||
"-gencode=arch=compute_60,code=sm_60 "
|
"-gencode=arch=compute_60,code=sm_60 "
|
||||||
"-gencode=arch=compute_70,code=sm_70 "
|
"-gencode=arch=compute_70,code=sm_70 "
|
||||||
@@ -57,19 +58,13 @@ def setup_cuda():
|
|||||||
"-gencode=arch=compute_50,code=compute_50"
|
"-gencode=arch=compute_50,code=compute_50"
|
||||||
)
|
)
|
||||||
if CU_VERSION == "cu102":
|
if CU_VERSION == "cu102":
|
||||||
nvcc_flags = "-gencode=arch=compute_35,code=sm_35 " + basic_nvcc_flags
|
nvcc_flags = basic_nvcc_flags
|
||||||
elif CU_VERSION < ("cu118"):
|
elif CU_VERSION == "cu110":
|
||||||
nvcc_flags = (
|
nvcc_flags = "-gencode=arch=compute_80,code=sm_80 " + basic_nvcc_flags
|
||||||
"-gencode=arch=compute_35,code=sm_35 "
|
|
||||||
+ "-gencode=arch=compute_80,code=sm_80 "
|
|
||||||
+ "-gencode=arch=compute_86,code=sm_86 "
|
|
||||||
+ basic_nvcc_flags
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
nvcc_flags = (
|
nvcc_flags = (
|
||||||
"-gencode=arch=compute_80,code=sm_80 "
|
"-gencode=arch=compute_80,code=sm_80 "
|
||||||
+ "-gencode=arch=compute_86,code=sm_86 "
|
+ "-gencode=arch=compute_86,code=sm_86 "
|
||||||
+ "-gencode=arch=compute_90,code=sm_90 "
|
|
||||||
+ basic_nvcc_flags
|
+ basic_nvcc_flags
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -80,12 +75,6 @@ def setup_cuda():
|
|||||||
def setup_conda_pytorch_constraint() -> List[str]:
|
def setup_conda_pytorch_constraint() -> List[str]:
|
||||||
pytorch_constraint = f"- pytorch=={PYTORCH_VERSION}"
|
pytorch_constraint = f"- pytorch=={PYTORCH_VERSION}"
|
||||||
os.environ["CONDA_PYTORCH_CONSTRAINT"] = pytorch_constraint
|
os.environ["CONDA_PYTORCH_CONSTRAINT"] = pytorch_constraint
|
||||||
if pytorch_major_minor < (2, 2):
|
|
||||||
os.environ["CONDA_PYTORCH_MKL_CONSTRAINT"] = "- mkl!=2024.1.0"
|
|
||||||
os.environ["SETUPTOOLS_CONSTRAINT"] = "- setuptools<70"
|
|
||||||
else:
|
|
||||||
os.environ["CONDA_PYTORCH_MKL_CONSTRAINT"] = ""
|
|
||||||
os.environ["SETUPTOOLS_CONSTRAINT"] = "- setuptools"
|
|
||||||
os.environ["CONDA_PYTORCH_BUILD_CONSTRAINT"] = pytorch_constraint
|
os.environ["CONDA_PYTORCH_BUILD_CONSTRAINT"] = pytorch_constraint
|
||||||
os.environ["PYTORCH_VERSION_NODOT"] = PYTORCH_VERSION.replace(".", "")
|
os.environ["PYTORCH_VERSION_NODOT"] = PYTORCH_VERSION.replace(".", "")
|
||||||
|
|
||||||
@@ -123,7 +112,7 @@ def do_build(start_args: List[str]):
|
|||||||
if test_flag is not None:
|
if test_flag is not None:
|
||||||
args.append(test_flag)
|
args.append(test_flag)
|
||||||
|
|
||||||
args.extend(["-c", "bottler", "-c", "iopath", "-c", "conda-forge"])
|
args.extend(["-c", "bottler", "-c", "fvcore", "-c", "iopath", "-c", "conda-forge"])
|
||||||
args.append("--no-anaconda-upload")
|
args.append("--no-anaconda-upload")
|
||||||
args.extend(["--python", os.environ["PYTHON_VERSION"]])
|
args.extend(["--python", os.environ["PYTHON_VERSION"]])
|
||||||
args.append("packaging/pytorch3d")
|
args.append("packaging/pytorch3d")
|
||||||
|
|||||||
@@ -26,6 +26,5 @@ version_str="".join([
|
|||||||
torch.version.cuda.replace(".",""),
|
torch.version.cuda.replace(".",""),
|
||||||
f"_pyt{pyt_version_str}"
|
f"_pyt{pyt_version_str}"
|
||||||
])
|
])
|
||||||
!pip install iopath
|
|
||||||
!pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html
|
!pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -5,13 +5,7 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# Some directory to persist downloaded conda packages
|
sudo docker run --rm -v "$PWD/../../:/inside" pytorch/conda-cuda bash inside/packaging/linux_wheels/inside.sh
|
||||||
conda_cache=/raid/$USER/building_conda_cache
|
sudo docker run --rm -v "$PWD/../../:/inside" -e SELECTED_CUDA=cu113 pytorch/conda-builder:cuda113 bash inside/packaging/linux_wheels/inside.sh
|
||||||
|
sudo docker run --rm -v "$PWD/../../:/inside" -e SELECTED_CUDA=cu115 pytorch/conda-builder:cuda115 bash inside/packaging/linux_wheels/inside.sh
|
||||||
mkdir -p "$conda_cache"
|
sudo docker run --rm -v "$PWD/../../:/inside" -e SELECTED_CUDA=cu116 pytorch/conda-builder:cuda116 bash inside/packaging/linux_wheels/inside.sh
|
||||||
|
|
||||||
sudo docker run --rm -v "$conda_cache:/conda_cache" -v "$PWD/../../:/inside" -e SELECTED_CUDA=cu113 pytorch/conda-builder:cuda113 bash inside/packaging/linux_wheels/inside.sh
|
|
||||||
sudo docker run --rm -v "$conda_cache:/conda_cache" -v "$PWD/../../:/inside" -e SELECTED_CUDA=cu115 pytorch/conda-builder:cuda115 bash inside/packaging/linux_wheels/inside.sh
|
|
||||||
sudo docker run --rm -v "$conda_cache:/conda_cache" -v "$PWD/../../:/inside" -e SELECTED_CUDA=cu116 pytorch/conda-builder:cuda116 bash inside/packaging/linux_wheels/inside.sh
|
|
||||||
sudo docker run --rm -v "$conda_cache:/conda_cache" -v "$PWD/../../:/inside" -e SELECTED_CUDA=cu117 pytorch/conda-builder:cuda117 bash inside/packaging/linux_wheels/inside.sh
|
|
||||||
sudo docker run --rm -v "$conda_cache:/conda_cache" -v "$PWD/../../:/inside" -e SELECTED_CUDA=cu118 pytorch/conda-builder:cuda118 bash inside/packaging/linux_wheels/inside.sh
|
|
||||||
|
|||||||
@@ -16,32 +16,23 @@ VERSION=$(python -c "exec(open('pytorch3d/__init__.py').read()); print(__version
|
|||||||
|
|
||||||
export BUILD_VERSION=$VERSION
|
export BUILD_VERSION=$VERSION
|
||||||
export FORCE_CUDA=1
|
export FORCE_CUDA=1
|
||||||
export MAX_JOBS=8
|
|
||||||
export CONDA_PKGS_DIRS=/conda_cache
|
|
||||||
|
|
||||||
if false
|
wget --no-verbose https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz
|
||||||
then
|
tar xzf 1.10.0.tar.gz
|
||||||
# We used to have to do this for old versions of CUDA
|
CUB_HOME=$(realpath ./cub-1.10.0)
|
||||||
wget --no-verbose https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz
|
export CUB_HOME
|
||||||
tar xzf 1.10.0.tar.gz
|
echo "CUB_HOME is now $CUB_HOME"
|
||||||
CUB_HOME=$(realpath ./cub-1.10.0)
|
|
||||||
export CUB_HOME
|
|
||||||
echo "CUB_HOME is now $CUB_HOME"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# As a rule, we want to build for any combination of dependencies which is supported by
|
# As a rule, we want to build for any combination of dependencies which is supported by
|
||||||
# PyTorch3D and not older than the current Google Colab set up.
|
# PyTorch3D and not older than the current Google Colab set up.
|
||||||
|
|
||||||
PYTHON_VERSIONS="3.8 3.9 3.10"
|
PYTHON_VERSIONS="3.7 3.8 3.9 3.10"
|
||||||
# the keys are pytorch versions
|
# the keys are pytorch versions
|
||||||
declare -A CONDA_CUDA_VERSIONS=(
|
declare -A CONDA_CUDA_VERSIONS=(
|
||||||
# ["1.11.0"]="cu113"
|
["1.10.1"]="cu111 cu113"
|
||||||
# ["1.12.0"]="cu113"
|
["1.10.2"]="cu111 cu113"
|
||||||
# ["1.12.1"]="cu113"
|
["1.10.0"]="cu111 cu113"
|
||||||
# ["1.13.0"]="cu116"
|
["1.11.0"]="cu111 cu113 cu115"
|
||||||
# ["1.13.1"]="cu116 cu117"
|
|
||||||
# ["2.0.0"]="cu117 cu118"
|
|
||||||
["2.0.1"]="cu117 cu118"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -50,43 +41,39 @@ for python_version in $PYTHON_VERSIONS
|
|||||||
do
|
do
|
||||||
for pytorch_version in "${!CONDA_CUDA_VERSIONS[@]}"
|
for pytorch_version in "${!CONDA_CUDA_VERSIONS[@]}"
|
||||||
do
|
do
|
||||||
|
if [[ "3.7 3.8" != *$python_version* ]] && [[ "1.7.0" == *$pytorch_version* ]]
|
||||||
|
then
|
||||||
|
#python 3.9 and later not supported by pytorch 1.7.0 and before
|
||||||
|
continue
|
||||||
|
fi
|
||||||
if [[ "3.7 3.8 3.9" != *$python_version* ]] && [[ "1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 1.9.1 1.10.0 1.10.1 1.10.2" == *$pytorch_version* ]]
|
if [[ "3.7 3.8 3.9" != *$python_version* ]] && [[ "1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 1.9.1 1.10.0 1.10.1 1.10.2" == *$pytorch_version* ]]
|
||||||
then
|
then
|
||||||
#python 3.10 and later not supported by pytorch 1.10.2 and before
|
#python 3.10 and later not supported by pytorch 1.10.2 and before
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
extra_channel="-c nvidia"
|
extra_channel="-c conda-forge"
|
||||||
cudatools="pytorch-cuda"
|
|
||||||
if [[ "1.11.0" == "$pytorch_version" ]]
|
if [[ "1.11.0" == "$pytorch_version" ]]
|
||||||
then
|
then
|
||||||
extra_channel=""
|
extra_channel=""
|
||||||
cudatools="cudatoolkit"
|
|
||||||
fi
|
|
||||||
if [[ "1.12.0" == "$pytorch_version" ]] || [[ "1.12.1" == "$pytorch_version" ]]
|
|
||||||
then
|
|
||||||
extra_channel="-c conda-forge"
|
|
||||||
cudatools="cudatoolkit"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for cu_version in ${CONDA_CUDA_VERSIONS[$pytorch_version]}
|
for cu_version in ${CONDA_CUDA_VERSIONS[$pytorch_version]}
|
||||||
do
|
do
|
||||||
|
if [[ "cu113 cu115 cu116" == *$cu_version* ]]
|
||||||
|
# ^^^ CUDA versions listed here have to be built
|
||||||
|
# in their own containers.
|
||||||
|
then
|
||||||
if [[ $SELECTED_CUDA != "$cu_version" ]]
|
if [[ $SELECTED_CUDA != "$cu_version" ]]
|
||||||
|
then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
elif [[ $SELECTED_CUDA != "" ]]
|
||||||
then
|
then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$cu_version" in
|
case "$cu_version" in
|
||||||
cu118)
|
|
||||||
export CUDA_HOME=/usr/local/cuda-11.8/
|
|
||||||
export CUDA_TAG=11.8
|
|
||||||
export NVCC_FLAGS="-gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_50,code=compute_50"
|
|
||||||
;;
|
|
||||||
cu117)
|
|
||||||
export CUDA_HOME=/usr/local/cuda-11.7/
|
|
||||||
export CUDA_TAG=11.7
|
|
||||||
export NVCC_FLAGS="-gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=sm_86 -gencode=arch=compute_50,code=compute_50"
|
|
||||||
;;
|
|
||||||
cu116)
|
cu116)
|
||||||
export CUDA_HOME=/usr/local/cuda-11.6/
|
export CUDA_HOME=/usr/local/cuda-11.6/
|
||||||
export CUDA_TAG=11.6
|
export CUDA_TAG=11.6
|
||||||
@@ -143,8 +130,8 @@ do
|
|||||||
conda create -y -n "$tag" "python=$python_version"
|
conda create -y -n "$tag" "python=$python_version"
|
||||||
conda activate "$tag"
|
conda activate "$tag"
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
conda install -y -c pytorch $extra_channel "pytorch=$pytorch_version" "$cudatools=$CUDA_TAG"
|
conda install -y -c pytorch $extra_channel "pytorch=$pytorch_version" "cudatoolkit=$CUDA_TAG" torchvision
|
||||||
pip install iopath
|
pip install fvcore iopath
|
||||||
echo "python version" "$python_version" "pytorch version" "$pytorch_version" "cuda version" "$cu_version" "tag" "$tag"
|
echo "python version" "$python_version" "pytorch version" "$pytorch_version" "cuda version" "$cu_version" "tag" "$tag"
|
||||||
|
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ requirements:
|
|||||||
|
|
||||||
host:
|
host:
|
||||||
- python
|
- python
|
||||||
{{ environ.get('SETUPTOOLS_CONSTRAINT') }}
|
- setuptools
|
||||||
{{ environ.get('CONDA_PYTORCH_BUILD_CONSTRAINT') }}
|
{{ environ.get('CONDA_PYTORCH_BUILD_CONSTRAINT') }}
|
||||||
{{ environ.get('CONDA_PYTORCH_MKL_CONSTRAINT') }}
|
|
||||||
{{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT') }}
|
{{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT') }}
|
||||||
{{ environ.get('CONDA_CPUONLY_FEATURE') }}
|
{{ environ.get('CONDA_CPUONLY_FEATURE') }}
|
||||||
|
|
||||||
@@ -22,6 +21,7 @@ requirements:
|
|||||||
- python
|
- python
|
||||||
- numpy >=1.11
|
- numpy >=1.11
|
||||||
- torchvision >=0.5
|
- torchvision >=0.5
|
||||||
|
- fvcore
|
||||||
- iopath
|
- iopath
|
||||||
{{ environ.get('CONDA_PYTORCH_CONSTRAINT') }}
|
{{ environ.get('CONDA_PYTORCH_CONSTRAINT') }}
|
||||||
{{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT') }}
|
{{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT') }}
|
||||||
|
|||||||
@@ -212,7 +212,9 @@ from pytorch3d.implicitron.tools.config import registry
|
|||||||
class XRayRenderer(BaseRenderer, torch.nn.Module):
|
class XRayRenderer(BaseRenderer, torch.nn.Module):
|
||||||
n_pts_per_ray: int = 64
|
n_pts_per_ray: int = 64
|
||||||
|
|
||||||
|
# if there are other base classes, make sure to call `super().__init__()` explicitly
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
|
super().__init__()
|
||||||
# custom initialization
|
# custom initialization
|
||||||
|
|
||||||
def forward(
|
def forward(
|
||||||
@@ -248,7 +250,7 @@ The main object for this trainer loop is `Experiment`. It has four top-level rep
|
|||||||
* `data_source`: This is a `DataSourceBase` which defaults to `ImplicitronDataSource`.
|
* `data_source`: This is a `DataSourceBase` which defaults to `ImplicitronDataSource`.
|
||||||
It constructs the data sets and dataloaders.
|
It constructs the data sets and dataloaders.
|
||||||
* `model_factory`: This is a `ModelFactoryBase` which defaults to `ImplicitronModelFactory`.
|
* `model_factory`: This is a `ModelFactoryBase` which defaults to `ImplicitronModelFactory`.
|
||||||
It constructs the model, which is usually an instance of `OverfitModel` (for NeRF-style training with overfitting to one scene) or `GenericModel` (that is able to generalize to multiple scenes by NeRFormer-style conditioning on other scene views), and can load its weights from a checkpoint.
|
It constructs the model, which is usually an instance of implicitron's main `GenericModel` class, and can load its weights from a checkpoint.
|
||||||
* `optimizer_factory`: This is an `OptimizerFactoryBase` which defaults to `ImplicitronOptimizerFactory`.
|
* `optimizer_factory`: This is an `OptimizerFactoryBase` which defaults to `ImplicitronOptimizerFactory`.
|
||||||
It constructs the optimizer and can load its weights from a checkpoint.
|
It constructs the optimizer and can load its weights from a checkpoint.
|
||||||
* `training_loop`: This is a `TrainingLoopBase` which defaults to `ImplicitronTrainingLoop` and defines the main training loop.
|
* `training_loop`: This is a `TrainingLoopBase` which defaults to `ImplicitronTrainingLoop` and defines the main training loop.
|
||||||
@@ -292,43 +294,6 @@ model_GenericModel_args: GenericModel
|
|||||||
╘== ReductionFeatureAggregator
|
╘== ReductionFeatureAggregator
|
||||||
```
|
```
|
||||||
|
|
||||||
Here is the class structure of OverfitModel:
|
|
||||||
|
|
||||||
```
|
|
||||||
model_OverfitModel_args: OverfitModel
|
|
||||||
└-- raysampler_*_args: RaySampler
|
|
||||||
╘== AdaptiveRaysampler
|
|
||||||
╘== NearFarRaysampler
|
|
||||||
└-- renderer_*_args: BaseRenderer
|
|
||||||
╘== MultiPassEmissionAbsorptionRenderer
|
|
||||||
╘== LSTMRenderer
|
|
||||||
╘== SignedDistanceFunctionRenderer
|
|
||||||
└-- ray_tracer_args: RayTracing
|
|
||||||
└-- ray_normal_coloring_network_args: RayNormalColoringNetwork
|
|
||||||
└-- implicit_function_*_args: ImplicitFunctionBase
|
|
||||||
╘== NeuralRadianceFieldImplicitFunction
|
|
||||||
╘== SRNImplicitFunction
|
|
||||||
└-- raymarch_function_args: SRNRaymarchFunction
|
|
||||||
└-- pixel_generator_args: SRNPixelGenerator
|
|
||||||
╘== SRNHyperNetImplicitFunction
|
|
||||||
└-- hypernet_args: SRNRaymarchHyperNet
|
|
||||||
└-- pixel_generator_args: SRNPixelGenerator
|
|
||||||
╘== IdrFeatureField
|
|
||||||
└-- coarse_implicit_function_*_args: ImplicitFunctionBase
|
|
||||||
╘== NeuralRadianceFieldImplicitFunction
|
|
||||||
╘== SRNImplicitFunction
|
|
||||||
└-- raymarch_function_args: SRNRaymarchFunction
|
|
||||||
└-- pixel_generator_args: SRNPixelGenerator
|
|
||||||
╘== SRNHyperNetImplicitFunction
|
|
||||||
└-- hypernet_args: SRNRaymarchHyperNet
|
|
||||||
└-- pixel_generator_args: SRNPixelGenerator
|
|
||||||
╘== IdrFeatureField
|
|
||||||
```
|
|
||||||
|
|
||||||
OverfitModel has been introduced to create a simple class to disantagle Nerfs which the overfit pattern
|
|
||||||
from the GenericModel.
|
|
||||||
|
|
||||||
|
|
||||||
Please look at the annotations of the respective classes or functions for the lists of hyperparameters.
|
Please look at the annotations of the respective classes or functions for the lists of hyperparameters.
|
||||||
`tests/experiment.yaml` shows every possible option if you have no user-defined classes.
|
`tests/experiment.yaml` shows every possible option if you have no user-defined classes.
|
||||||
|
|
||||||
|
|||||||
@@ -3,5 +3,3 @@
|
|||||||
#
|
#
|
||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
defaults:
|
|
||||||
- default_config
|
|
||||||
- _self_
|
|
||||||
exp_dir: ./data/exps/overfit_base/
|
|
||||||
training_loop_ImplicitronTrainingLoop_args:
|
|
||||||
visdom_port: 8097
|
|
||||||
visualize_interval: 0
|
|
||||||
max_epochs: 1000
|
|
||||||
data_source_ImplicitronDataSource_args:
|
|
||||||
data_loader_map_provider_class_type: SequenceDataLoaderMapProvider
|
|
||||||
dataset_map_provider_class_type: JsonIndexDatasetMapProvider
|
|
||||||
data_loader_map_provider_SequenceDataLoaderMapProvider_args:
|
|
||||||
dataset_length_train: 1000
|
|
||||||
dataset_length_val: 1
|
|
||||||
num_workers: 8
|
|
||||||
dataset_map_provider_JsonIndexDatasetMapProvider_args:
|
|
||||||
dataset_root: ${oc.env:CO3D_DATASET_ROOT}
|
|
||||||
n_frames_per_sequence: -1
|
|
||||||
test_on_train: true
|
|
||||||
test_restrict_sequence_id: 0
|
|
||||||
dataset_JsonIndexDataset_args:
|
|
||||||
load_point_clouds: false
|
|
||||||
mask_depths: false
|
|
||||||
mask_images: false
|
|
||||||
model_factory_ImplicitronModelFactory_args:
|
|
||||||
model_class_type: "OverfitModel"
|
|
||||||
model_OverfitModel_args:
|
|
||||||
loss_weights:
|
|
||||||
loss_mask_bce: 1.0
|
|
||||||
loss_prev_stage_mask_bce: 1.0
|
|
||||||
loss_autodecoder_norm: 0.01
|
|
||||||
loss_rgb_mse: 1.0
|
|
||||||
loss_prev_stage_rgb_mse: 1.0
|
|
||||||
output_rasterized_mc: false
|
|
||||||
chunk_size_grid: 102400
|
|
||||||
render_image_height: 400
|
|
||||||
render_image_width: 400
|
|
||||||
share_implicit_function_across_passes: false
|
|
||||||
implicit_function_class_type: "NeuralRadianceFieldImplicitFunction"
|
|
||||||
implicit_function_NeuralRadianceFieldImplicitFunction_args:
|
|
||||||
n_harmonic_functions_xyz: 10
|
|
||||||
n_harmonic_functions_dir: 4
|
|
||||||
n_hidden_neurons_xyz: 256
|
|
||||||
n_hidden_neurons_dir: 128
|
|
||||||
n_layers_xyz: 8
|
|
||||||
append_xyz:
|
|
||||||
- 5
|
|
||||||
coarse_implicit_function_class_type: "NeuralRadianceFieldImplicitFunction"
|
|
||||||
coarse_implicit_function_NeuralRadianceFieldImplicitFunction_args:
|
|
||||||
n_harmonic_functions_xyz: 10
|
|
||||||
n_harmonic_functions_dir: 4
|
|
||||||
n_hidden_neurons_xyz: 256
|
|
||||||
n_hidden_neurons_dir: 128
|
|
||||||
n_layers_xyz: 8
|
|
||||||
append_xyz:
|
|
||||||
- 5
|
|
||||||
raysampler_AdaptiveRaySampler_args:
|
|
||||||
n_rays_per_image_sampled_from_mask: 1024
|
|
||||||
scene_extent: 8.0
|
|
||||||
n_pts_per_ray_training: 64
|
|
||||||
n_pts_per_ray_evaluation: 64
|
|
||||||
stratified_point_sampling_training: true
|
|
||||||
stratified_point_sampling_evaluation: false
|
|
||||||
renderer_MultiPassEmissionAbsorptionRenderer_args:
|
|
||||||
n_pts_per_ray_fine_training: 64
|
|
||||||
n_pts_per_ray_fine_evaluation: 64
|
|
||||||
append_coarse_samples_to_fine: true
|
|
||||||
density_noise_std_train: 1.0
|
|
||||||
optimizer_factory_ImplicitronOptimizerFactory_args:
|
|
||||||
breed: Adam
|
|
||||||
weight_decay: 0.0
|
|
||||||
lr_policy: MultiStepLR
|
|
||||||
multistep_lr_milestones: []
|
|
||||||
lr: 0.0005
|
|
||||||
gamma: 0.1
|
|
||||||
momentum: 0.9
|
|
||||||
betas:
|
|
||||||
- 0.9
|
|
||||||
- 0.999
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
defaults:
|
|
||||||
- overfit_base
|
|
||||||
- _self_
|
|
||||||
data_source_ImplicitronDataSource_args:
|
|
||||||
data_loader_map_provider_SequenceDataLoaderMapProvider_args:
|
|
||||||
batch_size: 1
|
|
||||||
dataset_length_train: 1000
|
|
||||||
dataset_length_val: 1
|
|
||||||
num_workers: 8
|
|
||||||
dataset_map_provider_JsonIndexDatasetMapProvider_args:
|
|
||||||
assert_single_seq: true
|
|
||||||
n_frames_per_sequence: -1
|
|
||||||
test_restrict_sequence_id: 0
|
|
||||||
test_on_train: false
|
|
||||||
model_factory_ImplicitronModelFactory_args:
|
|
||||||
model_class_type: "OverfitModel"
|
|
||||||
model_OverfitModel_args:
|
|
||||||
render_image_height: 800
|
|
||||||
render_image_width: 800
|
|
||||||
log_vars:
|
|
||||||
- loss_rgb_psnr_fg
|
|
||||||
- loss_rgb_psnr
|
|
||||||
- loss_eikonal
|
|
||||||
- loss_prev_stage_rgb_psnr
|
|
||||||
- loss_mask_bce
|
|
||||||
- loss_prev_stage_mask_bce
|
|
||||||
- loss_rgb_mse
|
|
||||||
- loss_prev_stage_rgb_mse
|
|
||||||
- loss_depth_abs
|
|
||||||
- loss_depth_abs_fg
|
|
||||||
- loss_kl
|
|
||||||
- loss_mask_neg_iou
|
|
||||||
- objective
|
|
||||||
- epoch
|
|
||||||
- sec/it
|
|
||||||
optimizer_factory_ImplicitronOptimizerFactory_args:
|
|
||||||
lr: 0.0005
|
|
||||||
multistep_lr_milestones:
|
|
||||||
- 200
|
|
||||||
- 300
|
|
||||||
training_loop_ImplicitronTrainingLoop_args:
|
|
||||||
max_epochs: 400
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
defaults:
|
|
||||||
- overfit_singleseq_base
|
|
||||||
- _self_
|
|
||||||
exp_dir: "./data/overfit_nerf_blender_repro/${oc.env:BLENDER_SINGLESEQ_CLASS}"
|
|
||||||
data_source_ImplicitronDataSource_args:
|
|
||||||
data_loader_map_provider_SequenceDataLoaderMapProvider_args:
|
|
||||||
dataset_length_train: 100
|
|
||||||
dataset_map_provider_class_type: BlenderDatasetMapProvider
|
|
||||||
dataset_map_provider_BlenderDatasetMapProvider_args:
|
|
||||||
base_dir: ${oc.env:BLENDER_DATASET_ROOT}/${oc.env:BLENDER_SINGLESEQ_CLASS}
|
|
||||||
n_known_frames_for_test: null
|
|
||||||
object_name: ${oc.env:BLENDER_SINGLESEQ_CLASS}
|
|
||||||
path_manager_factory_class_type: PathManagerFactory
|
|
||||||
path_manager_factory_PathManagerFactory_args:
|
|
||||||
silence_logs: true
|
|
||||||
|
|
||||||
model_factory_ImplicitronModelFactory_args:
|
|
||||||
model_class_type: "OverfitModel"
|
|
||||||
model_OverfitModel_args:
|
|
||||||
mask_images: false
|
|
||||||
raysampler_class_type: AdaptiveRaySampler
|
|
||||||
raysampler_AdaptiveRaySampler_args:
|
|
||||||
n_pts_per_ray_training: 64
|
|
||||||
n_pts_per_ray_evaluation: 64
|
|
||||||
n_rays_per_image_sampled_from_mask: 4096
|
|
||||||
stratified_point_sampling_training: true
|
|
||||||
stratified_point_sampling_evaluation: false
|
|
||||||
scene_extent: 2.0
|
|
||||||
scene_center:
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
renderer_MultiPassEmissionAbsorptionRenderer_args:
|
|
||||||
density_noise_std_train: 0.0
|
|
||||||
n_pts_per_ray_fine_training: 128
|
|
||||||
n_pts_per_ray_fine_evaluation: 128
|
|
||||||
raymarcher_EmissionAbsorptionRaymarcher_args:
|
|
||||||
blend_output: false
|
|
||||||
loss_weights:
|
|
||||||
loss_rgb_mse: 1.0
|
|
||||||
loss_prev_stage_rgb_mse: 1.0
|
|
||||||
loss_mask_bce: 0.0
|
|
||||||
loss_prev_stage_mask_bce: 0.0
|
|
||||||
loss_autodecoder_norm: 0.00
|
|
||||||
|
|
||||||
optimizer_factory_ImplicitronOptimizerFactory_args:
|
|
||||||
exponential_lr_step_size: 3001
|
|
||||||
lr_policy: LinearExponential
|
|
||||||
linear_exponential_lr_milestone: 200
|
|
||||||
|
|
||||||
training_loop_ImplicitronTrainingLoop_args:
|
|
||||||
max_epochs: 6000
|
|
||||||
metric_print_interval: 10
|
|
||||||
store_checkpoints_purge: 3
|
|
||||||
test_when_finished: true
|
|
||||||
validation_interval: 100
|
|
||||||
@@ -5,8 +5,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
""""
|
""""
|
||||||
This file is the entry point for launching experiments with Implicitron.
|
This file is the entry point for launching experiments with Implicitron.
|
||||||
|
|
||||||
@@ -61,7 +59,7 @@ from pytorch3d.implicitron.dataset.data_source import (
|
|||||||
DataSourceBase,
|
DataSourceBase,
|
||||||
ImplicitronDataSource,
|
ImplicitronDataSource,
|
||||||
)
|
)
|
||||||
from pytorch3d.implicitron.models.base_model import ImplicitronModelBase
|
from pytorch3d.implicitron.models.generic_model import ImplicitronModelBase
|
||||||
|
|
||||||
from pytorch3d.implicitron.models.renderer.multipass_ea import (
|
from pytorch3d.implicitron.models.renderer.multipass_ea import (
|
||||||
MultiPassEmissionAbsorptionRenderer,
|
MultiPassEmissionAbsorptionRenderer,
|
||||||
@@ -99,7 +97,7 @@ except ModuleNotFoundError:
|
|||||||
no_accelerate = os.environ.get("PYTORCH3D_NO_ACCELERATE") is not None
|
no_accelerate = os.environ.get("PYTORCH3D_NO_ACCELERATE") is not None
|
||||||
|
|
||||||
|
|
||||||
class Experiment(Configurable):
|
class Experiment(Configurable): # pyre-ignore: 13
|
||||||
"""
|
"""
|
||||||
This class is at the top level of Implicitron's config hierarchy. Its
|
This class is at the top level of Implicitron's config hierarchy. Its
|
||||||
members are high-level components necessary for training an implicit rende-
|
members are high-level components necessary for training an implicit rende-
|
||||||
@@ -120,16 +118,12 @@ class Experiment(Configurable):
|
|||||||
will be saved here.
|
will be saved here.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# pyre-fixme[13]: Attribute `data_source` is never initialized.
|
|
||||||
data_source: DataSourceBase
|
data_source: DataSourceBase
|
||||||
data_source_class_type: str = "ImplicitronDataSource"
|
data_source_class_type: str = "ImplicitronDataSource"
|
||||||
# pyre-fixme[13]: Attribute `model_factory` is never initialized.
|
|
||||||
model_factory: ModelFactoryBase
|
model_factory: ModelFactoryBase
|
||||||
model_factory_class_type: str = "ImplicitronModelFactory"
|
model_factory_class_type: str = "ImplicitronModelFactory"
|
||||||
# pyre-fixme[13]: Attribute `optimizer_factory` is never initialized.
|
|
||||||
optimizer_factory: OptimizerFactoryBase
|
optimizer_factory: OptimizerFactoryBase
|
||||||
optimizer_factory_class_type: str = "ImplicitronOptimizerFactory"
|
optimizer_factory_class_type: str = "ImplicitronOptimizerFactory"
|
||||||
# pyre-fixme[13]: Attribute `training_loop` is never initialized.
|
|
||||||
training_loop: TrainingLoopBase
|
training_loop: TrainingLoopBase
|
||||||
training_loop_class_type: str = "ImplicitronTrainingLoop"
|
training_loop_class_type: str = "ImplicitronTrainingLoop"
|
||||||
|
|
||||||
@@ -213,6 +207,12 @@ class Experiment(Configurable):
|
|||||||
val_loader,
|
val_loader,
|
||||||
) = accelerator.prepare(model, optimizer, train_loader, val_loader)
|
) = accelerator.prepare(model, optimizer, train_loader, val_loader)
|
||||||
|
|
||||||
|
# pyre-fixme[16]: Optional type has no attribute `is_multisequence`.
|
||||||
|
if not self.training_loop.evaluator.is_multisequence:
|
||||||
|
all_train_cameras = self.data_source.all_train_cameras
|
||||||
|
else:
|
||||||
|
all_train_cameras = None
|
||||||
|
|
||||||
# Enter the main training loop.
|
# Enter the main training loop.
|
||||||
self.training_loop.run(
|
self.training_loop.run(
|
||||||
train_loader=train_loader,
|
train_loader=train_loader,
|
||||||
@@ -223,6 +223,7 @@ class Experiment(Configurable):
|
|||||||
model=model,
|
model=model,
|
||||||
optimizer=optimizer,
|
optimizer=optimizer,
|
||||||
scheduler=scheduler,
|
scheduler=scheduler,
|
||||||
|
all_train_cameras=all_train_cameras,
|
||||||
accelerator=accelerator,
|
accelerator=accelerator,
|
||||||
device=device,
|
device=device,
|
||||||
exp_dir=self.exp_dir,
|
exp_dir=self.exp_dir,
|
||||||
|
|||||||
@@ -3,5 +3,3 @@
|
|||||||
#
|
#
|
||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
@@ -45,7 +43,7 @@ class ModelFactoryBase(ReplaceableBase):
|
|||||||
|
|
||||||
|
|
||||||
@registry.register
|
@registry.register
|
||||||
class ImplicitronModelFactory(ModelFactoryBase):
|
class ImplicitronModelFactory(ModelFactoryBase): # pyre-ignore [13]
|
||||||
"""
|
"""
|
||||||
A factory class that initializes an implicit rendering model.
|
A factory class that initializes an implicit rendering model.
|
||||||
|
|
||||||
@@ -61,7 +59,6 @@ class ImplicitronModelFactory(ModelFactoryBase):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# pyre-fixme[13]: Attribute `model` is never initialized.
|
|
||||||
model: ImplicitronModelBase
|
model: ImplicitronModelBase
|
||||||
model_class_type: str = "GenericModel"
|
model_class_type: str = "GenericModel"
|
||||||
resume: bool = True
|
resume: bool = True
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@@ -123,6 +121,7 @@ class ImplicitronOptimizerFactory(OptimizerFactoryBase):
|
|||||||
"""
|
"""
|
||||||
# Get the parameters to optimize
|
# Get the parameters to optimize
|
||||||
if hasattr(model, "_get_param_groups"): # use the model function
|
if hasattr(model, "_get_param_groups"): # use the model function
|
||||||
|
# pyre-ignore[29]
|
||||||
p_groups = model._get_param_groups(self.lr, wd=self.weight_decay)
|
p_groups = model._get_param_groups(self.lr, wd=self.weight_decay)
|
||||||
else:
|
else:
|
||||||
p_groups = [
|
p_groups = [
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
@@ -23,6 +21,7 @@ from pytorch3d.implicitron.tools.config import (
|
|||||||
run_auto_creation,
|
run_auto_creation,
|
||||||
)
|
)
|
||||||
from pytorch3d.implicitron.tools.stats import Stats
|
from pytorch3d.implicitron.tools.stats import Stats
|
||||||
|
from pytorch3d.renderer.cameras import CamerasBase
|
||||||
from torch.utils.data import DataLoader, Dataset
|
from torch.utils.data import DataLoader, Dataset
|
||||||
|
|
||||||
from .utils import seed_all_random_engines
|
from .utils import seed_all_random_engines
|
||||||
@@ -30,13 +29,13 @@ from .utils import seed_all_random_engines
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
# pyre-fixme[13]: Attribute `evaluator` is never initialized.
|
||||||
class TrainingLoopBase(ReplaceableBase):
|
class TrainingLoopBase(ReplaceableBase):
|
||||||
"""
|
"""
|
||||||
Members:
|
Members:
|
||||||
evaluator: An EvaluatorBase instance, used to evaluate training results.
|
evaluator: An EvaluatorBase instance, used to evaluate training results.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# pyre-fixme[13]: Attribute `evaluator` is never initialized.
|
|
||||||
evaluator: Optional[EvaluatorBase]
|
evaluator: Optional[EvaluatorBase]
|
||||||
evaluator_class_type: Optional[str] = "ImplicitronEvaluator"
|
evaluator_class_type: Optional[str] = "ImplicitronEvaluator"
|
||||||
|
|
||||||
@@ -112,8 +111,6 @@ class ImplicitronTrainingLoop(TrainingLoopBase):
|
|||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
run_auto_creation(self)
|
run_auto_creation(self)
|
||||||
|
|
||||||
# pyre-fixme[14]: `run` overrides method defined in `TrainingLoopBase`
|
|
||||||
# inconsistently.
|
|
||||||
def run(
|
def run(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
@@ -125,6 +122,7 @@ class ImplicitronTrainingLoop(TrainingLoopBase):
|
|||||||
optimizer: torch.optim.Optimizer,
|
optimizer: torch.optim.Optimizer,
|
||||||
scheduler: Any,
|
scheduler: Any,
|
||||||
accelerator: Optional[Accelerator],
|
accelerator: Optional[Accelerator],
|
||||||
|
all_train_cameras: Optional[CamerasBase],
|
||||||
device: torch.device,
|
device: torch.device,
|
||||||
exp_dir: str,
|
exp_dir: str,
|
||||||
stats: Stats,
|
stats: Stats,
|
||||||
@@ -144,6 +142,7 @@ class ImplicitronTrainingLoop(TrainingLoopBase):
|
|||||||
if test_loader is not None:
|
if test_loader is not None:
|
||||||
# pyre-fixme[16]: `Optional` has no attribute `run`.
|
# pyre-fixme[16]: `Optional` has no attribute `run`.
|
||||||
self.evaluator.run(
|
self.evaluator.run(
|
||||||
|
all_train_cameras=all_train_cameras,
|
||||||
dataloader=test_loader,
|
dataloader=test_loader,
|
||||||
device=device,
|
device=device,
|
||||||
dump_to_json=True,
|
dump_to_json=True,
|
||||||
@@ -201,6 +200,7 @@ class ImplicitronTrainingLoop(TrainingLoopBase):
|
|||||||
and epoch % self.test_interval == 0
|
and epoch % self.test_interval == 0
|
||||||
):
|
):
|
||||||
self.evaluator.run(
|
self.evaluator.run(
|
||||||
|
all_train_cameras=all_train_cameras,
|
||||||
device=device,
|
device=device,
|
||||||
dataloader=test_loader,
|
dataloader=test_loader,
|
||||||
model=model,
|
model=model,
|
||||||
@@ -217,6 +217,7 @@ class ImplicitronTrainingLoop(TrainingLoopBase):
|
|||||||
if self.test_when_finished:
|
if self.test_when_finished:
|
||||||
if test_loader is not None:
|
if test_loader is not None:
|
||||||
self.evaluator.run(
|
self.evaluator.run(
|
||||||
|
all_train_cameras=all_train_cameras,
|
||||||
device=device,
|
device=device,
|
||||||
dump_to_json=True,
|
dump_to_json=True,
|
||||||
epoch=stats.epoch,
|
epoch=stats.epoch,
|
||||||
@@ -259,6 +260,7 @@ class ImplicitronTrainingLoop(TrainingLoopBase):
|
|||||||
list(log_vars),
|
list(log_vars),
|
||||||
plot_file=os.path.join(exp_dir, "train_stats.pdf"),
|
plot_file=os.path.join(exp_dir, "train_stats.pdf"),
|
||||||
visdom_env=visdom_env_charts,
|
visdom_env=visdom_env_charts,
|
||||||
|
verbose=False,
|
||||||
visdom_server=self.visdom_server,
|
visdom_server=self.visdom_server,
|
||||||
visdom_port=self.visdom_port,
|
visdom_port=self.visdom_port,
|
||||||
)
|
)
|
||||||
@@ -384,8 +386,7 @@ class ImplicitronTrainingLoop(TrainingLoopBase):
|
|||||||
|
|
||||||
# print textual status update
|
# print textual status update
|
||||||
if it % self.metric_print_interval == 0 or last_iter:
|
if it % self.metric_print_interval == 0 or last_iter:
|
||||||
std_out = stats.get_status_string(stat_set=trainmode, max_it=n_batches)
|
stats.print(stat_set=trainmode, max_it=n_batches)
|
||||||
logger.info(std_out)
|
|
||||||
|
|
||||||
# visualize results
|
# visualize results
|
||||||
if (
|
if (
|
||||||
@@ -395,6 +396,7 @@ class ImplicitronTrainingLoop(TrainingLoopBase):
|
|||||||
):
|
):
|
||||||
prefix = f"e{stats.epoch}_it{stats.it[trainmode]}"
|
prefix = f"e{stats.epoch}_it{stats.it[trainmode]}"
|
||||||
if hasattr(model, "visualize"):
|
if hasattr(model, "visualize"):
|
||||||
|
# pyre-ignore [29]
|
||||||
model.visualize(
|
model.visualize(
|
||||||
viz,
|
viz,
|
||||||
visdom_env_imgs,
|
visdom_env_imgs,
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
|||||||
@@ -3,5 +3,3 @@
|
|||||||
#
|
#
|
||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|||||||
@@ -103,10 +103,8 @@ data_source_ImplicitronDataSource_args:
|
|||||||
num_views: 40
|
num_views: 40
|
||||||
data_file: null
|
data_file: null
|
||||||
azimuth_range: 180.0
|
azimuth_range: 180.0
|
||||||
distance: 2.7
|
|
||||||
resolution: 128
|
resolution: 128
|
||||||
use_point_light: true
|
use_point_light: true
|
||||||
gpu_idx: 0
|
|
||||||
path_manager_factory_class_type: PathManagerFactory
|
path_manager_factory_class_type: PathManagerFactory
|
||||||
path_manager_factory_PathManagerFactory_args:
|
path_manager_factory_PathManagerFactory_args:
|
||||||
silence_logs: true
|
silence_logs: true
|
||||||
@@ -129,19 +127,6 @@ data_source_ImplicitronDataSource_args:
|
|||||||
dataset_length_train: 0
|
dataset_length_train: 0
|
||||||
dataset_length_val: 0
|
dataset_length_val: 0
|
||||||
dataset_length_test: 0
|
dataset_length_test: 0
|
||||||
data_loader_map_provider_TrainEvalDataLoaderMapProvider_args:
|
|
||||||
batch_size: 1
|
|
||||||
num_workers: 0
|
|
||||||
dataset_length_train: 0
|
|
||||||
dataset_length_val: 0
|
|
||||||
dataset_length_test: 0
|
|
||||||
train_conditioning_type: SAME
|
|
||||||
val_conditioning_type: SAME
|
|
||||||
test_conditioning_type: KNOWN
|
|
||||||
images_per_seq_options: []
|
|
||||||
sample_consecutive_frames: false
|
|
||||||
consecutive_frames_max_gap: 0
|
|
||||||
consecutive_frames_max_gap_seconds: 0.1
|
|
||||||
model_factory_ImplicitronModelFactory_args:
|
model_factory_ImplicitronModelFactory_args:
|
||||||
resume: true
|
resume: true
|
||||||
model_class_type: GenericModel
|
model_class_type: GenericModel
|
||||||
@@ -216,7 +201,6 @@ model_factory_ImplicitronModelFactory_args:
|
|||||||
n_rays_total_training: null
|
n_rays_total_training: null
|
||||||
stratified_point_sampling_training: true
|
stratified_point_sampling_training: true
|
||||||
stratified_point_sampling_evaluation: false
|
stratified_point_sampling_evaluation: false
|
||||||
cast_ray_bundle_as_cone: false
|
|
||||||
scene_extent: 8.0
|
scene_extent: 8.0
|
||||||
scene_center:
|
scene_center:
|
||||||
- 0.0
|
- 0.0
|
||||||
@@ -229,7 +213,6 @@ model_factory_ImplicitronModelFactory_args:
|
|||||||
n_rays_total_training: null
|
n_rays_total_training: null
|
||||||
stratified_point_sampling_training: true
|
stratified_point_sampling_training: true
|
||||||
stratified_point_sampling_evaluation: false
|
stratified_point_sampling_evaluation: false
|
||||||
cast_ray_bundle_as_cone: false
|
|
||||||
min_depth: 0.1
|
min_depth: 0.1
|
||||||
max_depth: 8.0
|
max_depth: 8.0
|
||||||
renderer_LSTMRenderer_args:
|
renderer_LSTMRenderer_args:
|
||||||
@@ -249,8 +232,6 @@ model_factory_ImplicitronModelFactory_args:
|
|||||||
append_coarse_samples_to_fine: true
|
append_coarse_samples_to_fine: true
|
||||||
density_noise_std_train: 0.0
|
density_noise_std_train: 0.0
|
||||||
return_weights: false
|
return_weights: false
|
||||||
blurpool_weights: false
|
|
||||||
sample_pdf_eps: 1.0e-05
|
|
||||||
raymarcher_CumsumRaymarcher_args:
|
raymarcher_CumsumRaymarcher_args:
|
||||||
surface_thickness: 1
|
surface_thickness: 1
|
||||||
bg_color:
|
bg_color:
|
||||||
@@ -363,7 +344,6 @@ model_factory_ImplicitronModelFactory_args:
|
|||||||
n_hidden_neurons_dir: 128
|
n_hidden_neurons_dir: 128
|
||||||
input_xyz: true
|
input_xyz: true
|
||||||
xyz_ray_dir_in_camera_coords: false
|
xyz_ray_dir_in_camera_coords: false
|
||||||
use_integrated_positional_encoding: false
|
|
||||||
transformer_dim_down_factor: 2.0
|
transformer_dim_down_factor: 2.0
|
||||||
n_hidden_neurons_xyz: 80
|
n_hidden_neurons_xyz: 80
|
||||||
n_layers_xyz: 2
|
n_layers_xyz: 2
|
||||||
@@ -375,7 +355,6 @@ model_factory_ImplicitronModelFactory_args:
|
|||||||
n_hidden_neurons_dir: 128
|
n_hidden_neurons_dir: 128
|
||||||
input_xyz: true
|
input_xyz: true
|
||||||
xyz_ray_dir_in_camera_coords: false
|
xyz_ray_dir_in_camera_coords: false
|
||||||
use_integrated_positional_encoding: false
|
|
||||||
transformer_dim_down_factor: 1.0
|
transformer_dim_down_factor: 1.0
|
||||||
n_hidden_neurons_xyz: 256
|
n_hidden_neurons_xyz: 256
|
||||||
n_layers_xyz: 8
|
n_layers_xyz: 8
|
||||||
@@ -580,631 +559,6 @@ model_factory_ImplicitronModelFactory_args:
|
|||||||
use_xavier_init: true
|
use_xavier_init: true
|
||||||
view_metrics_ViewMetrics_args: {}
|
view_metrics_ViewMetrics_args: {}
|
||||||
regularization_metrics_RegularizationMetrics_args: {}
|
regularization_metrics_RegularizationMetrics_args: {}
|
||||||
model_OverfitModel_args:
|
|
||||||
log_vars:
|
|
||||||
- loss_rgb_psnr_fg
|
|
||||||
- loss_rgb_psnr
|
|
||||||
- loss_rgb_mse
|
|
||||||
- loss_rgb_huber
|
|
||||||
- loss_depth_abs
|
|
||||||
- loss_depth_abs_fg
|
|
||||||
- loss_mask_neg_iou
|
|
||||||
- loss_mask_bce
|
|
||||||
- loss_mask_beta_prior
|
|
||||||
- loss_eikonal
|
|
||||||
- loss_density_tv
|
|
||||||
- loss_depth_neg_penalty
|
|
||||||
- loss_autodecoder_norm
|
|
||||||
- loss_prev_stage_rgb_mse
|
|
||||||
- loss_prev_stage_rgb_psnr_fg
|
|
||||||
- loss_prev_stage_rgb_psnr
|
|
||||||
- loss_prev_stage_mask_bce
|
|
||||||
- objective
|
|
||||||
- epoch
|
|
||||||
- sec/it
|
|
||||||
mask_images: true
|
|
||||||
mask_depths: true
|
|
||||||
render_image_width: 400
|
|
||||||
render_image_height: 400
|
|
||||||
mask_threshold: 0.5
|
|
||||||
output_rasterized_mc: false
|
|
||||||
bg_color:
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
chunk_size_grid: 4096
|
|
||||||
render_features_dimensions: 3
|
|
||||||
tqdm_trigger_threshold: 16
|
|
||||||
n_train_target_views: 1
|
|
||||||
sampling_mode_training: mask_sample
|
|
||||||
sampling_mode_evaluation: full_grid
|
|
||||||
global_encoder_class_type: null
|
|
||||||
raysampler_class_type: AdaptiveRaySampler
|
|
||||||
renderer_class_type: MultiPassEmissionAbsorptionRenderer
|
|
||||||
share_implicit_function_across_passes: false
|
|
||||||
implicit_function_class_type: NeuralRadianceFieldImplicitFunction
|
|
||||||
coarse_implicit_function_class_type: null
|
|
||||||
view_metrics_class_type: ViewMetrics
|
|
||||||
regularization_metrics_class_type: RegularizationMetrics
|
|
||||||
loss_weights:
|
|
||||||
loss_rgb_mse: 1.0
|
|
||||||
loss_prev_stage_rgb_mse: 1.0
|
|
||||||
loss_mask_bce: 0.0
|
|
||||||
loss_prev_stage_mask_bce: 0.0
|
|
||||||
global_encoder_HarmonicTimeEncoder_args:
|
|
||||||
n_harmonic_functions: 10
|
|
||||||
append_input: true
|
|
||||||
time_divisor: 1.0
|
|
||||||
global_encoder_SequenceAutodecoder_args:
|
|
||||||
autodecoder_args:
|
|
||||||
encoding_dim: 0
|
|
||||||
n_instances: 1
|
|
||||||
init_scale: 1.0
|
|
||||||
ignore_input: false
|
|
||||||
raysampler_AdaptiveRaySampler_args:
|
|
||||||
n_pts_per_ray_training: 64
|
|
||||||
n_pts_per_ray_evaluation: 64
|
|
||||||
n_rays_per_image_sampled_from_mask: 1024
|
|
||||||
n_rays_total_training: null
|
|
||||||
stratified_point_sampling_training: true
|
|
||||||
stratified_point_sampling_evaluation: false
|
|
||||||
cast_ray_bundle_as_cone: false
|
|
||||||
scene_extent: 8.0
|
|
||||||
scene_center:
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
raysampler_NearFarRaySampler_args:
|
|
||||||
n_pts_per_ray_training: 64
|
|
||||||
n_pts_per_ray_evaluation: 64
|
|
||||||
n_rays_per_image_sampled_from_mask: 1024
|
|
||||||
n_rays_total_training: null
|
|
||||||
stratified_point_sampling_training: true
|
|
||||||
stratified_point_sampling_evaluation: false
|
|
||||||
cast_ray_bundle_as_cone: false
|
|
||||||
min_depth: 0.1
|
|
||||||
max_depth: 8.0
|
|
||||||
renderer_LSTMRenderer_args:
|
|
||||||
num_raymarch_steps: 10
|
|
||||||
init_depth: 17.0
|
|
||||||
init_depth_noise_std: 0.0005
|
|
||||||
hidden_size: 16
|
|
||||||
n_feature_channels: 256
|
|
||||||
bg_color: null
|
|
||||||
verbose: false
|
|
||||||
renderer_MultiPassEmissionAbsorptionRenderer_args:
|
|
||||||
raymarcher_class_type: EmissionAbsorptionRaymarcher
|
|
||||||
n_pts_per_ray_fine_training: 64
|
|
||||||
n_pts_per_ray_fine_evaluation: 64
|
|
||||||
stratified_sampling_coarse_training: true
|
|
||||||
stratified_sampling_coarse_evaluation: false
|
|
||||||
append_coarse_samples_to_fine: true
|
|
||||||
density_noise_std_train: 0.0
|
|
||||||
return_weights: false
|
|
||||||
blurpool_weights: false
|
|
||||||
sample_pdf_eps: 1.0e-05
|
|
||||||
raymarcher_CumsumRaymarcher_args:
|
|
||||||
surface_thickness: 1
|
|
||||||
bg_color:
|
|
||||||
- 0.0
|
|
||||||
replicate_last_interval: false
|
|
||||||
background_opacity: 0.0
|
|
||||||
density_relu: true
|
|
||||||
blend_output: false
|
|
||||||
raymarcher_EmissionAbsorptionRaymarcher_args:
|
|
||||||
surface_thickness: 1
|
|
||||||
bg_color:
|
|
||||||
- 0.0
|
|
||||||
replicate_last_interval: false
|
|
||||||
background_opacity: 10000000000.0
|
|
||||||
density_relu: true
|
|
||||||
blend_output: false
|
|
||||||
renderer_SignedDistanceFunctionRenderer_args:
|
|
||||||
ray_normal_coloring_network_args:
|
|
||||||
feature_vector_size: 3
|
|
||||||
mode: idr
|
|
||||||
d_in: 9
|
|
||||||
d_out: 3
|
|
||||||
dims:
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
weight_norm: true
|
|
||||||
n_harmonic_functions_dir: 0
|
|
||||||
pooled_feature_dim: 0
|
|
||||||
bg_color:
|
|
||||||
- 0.0
|
|
||||||
soft_mask_alpha: 50.0
|
|
||||||
ray_tracer_args:
|
|
||||||
sdf_threshold: 5.0e-05
|
|
||||||
line_search_step: 0.5
|
|
||||||
line_step_iters: 1
|
|
||||||
sphere_tracing_iters: 10
|
|
||||||
n_steps: 100
|
|
||||||
n_secant_steps: 8
|
|
||||||
implicit_function_IdrFeatureField_args:
|
|
||||||
d_in: 3
|
|
||||||
d_out: 1
|
|
||||||
dims:
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
geometric_init: true
|
|
||||||
bias: 1.0
|
|
||||||
skip_in: []
|
|
||||||
weight_norm: true
|
|
||||||
n_harmonic_functions_xyz: 0
|
|
||||||
pooled_feature_dim: 0
|
|
||||||
implicit_function_NeRFormerImplicitFunction_args:
|
|
||||||
n_harmonic_functions_xyz: 10
|
|
||||||
n_harmonic_functions_dir: 4
|
|
||||||
n_hidden_neurons_dir: 128
|
|
||||||
input_xyz: true
|
|
||||||
xyz_ray_dir_in_camera_coords: false
|
|
||||||
use_integrated_positional_encoding: false
|
|
||||||
transformer_dim_down_factor: 2.0
|
|
||||||
n_hidden_neurons_xyz: 80
|
|
||||||
n_layers_xyz: 2
|
|
||||||
append_xyz:
|
|
||||||
- 1
|
|
||||||
implicit_function_NeuralRadianceFieldImplicitFunction_args:
|
|
||||||
n_harmonic_functions_xyz: 10
|
|
||||||
n_harmonic_functions_dir: 4
|
|
||||||
n_hidden_neurons_dir: 128
|
|
||||||
input_xyz: true
|
|
||||||
xyz_ray_dir_in_camera_coords: false
|
|
||||||
use_integrated_positional_encoding: false
|
|
||||||
transformer_dim_down_factor: 1.0
|
|
||||||
n_hidden_neurons_xyz: 256
|
|
||||||
n_layers_xyz: 8
|
|
||||||
append_xyz:
|
|
||||||
- 5
|
|
||||||
implicit_function_SRNHyperNetImplicitFunction_args:
|
|
||||||
latent_dim_hypernet: 0
|
|
||||||
hypernet_args:
|
|
||||||
n_harmonic_functions: 3
|
|
||||||
n_hidden_units: 256
|
|
||||||
n_layers: 2
|
|
||||||
n_hidden_units_hypernet: 256
|
|
||||||
n_layers_hypernet: 1
|
|
||||||
in_features: 3
|
|
||||||
out_features: 256
|
|
||||||
xyz_in_camera_coords: false
|
|
||||||
pixel_generator_args:
|
|
||||||
n_harmonic_functions: 4
|
|
||||||
n_hidden_units: 256
|
|
||||||
n_hidden_units_color: 128
|
|
||||||
n_layers: 2
|
|
||||||
in_features: 256
|
|
||||||
out_features: 3
|
|
||||||
ray_dir_in_camera_coords: false
|
|
||||||
implicit_function_SRNImplicitFunction_args:
|
|
||||||
raymarch_function_args:
|
|
||||||
n_harmonic_functions: 3
|
|
||||||
n_hidden_units: 256
|
|
||||||
n_layers: 2
|
|
||||||
in_features: 3
|
|
||||||
out_features: 256
|
|
||||||
xyz_in_camera_coords: false
|
|
||||||
raymarch_function: null
|
|
||||||
pixel_generator_args:
|
|
||||||
n_harmonic_functions: 4
|
|
||||||
n_hidden_units: 256
|
|
||||||
n_hidden_units_color: 128
|
|
||||||
n_layers: 2
|
|
||||||
in_features: 256
|
|
||||||
out_features: 3
|
|
||||||
ray_dir_in_camera_coords: false
|
|
||||||
implicit_function_VoxelGridImplicitFunction_args:
|
|
||||||
harmonic_embedder_xyz_density_args:
|
|
||||||
n_harmonic_functions: 6
|
|
||||||
omega_0: 1.0
|
|
||||||
logspace: true
|
|
||||||
append_input: true
|
|
||||||
harmonic_embedder_xyz_color_args:
|
|
||||||
n_harmonic_functions: 6
|
|
||||||
omega_0: 1.0
|
|
||||||
logspace: true
|
|
||||||
append_input: true
|
|
||||||
harmonic_embedder_dir_color_args:
|
|
||||||
n_harmonic_functions: 6
|
|
||||||
omega_0: 1.0
|
|
||||||
logspace: true
|
|
||||||
append_input: true
|
|
||||||
decoder_density_class_type: MLPDecoder
|
|
||||||
decoder_color_class_type: MLPDecoder
|
|
||||||
use_multiple_streams: true
|
|
||||||
xyz_ray_dir_in_camera_coords: false
|
|
||||||
scaffold_calculating_epochs: []
|
|
||||||
scaffold_resolution:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
scaffold_empty_space_threshold: 0.001
|
|
||||||
scaffold_occupancy_chunk_size: -1
|
|
||||||
scaffold_max_pool_kernel_size: 3
|
|
||||||
scaffold_filter_points: true
|
|
||||||
volume_cropping_epochs: []
|
|
||||||
voxel_grid_density_args:
|
|
||||||
voxel_grid_class_type: FullResolutionVoxelGrid
|
|
||||||
extents:
|
|
||||||
- 2.0
|
|
||||||
- 2.0
|
|
||||||
- 2.0
|
|
||||||
translation:
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
init_std: 0.1
|
|
||||||
init_mean: 0.0
|
|
||||||
hold_voxel_grid_as_parameters: true
|
|
||||||
param_groups: {}
|
|
||||||
voxel_grid_CPFactorizedVoxelGrid_args:
|
|
||||||
align_corners: true
|
|
||||||
padding: zeros
|
|
||||||
mode: bilinear
|
|
||||||
n_features: 1
|
|
||||||
resolution_changes:
|
|
||||||
0:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
n_components: 24
|
|
||||||
basis_matrix: true
|
|
||||||
voxel_grid_FullResolutionVoxelGrid_args:
|
|
||||||
align_corners: true
|
|
||||||
padding: zeros
|
|
||||||
mode: bilinear
|
|
||||||
n_features: 1
|
|
||||||
resolution_changes:
|
|
||||||
0:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
voxel_grid_VMFactorizedVoxelGrid_args:
|
|
||||||
align_corners: true
|
|
||||||
padding: zeros
|
|
||||||
mode: bilinear
|
|
||||||
n_features: 1
|
|
||||||
resolution_changes:
|
|
||||||
0:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
n_components: null
|
|
||||||
distribution_of_components: null
|
|
||||||
basis_matrix: true
|
|
||||||
voxel_grid_color_args:
|
|
||||||
voxel_grid_class_type: FullResolutionVoxelGrid
|
|
||||||
extents:
|
|
||||||
- 2.0
|
|
||||||
- 2.0
|
|
||||||
- 2.0
|
|
||||||
translation:
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
init_std: 0.1
|
|
||||||
init_mean: 0.0
|
|
||||||
hold_voxel_grid_as_parameters: true
|
|
||||||
param_groups: {}
|
|
||||||
voxel_grid_CPFactorizedVoxelGrid_args:
|
|
||||||
align_corners: true
|
|
||||||
padding: zeros
|
|
||||||
mode: bilinear
|
|
||||||
n_features: 1
|
|
||||||
resolution_changes:
|
|
||||||
0:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
n_components: 24
|
|
||||||
basis_matrix: true
|
|
||||||
voxel_grid_FullResolutionVoxelGrid_args:
|
|
||||||
align_corners: true
|
|
||||||
padding: zeros
|
|
||||||
mode: bilinear
|
|
||||||
n_features: 1
|
|
||||||
resolution_changes:
|
|
||||||
0:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
voxel_grid_VMFactorizedVoxelGrid_args:
|
|
||||||
align_corners: true
|
|
||||||
padding: zeros
|
|
||||||
mode: bilinear
|
|
||||||
n_features: 1
|
|
||||||
resolution_changes:
|
|
||||||
0:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
n_components: null
|
|
||||||
distribution_of_components: null
|
|
||||||
basis_matrix: true
|
|
||||||
decoder_density_ElementwiseDecoder_args:
|
|
||||||
scale: 1.0
|
|
||||||
shift: 0.0
|
|
||||||
operation: IDENTITY
|
|
||||||
decoder_density_MLPDecoder_args:
|
|
||||||
param_groups: {}
|
|
||||||
network_args:
|
|
||||||
n_layers: 8
|
|
||||||
output_dim: 256
|
|
||||||
skip_dim: 39
|
|
||||||
hidden_dim: 256
|
|
||||||
input_skips:
|
|
||||||
- 5
|
|
||||||
skip_affine_trans: false
|
|
||||||
last_layer_bias_init: null
|
|
||||||
last_activation: RELU
|
|
||||||
use_xavier_init: true
|
|
||||||
decoder_color_ElementwiseDecoder_args:
|
|
||||||
scale: 1.0
|
|
||||||
shift: 0.0
|
|
||||||
operation: IDENTITY
|
|
||||||
decoder_color_MLPDecoder_args:
|
|
||||||
param_groups: {}
|
|
||||||
network_args:
|
|
||||||
n_layers: 8
|
|
||||||
output_dim: 256
|
|
||||||
skip_dim: 39
|
|
||||||
hidden_dim: 256
|
|
||||||
input_skips:
|
|
||||||
- 5
|
|
||||||
skip_affine_trans: false
|
|
||||||
last_layer_bias_init: null
|
|
||||||
last_activation: RELU
|
|
||||||
use_xavier_init: true
|
|
||||||
coarse_implicit_function_IdrFeatureField_args:
|
|
||||||
d_in: 3
|
|
||||||
d_out: 1
|
|
||||||
dims:
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
- 512
|
|
||||||
geometric_init: true
|
|
||||||
bias: 1.0
|
|
||||||
skip_in: []
|
|
||||||
weight_norm: true
|
|
||||||
n_harmonic_functions_xyz: 0
|
|
||||||
pooled_feature_dim: 0
|
|
||||||
coarse_implicit_function_NeRFormerImplicitFunction_args:
|
|
||||||
n_harmonic_functions_xyz: 10
|
|
||||||
n_harmonic_functions_dir: 4
|
|
||||||
n_hidden_neurons_dir: 128
|
|
||||||
input_xyz: true
|
|
||||||
xyz_ray_dir_in_camera_coords: false
|
|
||||||
use_integrated_positional_encoding: false
|
|
||||||
transformer_dim_down_factor: 2.0
|
|
||||||
n_hidden_neurons_xyz: 80
|
|
||||||
n_layers_xyz: 2
|
|
||||||
append_xyz:
|
|
||||||
- 1
|
|
||||||
coarse_implicit_function_NeuralRadianceFieldImplicitFunction_args:
|
|
||||||
n_harmonic_functions_xyz: 10
|
|
||||||
n_harmonic_functions_dir: 4
|
|
||||||
n_hidden_neurons_dir: 128
|
|
||||||
input_xyz: true
|
|
||||||
xyz_ray_dir_in_camera_coords: false
|
|
||||||
use_integrated_positional_encoding: false
|
|
||||||
transformer_dim_down_factor: 1.0
|
|
||||||
n_hidden_neurons_xyz: 256
|
|
||||||
n_layers_xyz: 8
|
|
||||||
append_xyz:
|
|
||||||
- 5
|
|
||||||
coarse_implicit_function_SRNHyperNetImplicitFunction_args:
|
|
||||||
latent_dim_hypernet: 0
|
|
||||||
hypernet_args:
|
|
||||||
n_harmonic_functions: 3
|
|
||||||
n_hidden_units: 256
|
|
||||||
n_layers: 2
|
|
||||||
n_hidden_units_hypernet: 256
|
|
||||||
n_layers_hypernet: 1
|
|
||||||
in_features: 3
|
|
||||||
out_features: 256
|
|
||||||
xyz_in_camera_coords: false
|
|
||||||
pixel_generator_args:
|
|
||||||
n_harmonic_functions: 4
|
|
||||||
n_hidden_units: 256
|
|
||||||
n_hidden_units_color: 128
|
|
||||||
n_layers: 2
|
|
||||||
in_features: 256
|
|
||||||
out_features: 3
|
|
||||||
ray_dir_in_camera_coords: false
|
|
||||||
coarse_implicit_function_SRNImplicitFunction_args:
|
|
||||||
raymarch_function_args:
|
|
||||||
n_harmonic_functions: 3
|
|
||||||
n_hidden_units: 256
|
|
||||||
n_layers: 2
|
|
||||||
in_features: 3
|
|
||||||
out_features: 256
|
|
||||||
xyz_in_camera_coords: false
|
|
||||||
raymarch_function: null
|
|
||||||
pixel_generator_args:
|
|
||||||
n_harmonic_functions: 4
|
|
||||||
n_hidden_units: 256
|
|
||||||
n_hidden_units_color: 128
|
|
||||||
n_layers: 2
|
|
||||||
in_features: 256
|
|
||||||
out_features: 3
|
|
||||||
ray_dir_in_camera_coords: false
|
|
||||||
coarse_implicit_function_VoxelGridImplicitFunction_args:
|
|
||||||
harmonic_embedder_xyz_density_args:
|
|
||||||
n_harmonic_functions: 6
|
|
||||||
omega_0: 1.0
|
|
||||||
logspace: true
|
|
||||||
append_input: true
|
|
||||||
harmonic_embedder_xyz_color_args:
|
|
||||||
n_harmonic_functions: 6
|
|
||||||
omega_0: 1.0
|
|
||||||
logspace: true
|
|
||||||
append_input: true
|
|
||||||
harmonic_embedder_dir_color_args:
|
|
||||||
n_harmonic_functions: 6
|
|
||||||
omega_0: 1.0
|
|
||||||
logspace: true
|
|
||||||
append_input: true
|
|
||||||
decoder_density_class_type: MLPDecoder
|
|
||||||
decoder_color_class_type: MLPDecoder
|
|
||||||
use_multiple_streams: true
|
|
||||||
xyz_ray_dir_in_camera_coords: false
|
|
||||||
scaffold_calculating_epochs: []
|
|
||||||
scaffold_resolution:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
scaffold_empty_space_threshold: 0.001
|
|
||||||
scaffold_occupancy_chunk_size: -1
|
|
||||||
scaffold_max_pool_kernel_size: 3
|
|
||||||
scaffold_filter_points: true
|
|
||||||
volume_cropping_epochs: []
|
|
||||||
voxel_grid_density_args:
|
|
||||||
voxel_grid_class_type: FullResolutionVoxelGrid
|
|
||||||
extents:
|
|
||||||
- 2.0
|
|
||||||
- 2.0
|
|
||||||
- 2.0
|
|
||||||
translation:
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
init_std: 0.1
|
|
||||||
init_mean: 0.0
|
|
||||||
hold_voxel_grid_as_parameters: true
|
|
||||||
param_groups: {}
|
|
||||||
voxel_grid_CPFactorizedVoxelGrid_args:
|
|
||||||
align_corners: true
|
|
||||||
padding: zeros
|
|
||||||
mode: bilinear
|
|
||||||
n_features: 1
|
|
||||||
resolution_changes:
|
|
||||||
0:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
n_components: 24
|
|
||||||
basis_matrix: true
|
|
||||||
voxel_grid_FullResolutionVoxelGrid_args:
|
|
||||||
align_corners: true
|
|
||||||
padding: zeros
|
|
||||||
mode: bilinear
|
|
||||||
n_features: 1
|
|
||||||
resolution_changes:
|
|
||||||
0:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
voxel_grid_VMFactorizedVoxelGrid_args:
|
|
||||||
align_corners: true
|
|
||||||
padding: zeros
|
|
||||||
mode: bilinear
|
|
||||||
n_features: 1
|
|
||||||
resolution_changes:
|
|
||||||
0:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
n_components: null
|
|
||||||
distribution_of_components: null
|
|
||||||
basis_matrix: true
|
|
||||||
voxel_grid_color_args:
|
|
||||||
voxel_grid_class_type: FullResolutionVoxelGrid
|
|
||||||
extents:
|
|
||||||
- 2.0
|
|
||||||
- 2.0
|
|
||||||
- 2.0
|
|
||||||
translation:
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
- 0.0
|
|
||||||
init_std: 0.1
|
|
||||||
init_mean: 0.0
|
|
||||||
hold_voxel_grid_as_parameters: true
|
|
||||||
param_groups: {}
|
|
||||||
voxel_grid_CPFactorizedVoxelGrid_args:
|
|
||||||
align_corners: true
|
|
||||||
padding: zeros
|
|
||||||
mode: bilinear
|
|
||||||
n_features: 1
|
|
||||||
resolution_changes:
|
|
||||||
0:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
n_components: 24
|
|
||||||
basis_matrix: true
|
|
||||||
voxel_grid_FullResolutionVoxelGrid_args:
|
|
||||||
align_corners: true
|
|
||||||
padding: zeros
|
|
||||||
mode: bilinear
|
|
||||||
n_features: 1
|
|
||||||
resolution_changes:
|
|
||||||
0:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
voxel_grid_VMFactorizedVoxelGrid_args:
|
|
||||||
align_corners: true
|
|
||||||
padding: zeros
|
|
||||||
mode: bilinear
|
|
||||||
n_features: 1
|
|
||||||
resolution_changes:
|
|
||||||
0:
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
- 128
|
|
||||||
n_components: null
|
|
||||||
distribution_of_components: null
|
|
||||||
basis_matrix: true
|
|
||||||
decoder_density_ElementwiseDecoder_args:
|
|
||||||
scale: 1.0
|
|
||||||
shift: 0.0
|
|
||||||
operation: IDENTITY
|
|
||||||
decoder_density_MLPDecoder_args:
|
|
||||||
param_groups: {}
|
|
||||||
network_args:
|
|
||||||
n_layers: 8
|
|
||||||
output_dim: 256
|
|
||||||
skip_dim: 39
|
|
||||||
hidden_dim: 256
|
|
||||||
input_skips:
|
|
||||||
- 5
|
|
||||||
skip_affine_trans: false
|
|
||||||
last_layer_bias_init: null
|
|
||||||
last_activation: RELU
|
|
||||||
use_xavier_init: true
|
|
||||||
decoder_color_ElementwiseDecoder_args:
|
|
||||||
scale: 1.0
|
|
||||||
shift: 0.0
|
|
||||||
operation: IDENTITY
|
|
||||||
decoder_color_MLPDecoder_args:
|
|
||||||
param_groups: {}
|
|
||||||
network_args:
|
|
||||||
n_layers: 8
|
|
||||||
output_dim: 256
|
|
||||||
skip_dim: 39
|
|
||||||
hidden_dim: 256
|
|
||||||
input_skips:
|
|
||||||
- 5
|
|
||||||
skip_affine_trans: false
|
|
||||||
last_layer_bias_init: null
|
|
||||||
last_activation: RELU
|
|
||||||
use_xavier_init: true
|
|
||||||
view_metrics_ViewMetrics_args: {}
|
|
||||||
regularization_metrics_RegularizationMetrics_args: {}
|
|
||||||
optimizer_factory_ImplicitronOptimizerFactory_args:
|
optimizer_factory_ImplicitronOptimizerFactory_args:
|
||||||
betas:
|
betas:
|
||||||
- 0.9
|
- 0.9
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
@@ -134,13 +132,6 @@ class TestExperiment(unittest.TestCase):
|
|||||||
# Check that the default config values, defined by Experiment and its
|
# Check that the default config values, defined by Experiment and its
|
||||||
# members, is what we expect it to be.
|
# members, is what we expect it to be.
|
||||||
cfg = OmegaConf.structured(experiment.Experiment)
|
cfg = OmegaConf.structured(experiment.Experiment)
|
||||||
# the following removes the possible effect of env variables
|
|
||||||
ds_arg = cfg.data_source_ImplicitronDataSource_args
|
|
||||||
ds_arg.dataset_map_provider_JsonIndexDatasetMapProvider_args.dataset_root = ""
|
|
||||||
ds_arg.dataset_map_provider_JsonIndexDatasetMapProviderV2_args.dataset_root = ""
|
|
||||||
if "dataset_map_provider_SqlIndexDatasetMapProvider_args" in ds_arg:
|
|
||||||
del ds_arg.dataset_map_provider_SqlIndexDatasetMapProvider_args
|
|
||||||
cfg.training_loop_ImplicitronTrainingLoop_args.visdom_port = 8097
|
|
||||||
yaml = OmegaConf.to_yaml(cfg, sort_keys=False)
|
yaml = OmegaConf.to_yaml(cfg, sort_keys=False)
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
(DATA_DIR / "experiment.yaml").write_text(yaml)
|
(DATA_DIR / "experiment.yaml").write_text(yaml)
|
||||||
@@ -150,11 +141,7 @@ class TestExperiment(unittest.TestCase):
|
|||||||
# Check that all the pre-prepared configs are valid.
|
# Check that all the pre-prepared configs are valid.
|
||||||
config_files = []
|
config_files = []
|
||||||
|
|
||||||
for pattern in (
|
for pattern in ("repro_singleseq*.yaml", "repro_multiseq*.yaml"):
|
||||||
"repro_singleseq*.yaml",
|
|
||||||
"repro_multiseq*.yaml",
|
|
||||||
"overfit_singleseq*.yaml",
|
|
||||||
):
|
|
||||||
config_files.extend(
|
config_files.extend(
|
||||||
[
|
[
|
||||||
f
|
f
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Script to visualize a previously trained model. Example call:
|
Script to visualize a previously trained model. Example call:
|
||||||
|
|
||||||
@@ -41,7 +39,6 @@ def visualize_reconstruction(
|
|||||||
visdom_server: str = "http://127.0.0.1",
|
visdom_server: str = "http://127.0.0.1",
|
||||||
visdom_port: int = 8097,
|
visdom_port: int = 8097,
|
||||||
visdom_env: Optional[str] = None,
|
visdom_env: Optional[str] = None,
|
||||||
**render_flyaround_kwargs,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Given an `exp_dir` containing a trained Implicitron model, generates videos consisting
|
Given an `exp_dir` containing a trained Implicitron model, generates videos consisting
|
||||||
@@ -63,8 +60,6 @@ def visualize_reconstruction(
|
|||||||
visdom_server: The address of the visdom server.
|
visdom_server: The address of the visdom server.
|
||||||
visdom_port: The port of the visdom server.
|
visdom_port: The port of the visdom server.
|
||||||
visdom_env: If set, defines a custom name for the visdom environment.
|
visdom_env: If set, defines a custom name for the visdom environment.
|
||||||
render_flyaround_kwargs: Keyword arguments passed to the invoked `render_flyaround`
|
|
||||||
function (see `pytorch3d.implicitron.models.visualization.render_flyaround`).
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# In case an output directory is specified use it. If no output_directory
|
# In case an output directory is specified use it. If no output_directory
|
||||||
@@ -120,22 +115,20 @@ def visualize_reconstruction(
|
|||||||
# iterate over the sequences in the dataset
|
# iterate over the sequences in the dataset
|
||||||
for sequence_name in dataset.sequence_names():
|
for sequence_name in dataset.sequence_names():
|
||||||
with torch.no_grad():
|
with torch.no_grad():
|
||||||
render_kwargs = {
|
render_flyaround(
|
||||||
"dataset": dataset,
|
dataset=dataset,
|
||||||
"sequence_name": sequence_name,
|
sequence_name=sequence_name,
|
||||||
"model": model,
|
model=model,
|
||||||
"output_video_path": os.path.join(output_directory, "video"),
|
output_video_path=os.path.join(output_directory, "video"),
|
||||||
"n_source_views": n_source_views,
|
n_source_views=n_source_views,
|
||||||
"visdom_show_preds": visdom_show_preds,
|
visdom_show_preds=visdom_show_preds,
|
||||||
"n_flyaround_poses": n_eval_cameras,
|
n_flyaround_poses=n_eval_cameras,
|
||||||
"visdom_server": visdom_server,
|
visdom_server=visdom_server,
|
||||||
"visdom_port": visdom_port,
|
visdom_port=visdom_port,
|
||||||
"visdom_environment": visdom_env,
|
visdom_environment=visdom_env,
|
||||||
"video_resize": video_size,
|
video_resize=video_size,
|
||||||
"device": device,
|
device=device,
|
||||||
**render_flyaround_kwargs,
|
)
|
||||||
}
|
|
||||||
render_flyaround(**render_kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
enable_get_default_args(visualize_reconstruction)
|
enable_get_default_args(visualize_reconstruction)
|
||||||
|
|||||||
@@ -343,14 +343,12 @@ class RadianceFieldRenderer(torch.nn.Module):
|
|||||||
# For a full render pass concatenate the output chunks,
|
# For a full render pass concatenate the output chunks,
|
||||||
# and reshape to image size.
|
# and reshape to image size.
|
||||||
out = {
|
out = {
|
||||||
k: (
|
k: torch.cat(
|
||||||
torch.cat(
|
[ch_o[k] for ch_o in chunk_outputs],
|
||||||
[ch_o[k] for ch_o in chunk_outputs],
|
dim=1,
|
||||||
dim=1,
|
).view(-1, *self._image_size, 3)
|
||||||
).view(-1, *self._image_size, 3)
|
if chunk_outputs[0][k] is not None
|
||||||
if chunk_outputs[0][k] is not None
|
else None
|
||||||
else None
|
|
||||||
)
|
|
||||||
for k in ("rgb_fine", "rgb_coarse", "rgb_gt")
|
for k in ("rgb_fine", "rgb_coarse", "rgb_gt")
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -330,9 +330,9 @@ class NeRFRaysampler(torch.nn.Module):
|
|||||||
|
|
||||||
if self.training:
|
if self.training:
|
||||||
# During training we randomly subsample rays.
|
# During training we randomly subsample rays.
|
||||||
sel_rays = torch.randperm(
|
sel_rays = torch.randperm(n_pixels, device=device)[
|
||||||
n_pixels, device=full_ray_bundle.lengths.device
|
: self._mc_raysampler._n_rays_per_image
|
||||||
)[: self._mc_raysampler._n_rays_per_image]
|
]
|
||||||
else:
|
else:
|
||||||
# In case we test, we take only the requested chunk.
|
# In case we test, we take only the requested chunk.
|
||||||
if chunksize is None:
|
if chunksize is None:
|
||||||
|
|||||||
@@ -4,6 +4,4 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
__version__ = "0.7.2"
|
||||||
|
|
||||||
__version__ = "0.7.8"
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
from .datatypes import Device, get_device, make_device
|
from .datatypes import Device, get_device, make_device
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
from typing import Sequence, Tuple, Union
|
from typing import Sequence, Tuple, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
import sys
|
||||||
|
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
@@ -58,3 +57,19 @@ def get_device(x, device: Optional[Device] = None) -> torch.device:
|
|||||||
|
|
||||||
# Default device is cpu
|
# Default device is cpu
|
||||||
return torch.device("cpu")
|
return torch.device("cpu")
|
||||||
|
|
||||||
|
|
||||||
|
# Provide get_origin and get_args even in Python 3.7.
|
||||||
|
|
||||||
|
if sys.version_info >= (3, 8, 0):
|
||||||
|
from typing import get_args, get_origin
|
||||||
|
elif sys.version_info >= (3, 7, 0):
|
||||||
|
|
||||||
|
def get_origin(cls): # pragma: no cover
|
||||||
|
return getattr(cls, "__origin__", None)
|
||||||
|
|
||||||
|
def get_args(cls): # pragma: no cover
|
||||||
|
return getattr(cls, "__args__", None)
|
||||||
|
|
||||||
|
else:
|
||||||
|
raise ImportError("This module requires Python 3.7+")
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,5 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
from .symeig3x3 import symeig3x3
|
from .symeig3x3 import symeig3x3
|
||||||
from .utils import _safe_det_3x3
|
from .utils import _safe_det_3x3
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
#include "./pulsar/global.h" // Include before <torch/extension.h>.
|
#include "./pulsar/global.h" // Include before <torch/extension.h>.
|
||||||
#endif
|
|
||||||
#include <torch/extension.h>
|
#include <torch/extension.h>
|
||||||
// clang-format on
|
// clang-format on
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
#include "./pulsar/pytorch/renderer.h"
|
#include "./pulsar/pytorch/renderer.h"
|
||||||
#include "./pulsar/pytorch/tensor_util.h"
|
#include "./pulsar/pytorch/tensor_util.h"
|
||||||
#endif
|
|
||||||
#include "ball_query/ball_query.h"
|
#include "ball_query/ball_query.h"
|
||||||
#include "blending/sigmoid_alpha_blend.h"
|
#include "blending/sigmoid_alpha_blend.h"
|
||||||
#include "compositing/alpha_composite.h"
|
#include "compositing/alpha_composite.h"
|
||||||
@@ -103,8 +99,6 @@ PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
|
|||||||
m.def("marching_cubes", &MarchingCubes);
|
m.def("marching_cubes", &MarchingCubes);
|
||||||
|
|
||||||
// Pulsar.
|
// Pulsar.
|
||||||
// Pulsar not enabled on AMD.
|
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
#ifdef PULSAR_LOGGING_ENABLED
|
#ifdef PULSAR_LOGGING_ENABLED
|
||||||
c10::ShowLogInfoToStderr();
|
c10::ShowLogInfoToStderr();
|
||||||
#endif
|
#endif
|
||||||
@@ -189,5 +183,4 @@ PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
|
|||||||
m.attr("MAX_UINT") = py::int_(MAX_UINT);
|
m.attr("MAX_UINT") = py::int_(MAX_UINT);
|
||||||
m.attr("MAX_USHORT") = py::int_(MAX_USHORT);
|
m.attr("MAX_USHORT") = py::int_(MAX_USHORT);
|
||||||
m.attr("PULSAR_MAX_GRAD_SPHERES") = py::int_(MAX_GRAD_SPHERES);
|
m.attr("PULSAR_MAX_GRAD_SPHERES") = py::int_(MAX_GRAD_SPHERES);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -266,8 +266,6 @@ at::Tensor FaceAreasNormalsBackwardCuda(
|
|||||||
grad_normals_t{grad_normals, "grad_normals", 4};
|
grad_normals_t{grad_normals, "grad_normals", 4};
|
||||||
at::CheckedFrom c = "FaceAreasNormalsBackwardCuda";
|
at::CheckedFrom c = "FaceAreasNormalsBackwardCuda";
|
||||||
at::checkAllSameGPU(c, {verts_t, faces_t, grad_areas_t, grad_normals_t});
|
at::checkAllSameGPU(c, {verts_t, faces_t, grad_areas_t, grad_normals_t});
|
||||||
// This is nondeterministic because atomicAdd
|
|
||||||
at::globalContext().alertNotDeterministic("FaceAreasNormalsBackwardCuda");
|
|
||||||
|
|
||||||
// Set the device for the kernel launch based on the device of verts
|
// Set the device for the kernel launch based on the device of verts
|
||||||
at::cuda::CUDAGuard device_guard(verts.device());
|
at::cuda::CUDAGuard device_guard(verts.device());
|
||||||
|
|||||||
@@ -130,9 +130,6 @@ std::tuple<at::Tensor, at::Tensor> InterpFaceAttrsBackwardCuda(
|
|||||||
at::checkAllSameType(
|
at::checkAllSameType(
|
||||||
c, {barycentric_coords_t, face_attrs_t, grad_pix_attrs_t});
|
c, {barycentric_coords_t, face_attrs_t, grad_pix_attrs_t});
|
||||||
|
|
||||||
// This is nondeterministic because atomicAdd
|
|
||||||
at::globalContext().alertNotDeterministic("InterpFaceAttrsBackwardCuda");
|
|
||||||
|
|
||||||
// Set the device for the kernel launch based on the input
|
// Set the device for the kernel launch based on the input
|
||||||
at::cuda::CUDAGuard device_guard(pix_to_face.device());
|
at::cuda::CUDAGuard device_guard(pix_to_face.device());
|
||||||
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
|
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <thrust/device_vector.h>
|
||||||
|
#include <thrust/tuple.h>
|
||||||
#include "iou_box3d/iou_utils.cuh"
|
#include "iou_box3d/iou_utils.cuh"
|
||||||
|
|
||||||
// Parallelize over N*M computations which can each be done
|
// Parallelize over N*M computations which can each be done
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <thrust/device_vector.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include "utils/float_math.cuh"
|
#include "utils/float_math.cuh"
|
||||||
|
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ std::tuple<at::Tensor, at::Tensor> KNearestNeighborIdxCuda(
|
|||||||
|
|
||||||
TORCH_CHECK((norm == 1) || (norm == 2), "Norm must be 1 or 2.");
|
TORCH_CHECK((norm == 1) || (norm == 2), "Norm must be 1 or 2.");
|
||||||
|
|
||||||
TORCH_CHECK(p1.size(2) == D, "Point sets must have the same last dimension");
|
TORCH_CHECK(p2.size(2) == D, "Point sets must have the same last dimension");
|
||||||
auto long_dtype = lengths1.options().dtype(at::kLong);
|
auto long_dtype = lengths1.options().dtype(at::kLong);
|
||||||
auto idxs = at::zeros({N, P1, K}, long_dtype);
|
auto idxs = at::zeros({N, P1, K}, long_dtype);
|
||||||
auto dists = at::zeros({N, P1, K}, p1.options());
|
auto dists = at::zeros({N, P1, K}, p1.options());
|
||||||
@@ -495,7 +495,7 @@ __global__ void KNearestNeighborBackwardKernel(
|
|||||||
if ((p1_idx < num1) && (k < num2)) {
|
if ((p1_idx < num1) && (k < num2)) {
|
||||||
const float grad_dist = grad_dists[n * P1 * K + p1_idx * K + k];
|
const float grad_dist = grad_dists[n * P1 * K + p1_idx * K + k];
|
||||||
// index of point in p2 corresponding to the k-th nearest neighbor
|
// index of point in p2 corresponding to the k-th nearest neighbor
|
||||||
const int64_t p2_idx = idxs[n * P1 * K + p1_idx * K + k];
|
const size_t p2_idx = idxs[n * P1 * K + p1_idx * K + k];
|
||||||
// If the index is the pad value of -1 then ignore it
|
// If the index is the pad value of -1 then ignore it
|
||||||
if (p2_idx == -1) {
|
if (p2_idx == -1) {
|
||||||
continue;
|
continue;
|
||||||
@@ -534,9 +534,6 @@ std::tuple<at::Tensor, at::Tensor> KNearestNeighborBackwardCuda(
|
|||||||
c, {p1_t, p2_t, lengths1_t, lengths2_t, idxs_t, grad_dists_t});
|
c, {p1_t, p2_t, lengths1_t, lengths2_t, idxs_t, grad_dists_t});
|
||||||
at::checkAllSameType(c, {p1_t, p2_t, grad_dists_t});
|
at::checkAllSameType(c, {p1_t, p2_t, grad_dists_t});
|
||||||
|
|
||||||
// This is nondeterministic because atomicAdd
|
|
||||||
at::globalContext().alertNotDeterministic("KNearestNeighborBackwardCuda");
|
|
||||||
|
|
||||||
// Set the device for the kernel launch based on the device of the input
|
// Set the device for the kernel launch based on the device of the input
|
||||||
at::cuda::CUDAGuard device_guard(p1.device());
|
at::cuda::CUDAGuard device_guard(p1.device());
|
||||||
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
|
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
#include <ATen/ATen.h>
|
#include <ATen/ATen.h>
|
||||||
#include <ATen/cuda/CUDAContext.h>
|
#include <ATen/cuda/CUDAContext.h>
|
||||||
#include <c10/cuda/CUDAGuard.h>
|
#include <c10/cuda/CUDAGuard.h>
|
||||||
|
#include <thrust/device_vector.h>
|
||||||
|
#include <thrust/scan.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include "marching_cubes/tables.h"
|
#include "marching_cubes/tables.h"
|
||||||
|
|
||||||
@@ -38,6 +40,20 @@ through" each cube in the grid.
|
|||||||
// EPS: Used to indicate if two float values are close
|
// EPS: Used to indicate if two float values are close
|
||||||
__constant__ const float EPSILON = 1e-5;
|
__constant__ const float EPSILON = 1e-5;
|
||||||
|
|
||||||
|
// Thrust wrapper for exclusive scan
|
||||||
|
//
|
||||||
|
// Args:
|
||||||
|
// output: pointer to on-device output array
|
||||||
|
// input: pointer to on-device input array, where scan is performed
|
||||||
|
// numElements: number of elements for the input array
|
||||||
|
//
|
||||||
|
void ThrustScanWrapper(int* output, int* input, int numElements) {
|
||||||
|
thrust::exclusive_scan(
|
||||||
|
thrust::device_ptr<int>(input),
|
||||||
|
thrust::device_ptr<int>(input + numElements),
|
||||||
|
thrust::device_ptr<int>(output));
|
||||||
|
}
|
||||||
|
|
||||||
// Linearly interpolate the position where an isosurface cuts an edge
|
// Linearly interpolate the position where an isosurface cuts an edge
|
||||||
// between two vertices, based on their scalar values
|
// between two vertices, based on their scalar values
|
||||||
//
|
//
|
||||||
@@ -223,7 +239,7 @@ __global__ void CompactVoxelsKernel(
|
|||||||
compactedVoxelArray,
|
compactedVoxelArray,
|
||||||
const at::PackedTensorAccessor32<int, 1, at::RestrictPtrTraits>
|
const at::PackedTensorAccessor32<int, 1, at::RestrictPtrTraits>
|
||||||
voxelOccupied,
|
voxelOccupied,
|
||||||
const at::PackedTensorAccessor32<int64_t, 1, at::RestrictPtrTraits>
|
const at::PackedTensorAccessor32<int, 1, at::RestrictPtrTraits>
|
||||||
voxelOccupiedScan,
|
voxelOccupiedScan,
|
||||||
uint numVoxels) {
|
uint numVoxels) {
|
||||||
uint id = blockIdx.x * blockDim.x + threadIdx.x;
|
uint id = blockIdx.x * blockDim.x + threadIdx.x;
|
||||||
@@ -255,8 +271,7 @@ __global__ void GenerateFacesKernel(
|
|||||||
at::PackedTensorAccessor<int64_t, 1, at::RestrictPtrTraits> ids,
|
at::PackedTensorAccessor<int64_t, 1, at::RestrictPtrTraits> ids,
|
||||||
at::PackedTensorAccessor32<int, 1, at::RestrictPtrTraits>
|
at::PackedTensorAccessor32<int, 1, at::RestrictPtrTraits>
|
||||||
compactedVoxelArray,
|
compactedVoxelArray,
|
||||||
at::PackedTensorAccessor32<int64_t, 1, at::RestrictPtrTraits>
|
at::PackedTensorAccessor32<int, 1, at::RestrictPtrTraits> numVertsScanned,
|
||||||
numVertsScanned,
|
|
||||||
const uint activeVoxels,
|
const uint activeVoxels,
|
||||||
const at::PackedTensorAccessor32<float, 3, at::RestrictPtrTraits> vol,
|
const at::PackedTensorAccessor32<float, 3, at::RestrictPtrTraits> vol,
|
||||||
const at::PackedTensorAccessor32<int, 2, at::RestrictPtrTraits> faceTable,
|
const at::PackedTensorAccessor32<int, 2, at::RestrictPtrTraits> faceTable,
|
||||||
@@ -382,44 +397,6 @@ __global__ void GenerateFacesKernel(
|
|||||||
} // end for grid-strided kernel
|
} // end for grid-strided kernel
|
||||||
}
|
}
|
||||||
|
|
||||||
// ATen/Torch does not have an exclusive-scan operator. Additionally, in the
|
|
||||||
// code below we need to get the "total number of items to work on" after
|
|
||||||
// a scan, which with an inclusive-scan would simply be the value of the last
|
|
||||||
// element in the tensor.
|
|
||||||
//
|
|
||||||
// This utility function hits two birds with one stone, by running
|
|
||||||
// an inclusive-scan into a right-shifted view of a tensor that's
|
|
||||||
// allocated to be one element bigger than the input tensor.
|
|
||||||
//
|
|
||||||
// Note; return tensor is `int64_t` per element, even if the input
|
|
||||||
// tensor is only 32-bit. Also, the return tensor is one element bigger
|
|
||||||
// than the input one.
|
|
||||||
//
|
|
||||||
// Secondary optional argument is an output argument that gets the
|
|
||||||
// value of the last element of the return tensor (because you almost
|
|
||||||
// always need this CPU-side right after this function anyway).
|
|
||||||
static at::Tensor ExclusiveScanAndTotal(
|
|
||||||
const at::Tensor& inTensor,
|
|
||||||
int64_t* optTotal = nullptr) {
|
|
||||||
const auto inSize = inTensor.sizes()[0];
|
|
||||||
auto retTensor = at::zeros({inSize + 1}, at::kLong).to(inTensor.device());
|
|
||||||
|
|
||||||
using at::indexing::None;
|
|
||||||
using at::indexing::Slice;
|
|
||||||
auto rightShiftedView = retTensor.index({Slice(1, None)});
|
|
||||||
|
|
||||||
// Do an (inclusive-scan) cumulative sum in to the view that's
|
|
||||||
// shifted one element to the right...
|
|
||||||
at::cumsum_out(rightShiftedView, inTensor, 0, at::kLong);
|
|
||||||
|
|
||||||
if (optTotal) {
|
|
||||||
*optTotal = retTensor[inSize].cpu().item<int64_t>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ...so that the not-shifted tensor holds the exclusive-scan
|
|
||||||
return retTensor;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Entrance for marching cubes cuda extension. Marching Cubes is an algorithm to
|
// Entrance for marching cubes cuda extension. Marching Cubes is an algorithm to
|
||||||
// create triangle meshes from an implicit function (one of the form f(x, y, z)
|
// create triangle meshes from an implicit function (one of the form f(x, y, z)
|
||||||
// = 0). It works by iteratively checking a grid of cubes superimposed over a
|
// = 0). It works by iteratively checking a grid of cubes superimposed over a
|
||||||
@@ -478,9 +455,6 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> MarchingCubesCuda(
|
|||||||
grid.x = 65535;
|
grid.x = 65535;
|
||||||
}
|
}
|
||||||
|
|
||||||
using at::indexing::None;
|
|
||||||
using at::indexing::Slice;
|
|
||||||
|
|
||||||
auto d_voxelVerts =
|
auto d_voxelVerts =
|
||||||
at::zeros({numVoxels}, at::TensorOptions().dtype(at::kInt))
|
at::zeros({numVoxels}, at::TensorOptions().dtype(at::kInt))
|
||||||
.to(vol.device());
|
.to(vol.device());
|
||||||
@@ -503,9 +477,18 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> MarchingCubesCuda(
|
|||||||
// count for voxels in the grid and compute the number of active voxels.
|
// count for voxels in the grid and compute the number of active voxels.
|
||||||
// If the number of active voxels is 0, return zero tensor for verts and
|
// If the number of active voxels is 0, return zero tensor for verts and
|
||||||
// faces.
|
// faces.
|
||||||
int64_t activeVoxels = 0;
|
|
||||||
auto d_voxelOccupiedScan =
|
auto d_voxelOccupiedScan =
|
||||||
ExclusiveScanAndTotal(d_voxelOccupied, &activeVoxels);
|
at::zeros({numVoxels}, at::TensorOptions().dtype(at::kInt))
|
||||||
|
.to(vol.device());
|
||||||
|
ThrustScanWrapper(
|
||||||
|
d_voxelOccupiedScan.data_ptr<int>(),
|
||||||
|
d_voxelOccupied.data_ptr<int>(),
|
||||||
|
numVoxels);
|
||||||
|
|
||||||
|
// number of active voxels
|
||||||
|
int lastElement = d_voxelVerts[numVoxels - 1].cpu().item<int>();
|
||||||
|
int lastScan = d_voxelOccupiedScan[numVoxels - 1].cpu().item<int>();
|
||||||
|
int activeVoxels = lastElement + lastScan;
|
||||||
|
|
||||||
const int device_id = vol.device().index();
|
const int device_id = vol.device().index();
|
||||||
auto opt = at::TensorOptions().dtype(at::kInt).device(at::kCUDA, device_id);
|
auto opt = at::TensorOptions().dtype(at::kInt).device(at::kCUDA, device_id);
|
||||||
@@ -520,21 +503,28 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> MarchingCubesCuda(
|
|||||||
return std::make_tuple(verts, faces, ids);
|
return std::make_tuple(verts, faces, ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute "CompactVoxelsKernel" kernel to compress voxels for acceleration.
|
// Execute "CompactVoxelsKernel" kernel to compress voxels for accleration.
|
||||||
// This allows us to run triangle generation on only the occupied voxels.
|
// This allows us to run triangle generation on only the occupied voxels.
|
||||||
auto d_compVoxelArray = at::zeros({activeVoxels}, opt);
|
auto d_compVoxelArray = at::zeros({activeVoxels}, opt);
|
||||||
CompactVoxelsKernel<<<grid, threads, 0, stream>>>(
|
CompactVoxelsKernel<<<grid, threads, 0, stream>>>(
|
||||||
d_compVoxelArray.packed_accessor32<int, 1, at::RestrictPtrTraits>(),
|
d_compVoxelArray.packed_accessor32<int, 1, at::RestrictPtrTraits>(),
|
||||||
d_voxelOccupied.packed_accessor32<int, 1, at::RestrictPtrTraits>(),
|
d_voxelOccupied.packed_accessor32<int, 1, at::RestrictPtrTraits>(),
|
||||||
d_voxelOccupiedScan
|
d_voxelOccupiedScan.packed_accessor32<int, 1, at::RestrictPtrTraits>(),
|
||||||
.packed_accessor32<int64_t, 1, at::RestrictPtrTraits>(),
|
|
||||||
numVoxels);
|
numVoxels);
|
||||||
AT_CUDA_CHECK(cudaGetLastError());
|
AT_CUDA_CHECK(cudaGetLastError());
|
||||||
cudaDeviceSynchronize();
|
cudaDeviceSynchronize();
|
||||||
|
|
||||||
// Scan d_voxelVerts array to generate offsets of vertices for each voxel
|
// Scan d_voxelVerts array to generate offsets of vertices for each voxel
|
||||||
int64_t totalVerts = 0;
|
auto d_voxelVertsScan = at::zeros({numVoxels}, opt);
|
||||||
auto d_voxelVertsScan = ExclusiveScanAndTotal(d_voxelVerts, &totalVerts);
|
ThrustScanWrapper(
|
||||||
|
d_voxelVertsScan.data_ptr<int>(),
|
||||||
|
d_voxelVerts.data_ptr<int>(),
|
||||||
|
numVoxels);
|
||||||
|
|
||||||
|
// total number of vertices
|
||||||
|
lastElement = d_voxelVerts[numVoxels - 1].cpu().item<int>();
|
||||||
|
lastScan = d_voxelVertsScan[numVoxels - 1].cpu().item<int>();
|
||||||
|
int totalVerts = lastElement + lastScan;
|
||||||
|
|
||||||
// Execute "GenerateFacesKernel" kernel
|
// Execute "GenerateFacesKernel" kernel
|
||||||
// This runs only on the occupied voxels.
|
// This runs only on the occupied voxels.
|
||||||
@@ -554,7 +544,7 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> MarchingCubesCuda(
|
|||||||
faces.packed_accessor<int64_t, 2, at::RestrictPtrTraits>(),
|
faces.packed_accessor<int64_t, 2, at::RestrictPtrTraits>(),
|
||||||
ids.packed_accessor<int64_t, 1, at::RestrictPtrTraits>(),
|
ids.packed_accessor<int64_t, 1, at::RestrictPtrTraits>(),
|
||||||
d_compVoxelArray.packed_accessor32<int, 1, at::RestrictPtrTraits>(),
|
d_compVoxelArray.packed_accessor32<int, 1, at::RestrictPtrTraits>(),
|
||||||
d_voxelVertsScan.packed_accessor32<int64_t, 1, at::RestrictPtrTraits>(),
|
d_voxelVertsScan.packed_accessor32<int, 1, at::RestrictPtrTraits>(),
|
||||||
activeVoxels,
|
activeVoxels,
|
||||||
vol.packed_accessor32<float, 3, at::RestrictPtrTraits>(),
|
vol.packed_accessor32<float, 3, at::RestrictPtrTraits>(),
|
||||||
faceTable.packed_accessor32<int, 2, at::RestrictPtrTraits>(),
|
faceTable.packed_accessor32<int, 2, at::RestrictPtrTraits>(),
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ std::tuple<at::Tensor, at::Tensor, at::Tensor> MarchingCubesCpu(
|
|||||||
if ((j + 1) % 3 == 0 && ps[0] != ps[1] && ps[1] != ps[2] &&
|
if ((j + 1) % 3 == 0 && ps[0] != ps[1] && ps[1] != ps[2] &&
|
||||||
ps[2] != ps[0]) {
|
ps[2] != ps[0]) {
|
||||||
for (int k = 0; k < 3; k++) {
|
for (int k = 0; k < 3; k++) {
|
||||||
int64_t v = tri.at(k);
|
int v = tri[k];
|
||||||
edge_id_to_v[v] = ps.at(k);
|
edge_id_to_v[tri.at(k)] = ps.at(k);
|
||||||
if (!uniq_edge_id.count(v)) {
|
if (!uniq_edge_id.count(v)) {
|
||||||
uniq_edge_id[v] = verts.size();
|
uniq_edge_id[v] = verts.size();
|
||||||
verts.push_back(edge_id_to_v[v]);
|
verts.push_back(edge_id_to_v[v]);
|
||||||
|
|||||||
@@ -305,8 +305,6 @@ std::tuple<at::Tensor, at::Tensor> DistanceBackwardCuda(
|
|||||||
at::CheckedFrom c = "DistanceBackwardCuda";
|
at::CheckedFrom c = "DistanceBackwardCuda";
|
||||||
at::checkAllSameGPU(c, {objects_t, targets_t, idx_objects_t, grad_dists_t});
|
at::checkAllSameGPU(c, {objects_t, targets_t, idx_objects_t, grad_dists_t});
|
||||||
at::checkAllSameType(c, {objects_t, targets_t, grad_dists_t});
|
at::checkAllSameType(c, {objects_t, targets_t, grad_dists_t});
|
||||||
// This is nondeterministic because atomicAdd
|
|
||||||
at::globalContext().alertNotDeterministic("DistanceBackwardCuda");
|
|
||||||
|
|
||||||
// Set the device for the kernel launch based on the device of the input
|
// Set the device for the kernel launch based on the device of the input
|
||||||
at::cuda::CUDAGuard device_guard(objects.device());
|
at::cuda::CUDAGuard device_guard(objects.device());
|
||||||
@@ -626,9 +624,6 @@ std::tuple<at::Tensor, at::Tensor> PointFaceArrayDistanceBackwardCuda(
|
|||||||
at::CheckedFrom c = "PointFaceArrayDistanceBackwardCuda";
|
at::CheckedFrom c = "PointFaceArrayDistanceBackwardCuda";
|
||||||
at::checkAllSameGPU(c, {points_t, tris_t, grad_dists_t});
|
at::checkAllSameGPU(c, {points_t, tris_t, grad_dists_t});
|
||||||
at::checkAllSameType(c, {points_t, tris_t, grad_dists_t});
|
at::checkAllSameType(c, {points_t, tris_t, grad_dists_t});
|
||||||
// This is nondeterministic because atomicAdd
|
|
||||||
at::globalContext().alertNotDeterministic(
|
|
||||||
"PointFaceArrayDistanceBackwardCuda");
|
|
||||||
|
|
||||||
// Set the device for the kernel launch based on the device of the input
|
// Set the device for the kernel launch based on the device of the input
|
||||||
at::cuda::CUDAGuard device_guard(points.device());
|
at::cuda::CUDAGuard device_guard(points.device());
|
||||||
@@ -792,9 +787,6 @@ std::tuple<at::Tensor, at::Tensor> PointEdgeArrayDistanceBackwardCuda(
|
|||||||
at::CheckedFrom c = "PointEdgeArrayDistanceBackwardCuda";
|
at::CheckedFrom c = "PointEdgeArrayDistanceBackwardCuda";
|
||||||
at::checkAllSameGPU(c, {points_t, segms_t, grad_dists_t});
|
at::checkAllSameGPU(c, {points_t, segms_t, grad_dists_t});
|
||||||
at::checkAllSameType(c, {points_t, segms_t, grad_dists_t});
|
at::checkAllSameType(c, {points_t, segms_t, grad_dists_t});
|
||||||
// This is nondeterministic because atomicAdd
|
|
||||||
at::globalContext().alertNotDeterministic(
|
|
||||||
"PointEdgeArrayDistanceBackwardCuda");
|
|
||||||
|
|
||||||
// Set the device for the kernel launch based on the device of the input
|
// Set the device for the kernel launch based on the device of the input
|
||||||
at::cuda::CUDAGuard device_guard(points.device());
|
at::cuda::CUDAGuard device_guard(points.device());
|
||||||
|
|||||||
@@ -141,9 +141,6 @@ void PointsToVolumesForwardCuda(
|
|||||||
grid_sizes_t,
|
grid_sizes_t,
|
||||||
mask_t});
|
mask_t});
|
||||||
|
|
||||||
// This is nondeterministic because atomicAdd
|
|
||||||
at::globalContext().alertNotDeterministic("PointsToVolumesForwardCuda");
|
|
||||||
|
|
||||||
// Set the device for the kernel launch based on the device of the input
|
// Set the device for the kernel launch based on the device of the input
|
||||||
at::cuda::CUDAGuard device_guard(points_3d.device());
|
at::cuda::CUDAGuard device_guard(points_3d.device());
|
||||||
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
|
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <torch/csrc/autograd/VariableTypeUtils.h>
|
|
||||||
#include <torch/extension.h>
|
#include <torch/extension.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
@@ -97,8 +96,6 @@ inline void PointsToVolumesForward(
|
|||||||
point_weight,
|
point_weight,
|
||||||
align_corners,
|
align_corners,
|
||||||
splat);
|
splat);
|
||||||
torch::autograd::increment_version(volume_features);
|
|
||||||
torch::autograd::increment_version(volume_densities);
|
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
AT_ERROR("Not compiled with GPU support.");
|
AT_ERROR("Not compiled with GPU support.");
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <torch/csrc/autograd/VariableTypeUtils.h>
|
|
||||||
#include <torch/extension.h>
|
#include <torch/extension.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -149,8 +148,6 @@ void PointsToVolumesForwardCpu(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
torch::autograd::increment_version(volume_features);
|
|
||||||
torch::autograd::increment_version(volume_densities);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// With nearest, the only smooth dependence is that volume features
|
// With nearest, the only smooth dependence is that volume features
|
||||||
|
|||||||
@@ -30,18 +30,11 @@
|
|||||||
#define GLOBAL __global__
|
#define GLOBAL __global__
|
||||||
#define RESTRICT __restrict__
|
#define RESTRICT __restrict__
|
||||||
#define DEBUGBREAK()
|
#define DEBUGBREAK()
|
||||||
#ifdef __NVCC_DIAG_PRAGMA_SUPPORT__
|
|
||||||
#pragma nv_diag_suppress 1866
|
|
||||||
#pragma nv_diag_suppress 2941
|
|
||||||
#pragma nv_diag_suppress 2951
|
|
||||||
#pragma nv_diag_suppress 2967
|
|
||||||
#else
|
|
||||||
#pragma diag_suppress = attribute_not_allowed
|
#pragma diag_suppress = attribute_not_allowed
|
||||||
#pragma diag_suppress = 1866
|
#pragma diag_suppress = 1866
|
||||||
#pragma diag_suppress = 2941
|
#pragma diag_suppress = 2941
|
||||||
#pragma diag_suppress = 2951
|
#pragma diag_suppress = 2951
|
||||||
#pragma diag_suppress = 2967
|
#pragma diag_suppress = 2967
|
||||||
#endif
|
|
||||||
#else // __CUDACC__
|
#else // __CUDACC__
|
||||||
#define INLINE inline
|
#define INLINE inline
|
||||||
#define HOST
|
#define HOST
|
||||||
@@ -56,7 +49,6 @@
|
|||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#ifdef WITH_CUDA
|
#ifdef WITH_CUDA
|
||||||
#include <ATen/cuda/CUDAContext.h>
|
#include <ATen/cuda/CUDAContext.h>
|
||||||
#include <vector_functions.h>
|
|
||||||
#else
|
#else
|
||||||
#ifndef cudaStream_t
|
#ifndef cudaStream_t
|
||||||
typedef void* cudaStream_t;
|
typedef void* cudaStream_t;
|
||||||
@@ -73,6 +65,8 @@ struct float2 {
|
|||||||
struct float3 {
|
struct float3 {
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
namespace py = pybind11;
|
||||||
inline float3 make_float3(const float& x, const float& y, const float& z) {
|
inline float3 make_float3(const float& x, const float& y, const float& z) {
|
||||||
float3 res;
|
float3 res;
|
||||||
res.x = x;
|
res.x = x;
|
||||||
@@ -80,8 +74,6 @@ inline float3 make_float3(const float& x, const float& y, const float& z) {
|
|||||||
res.z = z;
|
res.z = z;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
namespace py = pybind11;
|
|
||||||
|
|
||||||
inline bool operator==(const float3& a, const float3& b) {
|
inline bool operator==(const float3& a, const float3& b) {
|
||||||
return a.x == b.x && a.y == b.y && a.z == b.z;
|
return a.x == b.x && a.y == b.y && a.z == b.z;
|
||||||
|
|||||||
@@ -357,11 +357,11 @@ void MAX_WS(
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
#define END_PARALLEL() \
|
#define END_PARALLEL() \
|
||||||
end_parallel :; \
|
end_parallel:; \
|
||||||
}
|
}
|
||||||
#define END_PARALLEL_NORET() }
|
#define END_PARALLEL_NORET() }
|
||||||
#define END_PARALLEL_2D() \
|
#define END_PARALLEL_2D() \
|
||||||
end_parallel :; \
|
end_parallel:; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define END_PARALLEL_2D_NORET() \
|
#define END_PARALLEL_2D_NORET() \
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ HOST void construct(
|
|||||||
MALLOC(self->di_sorted_d, DrawInfo, max_num_balls);
|
MALLOC(self->di_sorted_d, DrawInfo, max_num_balls);
|
||||||
MALLOC(self->region_flags_d, char, max_num_balls);
|
MALLOC(self->region_flags_d, char, max_num_balls);
|
||||||
MALLOC(self->num_selected_d, size_t, 1);
|
MALLOC(self->num_selected_d, size_t, 1);
|
||||||
MALLOC(self->forw_info_d, float, width* height * (3 + 2 * n_track));
|
MALLOC(self->forw_info_d, float, width* height*(3 + 2 * n_track));
|
||||||
MALLOC(self->min_max_pixels_d, IntersectInfo, 1);
|
MALLOC(self->min_max_pixels_d, IntersectInfo, 1);
|
||||||
MALLOC(self->grad_pos_d, float3, max_num_balls);
|
MALLOC(self->grad_pos_d, float3, max_num_balls);
|
||||||
MALLOC(self->grad_col_d, float, max_num_balls* n_channels);
|
MALLOC(self->grad_col_d, float, max_num_balls* n_channels);
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ void forward(
|
|||||||
self->workspace_d,
|
self->workspace_d,
|
||||||
self->workspace_size,
|
self->workspace_size,
|
||||||
stream);
|
stream);
|
||||||
CHECKLAUNCH();
|
|
||||||
SORT_ASCENDING_WS(
|
SORT_ASCENDING_WS(
|
||||||
self->min_depth_d,
|
self->min_depth_d,
|
||||||
self->min_depth_sorted_d,
|
self->min_depth_sorted_d,
|
||||||
@@ -112,7 +111,6 @@ void forward(
|
|||||||
self->workspace_d,
|
self->workspace_d,
|
||||||
self->workspace_size,
|
self->workspace_size,
|
||||||
stream);
|
stream);
|
||||||
CHECKLAUNCH();
|
|
||||||
SORT_ASCENDING_WS(
|
SORT_ASCENDING_WS(
|
||||||
self->min_depth_d,
|
self->min_depth_d,
|
||||||
self->min_depth_sorted_d,
|
self->min_depth_sorted_d,
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ GLOBAL void render(
|
|||||||
/** Whether loading of balls is completed. */
|
/** Whether loading of balls is completed. */
|
||||||
SHARED bool loading_done;
|
SHARED bool loading_done;
|
||||||
/** The number of balls loaded overall (just for statistics). */
|
/** The number of balls loaded overall (just for statistics). */
|
||||||
[[maybe_unused]] SHARED int n_balls_loaded;
|
SHARED int n_balls_loaded;
|
||||||
/** The area this thread block covers. */
|
/** The area this thread block covers. */
|
||||||
SHARED IntersectInfo block_area;
|
SHARED IntersectInfo block_area;
|
||||||
if (thread_block.thread_rank() == 0) {
|
if (thread_block.thread_rank() == 0) {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ inline void fill_cam_vecs(
|
|||||||
res->pixel_dir_y.x = pixel_dir_y.data_ptr<float>()[0];
|
res->pixel_dir_y.x = pixel_dir_y.data_ptr<float>()[0];
|
||||||
res->pixel_dir_y.y = pixel_dir_y.data_ptr<float>()[1];
|
res->pixel_dir_y.y = pixel_dir_y.data_ptr<float>()[1];
|
||||||
res->pixel_dir_y.z = pixel_dir_y.data_ptr<float>()[2];
|
res->pixel_dir_y.z = pixel_dir_y.data_ptr<float>()[2];
|
||||||
auto sensor_dir_z = pixel_dir_y.cross(pixel_dir_x, -1);
|
auto sensor_dir_z = pixel_dir_y.cross(pixel_dir_x);
|
||||||
sensor_dir_z /= sensor_dir_z.norm();
|
sensor_dir_z /= sensor_dir_z.norm();
|
||||||
if (right_handed) {
|
if (right_handed) {
|
||||||
sensor_dir_z *= -1.f;
|
sensor_dir_z *= -1.f;
|
||||||
|
|||||||
@@ -244,7 +244,8 @@ at::Tensor RasterizeCoarseCuda(
|
|||||||
if (num_bins_y >= kMaxItemsPerBin || num_bins_x >= kMaxItemsPerBin) {
|
if (num_bins_y >= kMaxItemsPerBin || num_bins_x >= kMaxItemsPerBin) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "In RasterizeCoarseCuda got num_bins_y: " << num_bins_y
|
ss << "In RasterizeCoarseCuda got num_bins_y: " << num_bins_y
|
||||||
<< ", num_bins_x: " << num_bins_x << ", " << "; that's too many!";
|
<< ", num_bins_x: " << num_bins_x << ", "
|
||||||
|
<< "; that's too many!";
|
||||||
AT_ERROR(ss.str());
|
AT_ERROR(ss.str());
|
||||||
}
|
}
|
||||||
auto opts = elems_per_batch.options().dtype(at::kInt);
|
auto opts = elems_per_batch.options().dtype(at::kInt);
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ __device__ void CheckPixelInsideFace(
|
|||||||
const bool zero_face_area =
|
const bool zero_face_area =
|
||||||
(face_area <= kEpsilon && face_area >= -1.0f * kEpsilon);
|
(face_area <= kEpsilon && face_area >= -1.0f * kEpsilon);
|
||||||
|
|
||||||
if (zmax < 0 || (cull_backfaces && back_face) || outside_bbox ||
|
if (zmax < 0 || cull_backfaces && back_face || outside_bbox ||
|
||||||
zero_face_area) {
|
zero_face_area) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -583,9 +583,6 @@ at::Tensor RasterizeMeshesBackwardCuda(
|
|||||||
at::checkAllSameType(
|
at::checkAllSameType(
|
||||||
c, {face_verts_t, grad_zbuf_t, grad_bary_t, grad_dists_t});
|
c, {face_verts_t, grad_zbuf_t, grad_bary_t, grad_dists_t});
|
||||||
|
|
||||||
// This is nondeterministic because atomicAdd
|
|
||||||
at::globalContext().alertNotDeterministic("RasterizeMeshesBackwardCuda");
|
|
||||||
|
|
||||||
// Set the device for the kernel launch based on the device of the input
|
// Set the device for the kernel launch based on the device of the input
|
||||||
at::cuda::CUDAGuard device_guard(face_verts.device());
|
at::cuda::CUDAGuard device_guard(face_verts.device());
|
||||||
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
|
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
|
||||||
|
|||||||
@@ -423,8 +423,7 @@ at::Tensor RasterizePointsBackwardCuda(
|
|||||||
at::CheckedFrom c = "RasterizePointsBackwardCuda";
|
at::CheckedFrom c = "RasterizePointsBackwardCuda";
|
||||||
at::checkAllSameGPU(c, {points_t, idxs_t, grad_zbuf_t, grad_dists_t});
|
at::checkAllSameGPU(c, {points_t, idxs_t, grad_zbuf_t, grad_dists_t});
|
||||||
at::checkAllSameType(c, {points_t, grad_zbuf_t, grad_dists_t});
|
at::checkAllSameType(c, {points_t, grad_zbuf_t, grad_dists_t});
|
||||||
// This is nondeterministic because atomicAdd
|
|
||||||
at::globalContext().alertNotDeterministic("RasterizePointsBackwardCuda");
|
|
||||||
// Set the device for the kernel launch based on the device of the input
|
// Set the device for the kernel launch based on the device of the input
|
||||||
at::cuda::CUDAGuard device_guard(points.device());
|
at::cuda::CUDAGuard device_guard(points.device());
|
||||||
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
|
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ at::Tensor FarthestPointSamplingCuda(
|
|||||||
|
|
||||||
// Max possible threads per block
|
// Max possible threads per block
|
||||||
const int MAX_THREADS_PER_BLOCK = 1024;
|
const int MAX_THREADS_PER_BLOCK = 1024;
|
||||||
const size_t threads = max(min(1 << points_pow_2, MAX_THREADS_PER_BLOCK), 2);
|
const size_t threads = max(min(1 << points_pow_2, MAX_THREADS_PER_BLOCK), 1);
|
||||||
|
|
||||||
// Create the accessors
|
// Create the accessors
|
||||||
auto points_a = points.packed_accessor64<float, 3, at::RestrictPtrTraits>();
|
auto points_a = points.packed_accessor64<float, 3, at::RestrictPtrTraits>();
|
||||||
@@ -215,6 +215,10 @@ at::Tensor FarthestPointSamplingCuda(
|
|||||||
FarthestPointSamplingKernel<2><<<threads, threads, shared_mem, stream>>>(
|
FarthestPointSamplingKernel<2><<<threads, threads, shared_mem, stream>>>(
|
||||||
points_a, lengths_a, K_a, idxs_a, min_point_dist_a, start_idxs_a);
|
points_a, lengths_a, K_a, idxs_a, min_point_dist_a, start_idxs_a);
|
||||||
break;
|
break;
|
||||||
|
case 1:
|
||||||
|
FarthestPointSamplingKernel<1><<<threads, threads, shared_mem, stream>>>(
|
||||||
|
points_a, lengths_a, K_a, idxs_a, min_point_dist_a, start_idxs_a);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
FarthestPointSamplingKernel<1024>
|
FarthestPointSamplingKernel<1024>
|
||||||
<<<blocks, threads, shared_mem, stream>>>(
|
<<<blocks, threads, shared_mem, stream>>>(
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <torch/csrc/autograd/VariableTypeUtils.h>
|
|
||||||
#include <torch/extension.h>
|
#include <torch/extension.h>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
@@ -64,7 +63,6 @@ inline void SamplePdf(
|
|||||||
#ifdef WITH_CUDA
|
#ifdef WITH_CUDA
|
||||||
CHECK_CUDA(weights);
|
CHECK_CUDA(weights);
|
||||||
CHECK_CONTIGUOUS_CUDA(outputs);
|
CHECK_CONTIGUOUS_CUDA(outputs);
|
||||||
torch::autograd::increment_version(outputs);
|
|
||||||
SamplePdfCuda(bins, weights, outputs, eps);
|
SamplePdfCuda(bins, weights, outputs, eps);
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <torch/csrc/autograd/VariableTypeUtils.h>
|
|
||||||
#include <torch/extension.h>
|
#include <torch/extension.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@@ -138,5 +137,4 @@ void SamplePdfCpu(
|
|||||||
for (auto&& thread : threads) {
|
for (auto&& thread : threads) {
|
||||||
thread.join();
|
thread.join();
|
||||||
}
|
}
|
||||||
torch::autograd::increment_version(outputs);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ const auto vEpsilon = 1e-8;
|
|||||||
|
|
||||||
// Common functions and operators for float2.
|
// Common functions and operators for float2.
|
||||||
|
|
||||||
// Complex arithmetic is already defined for AMD.
|
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
__device__ inline float2 operator-(const float2& a, const float2& b) {
|
__device__ inline float2 operator-(const float2& a, const float2& b) {
|
||||||
return make_float2(a.x - b.x, a.y - b.y);
|
return make_float2(a.x - b.x, a.y - b.y);
|
||||||
}
|
}
|
||||||
@@ -43,7 +41,6 @@ __device__ inline float2 operator*(const float2& a, const float2& b) {
|
|||||||
__device__ inline float2 operator*(const float a, const float2& b) {
|
__device__ inline float2 operator*(const float a, const float2& b) {
|
||||||
return make_float2(a * b.x, a * b.y);
|
return make_float2(a * b.x, a * b.y);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
__device__ inline float FloatMin3(const float a, const float b, const float c) {
|
__device__ inline float FloatMin3(const float a, const float b, const float c) {
|
||||||
return fminf(a, fminf(b, c));
|
return fminf(a, fminf(b, c));
|
||||||
|
|||||||
@@ -23,51 +23,37 @@ WarpReduceMin(scalar_t* min_dists, int64_t* min_idxs, const size_t tid) {
|
|||||||
min_idxs[tid] = min_idxs[tid + 32];
|
min_idxs[tid] = min_idxs[tid + 32];
|
||||||
min_dists[tid] = min_dists[tid + 32];
|
min_dists[tid] = min_dists[tid + 32];
|
||||||
}
|
}
|
||||||
// AMD does not use explicit syncwarp and instead automatically inserts memory
|
|
||||||
// fences during compilation.
|
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
__syncwarp();
|
__syncwarp();
|
||||||
#endif
|
|
||||||
// s = 16
|
// s = 16
|
||||||
if (min_dists[tid] > min_dists[tid + 16]) {
|
if (min_dists[tid] > min_dists[tid + 16]) {
|
||||||
min_idxs[tid] = min_idxs[tid + 16];
|
min_idxs[tid] = min_idxs[tid + 16];
|
||||||
min_dists[tid] = min_dists[tid + 16];
|
min_dists[tid] = min_dists[tid + 16];
|
||||||
}
|
}
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
__syncwarp();
|
__syncwarp();
|
||||||
#endif
|
|
||||||
// s = 8
|
// s = 8
|
||||||
if (min_dists[tid] > min_dists[tid + 8]) {
|
if (min_dists[tid] > min_dists[tid + 8]) {
|
||||||
min_idxs[tid] = min_idxs[tid + 8];
|
min_idxs[tid] = min_idxs[tid + 8];
|
||||||
min_dists[tid] = min_dists[tid + 8];
|
min_dists[tid] = min_dists[tid + 8];
|
||||||
}
|
}
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
__syncwarp();
|
__syncwarp();
|
||||||
#endif
|
|
||||||
// s = 4
|
// s = 4
|
||||||
if (min_dists[tid] > min_dists[tid + 4]) {
|
if (min_dists[tid] > min_dists[tid + 4]) {
|
||||||
min_idxs[tid] = min_idxs[tid + 4];
|
min_idxs[tid] = min_idxs[tid + 4];
|
||||||
min_dists[tid] = min_dists[tid + 4];
|
min_dists[tid] = min_dists[tid + 4];
|
||||||
}
|
}
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
__syncwarp();
|
__syncwarp();
|
||||||
#endif
|
|
||||||
// s = 2
|
// s = 2
|
||||||
if (min_dists[tid] > min_dists[tid + 2]) {
|
if (min_dists[tid] > min_dists[tid + 2]) {
|
||||||
min_idxs[tid] = min_idxs[tid + 2];
|
min_idxs[tid] = min_idxs[tid + 2];
|
||||||
min_dists[tid] = min_dists[tid + 2];
|
min_dists[tid] = min_dists[tid + 2];
|
||||||
}
|
}
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
__syncwarp();
|
__syncwarp();
|
||||||
#endif
|
|
||||||
// s = 1
|
// s = 1
|
||||||
if (min_dists[tid] > min_dists[tid + 1]) {
|
if (min_dists[tid] > min_dists[tid + 1]) {
|
||||||
min_idxs[tid] = min_idxs[tid + 1];
|
min_idxs[tid] = min_idxs[tid + 1];
|
||||||
min_dists[tid] = min_dists[tid + 1];
|
min_dists[tid] = min_dists[tid + 1];
|
||||||
}
|
}
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
__syncwarp();
|
__syncwarp();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename scalar_t>
|
template <typename scalar_t>
|
||||||
@@ -79,42 +65,30 @@ __device__ void WarpReduceMax(
|
|||||||
dists[tid] = dists[tid + 32];
|
dists[tid] = dists[tid + 32];
|
||||||
dists_idx[tid] = dists_idx[tid + 32];
|
dists_idx[tid] = dists_idx[tid + 32];
|
||||||
}
|
}
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
__syncwarp();
|
__syncwarp();
|
||||||
#endif
|
|
||||||
if (dists[tid] < dists[tid + 16]) {
|
if (dists[tid] < dists[tid + 16]) {
|
||||||
dists[tid] = dists[tid + 16];
|
dists[tid] = dists[tid + 16];
|
||||||
dists_idx[tid] = dists_idx[tid + 16];
|
dists_idx[tid] = dists_idx[tid + 16];
|
||||||
}
|
}
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
__syncwarp();
|
__syncwarp();
|
||||||
#endif
|
|
||||||
if (dists[tid] < dists[tid + 8]) {
|
if (dists[tid] < dists[tid + 8]) {
|
||||||
dists[tid] = dists[tid + 8];
|
dists[tid] = dists[tid + 8];
|
||||||
dists_idx[tid] = dists_idx[tid + 8];
|
dists_idx[tid] = dists_idx[tid + 8];
|
||||||
}
|
}
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
__syncwarp();
|
__syncwarp();
|
||||||
#endif
|
|
||||||
if (dists[tid] < dists[tid + 4]) {
|
if (dists[tid] < dists[tid + 4]) {
|
||||||
dists[tid] = dists[tid + 4];
|
dists[tid] = dists[tid + 4];
|
||||||
dists_idx[tid] = dists_idx[tid + 4];
|
dists_idx[tid] = dists_idx[tid + 4];
|
||||||
}
|
}
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
__syncwarp();
|
__syncwarp();
|
||||||
#endif
|
|
||||||
if (dists[tid] < dists[tid + 2]) {
|
if (dists[tid] < dists[tid + 2]) {
|
||||||
dists[tid] = dists[tid + 2];
|
dists[tid] = dists[tid + 2];
|
||||||
dists_idx[tid] = dists_idx[tid + 2];
|
dists_idx[tid] = dists_idx[tid + 2];
|
||||||
}
|
}
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
__syncwarp();
|
__syncwarp();
|
||||||
#endif
|
|
||||||
if (dists[tid] < dists[tid + 1]) {
|
if (dists[tid] < dists[tid + 1]) {
|
||||||
dists[tid] = dists[tid + 1];
|
dists[tid] = dists[tid + 1];
|
||||||
dists_idx[tid] = dists_idx[tid + 1];
|
dists_idx[tid] = dists_idx[tid + 1];
|
||||||
}
|
}
|
||||||
#if !defined(USE_ROCM)
|
|
||||||
__syncwarp();
|
__syncwarp();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
from .r2n2 import BlenderCamera, collate_batched_R2N2, R2N2, render_cubified_voxels
|
from .r2n2 import BlenderCamera, collate_batched_R2N2, R2N2, render_cubified_voxels
|
||||||
from .shapenet import ShapeNetCore
|
from .shapenet import ShapeNetCore
|
||||||
from .utils import collate_batched_meshes
|
from .utils import collate_batched_meshes
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
from .r2n2 import R2N2
|
from .r2n2 import R2N2
|
||||||
from .utils import BlenderCamera, collate_batched_R2N2, render_cubified_voxels
|
from .utils import BlenderCamera, collate_batched_R2N2, render_cubified_voxels
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import warnings
|
import warnings
|
||||||
from os import path
|
from os import path
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
from .shapenet_core import ShapeNetCore
|
from .shapenet_core import ShapeNetCore
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import warnings
|
import warnings
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
from typing import Dict, List, Optional, Tuple
|
from typing import Dict, List, Optional, Tuple
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|
||||||
from pytorch3d.renderer.mesh import TexturesAtlas
|
from pytorch3d.renderer.mesh import TexturesAtlas
|
||||||
|
|||||||
@@ -3,5 +3,3 @@
|
|||||||
#
|
#
|
||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|||||||
@@ -3,5 +3,3 @@
|
|||||||
#
|
#
|
||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
from pytorch3d.implicitron.tools.config import registry
|
from pytorch3d.implicitron.tools.config import registry
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Iterator, List, Optional, Tuple
|
from typing import Iterator, List, Optional, Tuple
|
||||||
@@ -14,15 +12,14 @@ import torch
|
|||||||
from pytorch3d.implicitron.tools.config import registry, ReplaceableBase
|
from pytorch3d.implicitron.tools.config import registry, ReplaceableBase
|
||||||
from torch.utils.data import (
|
from torch.utils.data import (
|
||||||
BatchSampler,
|
BatchSampler,
|
||||||
ConcatDataset,
|
ChainDataset,
|
||||||
DataLoader,
|
DataLoader,
|
||||||
RandomSampler,
|
RandomSampler,
|
||||||
Sampler,
|
Sampler,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .dataset_base import DatasetBase
|
from .dataset_base import DatasetBase, FrameData
|
||||||
from .dataset_map_provider import DatasetMap
|
from .dataset_map_provider import DatasetMap
|
||||||
from .frame_data import FrameData
|
|
||||||
from .scene_batch_sampler import SceneBatchSampler
|
from .scene_batch_sampler import SceneBatchSampler
|
||||||
from .utils import is_known_frame_scalar
|
from .utils import is_known_frame_scalar
|
||||||
|
|
||||||
@@ -485,7 +482,7 @@ class SequenceDataLoaderMapProvider(DataLoaderMapProviderBase):
|
|||||||
num_batches=num_batches,
|
num_batches=num_batches,
|
||||||
)
|
)
|
||||||
return DataLoader(
|
return DataLoader(
|
||||||
ConcatDataset([dataset, train_dataset]),
|
ChainDataset([dataset, train_dataset]),
|
||||||
batch_sampler=sampler,
|
batch_sampler=sampler,
|
||||||
**data_loader_kwargs,
|
**data_loader_kwargs,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
from typing import Optional, Tuple
|
from typing import Optional, Tuple
|
||||||
|
|
||||||
from pytorch3d.implicitron.tools.config import (
|
from pytorch3d.implicitron.tools.config import (
|
||||||
@@ -15,8 +13,13 @@ from pytorch3d.implicitron.tools.config import (
|
|||||||
)
|
)
|
||||||
from pytorch3d.renderer.cameras import CamerasBase
|
from pytorch3d.renderer.cameras import CamerasBase
|
||||||
|
|
||||||
|
from .blender_dataset_map_provider import BlenderDatasetMapProvider # noqa
|
||||||
from .data_loader_map_provider import DataLoaderMap, DataLoaderMapProviderBase
|
from .data_loader_map_provider import DataLoaderMap, DataLoaderMapProviderBase
|
||||||
from .dataset_map_provider import DatasetMap, DatasetMapProviderBase
|
from .dataset_map_provider import DatasetMap, DatasetMapProviderBase
|
||||||
|
from .json_index_dataset_map_provider import JsonIndexDatasetMapProvider # noqa
|
||||||
|
from .json_index_dataset_map_provider_v2 import JsonIndexDatasetMapProviderV2 # noqa
|
||||||
|
from .llff_dataset_map_provider import LlffDatasetMapProvider # noqa
|
||||||
|
from .rendered_mesh_dataset_map_provider import RenderedMeshDatasetMapProvider # noqa
|
||||||
|
|
||||||
|
|
||||||
class DataSourceBase(ReplaceableBase):
|
class DataSourceBase(ReplaceableBase):
|
||||||
@@ -31,7 +34,6 @@ class DataSourceBase(ReplaceableBase):
|
|||||||
@property
|
@property
|
||||||
def all_train_cameras(self) -> Optional[CamerasBase]:
|
def all_train_cameras(self) -> Optional[CamerasBase]:
|
||||||
"""
|
"""
|
||||||
DEPRECATED! The property will be removed in future versions.
|
|
||||||
If the data is all for a single scene, a list
|
If the data is all for a single scene, a list
|
||||||
of the known training cameras for that scene, which is
|
of the known training cameras for that scene, which is
|
||||||
used for evaluating the viewpoint difficulty of the
|
used for evaluating the viewpoint difficulty of the
|
||||||
@@ -41,7 +43,7 @@ class DataSourceBase(ReplaceableBase):
|
|||||||
|
|
||||||
|
|
||||||
@registry.register
|
@registry.register
|
||||||
class ImplicitronDataSource(DataSourceBase):
|
class ImplicitronDataSource(DataSourceBase): # pyre-ignore[13]
|
||||||
"""
|
"""
|
||||||
Represents the data used in Implicitron. This is the only implementation
|
Represents the data used in Implicitron. This is the only implementation
|
||||||
of DataSourceBase provided.
|
of DataSourceBase provided.
|
||||||
@@ -52,44 +54,11 @@ class ImplicitronDataSource(DataSourceBase):
|
|||||||
data_loader_map_provider_class_type: identifies type for data_loader_map_provider.
|
data_loader_map_provider_class_type: identifies type for data_loader_map_provider.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# pyre-fixme[13]: Attribute `dataset_map_provider` is never initialized.
|
|
||||||
dataset_map_provider: DatasetMapProviderBase
|
dataset_map_provider: DatasetMapProviderBase
|
||||||
# pyre-fixme[13]: Attribute `dataset_map_provider_class_type` is never initialized.
|
|
||||||
dataset_map_provider_class_type: str
|
dataset_map_provider_class_type: str
|
||||||
# pyre-fixme[13]: Attribute `data_loader_map_provider` is never initialized.
|
|
||||||
data_loader_map_provider: DataLoaderMapProviderBase
|
data_loader_map_provider: DataLoaderMapProviderBase
|
||||||
data_loader_map_provider_class_type: str = "SequenceDataLoaderMapProvider"
|
data_loader_map_provider_class_type: str = "SequenceDataLoaderMapProvider"
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def pre_expand(cls) -> None:
|
|
||||||
# use try/finally to bypass cinder's lazy imports
|
|
||||||
try:
|
|
||||||
from .blender_dataset_map_provider import ( # noqa: F401
|
|
||||||
BlenderDatasetMapProvider,
|
|
||||||
)
|
|
||||||
from .json_index_dataset_map_provider import ( # noqa: F401
|
|
||||||
JsonIndexDatasetMapProvider,
|
|
||||||
)
|
|
||||||
from .json_index_dataset_map_provider_v2 import ( # noqa: F401
|
|
||||||
JsonIndexDatasetMapProviderV2,
|
|
||||||
)
|
|
||||||
from .llff_dataset_map_provider import LlffDatasetMapProvider # noqa: F401
|
|
||||||
from .rendered_mesh_dataset_map_provider import ( # noqa: F401
|
|
||||||
RenderedMeshDatasetMapProvider,
|
|
||||||
)
|
|
||||||
from .train_eval_data_loader_provider import ( # noqa: F401
|
|
||||||
TrainEvalDataLoaderMapProvider,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
from .sql_dataset_provider import ( # noqa: F401 # pyre-ignore
|
|
||||||
SqlIndexDatasetMapProvider,
|
|
||||||
)
|
|
||||||
except ModuleNotFoundError:
|
|
||||||
pass # environment without SQL dataset
|
|
||||||
finally:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
run_auto_creation(self)
|
run_auto_creation(self)
|
||||||
self._all_train_cameras_cache: Optional[Tuple[Optional[CamerasBase]]] = None
|
self._all_train_cameras_cache: Optional[Tuple[Optional[CamerasBase]]] = None
|
||||||
@@ -101,9 +70,6 @@ class ImplicitronDataSource(DataSourceBase):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def all_train_cameras(self) -> Optional[CamerasBase]:
|
def all_train_cameras(self) -> Optional[CamerasBase]:
|
||||||
"""
|
|
||||||
DEPRECATED! The property will be removed in future versions.
|
|
||||||
"""
|
|
||||||
if self._all_train_cameras_cache is None: # pyre-ignore[16]
|
if self._all_train_cameras_cache is None: # pyre-ignore[16]
|
||||||
all_train_cameras = self.dataset_map_provider.get_all_train_cameras()
|
all_train_cameras = self.dataset_map_provider.get_all_train_cameras()
|
||||||
self._all_train_cameras_cache = (all_train_cameras,)
|
self._all_train_cameras_cache = (all_train_cameras,)
|
||||||
|
|||||||
@@ -4,30 +4,218 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass, field, fields
|
||||||
from typing import (
|
from typing import (
|
||||||
|
Any,
|
||||||
ClassVar,
|
ClassVar,
|
||||||
Dict,
|
Dict,
|
||||||
Iterable,
|
Iterable,
|
||||||
Iterator,
|
Iterator,
|
||||||
List,
|
List,
|
||||||
|
Mapping,
|
||||||
Optional,
|
Optional,
|
||||||
Sequence,
|
Sequence,
|
||||||
Tuple,
|
Tuple,
|
||||||
Type,
|
Type,
|
||||||
|
Union,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
from pytorch3d.renderer.camera_utils import join_cameras_as_batch
|
||||||
|
from pytorch3d.renderer.cameras import CamerasBase, PerspectiveCameras
|
||||||
|
from pytorch3d.structures.pointclouds import join_pointclouds_as_batch, Pointclouds
|
||||||
|
|
||||||
from pytorch3d.implicitron.dataset.frame_data import FrameData
|
|
||||||
from pytorch3d.implicitron.dataset.utils import GenericWorkaround
|
@dataclass
|
||||||
|
class FrameData(Mapping[str, Any]):
|
||||||
|
"""
|
||||||
|
A type of the elements returned by indexing the dataset object.
|
||||||
|
It can represent both individual frames and batches of thereof;
|
||||||
|
in this documentation, the sizes of tensors refer to single frames;
|
||||||
|
add the first batch dimension for the collation result.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
frame_number: The number of the frame within its sequence.
|
||||||
|
0-based continuous integers.
|
||||||
|
sequence_name: The unique name of the frame's sequence.
|
||||||
|
sequence_category: The object category of the sequence.
|
||||||
|
frame_timestamp: The time elapsed since the start of a sequence in sec.
|
||||||
|
image_size_hw: The size of the image in pixels; (height, width) tensor
|
||||||
|
of shape (2,).
|
||||||
|
image_path: The qualified path to the loaded image (with dataset_root).
|
||||||
|
image_rgb: A Tensor of shape `(3, H, W)` holding the RGB image
|
||||||
|
of the frame; elements are floats in [0, 1].
|
||||||
|
mask_crop: A binary mask of shape `(1, H, W)` denoting the valid image
|
||||||
|
regions. Regions can be invalid (mask_crop[i,j]=0) in case they
|
||||||
|
are a result of zero-padding of the image after cropping around
|
||||||
|
the object bounding box; elements are floats in {0.0, 1.0}.
|
||||||
|
depth_path: The qualified path to the frame's depth map.
|
||||||
|
depth_map: A float Tensor of shape `(1, H, W)` holding the depth map
|
||||||
|
of the frame; values correspond to distances from the camera;
|
||||||
|
use `depth_mask` and `mask_crop` to filter for valid pixels.
|
||||||
|
depth_mask: A binary mask of shape `(1, H, W)` denoting pixels of the
|
||||||
|
depth map that are valid for evaluation, they have been checked for
|
||||||
|
consistency across views; elements are floats in {0.0, 1.0}.
|
||||||
|
mask_path: A qualified path to the foreground probability mask.
|
||||||
|
fg_probability: A Tensor of `(1, H, W)` denoting the probability of the
|
||||||
|
pixels belonging to the captured object; elements are floats
|
||||||
|
in [0, 1].
|
||||||
|
bbox_xywh: The bounding box tightly enclosing the foreground object in the
|
||||||
|
format (x0, y0, width, height). The convention assumes that
|
||||||
|
`x0+width` and `y0+height` includes the boundary of the box.
|
||||||
|
I.e., to slice out the corresponding crop from an image tensor `I`
|
||||||
|
we execute `crop = I[..., y0:y0+height, x0:x0+width]`
|
||||||
|
crop_bbox_xywh: The bounding box denoting the boundaries of `image_rgb`
|
||||||
|
in the original image coordinates in the format (x0, y0, width, height).
|
||||||
|
The convention is the same as for `bbox_xywh`. `crop_bbox_xywh` differs
|
||||||
|
from `bbox_xywh` due to padding (which can happen e.g. due to
|
||||||
|
setting `JsonIndexDataset.box_crop_context > 0`)
|
||||||
|
camera: A PyTorch3D camera object corresponding the frame's viewpoint,
|
||||||
|
corrected for cropping if it happened.
|
||||||
|
camera_quality_score: The score proportional to the confidence of the
|
||||||
|
frame's camera estimation (the higher the more accurate).
|
||||||
|
point_cloud_quality_score: The score proportional to the accuracy of the
|
||||||
|
frame's sequence point cloud (the higher the more accurate).
|
||||||
|
sequence_point_cloud_path: The path to the sequence's point cloud.
|
||||||
|
sequence_point_cloud: A PyTorch3D Pointclouds object holding the
|
||||||
|
point cloud corresponding to the frame's sequence. When the object
|
||||||
|
represents a batch of frames, point clouds may be deduplicated;
|
||||||
|
see `sequence_point_cloud_idx`.
|
||||||
|
sequence_point_cloud_idx: Integer indices mapping frame indices to the
|
||||||
|
corresponding point clouds in `sequence_point_cloud`; to get the
|
||||||
|
corresponding point cloud to `image_rgb[i]`, use
|
||||||
|
`sequence_point_cloud[sequence_point_cloud_idx[i]]`.
|
||||||
|
frame_type: The type of the loaded frame specified in
|
||||||
|
`subset_lists_file`, if provided.
|
||||||
|
meta: A dict for storing additional frame information.
|
||||||
|
"""
|
||||||
|
|
||||||
|
frame_number: Optional[torch.LongTensor]
|
||||||
|
sequence_name: Union[str, List[str]]
|
||||||
|
sequence_category: Union[str, List[str]]
|
||||||
|
frame_timestamp: Optional[torch.Tensor] = None
|
||||||
|
image_size_hw: Optional[torch.Tensor] = None
|
||||||
|
image_path: Union[str, List[str], None] = None
|
||||||
|
image_rgb: Optional[torch.Tensor] = None
|
||||||
|
# masks out padding added due to cropping the square bit
|
||||||
|
mask_crop: Optional[torch.Tensor] = None
|
||||||
|
depth_path: Union[str, List[str], None] = None
|
||||||
|
depth_map: Optional[torch.Tensor] = None
|
||||||
|
depth_mask: Optional[torch.Tensor] = None
|
||||||
|
mask_path: Union[str, List[str], None] = None
|
||||||
|
fg_probability: Optional[torch.Tensor] = None
|
||||||
|
bbox_xywh: Optional[torch.Tensor] = None
|
||||||
|
crop_bbox_xywh: Optional[torch.Tensor] = None
|
||||||
|
camera: Optional[PerspectiveCameras] = None
|
||||||
|
camera_quality_score: Optional[torch.Tensor] = None
|
||||||
|
point_cloud_quality_score: Optional[torch.Tensor] = None
|
||||||
|
sequence_point_cloud_path: Union[str, List[str], None] = None
|
||||||
|
sequence_point_cloud: Optional[Pointclouds] = None
|
||||||
|
sequence_point_cloud_idx: Optional[torch.Tensor] = None
|
||||||
|
frame_type: Union[str, List[str], None] = None # known | unseen
|
||||||
|
meta: dict = field(default_factory=lambda: {})
|
||||||
|
|
||||||
|
def to(self, *args, **kwargs):
|
||||||
|
new_params = {}
|
||||||
|
for f in fields(self):
|
||||||
|
value = getattr(self, f.name)
|
||||||
|
if isinstance(value, (torch.Tensor, Pointclouds, CamerasBase)):
|
||||||
|
new_params[f.name] = value.to(*args, **kwargs)
|
||||||
|
else:
|
||||||
|
new_params[f.name] = value
|
||||||
|
return type(self)(**new_params)
|
||||||
|
|
||||||
|
def cpu(self):
|
||||||
|
return self.to(device=torch.device("cpu"))
|
||||||
|
|
||||||
|
def cuda(self):
|
||||||
|
return self.to(device=torch.device("cuda"))
|
||||||
|
|
||||||
|
# the following functions make sure **frame_data can be passed to functions
|
||||||
|
def __iter__(self):
|
||||||
|
for f in fields(self):
|
||||||
|
yield f.name
|
||||||
|
|
||||||
|
def __getitem__(self, key):
|
||||||
|
return getattr(self, key)
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return len(fields(self))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def collate(cls, batch):
|
||||||
|
"""
|
||||||
|
Given a list objects `batch` of class `cls`, collates them into a batched
|
||||||
|
representation suitable for processing with deep networks.
|
||||||
|
"""
|
||||||
|
|
||||||
|
elem = batch[0]
|
||||||
|
|
||||||
|
if isinstance(elem, cls):
|
||||||
|
pointcloud_ids = [id(el.sequence_point_cloud) for el in batch]
|
||||||
|
id_to_idx = defaultdict(list)
|
||||||
|
for i, pc_id in enumerate(pointcloud_ids):
|
||||||
|
id_to_idx[pc_id].append(i)
|
||||||
|
|
||||||
|
sequence_point_cloud = []
|
||||||
|
sequence_point_cloud_idx = -np.ones((len(batch),))
|
||||||
|
for i, ind in enumerate(id_to_idx.values()):
|
||||||
|
sequence_point_cloud_idx[ind] = i
|
||||||
|
sequence_point_cloud.append(batch[ind[0]].sequence_point_cloud)
|
||||||
|
assert (sequence_point_cloud_idx >= 0).all()
|
||||||
|
|
||||||
|
override_fields = {
|
||||||
|
"sequence_point_cloud": sequence_point_cloud,
|
||||||
|
"sequence_point_cloud_idx": sequence_point_cloud_idx.tolist(),
|
||||||
|
}
|
||||||
|
# note that the pre-collate value of sequence_point_cloud_idx is unused
|
||||||
|
|
||||||
|
collated = {}
|
||||||
|
for f in fields(elem):
|
||||||
|
list_values = override_fields.get(
|
||||||
|
f.name, [getattr(d, f.name) for d in batch]
|
||||||
|
)
|
||||||
|
collated[f.name] = (
|
||||||
|
cls.collate(list_values)
|
||||||
|
if all(list_value is not None for list_value in list_values)
|
||||||
|
else None
|
||||||
|
)
|
||||||
|
return cls(**collated)
|
||||||
|
|
||||||
|
elif isinstance(elem, Pointclouds):
|
||||||
|
return join_pointclouds_as_batch(batch)
|
||||||
|
|
||||||
|
elif isinstance(elem, CamerasBase):
|
||||||
|
# TODO: don't store K; enforce working in NDC space
|
||||||
|
return join_cameras_as_batch(batch)
|
||||||
|
else:
|
||||||
|
return torch.utils.data._utils.collate.default_collate(batch)
|
||||||
|
|
||||||
|
|
||||||
|
class _GenericWorkaround:
|
||||||
|
"""
|
||||||
|
OmegaConf.structured has a weirdness when you try to apply
|
||||||
|
it to a dataclass whose first base class is a Generic which is not
|
||||||
|
Dict. The issue is with a function called get_dict_key_value_types
|
||||||
|
in omegaconf/_utils.py.
|
||||||
|
For example this fails:
|
||||||
|
|
||||||
|
@dataclass(eq=False)
|
||||||
|
class D(torch.utils.data.Dataset[int]):
|
||||||
|
a: int = 3
|
||||||
|
|
||||||
|
OmegaConf.structured(D)
|
||||||
|
|
||||||
|
We avoid the problem by adding this class as an extra base class.
|
||||||
|
"""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@dataclass(eq=False)
|
@dataclass(eq=False)
|
||||||
class DatasetBase(GenericWorkaround, torch.utils.data.Dataset[FrameData]):
|
class DatasetBase(_GenericWorkaround, torch.utils.data.Dataset[FrameData]):
|
||||||
"""
|
"""
|
||||||
Base class to describe a dataset to be used with Implicitron.
|
Base class to describe a dataset to be used with Implicitron.
|
||||||
|
|
||||||
@@ -49,7 +237,7 @@ class DatasetBase(GenericWorkaround, torch.utils.data.Dataset[FrameData]):
|
|||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def get_frame_numbers_and_timestamps(
|
def get_frame_numbers_and_timestamps(
|
||||||
self, idxs: Sequence[int], subset_filter: Optional[Sequence[str]] = None
|
self, idxs: Sequence[int]
|
||||||
) -> List[Tuple[int, float]]:
|
) -> List[Tuple[int, float]]:
|
||||||
"""
|
"""
|
||||||
If the sequences in the dataset are videos rather than
|
If the sequences in the dataset are videos rather than
|
||||||
@@ -63,9 +251,7 @@ class DatasetBase(GenericWorkaround, torch.utils.data.Dataset[FrameData]):
|
|||||||
frames.
|
frames.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
idxs: frame index in self
|
idx: frame index in self
|
||||||
subset_filter: If given, an index in idxs is ignored if the
|
|
||||||
corresponding frame is not in any of the named subsets.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
tuple of
|
tuple of
|
||||||
@@ -105,7 +291,7 @@ class DatasetBase(GenericWorkaround, torch.utils.data.Dataset[FrameData]):
|
|||||||
return dict(c2seq)
|
return dict(c2seq)
|
||||||
|
|
||||||
def sequence_frames_in_order(
|
def sequence_frames_in_order(
|
||||||
self, seq_name: str, subset_filter: Optional[Sequence[str]] = None
|
self, seq_name: str
|
||||||
) -> Iterator[Tuple[float, int, int]]:
|
) -> Iterator[Tuple[float, int, int]]:
|
||||||
"""Returns an iterator over the frame indices in a given sequence.
|
"""Returns an iterator over the frame indices in a given sequence.
|
||||||
We attempt to first sort by timestamp (if they are available),
|
We attempt to first sort by timestamp (if they are available),
|
||||||
@@ -122,9 +308,7 @@ class DatasetBase(GenericWorkaround, torch.utils.data.Dataset[FrameData]):
|
|||||||
"""
|
"""
|
||||||
# pyre-ignore[16]
|
# pyre-ignore[16]
|
||||||
seq_frame_indices = self._seq_to_idx[seq_name]
|
seq_frame_indices = self._seq_to_idx[seq_name]
|
||||||
nos_timestamps = self.get_frame_numbers_and_timestamps(
|
nos_timestamps = self.get_frame_numbers_and_timestamps(seq_frame_indices)
|
||||||
seq_frame_indices, subset_filter
|
|
||||||
)
|
|
||||||
|
|
||||||
yield from sorted(
|
yield from sorted(
|
||||||
[
|
[
|
||||||
@@ -133,13 +317,11 @@ class DatasetBase(GenericWorkaround, torch.utils.data.Dataset[FrameData]):
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
def sequence_indices_in_order(
|
def sequence_indices_in_order(self, seq_name: str) -> Iterator[int]:
|
||||||
self, seq_name: str, subset_filter: Optional[Sequence[str]] = None
|
|
||||||
) -> Iterator[int]:
|
|
||||||
"""Same as `sequence_frames_in_order` but returns the iterator over
|
"""Same as `sequence_frames_in_order` but returns the iterator over
|
||||||
only dataset indices.
|
only dataset indices.
|
||||||
"""
|
"""
|
||||||
for _, _, idx in self.sequence_frames_in_order(seq_name, subset_filter):
|
for _, _, idx in self.sequence_frames_in_order(seq_name):
|
||||||
yield idx
|
yield idx
|
||||||
|
|
||||||
# frame_data_type is the actual type of frames returned by the dataset.
|
# frame_data_type is the actual type of frames returned by the dataset.
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# This source code is licensed under the BSD-style license found in the
|
# This source code is licensed under the BSD-style license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
# pyre-unsafe
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
@@ -97,7 +95,6 @@ class DatasetMapProviderBase(ReplaceableBase):
|
|||||||
|
|
||||||
def get_all_train_cameras(self) -> Optional[CamerasBase]:
|
def get_all_train_cameras(self) -> Optional[CamerasBase]:
|
||||||
"""
|
"""
|
||||||
DEPRECATED! The function will be removed in future versions.
|
|
||||||
If the data is all for a single scene, returns a list
|
If the data is all for a single scene, returns a list
|
||||||
of the known training cameras for that scene, which is
|
of the known training cameras for that scene, which is
|
||||||
used for evaluating the difficulty of the unknown
|
used for evaluating the difficulty of the unknown
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user