Spaces:
Running
on
Zero
Running
on
Zero
brandonsmart
commited on
Commit
•
5ed9923
1
Parent(s):
7e83b50
Initial commit
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- README.md +54 -12
- ablations.py +75 -0
- configs/debug.yaml +17 -0
- configs/main.yaml +42 -0
- configs/with_mast3r_loss.yaml +6 -0
- configs/without_lpips_loss.yaml +6 -0
- configs/without_masking.yaml +7 -0
- configs/without_offset.yaml +5 -0
- data/data.py +205 -0
- data/scannetpp/scannetpp.py +187 -0
- demo.py +139 -0
- environment.yml +453 -0
- main.py +429 -0
- src/mast3r_src/CHECKPOINTS_NOTICE +1376 -0
- src/mast3r_src/LICENSE +7 -0
- src/mast3r_src/NOTICE +103 -0
- src/mast3r_src/README.md +316 -0
- src/mast3r_src/assets/NLE_tower/01D90321-69C8-439F-B0B0-E87E7634741C-83120-000041DAE419D7AE.jpg +0 -0
- src/mast3r_src/assets/NLE_tower/1AD85EF5-B651-4291-A5C0-7BDB7D966384-83120-000041DADF639E09.jpg +0 -0
- src/mast3r_src/assets/NLE_tower/2679C386-1DC0-4443-81B5-93D7EDE4AB37-83120-000041DADB2EA917.jpg +0 -0
- src/mast3r_src/assets/NLE_tower/28EDBB63-B9F9-42FB-AC86-4852A33ED71B-83120-000041DAF22407A1.jpg +0 -0
- src/mast3r_src/assets/NLE_tower/91E9B685-7A7D-42D7-B933-23A800EE4129-83120-000041DAE12C8176.jpg +0 -0
- src/mast3r_src/assets/NLE_tower/CDBBD885-54C3-4EB4-9181-226059A60EE0-83120-000041DAE0C3D612.jpg +0 -0
- src/mast3r_src/assets/NLE_tower/FF5599FD-768B-431A-AB83-BDA5FB44CB9D-83120-000041DADDE35483.jpg +0 -0
- src/mast3r_src/assets/demo.jpg +0 -0
- src/mast3r_src/assets/examples.jpg +0 -0
- src/mast3r_src/assets/mast3r.jpg +0 -0
- src/mast3r_src/assets/mast3r_archi.jpg +0 -0
- src/mast3r_src/assets/matching.jpg +0 -0
- src/mast3r_src/demo.py +314 -0
- src/mast3r_src/demo_dust3r_ga.py +64 -0
- src/mast3r_src/dust3r/.gitignore +132 -0
- src/mast3r_src/dust3r/.gitmodules +3 -0
- src/mast3r_src/dust3r/LICENSE +7 -0
- src/mast3r_src/dust3r/NOTICE +12 -0
- src/mast3r_src/dust3r/README.md +388 -0
- src/mast3r_src/dust3r/assets/demo.jpg +0 -0
- src/mast3r_src/dust3r/assets/dust3r.jpg +0 -0
- src/mast3r_src/dust3r/assets/dust3r_archi.jpg +0 -0
- src/mast3r_src/dust3r/assets/matching.jpg +0 -0
- src/mast3r_src/dust3r/assets/pipeline1.jpg +0 -0
- src/mast3r_src/dust3r/croco/LICENSE +52 -0
- src/mast3r_src/dust3r/croco/NOTICE +21 -0
- src/mast3r_src/dust3r/croco/README.MD +124 -0
- src/mast3r_src/dust3r/croco/assets/Chateau1.png +0 -0
- src/mast3r_src/dust3r/croco/assets/Chateau2.png +0 -0
- src/mast3r_src/dust3r/croco/assets/arch.jpg +0 -0
- src/mast3r_src/dust3r/croco/croco-stereo-flow-demo.ipynb +191 -0
- src/mast3r_src/dust3r/croco/datasets/__init__.py +0 -0
- src/mast3r_src/dust3r/croco/datasets/crops/README.MD +104 -0
README.md
CHANGED
@@ -1,12 +1,54 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Splatt3R: Zero-shot Gaussian Splatting from Uncalibarated Image Pairs
|
2 |
+
|
3 |
+
Official implementation of `Zero-shot Gaussian Splatting from Uncalibarated Image Pairs`
|
4 |
+
|
5 |
+
Links removed for anonymity:
|
6 |
+
[Project Page](), [Splatt3R arXiv]()
|
7 |
+
|
8 |
+
## Installation
|
9 |
+
|
10 |
+
1. Clone Splatt3R
|
11 |
+
```bash
|
12 |
+
git clone <redacted github link>
|
13 |
+
cd splatt3r
|
14 |
+
```
|
15 |
+
|
16 |
+
2. Setup Anaconda Environment
|
17 |
+
```bash
|
18 |
+
conda env create -f environment.yml
|
19 |
+
pip install git+https://github.com/dcharatan/diff-gaussian-rasterization-modified
|
20 |
+
```
|
21 |
+
|
22 |
+
3. (Optional) Compile the CUDA kernels for RoPE (as in MASt3R and CroCo v2)
|
23 |
+
|
24 |
+
```bash
|
25 |
+
cd src/dust3r_src/croco/models/curope/
|
26 |
+
python setup.py build_ext --inplace
|
27 |
+
cd ../../../../../
|
28 |
+
```
|
29 |
+
|
30 |
+
## Checkpoints
|
31 |
+
|
32 |
+
We train our model using the pretrained `MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric` checkpoint from the MASt3R authors, available from [the MASt3R GitHub repo](https://github.com/naver/mast3r). This checkpoint is placed at the file path `checkpoints/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric.pth`.
|
33 |
+
|
34 |
+
A pretrained Splatt3R model can be downloaded [here]() (redacted link).
|
35 |
+
|
36 |
+
## Data
|
37 |
+
|
38 |
+
We use ScanNet++ to train our model. We download the data from the [official ScanNet++ homepage](https://kaldir.vc.in.tum.de/scannetpp/) and process the data using SplaTAM's modified version of [the ScanNet++ toolkit](https://github.com/Nik-V9/scannetpp). We save the processed data to the 'processed' subfolder of the ScanNet++ root directory.
|
39 |
+
|
40 |
+
Our generated test coverage files, and our training and testing splits, can be downloaded [here]() (redacted link), and placed in `data/scannetpp`.
|
41 |
+
|
42 |
+
## Demo
|
43 |
+
|
44 |
+
The Gradio demo can be run using `python demo.py <checkpoint_path>`, replacing `<checkpoint_path>` with the trained network path. A checkpoint will be available for the public release of this code.
|
45 |
+
|
46 |
+
This demo generates a `.ply` file that represents the scene, which can be downloaded and rendered using online 3D Gaussian Splatting viewers such as [here](https://projects.markkellogg.org/threejs/demo_gaussian_splats_3d.php?art=1&cu=0,-1,0&cp=0,1,0&cla=1,0,0&aa=false&2d=false&sh=0) or [here](https://playcanvas.com/supersplat/editor).
|
47 |
+
|
48 |
+
## Training
|
49 |
+
|
50 |
+
Our training run can be recreated by running `python main.py configs/main.yaml`. Other configurations can be found in the `configs` folder.
|
51 |
+
|
52 |
+
## BibTeX
|
53 |
+
|
54 |
+
Forthcoming arXiv citation
|
ablations.py
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from main import *
|
2 |
+
|
3 |
+
|
4 |
+
def default_run():
|
5 |
+
|
6 |
+
# Setup the workspace (eg. load the config, create a directory for results at config.save_dir, etc.)
|
7 |
+
config_location = "configs/main.yaml"
|
8 |
+
config = workspace.load_config(config_location, None)
|
9 |
+
if os.getenv("LOCAL_RANK", '0') == '0':
|
10 |
+
config = workspace.create_workspace(config)
|
11 |
+
|
12 |
+
# Run the experiment
|
13 |
+
run_experiment(config)
|
14 |
+
|
15 |
+
|
16 |
+
def with_mast3r_loss():
|
17 |
+
|
18 |
+
# Setup the workspace (eg. load the config, create a directory for results at config.save_dir, etc.)
|
19 |
+
config_location = "configs/with_mast3r_loss.yaml"
|
20 |
+
config = workspace.load_config(config_location, None)
|
21 |
+
if os.getenv("LOCAL_RANK", '0') == '0':
|
22 |
+
config = workspace.create_workspace(config)
|
23 |
+
|
24 |
+
# Run the experiment
|
25 |
+
run_experiment(config)
|
26 |
+
|
27 |
+
|
28 |
+
def without_masking():
|
29 |
+
|
30 |
+
# Setup the workspace (eg. load the config, create a directory for results at config.save_dir, etc.)
|
31 |
+
config_location = "configs/without_masking.yaml"
|
32 |
+
config = workspace.load_config(config_location, None)
|
33 |
+
if os.getenv("LOCAL_RANK", '0') == '0':
|
34 |
+
config = workspace.create_workspace(config)
|
35 |
+
|
36 |
+
# Run the experiment
|
37 |
+
run_experiment(config)
|
38 |
+
|
39 |
+
|
40 |
+
def without_lpips_loss():
|
41 |
+
|
42 |
+
# Setup the workspace (eg. load the config, create a directory for results at config.save_dir, etc.)
|
43 |
+
config_location = "configs/without_lpips_loss.yaml"
|
44 |
+
config = workspace.load_config(config_location, None)
|
45 |
+
if os.getenv("LOCAL_RANK", '0') == '0':
|
46 |
+
config = workspace.create_workspace(config)
|
47 |
+
|
48 |
+
# Run the experiment
|
49 |
+
run_experiment(config)
|
50 |
+
|
51 |
+
|
52 |
+
def without_offset():
|
53 |
+
|
54 |
+
# Setup the workspace (eg. load the config, create a directory for results at config.save_dir, etc.)
|
55 |
+
config_location = "configs/without_offset.yaml"
|
56 |
+
config = workspace.load_config(config_location, None)
|
57 |
+
if os.getenv("LOCAL_RANK", '0') == '0':
|
58 |
+
config = workspace.create_workspace(config)
|
59 |
+
|
60 |
+
# Run the experiment
|
61 |
+
run_experiment(config)
|
62 |
+
|
63 |
+
|
64 |
+
if __name__ == "__main__":
|
65 |
+
|
66 |
+
# Somewhat hacky way to fetch the function corresponding to the ablation we want to run
|
67 |
+
ablation_name = sys.argv[1]
|
68 |
+
ablation_function = locals().get(ablation_name)
|
69 |
+
|
70 |
+
# Run the ablation if it exists
|
71 |
+
if ablation_function:
|
72 |
+
ablation_function()
|
73 |
+
else:
|
74 |
+
raise NotImplementedError(
|
75 |
+
f"Ablation name '{sys.argv[1]}' not recognised")
|
configs/debug.yaml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
include: ['main.yaml']
|
2 |
+
|
3 |
+
save_dir: './results/debug/${name}/'
|
4 |
+
|
5 |
+
devices: [0]
|
6 |
+
|
7 |
+
loggers:
|
8 |
+
use_wandb: True
|
9 |
+
|
10 |
+
data:
|
11 |
+
root: '/media/brandon/anubis09/scannetpp'
|
12 |
+
batch_size: 2
|
13 |
+
num_workers: 8
|
14 |
+
epochs_per_train_epoch: 10
|
15 |
+
|
16 |
+
opt:
|
17 |
+
epochs: 1
|
configs/main.yaml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: '%Y-%m-%d-%H-%M-%S'
|
2 |
+
|
3 |
+
save_dir: './results/${name}/'
|
4 |
+
|
5 |
+
# Environment
|
6 |
+
seed: 0
|
7 |
+
devices: 'auto'
|
8 |
+
|
9 |
+
# Loggers
|
10 |
+
use_profiler: False
|
11 |
+
loggers:
|
12 |
+
use_csv_logger: True
|
13 |
+
use_wandb: True
|
14 |
+
|
15 |
+
# Model
|
16 |
+
use_pretrained: True
|
17 |
+
pretrained_mast3r_path: './checkpoints/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric.pth'
|
18 |
+
|
19 |
+
# Data
|
20 |
+
data:
|
21 |
+
root: '/home/bras5602/data/scannetpp'
|
22 |
+
batch_size: 12
|
23 |
+
num_workers: 16
|
24 |
+
resolution: [512, 512]
|
25 |
+
epochs_per_train_epoch: 100 # How many times to sample from each scene each training epoch (helps avoid unnecessary Pytorch Lightning overhead)
|
26 |
+
|
27 |
+
# Optimization
|
28 |
+
opt:
|
29 |
+
epochs: 20
|
30 |
+
lr: 0.00001
|
31 |
+
weight_decay: 0.05
|
32 |
+
gradient_clip_val: 0.5
|
33 |
+
|
34 |
+
loss:
|
35 |
+
mse_loss_weight: 1.0
|
36 |
+
lpips_loss_weight: 0.25
|
37 |
+
mast3r_loss_weight: Null
|
38 |
+
apply_mask: True
|
39 |
+
average_over_mask: True
|
40 |
+
|
41 |
+
use_offsets: True
|
42 |
+
sh_degree: 1
|
configs/with_mast3r_loss.yaml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
include: ['main.yaml']
|
2 |
+
|
3 |
+
name: 'with_mast3r_loss/%Y-%m-%d-%H-%M-%S'
|
4 |
+
|
5 |
+
loss:
|
6 |
+
mast3r_loss_weight: 0.05
|
configs/without_lpips_loss.yaml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
include: ['main.yaml']
|
2 |
+
|
3 |
+
name: 'without_lpips_loss/%Y-%m-%d-%H-%M-%S'
|
4 |
+
|
5 |
+
loss:
|
6 |
+
lpips_loss_weight: 0.0
|
configs/without_masking.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
include: ['main.yaml']
|
2 |
+
|
3 |
+
name: 'without_masking/%Y-%m-%d-%H-%M-%S'
|
4 |
+
|
5 |
+
loss:
|
6 |
+
apply_mask: False
|
7 |
+
average_over_mask: False
|
configs/without_offset.yaml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
include: ['main.yaml']
|
2 |
+
|
3 |
+
name: 'without_offset/%Y-%m-%d-%H-%M-%S'
|
4 |
+
|
5 |
+
use_offsets: False
|
data/data.py
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import random
|
2 |
+
|
3 |
+
import numpy as np
|
4 |
+
import PIL
|
5 |
+
import torch
|
6 |
+
import torchvision
|
7 |
+
|
8 |
+
from src.mast3r_src.dust3r.dust3r.datasets.utils.transforms import ImgNorm
|
9 |
+
from src.mast3r_src.dust3r.dust3r.utils.geometry import depthmap_to_absolute_camera_coordinates, geotrf
|
10 |
+
from src.mast3r_src.dust3r.dust3r.utils.misc import invalid_to_zeros
|
11 |
+
import src.mast3r_src.dust3r.dust3r.datasets.utils.cropping as cropping
|
12 |
+
|
13 |
+
|
14 |
+
def crop_resize_if_necessary(image, depthmap, intrinsics, resolution):
|
15 |
+
"""Adapted from DUST3R's Co3D dataset implementation"""
|
16 |
+
|
17 |
+
if not isinstance(image, PIL.Image.Image):
|
18 |
+
image = PIL.Image.fromarray(image)
|
19 |
+
|
20 |
+
# Downscale with lanczos interpolation so that image.size == resolution cropping centered on the principal point
|
21 |
+
# The new window will be a rectangle of size (2*min_margin_x, 2*min_margin_y) centered on (cx,cy)
|
22 |
+
W, H = image.size
|
23 |
+
cx, cy = intrinsics[:2, 2].round().astype(int)
|
24 |
+
min_margin_x = min(cx, W - cx)
|
25 |
+
min_margin_y = min(cy, H - cy)
|
26 |
+
assert min_margin_x > W / 5
|
27 |
+
assert min_margin_y > H / 5
|
28 |
+
l, t = cx - min_margin_x, cy - min_margin_y
|
29 |
+
r, b = cx + min_margin_x, cy + min_margin_y
|
30 |
+
crop_bbox = (l, t, r, b)
|
31 |
+
image, depthmap, intrinsics = cropping.crop_image_depthmap(image, depthmap, intrinsics, crop_bbox)
|
32 |
+
|
33 |
+
# High-quality Lanczos down-scaling
|
34 |
+
target_resolution = np.array(resolution)
|
35 |
+
image, depthmap, intrinsics = cropping.rescale_image_depthmap(image, depthmap, intrinsics, target_resolution)
|
36 |
+
|
37 |
+
# Actual cropping (if necessary) with bilinear interpolation
|
38 |
+
intrinsics2 = cropping.camera_matrix_of_crop(intrinsics, image.size, resolution, offset_factor=0.5)
|
39 |
+
crop_bbox = cropping.bbox_from_intrinsics_in_out(intrinsics, intrinsics2, resolution)
|
40 |
+
image, depthmap, intrinsics2 = cropping.crop_image_depthmap(image, depthmap, intrinsics, crop_bbox)
|
41 |
+
|
42 |
+
return image, depthmap, intrinsics2
|
43 |
+
|
44 |
+
|
45 |
+
class DUST3RSplattingDataset(torch.utils.data.Dataset):
|
46 |
+
|
47 |
+
def __init__(self, data, coverage, resolution, num_epochs_per_epoch=1, alpha=0.3, beta=0.3):
|
48 |
+
|
49 |
+
super(DUST3RSplattingDataset, self).__init__()
|
50 |
+
self.data = data
|
51 |
+
self.coverage = coverage
|
52 |
+
|
53 |
+
self.num_context_views = 2
|
54 |
+
self.num_target_views = 3
|
55 |
+
|
56 |
+
self.resolution = resolution
|
57 |
+
self.transform = ImgNorm
|
58 |
+
self.org_transform = torchvision.transforms.ToTensor()
|
59 |
+
self.num_epochs_per_epoch = num_epochs_per_epoch
|
60 |
+
|
61 |
+
self.alpha = alpha
|
62 |
+
self.beta = beta
|
63 |
+
|
64 |
+
def __getitem__(self, idx):
|
65 |
+
|
66 |
+
sequence = self.data.sequences[idx // self.num_epochs_per_epoch]
|
67 |
+
sequence_length = len(self.data.color_paths[sequence])
|
68 |
+
|
69 |
+
context_views, target_views = self.sample(sequence, self.num_target_views, self.alpha, self.beta)
|
70 |
+
|
71 |
+
views = {"context": [], "target": [], "scene": sequence}
|
72 |
+
|
73 |
+
# Fetch the context views
|
74 |
+
for c_view in context_views:
|
75 |
+
|
76 |
+
assert c_view < sequence_length, f"Invalid view index: {c_view}, sequence length: {sequence_length}, c_views: {context_views}"
|
77 |
+
|
78 |
+
view = self.data.get_view(sequence, c_view, self.resolution)
|
79 |
+
|
80 |
+
# Transform the input
|
81 |
+
view['img'] = self.transform(view['original_img'])
|
82 |
+
view['original_img'] = self.org_transform(view['original_img'])
|
83 |
+
|
84 |
+
# Create the point cloud and validity mask
|
85 |
+
pts3d, valid_mask = depthmap_to_absolute_camera_coordinates(**view)
|
86 |
+
view['pts3d'] = pts3d
|
87 |
+
view['valid_mask'] = valid_mask & np.isfinite(pts3d).all(axis=-1)
|
88 |
+
assert view['valid_mask'].any(), f"Invalid mask for sequence: {sequence}, view: {c_view}"
|
89 |
+
|
90 |
+
views['context'].append(view)
|
91 |
+
|
92 |
+
# Fetch the target views
|
93 |
+
for t_view in target_views:
|
94 |
+
|
95 |
+
view = self.data.get_view(sequence, t_view, self.resolution)
|
96 |
+
view['original_img'] = self.org_transform(view['original_img'])
|
97 |
+
views['target'].append(view)
|
98 |
+
|
99 |
+
return views
|
100 |
+
|
101 |
+
def __len__(self):
|
102 |
+
|
103 |
+
return len(self.data.sequences) * self.num_epochs_per_epoch
|
104 |
+
|
105 |
+
def sample(self, sequence, num_target_views, context_overlap_threshold=0.5, target_overlap_threshold=0.6):
|
106 |
+
|
107 |
+
first_context_view = random.randint(0, len(self.data.color_paths[sequence]) - 1)
|
108 |
+
|
109 |
+
# Pick a second context view that has sufficient overlap with the first context view
|
110 |
+
valid_second_context_views = []
|
111 |
+
for frame in range(len(self.data.color_paths[sequence])):
|
112 |
+
if frame == first_context_view:
|
113 |
+
continue
|
114 |
+
overlap = self.coverage[sequence][first_context_view][frame]
|
115 |
+
if overlap > context_overlap_threshold:
|
116 |
+
valid_second_context_views.append(frame)
|
117 |
+
if len(valid_second_context_views) > 0:
|
118 |
+
second_context_view = random.choice(valid_second_context_views)
|
119 |
+
|
120 |
+
# If there are no valid second context views, pick the best one
|
121 |
+
else:
|
122 |
+
best_view = None
|
123 |
+
best_overlap = None
|
124 |
+
for frame in range(len(self.data.color_paths[sequence])):
|
125 |
+
if frame == first_context_view:
|
126 |
+
continue
|
127 |
+
overlap = self.coverage[sequence][first_context_view][frame]
|
128 |
+
if best_view is None or overlap > best_overlap:
|
129 |
+
best_view = frame
|
130 |
+
best_overlap = overlap
|
131 |
+
second_context_view = best_view
|
132 |
+
|
133 |
+
# Pick the target views
|
134 |
+
valid_target_views = []
|
135 |
+
for frame in range(len(self.data.color_paths[sequence])):
|
136 |
+
if frame == first_context_view or frame == second_context_view:
|
137 |
+
continue
|
138 |
+
overlap_max = max(
|
139 |
+
self.coverage[sequence][first_context_view][frame],
|
140 |
+
self.coverage[sequence][second_context_view][frame]
|
141 |
+
)
|
142 |
+
if overlap_max > target_overlap_threshold:
|
143 |
+
valid_target_views.append(frame)
|
144 |
+
if len(valid_target_views) >= num_target_views:
|
145 |
+
target_views = random.sample(valid_target_views, num_target_views)
|
146 |
+
|
147 |
+
# If there are not enough valid target views, pick the best ones
|
148 |
+
else:
|
149 |
+
overlaps = []
|
150 |
+
for frame in range(len(self.data.color_paths[sequence])):
|
151 |
+
if frame == first_context_view or frame == second_context_view:
|
152 |
+
continue
|
153 |
+
overlap = max(
|
154 |
+
self.coverage[sequence][first_context_view][frame],
|
155 |
+
self.coverage[sequence][second_context_view][frame]
|
156 |
+
)
|
157 |
+
overlaps.append((frame, overlap))
|
158 |
+
overlaps.sort(key=lambda x: x[1], reverse=True)
|
159 |
+
target_views = [frame for frame, _ in overlaps[:num_target_views]]
|
160 |
+
|
161 |
+
return [first_context_view, second_context_view], target_views
|
162 |
+
|
163 |
+
|
164 |
+
class DUST3RSplattingTestDataset(torch.utils.data.Dataset):
|
165 |
+
|
166 |
+
def __init__(self, data, samples, resolution):
|
167 |
+
|
168 |
+
self.data = data
|
169 |
+
self.samples = samples
|
170 |
+
|
171 |
+
self.resolution = resolution
|
172 |
+
self.transform = ImgNorm
|
173 |
+
self.org_transform = torchvision.transforms.ToTensor()
|
174 |
+
|
175 |
+
def get_view(self, sequence, c_view):
|
176 |
+
|
177 |
+
view = self.data.get_view(sequence, c_view, self.resolution)
|
178 |
+
|
179 |
+
# Transform the input
|
180 |
+
view['img'] = self.transform(view['original_img'])
|
181 |
+
view['original_img'] = self.org_transform(view['original_img'])
|
182 |
+
|
183 |
+
# Create the point cloud and validity mask
|
184 |
+
pts3d, valid_mask = depthmap_to_absolute_camera_coordinates(**view)
|
185 |
+
view['pts3d'] = pts3d
|
186 |
+
view['valid_mask'] = valid_mask & np.isfinite(pts3d).all(axis=-1)
|
187 |
+
assert view['valid_mask'].any(), f"Invalid mask for sequence: {sequence}, view: {c_view}"
|
188 |
+
|
189 |
+
return view
|
190 |
+
|
191 |
+
def __getitem__(self, idx):
|
192 |
+
|
193 |
+
sequence, c_view_1, c_view_2, target_view = self.samples[idx]
|
194 |
+
c_view_1, c_view_2, target_view = int(c_view_1), int(c_view_2), int(target_view)
|
195 |
+
fetched_c_view_1 = self.get_view(sequence, c_view_1)
|
196 |
+
fetched_c_view_2 = self.get_view(sequence, c_view_2)
|
197 |
+
fetched_target_view = self.get_view(sequence, target_view)
|
198 |
+
|
199 |
+
views = {"context": [fetched_c_view_1, fetched_c_view_2], "target": [fetched_target_view], "scene": sequence}
|
200 |
+
|
201 |
+
return views
|
202 |
+
|
203 |
+
def __len__(self):
|
204 |
+
|
205 |
+
return len(self.samples)
|
data/scannetpp/scannetpp.py
ADDED
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import logging
|
3 |
+
import os
|
4 |
+
import sys
|
5 |
+
|
6 |
+
import cv2
|
7 |
+
import numpy as np
|
8 |
+
|
9 |
+
# Add dust3r to the sys.path
|
10 |
+
sys.path.append('src/dust3r_src')
|
11 |
+
from data.data import crop_resize_if_necessary, DUST3RSplattingDataset, DUST3RSplattingTestDataset
|
12 |
+
from src.mast3r_src.dust3r.dust3r.utils.image import imread_cv2
|
13 |
+
|
14 |
+
logger = logging.getLogger(__name__)
|
15 |
+
|
16 |
+
|
17 |
+
class ScanNetPPData():
|
18 |
+
|
19 |
+
def __init__(self, root, stage):
|
20 |
+
|
21 |
+
self.root = root
|
22 |
+
self.stage = stage
|
23 |
+
self.png_depth_scale = 1000.0
|
24 |
+
|
25 |
+
# Dictionaries to store the data for each scene
|
26 |
+
self.color_paths = {}
|
27 |
+
self.depth_paths = {}
|
28 |
+
self.intrinsics = {}
|
29 |
+
self.c2ws = {}
|
30 |
+
|
31 |
+
# Fetch the sequences to use
|
32 |
+
if stage == "train":
|
33 |
+
sequence_file = os.path.join(self.root, "raw", "splits", "nvs_sem_train.txt")
|
34 |
+
bad_scenes = ['303745abc7']
|
35 |
+
elif stage == "val" or stage == "test":
|
36 |
+
sequence_file = os.path.join(self.root, "raw", "splits", "nvs_sem_val.txt")
|
37 |
+
bad_scenes = ['cc5237fd77']
|
38 |
+
with open(sequence_file, "r") as f:
|
39 |
+
self.sequences = f.read().splitlines()
|
40 |
+
|
41 |
+
# Remove scenes that have frames with no valid depths
|
42 |
+
logger.info(f"Removing scenes that have frames with no valid depths: {bad_scenes}")
|
43 |
+
self.sequences = [s for s in self.sequences if s not in bad_scenes]
|
44 |
+
|
45 |
+
P = np.array([
|
46 |
+
[1, 0, 0, 0],
|
47 |
+
[0, -1, 0, 0],
|
48 |
+
[0, 0, -1, 0],
|
49 |
+
[0, 0, 0, 1]]
|
50 |
+
).astype(np.float32)
|
51 |
+
|
52 |
+
# Collect information for every sequence
|
53 |
+
scenes_with_no_good_frames = []
|
54 |
+
for sequence in self.sequences:
|
55 |
+
|
56 |
+
input_raw_folder = os.path.join(self.root, 'raw', 'data', sequence)
|
57 |
+
input_processed_folder = os.path.join(self.root, 'processed', sequence)
|
58 |
+
|
59 |
+
# Load Train & Test Splits
|
60 |
+
frame_file = os.path.join(input_raw_folder, "dslr", "train_test_lists.json")
|
61 |
+
with open(frame_file, "r") as f:
|
62 |
+
train_test_list = json.load(f)
|
63 |
+
|
64 |
+
# Camera Metadata
|
65 |
+
cams_metadata_path = f"{input_processed_folder}/dslr/nerfstudio/transforms_undistorted.json"
|
66 |
+
with open(cams_metadata_path, "r") as f:
|
67 |
+
cams_metadata = json.load(f)
|
68 |
+
|
69 |
+
# Load the nerfstudio/transforms.json file to check whether each image is blurry
|
70 |
+
nerfstudio_transforms_path = f"{input_raw_folder}/dslr/nerfstudio/transforms.json"
|
71 |
+
with open(nerfstudio_transforms_path, "r") as f:
|
72 |
+
nerfstudio_transforms = json.load(f)
|
73 |
+
|
74 |
+
# Create a reverse mapping from image name to the frame information and nerfstudio transform
|
75 |
+
# (as transforms_undistorted.json does not store the frames in the same order as train_test_lists.json)
|
76 |
+
file_path_to_frame_metadata = {}
|
77 |
+
file_path_to_nerfstudio_transform = {}
|
78 |
+
for frame in cams_metadata["frames"]:
|
79 |
+
file_path_to_frame_metadata[frame["file_path"]] = frame
|
80 |
+
for frame in nerfstudio_transforms["frames"]:
|
81 |
+
file_path_to_nerfstudio_transform[frame["file_path"]] = frame
|
82 |
+
|
83 |
+
# Fetch the pose for every frame
|
84 |
+
sequence_color_paths = []
|
85 |
+
sequence_depth_paths = []
|
86 |
+
sequence_c2ws = []
|
87 |
+
for train_file_name in train_test_list["train"]:
|
88 |
+
is_bad = file_path_to_nerfstudio_transform[train_file_name]["is_bad"]
|
89 |
+
if is_bad:
|
90 |
+
continue
|
91 |
+
sequence_color_paths.append(f"{input_processed_folder}/dslr/undistorted_images/{train_file_name}")
|
92 |
+
sequence_depth_paths.append(f"{input_processed_folder}/dslr/undistorted_depths/{train_file_name.replace('.JPG', '.png')}")
|
93 |
+
frame_metadata = file_path_to_frame_metadata[train_file_name]
|
94 |
+
c2w = np.array(frame_metadata["transform_matrix"], dtype=np.float32)
|
95 |
+
c2w = P @ c2w @ P.T
|
96 |
+
sequence_c2ws.append(c2w)
|
97 |
+
|
98 |
+
if len(sequence_color_paths) == 0:
|
99 |
+
logger.info(f"No good frames for sequence: {sequence}")
|
100 |
+
scenes_with_no_good_frames.append(sequence)
|
101 |
+
continue
|
102 |
+
|
103 |
+
# Get the intrinsics data for the frame
|
104 |
+
K = np.eye(4, dtype=np.float32)
|
105 |
+
K[0, 0] = cams_metadata["fl_x"]
|
106 |
+
K[1, 1] = cams_metadata["fl_y"]
|
107 |
+
K[0, 2] = cams_metadata["cx"]
|
108 |
+
K[1, 2] = cams_metadata["cy"]
|
109 |
+
|
110 |
+
self.color_paths[sequence] = sequence_color_paths
|
111 |
+
self.depth_paths[sequence] = sequence_depth_paths
|
112 |
+
self.c2ws[sequence] = sequence_c2ws
|
113 |
+
self.intrinsics[sequence] = K
|
114 |
+
|
115 |
+
# Remove scenes with no good frames
|
116 |
+
self.sequences = [s for s in self.sequences if s not in scenes_with_no_good_frames]
|
117 |
+
|
118 |
+
def get_view(self, sequence, view_idx, resolution):
|
119 |
+
|
120 |
+
# RGB Image
|
121 |
+
rgb_path = self.color_paths[sequence][view_idx]
|
122 |
+
rgb_image = imread_cv2(rgb_path)
|
123 |
+
|
124 |
+
# Depthmap
|
125 |
+
depth_path = self.depth_paths[sequence][view_idx]
|
126 |
+
depthmap = imread_cv2(depth_path, cv2.IMREAD_UNCHANGED)
|
127 |
+
depthmap = depthmap.astype(np.float32)
|
128 |
+
depthmap = depthmap / self.png_depth_scale
|
129 |
+
|
130 |
+
# C2W Pose
|
131 |
+
c2w = self.c2ws[sequence][view_idx]
|
132 |
+
|
133 |
+
# Camera Intrinsics
|
134 |
+
intrinsics = self.intrinsics[sequence]
|
135 |
+
|
136 |
+
# Resize
|
137 |
+
rgb_image, depthmap, intrinsics = crop_resize_if_necessary(
|
138 |
+
rgb_image, depthmap, intrinsics, resolution
|
139 |
+
)
|
140 |
+
|
141 |
+
view = {
|
142 |
+
'original_img': rgb_image,
|
143 |
+
'depthmap': depthmap,
|
144 |
+
'camera_pose': c2w,
|
145 |
+
'camera_intrinsics': intrinsics,
|
146 |
+
'dataset': 'scannet++',
|
147 |
+
'label': f"scannet++/{sequence}",
|
148 |
+
'instance': f'{view_idx}',
|
149 |
+
'is_metric_scale': True,
|
150 |
+
'sky_mask': depthmap <= 0.0,
|
151 |
+
}
|
152 |
+
return view
|
153 |
+
|
154 |
+
|
155 |
+
def get_scannet_dataset(root, stage, resolution, num_epochs_per_epoch=1):
|
156 |
+
|
157 |
+
data = ScanNetPPData(root, stage)
|
158 |
+
|
159 |
+
coverage = {}
|
160 |
+
for sequence in data.sequences:
|
161 |
+
with open(f'./data/scannetpp/coverage/{sequence}.json', 'r') as f:
|
162 |
+
sequence_coverage = json.load(f)
|
163 |
+
coverage[sequence] = sequence_coverage[sequence]
|
164 |
+
|
165 |
+
dataset = DUST3RSplattingDataset(
|
166 |
+
data,
|
167 |
+
coverage,
|
168 |
+
resolution,
|
169 |
+
num_epochs_per_epoch=num_epochs_per_epoch,
|
170 |
+
)
|
171 |
+
|
172 |
+
return dataset
|
173 |
+
|
174 |
+
|
175 |
+
def get_scannet_test_dataset(root, alpha, beta, resolution, use_every_n_sample=100):
|
176 |
+
|
177 |
+
data = ScanNetPPData(root, 'val')
|
178 |
+
|
179 |
+
samples_file = f'data/scannetpp/test_set_{alpha}_{beta}.json'
|
180 |
+
print(f"Loading samples from: {samples_file}")
|
181 |
+
with open(samples_file, 'r') as f:
|
182 |
+
samples = json.load(f)
|
183 |
+
samples = samples[::use_every_n_sample]
|
184 |
+
|
185 |
+
dataset = DUST3RSplattingTestDataset(data, samples, resolution)
|
186 |
+
|
187 |
+
return dataset
|
demo.py
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
# The MASt3R Gradio demo, modified for predicting 3D Gaussian Splats
|
3 |
+
|
4 |
+
# --- Original License ---
|
5 |
+
# Copyright (C) 2024-present Naver Corporation. All rights reserved.
|
6 |
+
# Licensed under CC BY-NC-SA 4.0 (non-commercial use only).
|
7 |
+
|
8 |
+
import functools
|
9 |
+
import os
|
10 |
+
import sys
|
11 |
+
import tempfile
|
12 |
+
|
13 |
+
import gradio
|
14 |
+
import torch
|
15 |
+
|
16 |
+
sys.path.append('src/mast3r_src')
|
17 |
+
sys.path.append('src/mast3r_src/dust3r')
|
18 |
+
sys.path.append('src/pixelsplat_src')
|
19 |
+
from dust3r.utils.image import load_images
|
20 |
+
from mast3r.utils.misc import hash_md5
|
21 |
+
import main
|
22 |
+
import utils.export as export
|
23 |
+
|
24 |
+
|
25 |
+
def get_reconstructed_scene(outdir, model, device, silent, image_size, ios_mode, filelist):
|
26 |
+
|
27 |
+
if ios_mode:
|
28 |
+
filelist = [f[0] for f in filelist]
|
29 |
+
if len(filelist) == 1:
|
30 |
+
filelist = [filelist[0], filelist[0]]
|
31 |
+
assert len(filelist) == 2, "Please provide two images"
|
32 |
+
imgs = load_images(filelist, size=image_size, verbose=not silent)
|
33 |
+
|
34 |
+
for img in imgs:
|
35 |
+
img['img'] = img['img'].to(device)
|
36 |
+
img['original_img'] = img['original_img'].to(device)
|
37 |
+
img['true_shape'] = torch.from_numpy(img['true_shape'])
|
38 |
+
|
39 |
+
output = model(imgs[0], imgs[1])
|
40 |
+
|
41 |
+
pred1, pred2 = output
|
42 |
+
plyfile = os.path.join(outdir, 'gaussians.ply')
|
43 |
+
export.save_as_ply(pred1, pred2, plyfile)
|
44 |
+
return plyfile
|
45 |
+
|
46 |
+
if __name__ == '__main__':
|
47 |
+
|
48 |
+
weights_path = sys.argv[1]
|
49 |
+
|
50 |
+
image_size = 512
|
51 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
52 |
+
server_name = '127.0.0.1'
|
53 |
+
server_port = None
|
54 |
+
share = True
|
55 |
+
silent = False
|
56 |
+
ios_mode = True
|
57 |
+
|
58 |
+
model = main.MAST3RGaussians.load_from_checkpoint(weights_path, device)
|
59 |
+
chkpt_tag = hash_md5(weights_path)
|
60 |
+
|
61 |
+
# Define example inputs and their corresponding precalculated outputs
|
62 |
+
examples = [
|
63 |
+
["assets/demo_examples/scannet++_1_img_1.jpg", "assets/demo_examples/scannet++_1_img_2.jpg", "assets/demo_examples/scannet++_1.ply"],
|
64 |
+
["assets/demo_examples/scannet++_2_img_1.jpg", "assets/demo_examples/scannet++_2_img_2.jpg", "assets/demo_examples/scannet++_2.ply"],
|
65 |
+
["assets/demo_examples/scannet++_3_img_1.jpg", "assets/demo_examples/scannet++_3_img_2.jpg", "assets/demo_examples/scannet++_3.ply"],
|
66 |
+
["assets/demo_examples/scannet++_4_img_1.jpg", "assets/demo_examples/scannet++_4_img_2.jpg", "assets/demo_examples/scannet++_4.ply"],
|
67 |
+
["assets/demo_examples/scannet++_5_img_1.jpg", "assets/demo_examples/scannet++_5_img_2.jpg", "assets/demo_examples/scannet++_5.ply"],
|
68 |
+
["assets/demo_examples/scannet++_6_img_1.jpg", "assets/demo_examples/scannet++_6_img_2.jpg", "assets/demo_examples/scannet++_6.ply"],
|
69 |
+
["assets/demo_examples/scannet++_7_img_1.jpg", "assets/demo_examples/scannet++_7_img_2.jpg", "assets/demo_examples/scannet++_7.ply"],
|
70 |
+
["assets/demo_examples/scannet++_8_img_1.jpg", "assets/demo_examples/scannet++_8_img_2.jpg", "assets/demo_examples/scannet++_8.ply"],
|
71 |
+
["assets/demo_examples/in_the_wild_1_img_1.jpg", "assets/demo_examples/in_the_wild_1_img_2.jpg", "assets/demo_examples/in_the_wild_1.ply"],
|
72 |
+
["assets/demo_examples/in_the_wild_2_img_1.jpg", "assets/demo_examples/in_the_wild_2_img_2.jpg", "assets/demo_examples/in_the_wild_2.ply"],
|
73 |
+
["assets/demo_examples/in_the_wild_3_img_1.jpg", "assets/demo_examples/in_the_wild_3_img_2.jpg", "assets/demo_examples/in_the_wild_3.ply"],
|
74 |
+
["assets/demo_examples/in_the_wild_4_img_1.jpg", "assets/demo_examples/in_the_wild_4_img_2.jpg", "assets/demo_examples/in_the_wild_4.ply"],
|
75 |
+
["assets/demo_examples/in_the_wild_5_img_1.jpg", "assets/demo_examples/in_the_wild_5_img_2.jpg", "assets/demo_examples/in_the_wild_5.ply"],
|
76 |
+
["assets/demo_examples/in_the_wild_6_img_1.jpg", "assets/demo_examples/in_the_wild_6_img_2.jpg", "assets/demo_examples/in_the_wild_6.ply"],
|
77 |
+
["assets/demo_examples/in_the_wild_7_img_1.jpg", "assets/demo_examples/in_the_wild_7_img_2.jpg", "assets/demo_examples/in_the_wild_7.ply"],
|
78 |
+
["assets/demo_examples/in_the_wild_8_img_1.jpg", "assets/demo_examples/in_the_wild_8_img_2.jpg", "assets/demo_examples/in_the_wild_8.ply"],
|
79 |
+
]
|
80 |
+
|
81 |
+
with tempfile.TemporaryDirectory(suffix='_mast3r_gradio_demo') as tmpdirname:
|
82 |
+
|
83 |
+
cache_path = os.path.join(tmpdirname, chkpt_tag)
|
84 |
+
os.makedirs(cache_path, exist_ok=True)
|
85 |
+
|
86 |
+
recon_fun = functools.partial(get_reconstructed_scene, tmpdirname, model, device, silent, image_size, ios_mode)
|
87 |
+
|
88 |
+
if not ios_mode:
|
89 |
+
for i in range(len(examples)):
|
90 |
+
examples[i].insert(2, (examples[i][0], examples[i][1]))
|
91 |
+
|
92 |
+
css = """.gradio-container {margin: 0 !important; min-width: 100%};"""
|
93 |
+
with gradio.Blocks(css=css, title="Splatt3R Demo") as demo:
|
94 |
+
|
95 |
+
gradio.HTML('<h2 style="text-align: center;">Splatt3R Demo</h2>')
|
96 |
+
|
97 |
+
with gradio.Column():
|
98 |
+
gradio.Markdown('''
|
99 |
+
Please upload exactly one or two images below to be used for reconstruction.
|
100 |
+
If non-square images are uploaded, they will be cropped to squares for reconstruction.
|
101 |
+
''')
|
102 |
+
if ios_mode:
|
103 |
+
inputfiles = gradio.Gallery(type="filepath")
|
104 |
+
else:
|
105 |
+
inputfiles = gradio.File(file_count="multiple")
|
106 |
+
run_btn = gradio.Button("Run")
|
107 |
+
gradio.Markdown('''
|
108 |
+
## Output
|
109 |
+
Below we show the generated 3D Gaussian Splat.
|
110 |
+
There may be a short delay as the reconstruction needs to be downloaded before rendering.
|
111 |
+
The arrow in the top right of the window below can be used to download the .ply for rendering with other viewers,
|
112 |
+
such as [here](https://projects.markkellogg.org/threejs/demo_gaussian_splats_3d.php?art=1&cu=0,-1,0&cp=0,1,0&cla=1,0,0&aa=false&2d=false&sh=0) or [here](https://playcanvas.com/supersplat/editor)
|
113 |
+
''')
|
114 |
+
outmodel = gradio.Model3D(
|
115 |
+
clear_color=[1.0, 1.0, 1.0, 0.0],
|
116 |
+
)
|
117 |
+
run_btn.click(fn=recon_fun, inputs=[inputfiles], outputs=[outmodel])
|
118 |
+
|
119 |
+
gradio.Markdown('''
|
120 |
+
## Examples
|
121 |
+
A gallery of examples generated from ScanNet++ and from 'in the wild' images taken with a mobile phone.
|
122 |
+
''')
|
123 |
+
|
124 |
+
snapshot_1 = gradio.Image(None, visible=False)
|
125 |
+
snapshot_2 = gradio.Image(None, visible=False)
|
126 |
+
if ios_mode:
|
127 |
+
gradio.Examples(
|
128 |
+
examples=examples,
|
129 |
+
inputs=[snapshot_1, snapshot_2, outmodel],
|
130 |
+
examples_per_page=5
|
131 |
+
)
|
132 |
+
else:
|
133 |
+
gradio.Examples(
|
134 |
+
examples=examples,
|
135 |
+
inputs=[snapshot_1, snapshot_2, inputfiles, outmodel],
|
136 |
+
examples_per_page=5
|
137 |
+
)
|
138 |
+
|
139 |
+
demo.launch(share=share, server_name=server_name, server_port=server_port)
|
environment.yml
ADDED
@@ -0,0 +1,453 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: mast3r
|
2 |
+
channels:
|
3 |
+
- anaconda
|
4 |
+
- pytorch
|
5 |
+
- nvidia
|
6 |
+
- conda-forge
|
7 |
+
- defaults
|
8 |
+
dependencies:
|
9 |
+
- _libgcc_mutex=0.1=conda_forge
|
10 |
+
- _openmp_mutex=4.5=2_gnu
|
11 |
+
- _sysroot_linux-64_curr_repodata_hack=3=haa98f57_10
|
12 |
+
- aiohttp=3.9.5=py311h5eee18b_0
|
13 |
+
- aiosignal=1.2.0=pyhd3eb1b0_0
|
14 |
+
- ansi2html=1.9.1=py311h06a4308_0
|
15 |
+
- antlr-python-runtime=4.9.3=pyhd8ed1ab_1
|
16 |
+
- aom=3.9.1=hac33072_0
|
17 |
+
- appdirs=1.4.4=pyhd3eb1b0_0
|
18 |
+
- assimp=5.4.1=h8343317_0
|
19 |
+
- binutils=2.38=h1680402_1
|
20 |
+
- binutils_impl_linux-64=2.38=h2a08ee3_1
|
21 |
+
- binutils_linux-64=2.38.0=hc2dff05_0
|
22 |
+
- blas=1.0=mkl
|
23 |
+
- blinker=1.6.2=py311h06a4308_0
|
24 |
+
- blosc=1.21.5=hc2324a3_1
|
25 |
+
- brotli=1.0.9=he6710b0_2
|
26 |
+
- brotli-bin=1.1.0=hd590300_1
|
27 |
+
- brotli-python=1.0.9=py311h6a678d5_8
|
28 |
+
- brunsli=0.1=h2531618_0
|
29 |
+
- bzip2=1.0.8=h5eee18b_6
|
30 |
+
- c-ares=1.32.3=h4bc722e_0
|
31 |
+
- c-blosc2=2.14.4=hb4ffafa_1
|
32 |
+
- ca-certificates=2024.7.4=hbcca054_0
|
33 |
+
- cccl=2.4.0=h7ab4013_0
|
34 |
+
- certifi=2024.7.4=py311h06a4308_0
|
35 |
+
- cfitsio=3.470=h5893167_7
|
36 |
+
- charls=2.4.2=h59595ed_0
|
37 |
+
- charset-normalizer=2.0.4=pyhd3eb1b0_0
|
38 |
+
- click=8.1.7=py311h06a4308_0
|
39 |
+
- cloudpickle=2.2.1=py311h06a4308_0
|
40 |
+
- cmake=3.14.0=h52cb24c_0
|
41 |
+
- colorama=0.4.6=pyhd8ed1ab_0
|
42 |
+
- cuda=12.1.0=0
|
43 |
+
- cuda-cccl=12.5.39=ha770c72_0
|
44 |
+
- cuda-cccl_linux-64=12.5.39=ha770c72_0
|
45 |
+
- cuda-command-line-tools=12.1.1=0
|
46 |
+
- cuda-compiler=12.4.1=h6a678d5_1
|
47 |
+
- cuda-cudart=12.1.105=0
|
48 |
+
- cuda-cudart-dev=12.1.105=0
|
49 |
+
- cuda-cudart-static=12.5.82=0
|
50 |
+
- cuda-cudart-static_linux-64=12.5.82=0
|
51 |
+
- cuda-cuobjdump=12.4.127=0
|
52 |
+
- cuda-cupti=12.1.105=0
|
53 |
+
- cuda-cuxxfilt=12.4.127=0
|
54 |
+
- cuda-demo-suite=12.4.127=0
|
55 |
+
- cuda-documentation=12.4.127=0
|
56 |
+
- cuda-driver-dev=12.5.82=0
|
57 |
+
- cuda-driver-dev_linux-64=12.5.82=h85509e4_0
|
58 |
+
- cuda-gdb=12.5.82=0
|
59 |
+
- cuda-libraries=12.1.0=0
|
60 |
+
- cuda-libraries-dev=12.5.1=0
|
61 |
+
- cuda-libraries-static=12.5.1=ha770c72_0
|
62 |
+
- cuda-nsight=12.5.82=ha770c72_0
|
63 |
+
- cuda-nsight-compute=12.4.1=0
|
64 |
+
- cuda-nvcc=12.4.131=0
|
65 |
+
- cuda-nvdisasm=12.5.39=0
|
66 |
+
- cuda-nvml-dev=12.5.82=0
|
67 |
+
- cuda-nvprof=12.5.82=0
|
68 |
+
- cuda-nvprune=12.4.127=0
|
69 |
+
- cuda-nvrtc=12.1.105=0
|
70 |
+
- cuda-nvrtc-dev=12.1.105=0
|
71 |
+
- cuda-nvrtc-static=12.5.82=0
|
72 |
+
- cuda-nvtx=12.1.105=0
|
73 |
+
- cuda-nvvp=12.5.82=0
|
74 |
+
- cuda-opencl=12.5.39=0
|
75 |
+
- cuda-opencl-dev=12.5.39=0
|
76 |
+
- cuda-profiler-api=12.5.39=ha770c72_0
|
77 |
+
- cuda-runtime=12.1.0=0
|
78 |
+
- cuda-sanitizer-api=12.5.81=0
|
79 |
+
- cuda-toolkit=12.1.0=0
|
80 |
+
- cuda-tools=12.1.1=ha770c72_0
|
81 |
+
- cuda-version=12.5=3
|
82 |
+
- cuda-visual-tools=12.1.1=0
|
83 |
+
- cytoolz=0.12.2=py311h5eee18b_0
|
84 |
+
- dash=2.14.2=py311h06a4308_0
|
85 |
+
- dask-core=2024.5.0=py311h06a4308_0
|
86 |
+
- dav1d=1.2.1=h5eee18b_0
|
87 |
+
- dbus=1.13.18=hb2f20db_0
|
88 |
+
- docker-pycreds=0.4.0=pyhd3eb1b0_0
|
89 |
+
- double-conversion=3.3.0=h59595ed_0
|
90 |
+
- eigen=3.4.0=hdb19cb5_0
|
91 |
+
- elfutils=0.189=hde5d1a3_0
|
92 |
+
- embree=3.13.0=habf647b_1
|
93 |
+
- expat=2.5.0=h6a678d5_0
|
94 |
+
- ffmpeg=4.3=hf484d3e_0
|
95 |
+
- filelock=3.13.1=py311h06a4308_0
|
96 |
+
- flask=3.0.3=py311h06a4308_0
|
97 |
+
- flask-compress=1.13=py311h06a4308_0
|
98 |
+
- fmt=9.1.0=hdb19cb5_1
|
99 |
+
- fontconfig=2.14.2=h14ed4e7_0
|
100 |
+
- freetype=2.12.1=h4a9f257_0
|
101 |
+
- frozenlist=1.4.0=py311h5eee18b_0
|
102 |
+
- fsspec=2024.6.1=pyhff2d567_0
|
103 |
+
- gcc_impl_linux-64=11.2.0=h1234567_1
|
104 |
+
- gcc_linux-64=11.2.0=h5c386dc_0
|
105 |
+
- gds-tools=1.6.1.9=0
|
106 |
+
- giflib=5.2.2=hd590300_0
|
107 |
+
- gitdb=4.0.7=pyhd3eb1b0_0
|
108 |
+
- gitpython=3.1.43=py311h06a4308_0
|
109 |
+
- gl2ps=1.4.2=h70c0345_1
|
110 |
+
- glew=2.1.0=h295c915_3
|
111 |
+
- glfw=3.4=hd590300_0
|
112 |
+
- glib=2.78.4=h6a678d5_0
|
113 |
+
- glib-tools=2.78.4=h6a678d5_0
|
114 |
+
- gmp=6.2.1=h295c915_3
|
115 |
+
- gmpy2=2.1.2=py311hc9b5ff0_0
|
116 |
+
- gnutls=3.6.15=he1e5248_0
|
117 |
+
- gxx_impl_linux-64=11.2.0=h1234567_1
|
118 |
+
- gxx_linux-64=11.2.0=hc2dff05_0
|
119 |
+
- hdf4=4.2.15=h2a13503_7
|
120 |
+
- hdf5=1.14.3=nompi_hdf9ad27_105
|
121 |
+
- icu=73.2=h59595ed_0
|
122 |
+
- idna=3.7=py311h06a4308_0
|
123 |
+
- imagecodecs=2024.6.1=py311h60053b1_0
|
124 |
+
- importlib-metadata=7.0.1=py311h06a4308_0
|
125 |
+
- intel-openmp=2023.1.0=hdb19cb5_46306
|
126 |
+
- itsdangerous=2.2.0=py311h06a4308_0
|
127 |
+
- jinja2=3.1.4=py311h06a4308_0
|
128 |
+
- jsoncpp=1.9.5=h4bd325d_1
|
129 |
+
- jxrlib=1.1=h7b6447c_2
|
130 |
+
- kernel-headers_linux-64=3.10.0=h57e8cba_10
|
131 |
+
- keyutils=1.6.1=h166bdaf_0
|
132 |
+
- krb5=1.21.3=h659f571_0
|
133 |
+
- lame=3.100=h7b6447c_0
|
134 |
+
- lazy_loader=0.4=py311h06a4308_0
|
135 |
+
- lcms2=2.16=hb7c19ff_0
|
136 |
+
- ld_impl_linux-64=2.38=h1181459_1
|
137 |
+
- lerc=4.0.0=h27087fc_0
|
138 |
+
- libabseil=20240116.2=cxx17_h6a678d5_0
|
139 |
+
- libaec=1.1.3=h59595ed_0
|
140 |
+
- libarchive=3.6.2=h039dbb9_1
|
141 |
+
- libavif=1.1.0=h9b56c87_0
|
142 |
+
- libavif16=1.1.0=h9b56c87_0
|
143 |
+
- libblas=3.9.0=1_h86c2bf4_netlib
|
144 |
+
- libboost=1.84.0=hba137d9_3
|
145 |
+
- libbrotlicommon=1.1.0=hd590300_1
|
146 |
+
- libbrotlidec=1.1.0=hd590300_1
|
147 |
+
- libbrotlienc=1.1.0=hd590300_1
|
148 |
+
- libcblas=3.9.0=6_ha36c22a_netlib
|
149 |
+
- libcublas=12.1.0.26=0
|
150 |
+
- libcublas-dev=12.1.0.26=0
|
151 |
+
- libcublas-static=12.5.3.2=0
|
152 |
+
- libcufft=11.0.2.4=0
|
153 |
+
- libcufft-dev=11.0.2.4=0
|
154 |
+
- libcufft-static=11.2.3.61=0
|
155 |
+
- libcufile=1.10.1.7=0
|
156 |
+
- libcufile-dev=1.10.1.7=0
|
157 |
+
- libcufile-static=1.10.1.7=0
|
158 |
+
- libcurand=10.3.6.82=0
|
159 |
+
- libcurand-dev=10.3.6.82=0
|
160 |
+
- libcurand-static=10.3.6.82=0
|
161 |
+
- libcurl=8.8.0=hca28451_1
|
162 |
+
- libcusolver=11.4.4.55=0
|
163 |
+
- libcusolver-dev=11.4.4.55=0
|
164 |
+
- libcusolver-static=11.6.3.83=0
|
165 |
+
- libcusparse=12.0.2.55=0
|
166 |
+
- libcusparse-dev=12.0.2.55=0
|
167 |
+
- libcusparse-static=12.5.1.3=0
|
168 |
+
- libdeflate=1.20=hd590300_0
|
169 |
+
- libdrm=2.4.122=h4ab18f5_0
|
170 |
+
- libedit=3.1.20230828=h5eee18b_0
|
171 |
+
- libev=4.33=h7f8727e_1
|
172 |
+
- libexpat=2.5.0=hcb278e6_1
|
173 |
+
- libffi=3.4.4=h6a678d5_1
|
174 |
+
- libgcc-devel_linux-64=11.2.0=h1234567_1
|
175 |
+
- libgcc-ng=14.1.0=h77fa898_0
|
176 |
+
- libgfortran-ng=14.1.0=h69a702a_0
|
177 |
+
- libgfortran5=14.1.0=hc5f4f2c_0
|
178 |
+
- libglib=2.78.4=hdc74915_0
|
179 |
+
- libglu=9.0.0=hf484d3e_1
|
180 |
+
- libgomp=14.1.0=h77fa898_0
|
181 |
+
- libhwloc=2.11.1=default_hecaa2ac_1000
|
182 |
+
- libhwy=1.1.0=h00ab1b0_0
|
183 |
+
- libiconv=1.16=h5eee18b_3
|
184 |
+
- libidn2=2.3.4=h5eee18b_0
|
185 |
+
- libjpeg-turbo=3.0.3=h5eee18b_0
|
186 |
+
- libjxl=0.10.3=h66b40c8_0
|
187 |
+
- liblapack=3.9.0=6_ha36c22a_netlib
|
188 |
+
- liblapacke=3.9.0=6_ha36c22a_netlib
|
189 |
+
- libllvm17=17.0.6=hc9c083f_0
|
190 |
+
- liblzf=3.6=hd590300_0
|
191 |
+
- libmicrohttpd=0.9.76=h5eee18b_0
|
192 |
+
- libnetcdf=4.9.2=nompi_h135f659_114
|
193 |
+
- libnghttp2=1.58.0=h47da74e_1
|
194 |
+
- libnpp=12.0.2.50=0
|
195 |
+
- libnpp-dev=12.0.2.50=0
|
196 |
+
- libnpp-static=12.3.0.159=0
|
197 |
+
- libnsl=2.0.1=hd590300_0
|
198 |
+
- libnvfatbin=12.5.82=0
|
199 |
+
- libnvfatbin-dev=12.5.82=0
|
200 |
+
- libnvfatbin-static=12.5.82=0
|
201 |
+
- libnvjitlink=12.1.105=0
|
202 |
+
- libnvjitlink-dev=12.1.105=0
|
203 |
+
- libnvjitlink-static=12.5.82=0
|
204 |
+
- libnvjpeg=12.1.1.14=0
|
205 |
+
- libnvjpeg-dev=12.1.1.14=0
|
206 |
+
- libnvjpeg-static=12.3.2.81=ha770c72_0
|
207 |
+
- libnvvm-samples=12.1.105=0
|
208 |
+
- libogg=1.3.5=h27cfd23_1
|
209 |
+
- libpciaccess=0.18=hd590300_0
|
210 |
+
- libpng=1.6.43=h2797004_0
|
211 |
+
- libprotobuf=4.25.3=he621ea3_0
|
212 |
+
- libsodium=1.0.18=h7b6447c_0
|
213 |
+
- libsqlite=3.46.0=hde9e2c9_0
|
214 |
+
- libssh2=1.11.0=h251f7ec_0
|
215 |
+
- libstdcxx-devel_linux-64=11.2.0=h1234567_1
|
216 |
+
- libstdcxx-ng=14.1.0=hc0a3c3a_0
|
217 |
+
- libtasn1=4.19.0=h5eee18b_0
|
218 |
+
- libtheora=1.1.1=h7f8727e_3
|
219 |
+
- libtiff=4.6.0=h1dd3fc0_3
|
220 |
+
- libunistring=0.9.10=h27cfd23_0
|
221 |
+
- libuuid=2.38.1=h0b41bf4_0
|
222 |
+
- libvorbis=1.3.7=h7b6447c_0
|
223 |
+
- libwebp-base=1.4.0=hd590300_0
|
224 |
+
- libxcb=1.15=h7f8727e_0
|
225 |
+
- libxcrypt=4.4.36=hd590300_1
|
226 |
+
- libxkbcommon=1.7.0=h662e7e4_0
|
227 |
+
- libxml2=2.13.1=hfdd30dd_1
|
228 |
+
- libzip=1.10.1=h2629f0a_3
|
229 |
+
- libzlib=1.2.13=h4ab18f5_6
|
230 |
+
- libzopfli=1.0.3=he6710b0_0
|
231 |
+
- lightning=2.3.2=pyhd8ed1ab_0
|
232 |
+
- lightning-utilities=0.11.3.post0=pyhd8ed1ab_0
|
233 |
+
- llvm-openmp=14.0.6=h9e868ea_0
|
234 |
+
- locket=1.0.0=py311h06a4308_0
|
235 |
+
- loguru=0.5.3=py311h06a4308_4
|
236 |
+
- lz4-c=1.9.4=h6a678d5_1
|
237 |
+
- lzo=2.10=h7b6447c_2
|
238 |
+
- markupsafe=2.1.3=py311h5eee18b_0
|
239 |
+
- mesalib=23.3.2=h6b56f8e_0
|
240 |
+
- mkl=2023.1.0=h213fc3f_46344
|
241 |
+
- mkl-service=2.4.0=py311h5eee18b_1
|
242 |
+
- mkl_fft=1.3.8=py311h5eee18b_0
|
243 |
+
- mkl_random=1.2.4=py311hdb19cb5_0
|
244 |
+
- mpc=1.1.0=h10f8cd9_1
|
245 |
+
- mpfr=4.0.2=hb69a4c5_1
|
246 |
+
- mpmath=1.3.0=py311h06a4308_0
|
247 |
+
- msgpack-python=1.0.3=py311hdb19cb5_0
|
248 |
+
- multidict=6.0.4=py311h5eee18b_0
|
249 |
+
- ncurses=6.4=h6a678d5_0
|
250 |
+
- nest-asyncio=1.6.0=py311h06a4308_0
|
251 |
+
- nettle=3.7.3=hbbd107a_1
|
252 |
+
- networkx=3.3=py311h06a4308_0
|
253 |
+
- nlohmann_json=3.11.2=h6a678d5_0
|
254 |
+
- nsight-compute=2024.2.0.16=2
|
255 |
+
- nspr=4.35=h6a678d5_0
|
256 |
+
- nss=3.89.1=h6a678d5_0
|
257 |
+
- numpy=1.26.4=py311h08b1b3b_0
|
258 |
+
- numpy-base=1.26.4=py311hf175353_0
|
259 |
+
- omegaconf=2.3.0=pyhd8ed1ab_0
|
260 |
+
- open3d=0.18.0=py311hcec1c9b_3
|
261 |
+
- openh264=2.1.1=h4ff587b_0
|
262 |
+
- openjpeg=2.5.2=h488ebb8_0
|
263 |
+
- openssl=3.3.1=h4ab18f5_1
|
264 |
+
- packaging=24.1=pyhd8ed1ab_0
|
265 |
+
- partd=1.4.1=py311h06a4308_0
|
266 |
+
- pathtools=0.1.2=pyhd3eb1b0_1
|
267 |
+
- pcre2=10.42=hebb0a14_1
|
268 |
+
- pillow=10.3.0=py311h18e6fac_0
|
269 |
+
- pip=24.0=py311h06a4308_0
|
270 |
+
- plotly=5.22.0=py311h92b7b1e_0
|
271 |
+
- plyfile=1.0.3=pyhd8ed1ab_0
|
272 |
+
- proj=9.3.1=he5811b7_0
|
273 |
+
- protobuf=4.25.3=py311h12ddb61_0
|
274 |
+
- psutil=5.9.0=py311h5eee18b_0
|
275 |
+
- pugixml=1.14=h59595ed_0
|
276 |
+
- pybind11-abi=4=hd3eb1b0_1
|
277 |
+
- pysocks=1.7.1=py311h06a4308_0
|
278 |
+
- python=3.11.8=hab00c5b_0_cpython
|
279 |
+
- python_abi=3.11=4_cp311
|
280 |
+
- pytorch=2.3.1=py3.11_cuda12.1_cudnn8.9.2_0
|
281 |
+
- pytorch-cuda=12.1=ha16c6d3_5
|
282 |
+
- pytorch-lightning=2.3.3=pyhd8ed1ab_0
|
283 |
+
- pytorch-mutex=1.0=cuda
|
284 |
+
- pywavelets=1.5.0=py311hf4808d0_0
|
285 |
+
- pyyaml=6.0.1=py311h5eee18b_0
|
286 |
+
- qhull=2020.2=hdb19cb5_2
|
287 |
+
- rav1e=0.6.6=he8a937b_2
|
288 |
+
- readline=8.2=h5eee18b_0
|
289 |
+
- requests=2.32.2=py311h06a4308_0
|
290 |
+
- retrying=1.3.3=pyhd3eb1b0_2
|
291 |
+
- rhash=1.4.3=hdbd6064_0
|
292 |
+
- scikit-image=0.20.0=py311h6a678d5_0
|
293 |
+
- sentry-sdk=1.9.0=py311h06a4308_0
|
294 |
+
- setproctitle=1.2.2=py311h5eee18b_0
|
295 |
+
- setuptools=69.5.1=py311h06a4308_0
|
296 |
+
- six=1.16.0=pyhd3eb1b0_1
|
297 |
+
- smmap=4.0.0=pyhd3eb1b0_0
|
298 |
+
- snappy=1.2.1=ha2e4443_0
|
299 |
+
- sqlite=3.45.3=h5eee18b_0
|
300 |
+
- svt-av1=2.1.2=hac33072_0
|
301 |
+
- sympy=1.12.1=pyh04b8f61_3
|
302 |
+
- sysroot_linux-64=2.17=h57e8cba_10
|
303 |
+
- tbb=2021.12.0=h434a139_3
|
304 |
+
- tbb-devel=2021.12.0=hfcbfbdb_3
|
305 |
+
- tenacity=8.2.3=py311h06a4308_0
|
306 |
+
- tifffile=2023.4.12=py311h06a4308_0
|
307 |
+
- tinyobjloader=1.0.7=h59595ed_2
|
308 |
+
- tk=8.6.14=h39e8969_0
|
309 |
+
- torchmetrics=1.4.0.post0=pyhd8ed1ab_0
|
310 |
+
- torchtriton=2.3.1=py311
|
311 |
+
- torchvision=0.18.1=py311_cu121
|
312 |
+
- tqdm=4.66.4=pyhd8ed1ab_0
|
313 |
+
- typing-extensions=4.11.0=py311h06a4308_0
|
314 |
+
- typing_extensions=4.11.0=py311h06a4308_0
|
315 |
+
- urllib3=2.2.2=py311h06a4308_0
|
316 |
+
- utfcpp=3.2.1=h06a4308_0
|
317 |
+
- vtk-base=9.2.6=osmesa_py311h1234567_123
|
318 |
+
- wandb=0.16.6=pyhd8ed1ab_0
|
319 |
+
- wayland=1.22.0=h8c25dac_1
|
320 |
+
- werkzeug=3.0.3=py311h06a4308_0
|
321 |
+
- wheel=0.43.0=py311h06a4308_0
|
322 |
+
- wslink=2.1.1=pyhd8ed1ab_0
|
323 |
+
- xkeyboard-config=2.42=h4ab18f5_0
|
324 |
+
- xorg-damageproto=1.2.1=h7f98852_1002
|
325 |
+
- xorg-fixesproto=5.0=h7f98852_1002
|
326 |
+
- xorg-glproto=1.4.17=h7f98852_1002
|
327 |
+
- xorg-kbproto=1.0.7=h7f98852_1002
|
328 |
+
- xorg-libice=1.1.1=hd590300_0
|
329 |
+
- xorg-libsm=1.2.4=h7391055_0
|
330 |
+
- xorg-libx11=1.8.9=h8ee46fc_0
|
331 |
+
- xorg-libxau=1.0.11=hd590300_0
|
332 |
+
- xorg-libxdamage=1.1.5=h7f98852_1
|
333 |
+
- xorg-libxext=1.3.4=h0b41bf4_2
|
334 |
+
- xorg-libxfixes=5.0.3=h7f98852_1004
|
335 |
+
- xorg-libxinerama=1.1.5=h27087fc_0
|
336 |
+
- xorg-libxrandr=1.5.2=h7f98852_1
|
337 |
+
- xorg-libxrender=0.9.11=hd590300_0
|
338 |
+
- xorg-libxt=1.3.0=hd590300_1
|
339 |
+
- xorg-randrproto=1.5.0=h7f98852_1001
|
340 |
+
- xorg-renderproto=0.11.1=h7f98852_1002
|
341 |
+
- xorg-util-macros=1.19.0=h27cfd23_2
|
342 |
+
- xorg-xextproto=7.3.0=h0b41bf4_1003
|
343 |
+
- xorg-xf86vidmodeproto=2.3.1=h7f98852_1002
|
344 |
+
- xorg-xproto=7.0.31=h27cfd23_1007
|
345 |
+
- xz=5.4.6=h5eee18b_1
|
346 |
+
- yaml=0.2.5=h7b6447c_0
|
347 |
+
- yarl=1.9.3=py311h5eee18b_0
|
348 |
+
- zeromq=4.3.5=h6a678d5_0
|
349 |
+
- zfp=1.0.1=hac33072_1
|
350 |
+
- zipp=3.17.0=py311h06a4308_0
|
351 |
+
- zlib=1.2.13=h4ab18f5_6
|
352 |
+
- zlib-ng=2.0.7=h5eee18b_0
|
353 |
+
- zstd=1.5.6=ha6fb4c9_0
|
354 |
+
- pip:
|
355 |
+
- absl-py==2.1.0
|
356 |
+
- aiofiles==23.2.1
|
357 |
+
- altair==5.3.0
|
358 |
+
- annotated-types==0.7.0
|
359 |
+
- anyio==4.4.0
|
360 |
+
- attrs==23.2.0
|
361 |
+
- bracex==2.4
|
362 |
+
- build==1.2.1
|
363 |
+
- clarabel==0.9.0
|
364 |
+
- contourpy==1.2.1
|
365 |
+
- cvxpy==1.5.2
|
366 |
+
- cycler==0.12.1
|
367 |
+
# - diff-gaussian-rasterization==0.0.0
|
368 |
+
- dnspython==2.6.1
|
369 |
+
- ecos==2.0.14
|
370 |
+
- einops==0.8.0
|
371 |
+
- email-validator==2.2.0
|
372 |
+
- fastapi==0.111.0
|
373 |
+
- fastapi-cli==0.0.4
|
374 |
+
- ffmpy==0.3.2
|
375 |
+
- fonttools==4.53.1
|
376 |
+
- freetype-py==2.4.0
|
377 |
+
- gradio==4.37.2
|
378 |
+
- gradio-client==1.0.2
|
379 |
+
- grpcio==1.64.1
|
380 |
+
- h11==0.14.0
|
381 |
+
- httpcore==1.0.5
|
382 |
+
- httptools==0.6.1
|
383 |
+
- httpx==0.27.0
|
384 |
+
- huggingface-hub==0.23.4
|
385 |
+
- imageio==2.34.2
|
386 |
+
- importlib-resources==6.4.0
|
387 |
+
- jaxtyping==0.2.33
|
388 |
+
- joblib==1.4.2
|
389 |
+
- jsonschema==4.23.0
|
390 |
+
- jsonschema-specifications==2023.12.1
|
391 |
+
- kapture==1.1.10
|
392 |
+
- kapture-localization==1.1.10
|
393 |
+
- kiwisolver==1.4.5
|
394 |
+
- llvmlite==0.43.0
|
395 |
+
- lpips==0.1.4
|
396 |
+
- markdown==3.6
|
397 |
+
- markdown-it-py==3.0.0
|
398 |
+
- matplotlib==3.9.1
|
399 |
+
- mdurl==0.1.2
|
400 |
+
- numba==0.60.0
|
401 |
+
- numpy-quaternion==2023.0.4
|
402 |
+
- opencv-python==4.10.0.84
|
403 |
+
- orjson==3.10.6
|
404 |
+
- osqp==0.6.7.post0
|
405 |
+
- pandas==2.2.2
|
406 |
+
- piexif==1.1.3
|
407 |
+
- pillow-heif==0.17.0
|
408 |
+
- poselib==2.0.2
|
409 |
+
- pycolmap==0.6.1
|
410 |
+
- pydantic==2.8.2
|
411 |
+
- pydantic-core==2.20.1
|
412 |
+
- pydub==0.25.1
|
413 |
+
- pyglet==1.5.29
|
414 |
+
- pygments==2.18.0
|
415 |
+
- pyopengl==3.1.0
|
416 |
+
- pyparsing==3.1.2
|
417 |
+
- pyproject-hooks==1.1.0
|
418 |
+
- pyrender==0.1.45
|
419 |
+
- python-dateutil==2.9.0.post0
|
420 |
+
- python-dotenv==1.0.1
|
421 |
+
- python-multipart==0.0.9
|
422 |
+
- pytz==2024.1
|
423 |
+
- qdldl==0.1.7.post4
|
424 |
+
- referencing==0.35.1
|
425 |
+
- rich==13.7.1
|
426 |
+
- roma==1.5.0
|
427 |
+
- rpds-py==0.19.0
|
428 |
+
- ruff==0.5.1
|
429 |
+
- safetensors==0.4.3
|
430 |
+
- scikit-learn==1.5.1
|
431 |
+
- scipy==1.14.0
|
432 |
+
- scs==3.2.6
|
433 |
+
- semantic-version==2.10.0
|
434 |
+
- shellingham==1.5.4
|
435 |
+
- sniffio==1.3.1
|
436 |
+
- starlette==0.37.2
|
437 |
+
- tabulate==0.9.0
|
438 |
+
- tensorboard==2.17.0
|
439 |
+
- tensorboard-data-server==0.7.2
|
440 |
+
- threadpoolctl==3.5.0
|
441 |
+
- tomlkit==0.12.0
|
442 |
+
- toolz==0.12.1
|
443 |
+
- trimesh==4.4.3
|
444 |
+
- typeguard==2.13.3
|
445 |
+
- typer==0.12.3
|
446 |
+
- tzdata==2024.1
|
447 |
+
- ujson==5.10.0
|
448 |
+
- uvicorn==0.30.1
|
449 |
+
- uvloop==0.19.0
|
450 |
+
- watchfiles==0.22.0
|
451 |
+
- wcmatch==8.5.2
|
452 |
+
- websockets==11.0.3
|
453 |
+
prefix: /media/brandon/HDD/anaconda3/envs/mast3r
|
main.py
ADDED
@@ -0,0 +1,429 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import os
|
3 |
+
import sys
|
4 |
+
|
5 |
+
import einops
|
6 |
+
import lightning as L
|
7 |
+
import lpips
|
8 |
+
import omegaconf
|
9 |
+
import torch
|
10 |
+
import wandb
|
11 |
+
|
12 |
+
# Add MAST3R and PixelSplat to the sys.path to prevent issues during importing
|
13 |
+
sys.path.append('src/pixelsplat_src')
|
14 |
+
sys.path.append('src/mast3r_src')
|
15 |
+
sys.path.append('src/mast3r_src/dust3r')
|
16 |
+
from src.mast3r_src.dust3r.dust3r.losses import L21
|
17 |
+
from src.mast3r_src.mast3r.losses import ConfLoss, Regr3D
|
18 |
+
import data.scannetpp.scannetpp as scannetpp
|
19 |
+
import src.mast3r_src.mast3r.model as mast3r_model
|
20 |
+
import src.pixelsplat_src.benchmarker as benchmarker
|
21 |
+
import src.pixelsplat_src.decoder_splatting_cuda as pixelsplat_decoder
|
22 |
+
import utils.compute_ssim as compute_ssim
|
23 |
+
import utils.export as export
|
24 |
+
import utils.geometry as geometry
|
25 |
+
import utils.loss_mask as loss_mask
|
26 |
+
import utils.sh_utils as sh_utils
|
27 |
+
import workspace
|
28 |
+
|
29 |
+
|
30 |
+
class MAST3RGaussians(L.LightningModule):
|
31 |
+
|
32 |
+
def __init__(self, config):
|
33 |
+
|
34 |
+
super().__init__()
|
35 |
+
|
36 |
+
# Save the config
|
37 |
+
self.config = config
|
38 |
+
|
39 |
+
# The encoder which we use to predict the 3D points and Gaussians,
|
40 |
+
# trained as a modified MAST3R model. The model's configuration is
|
41 |
+
# primarily defined by the pretrained checkpoint that we load, see
|
42 |
+
# MASt3R's README.md
|
43 |
+
self.encoder = mast3r_model.AsymmetricMASt3R(
|
44 |
+
pos_embed='RoPE100',
|
45 |
+
patch_embed_cls='ManyAR_PatchEmbed',
|
46 |
+
img_size=(512, 512),
|
47 |
+
head_type='gaussian_head',
|
48 |
+
output_mode='pts3d+gaussian+desc24',
|
49 |
+
depth_mode=('exp', -mast3r_model.inf, mast3r_model.inf),
|
50 |
+
conf_mode=('exp', 1, mast3r_model.inf),
|
51 |
+
enc_embed_dim=1024,
|
52 |
+
enc_depth=24,
|
53 |
+
enc_num_heads=16,
|
54 |
+
dec_embed_dim=768,
|
55 |
+
dec_depth=12,
|
56 |
+
dec_num_heads=12,
|
57 |
+
two_confs=True,
|
58 |
+
use_offsets=config.use_offsets,
|
59 |
+
sh_degree=config.sh_degree if hasattr(config, 'sh_degree') else 1
|
60 |
+
)
|
61 |
+
self.encoder.requires_grad_(False)
|
62 |
+
self.encoder.downstream_head1.gaussian_dpt.dpt.requires_grad_(True)
|
63 |
+
self.encoder.downstream_head2.gaussian_dpt.dpt.requires_grad_(True)
|
64 |
+
|
65 |
+
# The decoder which we use to render the predicted Gaussians into
|
66 |
+
# images, lightly modified from PixelSplat
|
67 |
+
self.decoder = pixelsplat_decoder.DecoderSplattingCUDA(
|
68 |
+
background_color=[0.0, 0.0, 0.0]
|
69 |
+
)
|
70 |
+
|
71 |
+
self.benchmarker = benchmarker.Benchmarker()
|
72 |
+
|
73 |
+
# Loss criteria
|
74 |
+
if config.loss.average_over_mask:
|
75 |
+
self.lpips_criterion = lpips.LPIPS('vgg', spatial=True)
|
76 |
+
else:
|
77 |
+
self.lpips_criterion = lpips.LPIPS('vgg')
|
78 |
+
|
79 |
+
if config.loss.mast3r_loss_weight is not None:
|
80 |
+
self.mast3r_criterion = ConfLoss(Regr3D(L21, norm_mode='?avg_dis'), alpha=0.2)
|
81 |
+
self.encoder.downstream_head1.requires_grad_(True)
|
82 |
+
self.encoder.downstream_head2.requires_grad_(True)
|
83 |
+
|
84 |
+
self.save_hyperparameters()
|
85 |
+
|
86 |
+
def forward(self, view1, view2):
|
87 |
+
|
88 |
+
# Freeze the encoder and decoder
|
89 |
+
with torch.no_grad():
|
90 |
+
(shape1, shape2), (feat1, feat2), (pos1, pos2) = self.encoder._encode_symmetrized(view1, view2)
|
91 |
+
dec1, dec2 = self.encoder._decoder(feat1, pos1, feat2, pos2)
|
92 |
+
|
93 |
+
# Train the downstream heads
|
94 |
+
pred1 = self.encoder._downstream_head(1, [tok.float() for tok in dec1], shape1)
|
95 |
+
pred2 = self.encoder._downstream_head(2, [tok.float() for tok in dec2], shape2)
|
96 |
+
|
97 |
+
pred1['covariances'] = geometry.build_covariance(pred1['scales'], pred1['rotations'])
|
98 |
+
pred2['covariances'] = geometry.build_covariance(pred2['scales'], pred2['rotations'])
|
99 |
+
|
100 |
+
learn_residual = True
|
101 |
+
if learn_residual:
|
102 |
+
new_sh1 = torch.zeros_like(pred1['sh'])
|
103 |
+
new_sh2 = torch.zeros_like(pred2['sh'])
|
104 |
+
new_sh1[..., 0] = sh_utils.RGB2SH(einops.rearrange(view1['original_img'], 'b c h w -> b h w c'))
|
105 |
+
new_sh2[..., 0] = sh_utils.RGB2SH(einops.rearrange(view2['original_img'], 'b c h w -> b h w c'))
|
106 |
+
pred1['sh'] = pred1['sh'] + new_sh1
|
107 |
+
pred2['sh'] = pred2['sh'] + new_sh2
|
108 |
+
|
109 |
+
# Update the keys to make clear that pts3d and means are in view1's frame
|
110 |
+
pred2['pts3d_in_other_view'] = pred2.pop('pts3d')
|
111 |
+
pred2['means_in_other_view'] = pred2.pop('means')
|
112 |
+
|
113 |
+
return pred1, pred2
|
114 |
+
|
115 |
+
def training_step(self, batch, batch_idx):
|
116 |
+
|
117 |
+
_, _, h, w = batch["context"][0]["img"].shape
|
118 |
+
view1, view2 = batch['context']
|
119 |
+
|
120 |
+
# Predict using the encoder/decoder and calculate the loss
|
121 |
+
pred1, pred2 = self.forward(view1, view2)
|
122 |
+
color, _ = self.decoder(batch, pred1, pred2, (h, w))
|
123 |
+
|
124 |
+
# Calculate losses
|
125 |
+
mask = loss_mask.calculate_loss_mask(batch)
|
126 |
+
loss, mse, lpips = self.calculate_loss(
|
127 |
+
batch, view1, view2, pred1, pred2, color, mask,
|
128 |
+
apply_mask=self.config.loss.apply_mask,
|
129 |
+
average_over_mask=self.config.loss.average_over_mask,
|
130 |
+
calculate_ssim=False
|
131 |
+
)
|
132 |
+
|
133 |
+
# Log losses
|
134 |
+
self.log_metrics('train', loss, mse, lpips)
|
135 |
+
return loss
|
136 |
+
|
137 |
+
def validation_step(self, batch, batch_idx):
|
138 |
+
|
139 |
+
_, _, h, w = batch["context"][0]["img"].shape
|
140 |
+
view1, view2 = batch['context']
|
141 |
+
|
142 |
+
# Predict using the encoder/decoder and calculate the loss
|
143 |
+
pred1, pred2 = self.forward(view1, view2)
|
144 |
+
color, _ = self.decoder(batch, pred1, pred2, (h, w))
|
145 |
+
|
146 |
+
# Calculate losses
|
147 |
+
mask = loss_mask.calculate_loss_mask(batch)
|
148 |
+
loss, mse, lpips = self.calculate_loss(
|
149 |
+
batch, view1, view2, pred1, pred2, color, mask,
|
150 |
+
apply_mask=self.config.loss.apply_mask,
|
151 |
+
average_over_mask=self.config.loss.average_over_mask,
|
152 |
+
calculate_ssim=False
|
153 |
+
)
|
154 |
+
|
155 |
+
# Log losses
|
156 |
+
self.log_metrics('val', loss, mse, lpips)
|
157 |
+
return loss
|
158 |
+
|
159 |
+
def test_step(self, batch, batch_idx):
|
160 |
+
|
161 |
+
_, _, h, w = batch["context"][0]["img"].shape
|
162 |
+
view1, view2 = batch['context']
|
163 |
+
num_targets = len(batch['target'])
|
164 |
+
|
165 |
+
# Predict using the encoder/decoder and calculate the loss
|
166 |
+
with self.benchmarker.time("encoder"):
|
167 |
+
pred1, pred2 = self.forward(view1, view2)
|
168 |
+
with self.benchmarker.time("decoder", num_calls=num_targets):
|
169 |
+
color, _ = self.decoder(batch, pred1, pred2, (h, w))
|
170 |
+
|
171 |
+
# Calculate losses
|
172 |
+
mask = loss_mask.calculate_loss_mask(batch)
|
173 |
+
loss, mse, lpips, ssim = self.calculate_loss(
|
174 |
+
batch, view1, view2, pred1, pred2, color, mask,
|
175 |
+
apply_mask=self.config.loss.apply_mask,
|
176 |
+
average_over_mask=self.config.loss.average_over_mask,
|
177 |
+
calculate_ssim=True
|
178 |
+
)
|
179 |
+
|
180 |
+
# Log losses
|
181 |
+
self.log_metrics('test', loss, mse, lpips, ssim=ssim)
|
182 |
+
return loss
|
183 |
+
|
184 |
+
def on_test_end(self):
|
185 |
+
benchmark_file_path = os.path.join(self.config.save_dir, "benchmark.json")
|
186 |
+
self.benchmarker.dump(os.path.join(benchmark_file_path))
|
187 |
+
|
188 |
+
def calculate_loss(self, batch, view1, view2, pred1, pred2, color, mask, apply_mask=True, average_over_mask=True, calculate_ssim=False):
|
189 |
+
|
190 |
+
target_color = torch.stack([target_view['original_img'] for target_view in batch['target']], dim=1)
|
191 |
+
predicted_color = color
|
192 |
+
|
193 |
+
if apply_mask:
|
194 |
+
assert mask.sum() > 0, "There are no valid pixels in the mask!"
|
195 |
+
target_color = target_color * mask[..., None, :, :]
|
196 |
+
predicted_color = predicted_color * mask[..., None, :, :]
|
197 |
+
|
198 |
+
flattened_color = einops.rearrange(predicted_color, 'b v c h w -> (b v) c h w')
|
199 |
+
flattened_target_color = einops.rearrange(target_color, 'b v c h w -> (b v) c h w')
|
200 |
+
flattened_mask = einops.rearrange(mask, 'b v h w -> (b v) h w')
|
201 |
+
|
202 |
+
# MSE loss
|
203 |
+
rgb_l2_loss = (predicted_color - target_color) ** 2
|
204 |
+
if average_over_mask:
|
205 |
+
mse_loss = (rgb_l2_loss * mask[:, None, ...]).sum() / mask.sum()
|
206 |
+
else:
|
207 |
+
mse_loss = rgb_l2_loss.mean()
|
208 |
+
|
209 |
+
# LPIPS loss
|
210 |
+
lpips_loss = self.lpips_criterion(flattened_target_color, flattened_color, normalize=True)
|
211 |
+
if average_over_mask:
|
212 |
+
lpips_loss = (lpips_loss * flattened_mask[:, None, ...]).sum() / flattened_mask.sum()
|
213 |
+
else:
|
214 |
+
lpips_loss = lpips_loss.mean()
|
215 |
+
|
216 |
+
# Calculate the total loss
|
217 |
+
loss = 0
|
218 |
+
loss += self.config.loss.mse_loss_weight * mse_loss
|
219 |
+
loss += self.config.loss.lpips_loss_weight * lpips_loss
|
220 |
+
|
221 |
+
# MAST3R Loss
|
222 |
+
if self.config.loss.mast3r_loss_weight is not None:
|
223 |
+
mast3r_loss = self.mast3r_criterion(view1, view2, pred1, pred2)[0]
|
224 |
+
loss += self.config.loss.mast3r_loss_weight * mast3r_loss
|
225 |
+
|
226 |
+
# Masked SSIM
|
227 |
+
if calculate_ssim:
|
228 |
+
if average_over_mask:
|
229 |
+
ssim_val = compute_ssim.compute_ssim(flattened_target_color, flattened_color, full=True)
|
230 |
+
ssim_val = (ssim_val * flattened_mask[:, None, ...]).sum() / flattened_mask.sum()
|
231 |
+
else:
|
232 |
+
ssim_val = compute_ssim.compute_ssim(flattened_target_color, flattened_color, full=False)
|
233 |
+
ssim_val = ssim_val.mean()
|
234 |
+
return loss, mse_loss, lpips_loss, ssim_val
|
235 |
+
|
236 |
+
return loss, mse_loss, lpips_loss
|
237 |
+
|
238 |
+
def log_metrics(self, prefix, loss, mse, lpips, ssim=None):
|
239 |
+
values = {
|
240 |
+
f'{prefix}/loss': loss,
|
241 |
+
f'{prefix}/mse': mse,
|
242 |
+
f'{prefix}/psnr': -10.0 * mse.log10(),
|
243 |
+
f'{prefix}/lpips': lpips,
|
244 |
+
}
|
245 |
+
|
246 |
+
if ssim is not None:
|
247 |
+
values[f'{prefix}/ssim'] = ssim
|
248 |
+
|
249 |
+
prog_bar = prefix != 'val'
|
250 |
+
sync_dist = prefix != 'train'
|
251 |
+
self.log_dict(values, prog_bar=prog_bar, sync_dist=sync_dist, batch_size=self.config.data.batch_size)
|
252 |
+
|
253 |
+
def configure_optimizers(self):
|
254 |
+
optimizer = torch.optim.Adam(self.encoder.parameters(), lr=self.config.opt.lr)
|
255 |
+
scheduler = torch.optim.lr_scheduler.MultiStepLR(optimizer, [self.config.opt.epochs // 2], gamma=0.1)
|
256 |
+
return {
|
257 |
+
"optimizer": optimizer,
|
258 |
+
"lr_scheduler": {
|
259 |
+
"scheduler": scheduler,
|
260 |
+
"interval": "epoch",
|
261 |
+
"frequency": 1,
|
262 |
+
},
|
263 |
+
}
|
264 |
+
|
265 |
+
|
266 |
+
def run_experiment(config):
|
267 |
+
|
268 |
+
# Set the seed
|
269 |
+
L.seed_everything(config.seed, workers=True)
|
270 |
+
|
271 |
+
# Set up loggers
|
272 |
+
os.makedirs(os.path.join(config.save_dir, config.name), exist_ok=True)
|
273 |
+
loggers = []
|
274 |
+
if config.loggers.use_csv_logger:
|
275 |
+
csv_logger = L.pytorch.loggers.CSVLogger(
|
276 |
+
save_dir=config.save_dir,
|
277 |
+
name=config.name
|
278 |
+
)
|
279 |
+
loggers.append(csv_logger)
|
280 |
+
if config.loggers.use_wandb:
|
281 |
+
wandb_logger = L.pytorch.loggers.WandbLogger(
|
282 |
+
project='gaussian_zero',
|
283 |
+
name=config.name,
|
284 |
+
save_dir=config.save_dir,
|
285 |
+
config=omegaconf.OmegaConf.to_container(config),
|
286 |
+
)
|
287 |
+
if wandb.run is not None:
|
288 |
+
wandb.run.log_code(".")
|
289 |
+
loggers.append(wandb_logger)
|
290 |
+
|
291 |
+
# Set up profiler
|
292 |
+
if config.use_profiler:
|
293 |
+
profiler = L.pytorch.profilers.PyTorchProfiler(
|
294 |
+
dirpath=config.save_dir,
|
295 |
+
filename='trace',
|
296 |
+
export_to_chrome=True,
|
297 |
+
schedule=torch.profiler.schedule(wait=0, warmup=1, active=3),
|
298 |
+
on_trace_ready=torch.profiler.tensorboard_trace_handler(config.save_dir),
|
299 |
+
activities=[
|
300 |
+
torch.profiler.ProfilerActivity.CPU,
|
301 |
+
torch.profiler.ProfilerActivity.CUDA
|
302 |
+
],
|
303 |
+
profile_memory=True,
|
304 |
+
with_stack=True
|
305 |
+
)
|
306 |
+
else:
|
307 |
+
profiler = None
|
308 |
+
|
309 |
+
# Model
|
310 |
+
print('Loading Model')
|
311 |
+
model = MAST3RGaussians(config)
|
312 |
+
if config.use_pretrained:
|
313 |
+
ckpt = torch.load(config.pretrained_mast3r_path)
|
314 |
+
_ = model.encoder.load_state_dict(ckpt['model'], strict=False)
|
315 |
+
del ckpt
|
316 |
+
|
317 |
+
# Training Datasets
|
318 |
+
print(f'Building Datasets')
|
319 |
+
train_dataset = scannetpp.get_scannet_dataset(
|
320 |
+
config.data.root,
|
321 |
+
'train',
|
322 |
+
config.data.resolution,
|
323 |
+
num_epochs_per_epoch=config.data.epochs_per_train_epoch,
|
324 |
+
)
|
325 |
+
data_loader_train = torch.utils.data.DataLoader(
|
326 |
+
train_dataset,
|
327 |
+
shuffle=True,
|
328 |
+
batch_size=config.data.batch_size,
|
329 |
+
num_workers=config.data.num_workers,
|
330 |
+
)
|
331 |
+
|
332 |
+
val_dataset = scannetpp.get_scannet_test_dataset(
|
333 |
+
config.data.root,
|
334 |
+
alpha=0.5,
|
335 |
+
beta=0.5,
|
336 |
+
resolution=config.data.resolution,
|
337 |
+
use_every_n_sample=100,
|
338 |
+
)
|
339 |
+
data_loader_val = torch.utils.data.DataLoader(
|
340 |
+
val_dataset,
|
341 |
+
shuffle=False,
|
342 |
+
batch_size=config.data.batch_size,
|
343 |
+
num_workers=config.data.num_workers,
|
344 |
+
)
|
345 |
+
|
346 |
+
# Training
|
347 |
+
print('Training')
|
348 |
+
trainer = L.Trainer(
|
349 |
+
accelerator="gpu",
|
350 |
+
benchmark=True,
|
351 |
+
callbacks=[
|
352 |
+
L.pytorch.callbacks.LearningRateMonitor(logging_interval='epoch', log_momentum=True),
|
353 |
+
export.SaveBatchData(save_dir=config.save_dir),
|
354 |
+
],
|
355 |
+
check_val_every_n_epoch=1,
|
356 |
+
default_root_dir=config.save_dir,
|
357 |
+
devices=config.devices,
|
358 |
+
gradient_clip_val=config.opt.gradient_clip_val,
|
359 |
+
log_every_n_steps=10,
|
360 |
+
logger=loggers,
|
361 |
+
max_epochs=config.opt.epochs,
|
362 |
+
profiler=profiler,
|
363 |
+
strategy="ddp_find_unused_parameters_true" if len(config.devices) > 1 else "auto",
|
364 |
+
)
|
365 |
+
trainer.fit(model, train_dataloaders=data_loader_train, val_dataloaders=data_loader_val)
|
366 |
+
|
367 |
+
# Testing
|
368 |
+
original_save_dir = config.save_dir
|
369 |
+
results = {}
|
370 |
+
for alpha, beta in ((0.9, 0.9), (0.7, 0.7), (0.5, 0.5), (0.3, 0.3)):
|
371 |
+
|
372 |
+
test_dataset = scannetpp.get_scannet_test_dataset(
|
373 |
+
config.data.root,
|
374 |
+
alpha=alpha,
|
375 |
+
beta=beta,
|
376 |
+
resolution=config.data.resolution,
|
377 |
+
use_every_n_sample=10
|
378 |
+
)
|
379 |
+
data_loader_test = torch.utils.data.DataLoader(
|
380 |
+
test_dataset,
|
381 |
+
shuffle=False,
|
382 |
+
batch_size=config.data.batch_size,
|
383 |
+
num_workers=config.data.num_workers,
|
384 |
+
)
|
385 |
+
|
386 |
+
masking_configs = ((True, False), (True, True))
|
387 |
+
for apply_mask, average_over_mask in masking_configs:
|
388 |
+
|
389 |
+
new_save_dir = os.path.join(
|
390 |
+
original_save_dir,
|
391 |
+
f'alpha_{alpha}_beta_{beta}_apply_mask_{apply_mask}_average_over_mask_{average_over_mask}'
|
392 |
+
)
|
393 |
+
os.makedirs(new_save_dir, exist_ok=True)
|
394 |
+
model.config.save_dir = new_save_dir
|
395 |
+
|
396 |
+
L.seed_everything(config.seed, workers=True)
|
397 |
+
|
398 |
+
# Training
|
399 |
+
trainer = L.Trainer(
|
400 |
+
accelerator="gpu",
|
401 |
+
benchmark=True,
|
402 |
+
callbacks=[export.SaveBatchData(save_dir=config.save_dir),],
|
403 |
+
default_root_dir=config.save_dir,
|
404 |
+
devices=config.devices,
|
405 |
+
log_every_n_steps=10,
|
406 |
+
strategy="ddp_find_unused_parameters_true" if len(config.devices) > 1 else "auto",
|
407 |
+
)
|
408 |
+
|
409 |
+
model.lpips_criterion = lpips.LPIPS('vgg', spatial=average_over_mask)
|
410 |
+
model.config.loss.apply_mask = apply_mask
|
411 |
+
model.config.loss.average_over_mask = average_over_mask
|
412 |
+
res = trainer.test(model, dataloaders=data_loader_test)
|
413 |
+
results[f"alpha: {alpha}, beta: {beta}, apply_mask: {apply_mask}, average_over_mask: {average_over_mask}"] = res
|
414 |
+
|
415 |
+
# Save the results
|
416 |
+
save_path = os.path.join(original_save_dir, 'results.json')
|
417 |
+
with open(save_path, 'w') as f:
|
418 |
+
json.dump(results, f)
|
419 |
+
|
420 |
+
|
421 |
+
if __name__ == "__main__":
|
422 |
+
|
423 |
+
# Setup the workspace (eg. load the config, create a directory for results at config.save_dir, etc.)
|
424 |
+
config = workspace.load_config(sys.argv[1], sys.argv[2:])
|
425 |
+
if os.getenv("LOCAL_RANK", '0') == '0':
|
426 |
+
config = workspace.create_workspace(config)
|
427 |
+
|
428 |
+
# Run training
|
429 |
+
run_experiment(config)
|
src/mast3r_src/CHECKPOINTS_NOTICE
ADDED
@@ -0,0 +1,1376 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MASt3R
|
2 |
+
Copyright 2024-present NAVER Corp.
|
3 |
+
|
4 |
+
This project's checkpoints were trained on datasets with separate license terms.
|
5 |
+
Your use of theses checkpoints is subject to the terms and conditions of the following licenses.
|
6 |
+
|
7 |
+
===
|
8 |
+
pretrained model:
|
9 |
+
DUSt3R: DUSt3R_ViTLarge_BaseDecoder_512_dpt
|
10 |
+
https://github.com/naver/dust3r
|
11 |
+
|
12 |
+
In particular, from the croco training set:
|
13 |
+
|
14 |
+
3D_Street_View
|
15 |
+
https://github.com/amir32002/3D_Street_View/blob/master/LICENSE
|
16 |
+
This dataset is made freely available to academic and non-academic entities for non-commercial purposes such as academic research, teaching, scientific publications, or personal experimentation. Permission is granted to use the data given that you agree:
|
17 |
+
|
18 |
+
1. That the dataset comes "AS IS", without express or implied warranty. Although every effort has been made to ensure accuracy, we do not accept any responsibility for errors or omissions.
|
19 |
+
|
20 |
+
2. That you include a reference to the Dataset in any work that makes use of the dataset. For research papers, cite our publication as listed on our website.
|
21 |
+
|
22 |
+
3. That you do not distribute this dataset or modified versions. It is permissible to distribute derivative works in as far as they are abstract representations of this dataset (such as models trained on it or additional annotations that do not directly include any of our data) and do not allow to recover the dataset or something similar in character.
|
23 |
+
|
24 |
+
4. That you may not use the dataset or any derivative work for commercial purposes as, for example, licensing or selling the data, or using the data with a purpose to procure a commercial gain.
|
25 |
+
That all rights not expressly granted to you are reserved by us.
|
26 |
+
|
27 |
+
In addition, using the dataset is subject to the following standard terms:
|
28 |
+
|
29 |
+
|
30 |
+
Apache License
|
31 |
+
Version 2.0, January 2004
|
32 |
+
http://www.apache.org/licenses/
|
33 |
+
|
34 |
+
Indoor Visual Localization datasets (IndoorVL)
|
35 |
+
https://challenge.naverlabs.com/kapture/GangnamStation_LICENSE.txt
|
36 |
+
https://challenge.naverlabs.com/kapture/HyundaiDepartmentStore_LICENSE.txt
|
37 |
+
|
38 |
+
LICENSE.txt
|
39 |
+
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 (modified ver.)
|
40 |
+
International Public License
|
41 |
+
|
42 |
+
By exercising the Licensed Rights (defined below), You accept and agree
|
43 |
+
to be bound by the terms and conditions of this Creative Commons
|
44 |
+
Attribution-NonCommercial-NoDerivatives 4.0 International Public
|
45 |
+
License ("Public License"). To the extent this Public License may be
|
46 |
+
interpreted as a contract, You are granted the Licensed Rights in
|
47 |
+
consideration of Your acceptance of these terms and conditions, and the
|
48 |
+
Licensor grants You such rights in consideration of benefits the
|
49 |
+
Licensor receives from making the Licensed Material available under
|
50 |
+
these terms and conditions.
|
51 |
+
|
52 |
+
|
53 |
+
Section 1 -- Definitions.
|
54 |
+
|
55 |
+
a. Adapted Material means material subject to Copyright and Similar
|
56 |
+
Rights that is derived from or based upon the Licensed Material
|
57 |
+
and in which the Licensed Material is translated, altered,
|
58 |
+
arranged, transformed, or otherwise modified in a manner requiring
|
59 |
+
permission under the Copyright and Similar Rights held by the
|
60 |
+
Licensor. For purposes of this Public License, where the Licensed
|
61 |
+
Material is a musical work, performance, or sound recording,
|
62 |
+
Adapted Material is always produced where the Licensed Material is
|
63 |
+
synched in timed relation with a moving image.
|
64 |
+
|
65 |
+
b. Copyright and Similar Rights means copyright and/or similar rights
|
66 |
+
closely related to copyright including, without limitation,
|
67 |
+
performance, broadcast, sound recording, and Sui Generis Database
|
68 |
+
Rights, without regard to how the rights are labeled or
|
69 |
+
categorized. For purposes of this Public License, the rights
|
70 |
+
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
71 |
+
Rights.
|
72 |
+
|
73 |
+
c. Effective Technological Measures means those measures that, in the
|
74 |
+
absence of proper authority, may not be circumvented under laws
|
75 |
+
fulfilling obligations under Article 11 of the WIPO Copyright
|
76 |
+
Treaty adopted on December 20, 1996, and/or similar international
|
77 |
+
agreements.
|
78 |
+
|
79 |
+
d. Exceptions and Limitations means fair use, fair dealing, and/or
|
80 |
+
any other exception or limitation to Copyright and Similar Rights
|
81 |
+
that applies to Your use of the Licensed Material.
|
82 |
+
|
83 |
+
e. Licensed Material means the artistic or literary work, database,
|
84 |
+
or other material to which the Licensor applied this Public
|
85 |
+
License.
|
86 |
+
|
87 |
+
f. Licensed Rights means the rights granted to You subject to the
|
88 |
+
terms and conditions of this Public License, which are limited to
|
89 |
+
all Copyright and Similar Rights that apply to Your use of the
|
90 |
+
Licensed Material and that the Licensor has authority to license.
|
91 |
+
|
92 |
+
g. Licensor means the individual(s) or entity(ies) granting rights
|
93 |
+
under this Public License.
|
94 |
+
|
95 |
+
h. NonCommercial means not primarily intended for or directed towards
|
96 |
+
commercial advantage or monetary compensation. For purposes of
|
97 |
+
this Public License, the exchange of the Licensed Material for
|
98 |
+
other material subject to Copyright and Similar Rights by digital
|
99 |
+
file-sharing or similar means is NonCommercial provided there is
|
100 |
+
no payment of monetary compensation in connection with the
|
101 |
+
exchange.
|
102 |
+
|
103 |
+
i. Share means to provide material to the public by any means or
|
104 |
+
process that requires permission under the Licensed Rights, such
|
105 |
+
as reproduction, public display, public performance, distribution,
|
106 |
+
dissemination, communication, or importation, and to make material
|
107 |
+
available to the public including in ways that members of the
|
108 |
+
public may access the material from a place and at a time
|
109 |
+
individually chosen by them.
|
110 |
+
|
111 |
+
j. Sui Generis Database Rights means rights other than copyright
|
112 |
+
resulting from Directive 96/9/EC of the European Parliament and of
|
113 |
+
the Council of 11 March 1996 on the legal protection of databases,
|
114 |
+
as amended and/or succeeded, as well as other essentially
|
115 |
+
equivalent rights anywhere in the world.
|
116 |
+
|
117 |
+
k. You means the individual or entity exercising the Licensed Rights
|
118 |
+
under this Public License. Your has a corresponding meaning.
|
119 |
+
|
120 |
+
l. Research purpose means to publish research achievements in a research paper
|
121 |
+
|
122 |
+
|
123 |
+
Section 2 -- Scope.
|
124 |
+
|
125 |
+
a. License grant.
|
126 |
+
|
127 |
+
1. Subject to the terms and conditions of this Public License,
|
128 |
+
the Licensor hereby grants You a worldwide, royalty-free,
|
129 |
+
non-sublicensable, non-exclusive, irrevocable license to
|
130 |
+
exercise the Licensed Rights in the Licensed Material to:
|
131 |
+
|
132 |
+
a. reproduce and Share the Licensed Material, in whole or
|
133 |
+
in part, for NonCommercial purposes only; and
|
134 |
+
|
135 |
+
b. produce and reproduce, but not Share, Adapted Material
|
136 |
+
for NonCommercial purposes only.
|
137 |
+
|
138 |
+
c. reproduce and share the Adapted Matrerial, in part,
|
139 |
+
for Research purposes only.
|
140 |
+
|
141 |
+
2. Exceptions and Limitations. For the avoidance of doubt, where
|
142 |
+
Exceptions and Limitations apply to Your use, this Public
|
143 |
+
License does not apply, and You do not need to comply with
|
144 |
+
its terms and conditions.
|
145 |
+
|
146 |
+
3. Term. The term of this Public License is specified in Section
|
147 |
+
6(a).
|
148 |
+
|
149 |
+
4. Media and formats; technical modifications allowed. The
|
150 |
+
Licensor authorizes You to exercise the Licensed Rights in
|
151 |
+
all media and formats whether now known or hereafter created,
|
152 |
+
and to make technical modifications necessary to do so. The
|
153 |
+
Licensor waives and/or agrees not to assert any right or
|
154 |
+
authority to forbid You from making technical modifications
|
155 |
+
necessary to exercise the Licensed Rights, including
|
156 |
+
technical modifications necessary to circumvent Effective
|
157 |
+
Technological Measures. For purposes of this Public License,
|
158 |
+
simply making modifications authorized by this Section 2(a)
|
159 |
+
(4) never produces Adapted Material.
|
160 |
+
|
161 |
+
5. Downstream recipients.
|
162 |
+
|
163 |
+
a. Offer from the Licensor -- Licensed Material. Every
|
164 |
+
recipient of the Licensed Material automatically
|
165 |
+
receives an offer from the Licensor to exercise the
|
166 |
+
Licensed Rights under the terms and conditions of this
|
167 |
+
Public License.
|
168 |
+
|
169 |
+
b. No downstream restrictions. You may not offer or impose
|
170 |
+
any additional or different terms or conditions on, or
|
171 |
+
apply any Effective Technological Measures to, the
|
172 |
+
Licensed Material if doing so restricts exercise of the
|
173 |
+
Licensed Rights by any recipient of the Licensed
|
174 |
+
Material.
|
175 |
+
|
176 |
+
6. No endorsement. Nothing in this Public License constitutes or
|
177 |
+
may be construed as permission to assert or imply that You
|
178 |
+
are, or that Your use of the Licensed Material is, connected
|
179 |
+
with, or sponsored, endorsed, or granted official status by,
|
180 |
+
the Licensor or others designated to receive attribution as
|
181 |
+
provided in Section 3(a)(1)(A)(i).
|
182 |
+
|
183 |
+
b. Other rights.
|
184 |
+
|
185 |
+
1. Moral rights, such as the right of integrity, are not
|
186 |
+
licensed under this Public License, nor are publicity,
|
187 |
+
privacy, and/or other similar personality rights; however, to
|
188 |
+
the extent possible, the Licensor waives and/or agrees not to
|
189 |
+
assert any such rights held by the Licensor to the limited
|
190 |
+
extent necessary to allow You to exercise the Licensed
|
191 |
+
Rights, but not otherwise.
|
192 |
+
|
193 |
+
2. Patent and trademark rights are not licensed under this
|
194 |
+
Public License.
|
195 |
+
|
196 |
+
3. To the extent possible, the Licensor waives any right to
|
197 |
+
collect royalties from You for the exercise of the Licensed
|
198 |
+
Rights, whether directly or through a collecting society
|
199 |
+
under any voluntary or waivable statutory or compulsory
|
200 |
+
licensing scheme. In all other cases the Licensor expressly
|
201 |
+
reserves any right to collect such royalties, including when
|
202 |
+
the Licensed Material is used other than for NonCommercial
|
203 |
+
purposes.
|
204 |
+
|
205 |
+
|
206 |
+
Section 3 -- License Conditions.
|
207 |
+
|
208 |
+
Your exercise of the Licensed Rights is expressly made subject to the
|
209 |
+
following conditions.
|
210 |
+
|
211 |
+
a. Attribution.
|
212 |
+
|
213 |
+
1. If You Share the Licensed Material(including in a research paper),
|
214 |
+
You must:
|
215 |
+
|
216 |
+
a. retain the following if it is supplied by the Licensor
|
217 |
+
with the Licensed Material:
|
218 |
+
|
219 |
+
i. identification of the creator(s) of the Licensed
|
220 |
+
Material and any others designated to receive
|
221 |
+
attribution, in any reasonable manner requested by
|
222 |
+
the Licensor (including by pseudonym if
|
223 |
+
designated);
|
224 |
+
|
225 |
+
ii. a copyright notice;
|
226 |
+
|
227 |
+
iii. a notice that refers to this Public License;
|
228 |
+
|
229 |
+
iv. a notice that refers to the disclaimer of
|
230 |
+
warranties;
|
231 |
+
|
232 |
+
v. a URI or hyperlink to the Licensed Material to the
|
233 |
+
extent reasonably practicable;
|
234 |
+
|
235 |
+
b. indicate if You modified the Licensed Material and
|
236 |
+
retain an indication of any previous modifications; and
|
237 |
+
|
238 |
+
c. indicate the Licensed Material is licensed under this
|
239 |
+
Public License, and include the text of, or the URI or
|
240 |
+
hyperlink to, this Public License.
|
241 |
+
|
242 |
+
For the avoidance of doubt, You do not have permission under
|
243 |
+
this Public License to Share Adapted Material.
|
244 |
+
|
245 |
+
2. You may satisfy the conditions in Section 3(a)(1) in any
|
246 |
+
reasonable manner based on the medium, means, and context in
|
247 |
+
which You Share the Licensed Material. For example, it may be
|
248 |
+
reasonable to satisfy the conditions by providing a URI or
|
249 |
+
hyperlink to a resource that includes the required
|
250 |
+
information.
|
251 |
+
|
252 |
+
3. If requested by the Licensor, You must remove any of the
|
253 |
+
information required by Section 3(a)(1)(A) to the extent
|
254 |
+
reasonably practicable.
|
255 |
+
|
256 |
+
|
257 |
+
Section 4 -- Sui Generis Database Rights.
|
258 |
+
|
259 |
+
Where the Licensed Rights include Sui Generis Database Rights that
|
260 |
+
apply to Your use of the Licensed Material:
|
261 |
+
|
262 |
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
263 |
+
to extract, reuse, reproduce, and Share all or a substantial
|
264 |
+
portion of the contents of the database for NonCommercial purposes
|
265 |
+
only and provided You do not Share Adapted Material;
|
266 |
+
|
267 |
+
b. if You include all or a substantial portion of the database
|
268 |
+
contents in a database in which You have Sui Generis Database
|
269 |
+
Rights, then the database in which You have Sui Generis Database
|
270 |
+
Rights (but not its individual contents) is Adapted Material; and
|
271 |
+
|
272 |
+
c. You must comply with the conditions in Section 3(a) if You Share
|
273 |
+
all or a substantial portion of the contents of the database.
|
274 |
+
|
275 |
+
For the avoidance of doubt, this Section 4 supplements and does not
|
276 |
+
replace Your obligations under this Public License where the Licensed
|
277 |
+
Rights include other Copyright and Similar Rights.
|
278 |
+
|
279 |
+
|
280 |
+
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
281 |
+
|
282 |
+
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
283 |
+
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
284 |
+
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
285 |
+
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
286 |
+
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
287 |
+
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
288 |
+
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
289 |
+
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
290 |
+
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
291 |
+
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
292 |
+
|
293 |
+
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
294 |
+
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
295 |
+
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
296 |
+
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
297 |
+
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
298 |
+
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
299 |
+
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
300 |
+
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
301 |
+
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
302 |
+
|
303 |
+
c. The disclaimer of warranties and limitation of liability provided
|
304 |
+
above shall be interpreted in a manner that, to the extent
|
305 |
+
possible, most closely approximates an absolute disclaimer and
|
306 |
+
waiver of all liability.
|
307 |
+
|
308 |
+
|
309 |
+
Section 6 -- Term and Termination.
|
310 |
+
|
311 |
+
a. This Public License applies for the term of the Copyright and
|
312 |
+
Similar Rights licensed here. However, if You fail to comply with
|
313 |
+
this Public License, then Your rights under this Public License
|
314 |
+
terminate automatically.
|
315 |
+
|
316 |
+
b. Where Your right to use the Licensed Material has terminated under
|
317 |
+
Section 6(a), it reinstates:
|
318 |
+
|
319 |
+
1. automatically as of the date the violation is cured, provided
|
320 |
+
it is cured within 30 days of Your discovery of the
|
321 |
+
violation; or
|
322 |
+
|
323 |
+
2. upon express reinstatement by the Licensor.
|
324 |
+
|
325 |
+
For the avoidance of doubt, this Section 6(b) does not affect any
|
326 |
+
right the Licensor may have to seek remedies for Your violations
|
327 |
+
of this Public License.
|
328 |
+
|
329 |
+
c. For the avoidance of doubt, the Licensor may also offer the
|
330 |
+
Licensed Material under separate terms or conditions or stop
|
331 |
+
distributing the Licensed Material at any time; however, doing so
|
332 |
+
will not terminate this Public License.
|
333 |
+
|
334 |
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
335 |
+
License.
|
336 |
+
|
337 |
+
|
338 |
+
Section 7 -- Other Terms and Conditions.
|
339 |
+
|
340 |
+
a. The Licensor shall not be bound by any additional or different
|
341 |
+
terms or conditions communicated by You unless expressly agreed.
|
342 |
+
|
343 |
+
b. Any arrangements, understandings, or agreements regarding the
|
344 |
+
Licensed Material not stated herein are separate from and
|
345 |
+
independent of the terms and conditions of this Public License.
|
346 |
+
|
347 |
+
|
348 |
+
Section 8 -- Interpretation.
|
349 |
+
|
350 |
+
a. For the avoidance of doubt, this Public License does not, and
|
351 |
+
shall not be interpreted to, reduce, limit, restrict, or impose
|
352 |
+
conditions on any use of the Licensed Material that could lawfully
|
353 |
+
be made without permission under this Public License.
|
354 |
+
|
355 |
+
b. To the extent possible, if any provision of this Public License is
|
356 |
+
deemed unenforceable, it shall be automatically reformed to the
|
357 |
+
minimum extent necessary to make it enforceable. If the provision
|
358 |
+
cannot be reformed, it shall be severed from this Public License
|
359 |
+
without affecting the enforceability of the remaining terms and
|
360 |
+
conditions.
|
361 |
+
|
362 |
+
c. No term or condition of this Public License will be waived and no
|
363 |
+
failure to comply consented to unless expressly agreed to by the
|
364 |
+
Licensor.
|
365 |
+
|
366 |
+
d. Nothing in this Public License constitutes or may be interpreted
|
367 |
+
as a limitation upon, or waiver of, any privileges and immunities
|
368 |
+
that apply to the Licensor or You, including from the legal
|
369 |
+
processes of any jurisdiction or authority.
|
370 |
+
|
371 |
+
===
|
372 |
+
CO3Dv2
|
373 |
+
|
374 |
+
Creative Commons Attribution-NonCommercial 4.0 International Public
|
375 |
+
License
|
376 |
+
|
377 |
+
By exercising the Licensed Rights (defined below), You accept and agree
|
378 |
+
to be bound by the terms and conditions of this Creative Commons
|
379 |
+
Attribution-NonCommercial 4.0 International Public License ("Public
|
380 |
+
License"). To the extent this Public License may be interpreted as a
|
381 |
+
contract, You are granted the Licensed Rights in consideration of Your
|
382 |
+
acceptance of these terms and conditions, and the Licensor grants You
|
383 |
+
such rights in consideration of benefits the Licensor receives from
|
384 |
+
making the Licensed Material available under these terms and
|
385 |
+
conditions.
|
386 |
+
|
387 |
+
Section 1 -- Definitions.
|
388 |
+
|
389 |
+
a. Adapted Material means material subject to Copyright and Similar
|
390 |
+
Rights that is derived from or based upon the Licensed Material
|
391 |
+
and in which the Licensed Material is translated, altered,
|
392 |
+
arranged, transformed, or otherwise modified in a manner requiring
|
393 |
+
permission under the Copyright and Similar Rights held by the
|
394 |
+
Licensor. For purposes of this Public License, where the Licensed
|
395 |
+
Material is a musical work, performance, or sound recording,
|
396 |
+
Adapted Material is always produced where the Licensed Material is
|
397 |
+
synched in timed relation with a moving image.
|
398 |
+
|
399 |
+
b. Adapter's License means the license You apply to Your Copyright
|
400 |
+
and Similar Rights in Your contributions to Adapted Material in
|
401 |
+
accordance with the terms and conditions of this Public License.
|
402 |
+
|
403 |
+
c. Copyright and Similar Rights means copyright and/or similar rights
|
404 |
+
closely related to copyright including, without limitation,
|
405 |
+
performance, broadcast, sound recording, and Sui Generis Database
|
406 |
+
Rights, without regard to how the rights are labeled or
|
407 |
+
categorized. For purposes of this Public License, the rights
|
408 |
+
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
409 |
+
Rights.
|
410 |
+
d. Effective Technological Measures means those measures that, in the
|
411 |
+
absence of proper authority, may not be circumvented under laws
|
412 |
+
fulfilling obligations under Article 11 of the WIPO Copyright
|
413 |
+
Treaty adopted on December 20, 1996, and/or similar international
|
414 |
+
agreements.
|
415 |
+
|
416 |
+
e. Exceptions and Limitations means fair use, fair dealing, and/or
|
417 |
+
any other exception or limitation to Copyright and Similar Rights
|
418 |
+
that applies to Your use of the Licensed Material.
|
419 |
+
|
420 |
+
f. Licensed Material means the artistic or literary work, database,
|
421 |
+
or other material to which the Licensor applied this Public
|
422 |
+
License.
|
423 |
+
|
424 |
+
g. Licensed Rights means the rights granted to You subject to the
|
425 |
+
terms and conditions of this Public License, which are limited to
|
426 |
+
all Copyright and Similar Rights that apply to Your use of the
|
427 |
+
Licensed Material and that the Licensor has authority to license.
|
428 |
+
|
429 |
+
h. Licensor means the individual(s) or entity(ies) granting rights
|
430 |
+
under this Public License.
|
431 |
+
|
432 |
+
i. NonCommercial means not primarily intended for or directed towards
|
433 |
+
commercial advantage or monetary compensation. For purposes of
|
434 |
+
this Public License, the exchange of the Licensed Material for
|
435 |
+
other material subject to Copyright and Similar Rights by digital
|
436 |
+
file-sharing or similar means is NonCommercial provided there is
|
437 |
+
no payment of monetary compensation in connection with the
|
438 |
+
exchange.
|
439 |
+
|
440 |
+
j. Share means to provide material to the public by any means or
|
441 |
+
process that requires permission under the Licensed Rights, such
|
442 |
+
as reproduction, public display, public performance, distribution,
|
443 |
+
dissemination, communication, or importation, and to make material
|
444 |
+
available to the public including in ways that members of the
|
445 |
+
public may access the material from a place and at a time
|
446 |
+
individually chosen by them.
|
447 |
+
|
448 |
+
k. Sui Generis Database Rights means rights other than copyright
|
449 |
+
resulting from Directive 96/9/EC of the European Parliament and of
|
450 |
+
the Council of 11 March 1996 on the legal protection of databases,
|
451 |
+
as amended and/or succeeded, as well as other essentially
|
452 |
+
equivalent rights anywhere in the world.
|
453 |
+
|
454 |
+
l. You means the individual or entity exercising the Licensed Rights
|
455 |
+
under this Public License. Your has a corresponding meaning.
|
456 |
+
|
457 |
+
Section 2 -- Scope.
|
458 |
+
|
459 |
+
a. License grant.
|
460 |
+
|
461 |
+
1. Subject to the terms and conditions of this Public License,
|
462 |
+
the Licensor hereby grants You a worldwide, royalty-free,
|
463 |
+
non-sublicensable, non-exclusive, irrevocable license to
|
464 |
+
exercise the Licensed Rights in the Licensed Material to:
|
465 |
+
|
466 |
+
a. reproduce and Share the Licensed Material, in whole or
|
467 |
+
in part, for NonCommercial purposes only; and
|
468 |
+
|
469 |
+
b. produce, reproduce, and Share Adapted Material for
|
470 |
+
NonCommercial purposes only.
|
471 |
+
|
472 |
+
2. Exceptions and Limitations. For the avoidance of doubt, where
|
473 |
+
Exceptions and Limitations apply to Your use, this Public
|
474 |
+
License does not apply, and You do not need to comply with
|
475 |
+
its terms and conditions.
|
476 |
+
|
477 |
+
3. Term. The term of this Public License is specified in Section
|
478 |
+
6(a).
|
479 |
+
|
480 |
+
4. Media and formats; technical modifications allowed. The
|
481 |
+
Licensor authorizes You to exercise the Licensed Rights in
|
482 |
+
all media and formats whether now known or hereafter created,
|
483 |
+
and to make technical modifications necessary to do so. The
|
484 |
+
Licensor waives and/or agrees not to assert any right or
|
485 |
+
authority to forbid You from making technical modifications
|
486 |
+
necessary to exercise the Licensed Rights, including
|
487 |
+
technical modifications necessary to circumvent Effective
|
488 |
+
Technological Measures. For purposes of this Public License,
|
489 |
+
simply making modifications authorized by this Section 2(a)
|
490 |
+
(4) never produces Adapted Material.
|
491 |
+
|
492 |
+
5. Downstream recipients.
|
493 |
+
|
494 |
+
a. Offer from the Licensor -- Licensed Material. Every
|
495 |
+
recipient of the Licensed Material automatically
|
496 |
+
receives an offer from the Licensor to exercise the
|
497 |
+
Licensed Rights under the terms and conditions of this
|
498 |
+
Public License.
|
499 |
+
|
500 |
+
b. No downstream restrictions. You may not offer or impose
|
501 |
+
any additional or different terms or conditions on, or
|
502 |
+
apply any Effective Technological Measures to, the
|
503 |
+
Licensed Material if doing so restricts exercise of the
|
504 |
+
Licensed Rights by any recipient of the Licensed
|
505 |
+
Material.
|
506 |
+
|
507 |
+
6. No endorsement. Nothing in this Public License constitutes or
|
508 |
+
may be construed as permission to assert or imply that You
|
509 |
+
are, or that Your use of the Licensed Material is, connected
|
510 |
+
with, or sponsored, endorsed, or granted official status by,
|
511 |
+
the Licensor or others designated to receive attribution as
|
512 |
+
provided in Section 3(a)(1)(A)(i).
|
513 |
+
|
514 |
+
b. Other rights.
|
515 |
+
|
516 |
+
1. Moral rights, such as the right of integrity, are not
|
517 |
+
licensed under this Public License, nor are publicity,
|
518 |
+
privacy, and/or other similar personality rights; however, to
|
519 |
+
the extent possible, the Licensor waives and/or agrees not to
|
520 |
+
assert any such rights held by the Licensor to the limited
|
521 |
+
extent necessary to allow You to exercise the Licensed
|
522 |
+
Rights, but not otherwise.
|
523 |
+
|
524 |
+
2. Patent and trademark rights are not licensed under this
|
525 |
+
Public License.
|
526 |
+
|
527 |
+
3. To the extent possible, the Licensor waives any right to
|
528 |
+
collect royalties from You for the exercise of the Licensed
|
529 |
+
Rights, whether directly or through a collecting society
|
530 |
+
under any voluntary or waivable statutory or compulsory
|
531 |
+
licensing scheme. In all other cases the Licensor expressly
|
532 |
+
reserves any right to collect such royalties, including when
|
533 |
+
the Licensed Material is used other than for NonCommercial
|
534 |
+
purposes.
|
535 |
+
|
536 |
+
Section 3 -- License Conditions.
|
537 |
+
|
538 |
+
Your exercise of the Licensed Rights is expressly made subject to the
|
539 |
+
following conditions.
|
540 |
+
|
541 |
+
a. Attribution.
|
542 |
+
|
543 |
+
1. If You Share the Licensed Material (including in modified
|
544 |
+
form), You must:
|
545 |
+
|
546 |
+
a. retain the following if it is supplied by the Licensor
|
547 |
+
with the Licensed Material:
|
548 |
+
|
549 |
+
i. identification of the creator(s) of the Licensed
|
550 |
+
Material and any others designated to receive
|
551 |
+
attribution, in any reasonable manner requested by
|
552 |
+
the Licensor (including by pseudonym if
|
553 |
+
designated);
|
554 |
+
|
555 |
+
ii. a copyright notice;
|
556 |
+
|
557 |
+
iii. a notice that refers to this Public License;
|
558 |
+
|
559 |
+
iv. a notice that refers to the disclaimer of
|
560 |
+
warranties;
|
561 |
+
|
562 |
+
v. a URI or hyperlink to the Licensed Material to the
|
563 |
+
extent reasonably practicable;
|
564 |
+
|
565 |
+
b. indicate if You modified the Licensed Material and
|
566 |
+
retain an indication of any previous modifications; and
|
567 |
+
|
568 |
+
c. indicate the Licensed Material is licensed under this
|
569 |
+
Public License, and include the text of, or the URI or
|
570 |
+
hyperlink to, this Public License.
|
571 |
+
|
572 |
+
2. You may satisfy the conditions in Section 3(a)(1) in any
|
573 |
+
reasonable manner based on the medium, means, and context in
|
574 |
+
which You Share the Licensed Material. For example, it may be
|
575 |
+
reasonable to satisfy the conditions by providing a URI or
|
576 |
+
hyperlink to a resource that includes the required
|
577 |
+
information.
|
578 |
+
|
579 |
+
3. If requested by the Licensor, You must remove any of the
|
580 |
+
information required by Section 3(a)(1)(A) to the extent
|
581 |
+
reasonably practicable.
|
582 |
+
|
583 |
+
4. If You Share Adapted Material You produce, the Adapter's
|
584 |
+
License You apply must not prevent recipients of the Adapted
|
585 |
+
Material from complying with this Public License.
|
586 |
+
|
587 |
+
Section 4 -- Sui Generis Database Rights.
|
588 |
+
|
589 |
+
Where the Licensed Rights include Sui Generis Database Rights that
|
590 |
+
apply to Your use of the Licensed Material:
|
591 |
+
|
592 |
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
593 |
+
to extract, reuse, reproduce, and Share all or a substantial
|
594 |
+
portion of the contents of the database for NonCommercial purposes
|
595 |
+
only;
|
596 |
+
|
597 |
+
b. if You include all or a substantial portion of the database
|
598 |
+
contents in a database in which You have Sui Generis Database
|
599 |
+
Rights, then the database in which You have Sui Generis Database
|
600 |
+
Rights (but not its individual contents) is Adapted Material; and
|
601 |
+
|
602 |
+
c. You must comply with the conditions in Section 3(a) if You Share
|
603 |
+
all or a substantial portion of the contents of the database.
|
604 |
+
|
605 |
+
For the avoidance of doubt, this Section 4 supplements and does not
|
606 |
+
replace Your obligations under this Public License where the Licensed
|
607 |
+
Rights include other Copyright and Similar Rights.
|
608 |
+
|
609 |
+
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
610 |
+
|
611 |
+
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
612 |
+
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
613 |
+
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
614 |
+
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
615 |
+
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
616 |
+
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
617 |
+
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
618 |
+
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
619 |
+
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
620 |
+
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
621 |
+
|
622 |
+
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
623 |
+
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
624 |
+
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
625 |
+
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
626 |
+
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
627 |
+
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
628 |
+
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
629 |
+
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
630 |
+
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
631 |
+
|
632 |
+
c. The disclaimer of warranties and limitation of liability provided
|
633 |
+
above shall be interpreted in a manner that, to the extent
|
634 |
+
possible, most closely approximates an absolute disclaimer and
|
635 |
+
waiver of all liability.
|
636 |
+
|
637 |
+
Section 6 -- Term and Termination.
|
638 |
+
|
639 |
+
a. This Public License applies for the term of the Copyright and
|
640 |
+
Similar Rights licensed here. However, if You fail to comply with
|
641 |
+
this Public License, then Your rights under this Public License
|
642 |
+
terminate automatically.
|
643 |
+
|
644 |
+
b. Where Your right to use the Licensed Material has terminated under
|
645 |
+
Section 6(a), it reinstates:
|
646 |
+
|
647 |
+
1. automatically as of the date the violation is cured, provided
|
648 |
+
it is cured within 30 days of Your discovery of the
|
649 |
+
violation; or
|
650 |
+
|
651 |
+
2. upon express reinstatement by the Licensor.
|
652 |
+
|
653 |
+
For the avoidance of doubt, this Section 6(b) does not affect any
|
654 |
+
right the Licensor may have to seek remedies for Your violations
|
655 |
+
of this Public License.
|
656 |
+
|
657 |
+
c. For the avoidance of doubt, the Licensor may also offer the
|
658 |
+
Licensed Material under separate terms or conditions or stop
|
659 |
+
distributing the Licensed Material at any time; however, doing so
|
660 |
+
will not terminate this Public License.
|
661 |
+
|
662 |
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
663 |
+
License.
|
664 |
+
|
665 |
+
Section 7 -- Other Terms and Conditions.
|
666 |
+
|
667 |
+
a. The Licensor shall not be bound by any additional or different
|
668 |
+
terms or conditions communicated by You unless expressly agreed.
|
669 |
+
|
670 |
+
b. Any arrangements, understandings, or agreements regarding the
|
671 |
+
Licensed Material not stated herein are separate from and
|
672 |
+
independent of the terms and conditions of this Public License.
|
673 |
+
|
674 |
+
Section 8 -- Interpretation.
|
675 |
+
|
676 |
+
a. For the avoidance of doubt, this Public License does not, and
|
677 |
+
shall not be interpreted to, reduce, limit, restrict, or impose
|
678 |
+
conditions on any use of the Licensed Material that could lawfully
|
679 |
+
be made without permission under this Public License.
|
680 |
+
|
681 |
+
b. To the extent possible, if any provision of this Public License is
|
682 |
+
deemed unenforceable, it shall be automatically reformed to the
|
683 |
+
minimum extent necessary to make it enforceable. If the provision
|
684 |
+
cannot be reformed, it shall be severed from this Public License
|
685 |
+
without affecting the enforceability of the remaining terms and
|
686 |
+
conditions.
|
687 |
+
|
688 |
+
c. No term or condition of this Public License will be waived and no
|
689 |
+
failure to comply consented to unless expressly agreed to by the
|
690 |
+
Licensor.
|
691 |
+
|
692 |
+
d. Nothing in this Public License constitutes or may be interpreted
|
693 |
+
as a limitation upon, or waiver of, any privileges and immunities
|
694 |
+
that apply to the Licensor or You, including from the legal
|
695 |
+
processes of any jurisdiction or authority.
|
696 |
+
|
697 |
+
===
|
698 |
+
ARKitScenes
|
699 |
+
Creative Commons Attribution-NonCommercial-ShareAlike 4.0: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
700 |
+
|
701 |
+
===
|
702 |
+
ScanNet++
|
703 |
+
https://kaldir.vc.in.tum.de/scannetpp/static/scannetpp-terms-of-use.pdf
|
704 |
+
|
705 |
+
===
|
706 |
+
BlendedMVS
|
707 |
+
Creative Commons Attribution 4.0 International: http://creativecommons.org/licenses/by/4.0/
|
708 |
+
|
709 |
+
===
|
710 |
+
Habitat-Sim
|
711 |
+
HM3D
|
712 |
+
https://matterport.com/fr/legal/matterport-end-user-license-agreement-academic-use-model-data
|
713 |
+
|
714 |
+
ScanNet
|
715 |
+
https://kaldir.vc.in.tum.de/scannet/ScanNet_TOS.pdf
|
716 |
+
|
717 |
+
Replica
|
718 |
+
Before Facebook Technologies, LLC (“FB”) is able to offer you (“Researcher” or
|
719 |
+
“You”) access to the Replica Dataset (the “Dataset”), please read the following
|
720 |
+
agreement (“Agreement”).
|
721 |
+
|
722 |
+
By accessing, and in exchange for receiving permission to access, the Dataset,
|
723 |
+
Researcher hereby agrees to the following terms and conditions:
|
724 |
+
1. Researcher may use, modify, improve and/or publish the Dataset only in
|
725 |
+
connection with a research or educational purpose that is non-commercial or
|
726 |
+
not-for-profit in nature, and not for any other purpose.
|
727 |
+
1. Researcher may provide research associates and colleagues with access to the
|
728 |
+
Dataset provided that they first agree to be bound by these terms and
|
729 |
+
conditions.
|
730 |
+
1. Researcher may use the Dataset in the scope of their employment at a
|
731 |
+
for-profit or commercial entity provided that Researcher complies with Section 1
|
732 |
+
of this Agreement. If Researcher is employed by a for-profit or commercial
|
733 |
+
entity, Researcher's employer shall also be bound by these terms and conditions,
|
734 |
+
and Researcher hereby represents that they are fully authorized to enter into
|
735 |
+
this agreement on behalf of such employer.
|
736 |
+
1. THE DATASET IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
737 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
738 |
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL FB OR ANY
|
739 |
+
CONTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
740 |
+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
741 |
+
WITH THE DATASET OR THE USE OR OTHER DEALINGS IN THE DATASET.
|
742 |
+
1. The law of the State of California shall apply to all disputes related to
|
743 |
+
this Dataset.
|
744 |
+
|
745 |
+
ReplicaCAD
|
746 |
+
Creative Commons Attribution 4.0 International (CC BY 4.0): https://creativecommons.org/licenses/by/4.0/
|
747 |
+
|
748 |
+
habitat-sim
|
749 |
+
MIT License
|
750 |
+
|
751 |
+
Copyright (c) Meta Platforms, Inc. and its affiliates.
|
752 |
+
|
753 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
754 |
+
of this software and associated documentation files (the "Software"), to deal
|
755 |
+
in the Software without restriction, including without limitation the rights
|
756 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
757 |
+
copies of the Software, and to permit persons to whom the Software is
|
758 |
+
furnished to do so, subject to the following conditions:
|
759 |
+
|
760 |
+
The above copyright notice and this permission notice shall be included in all
|
761 |
+
copies or substantial portions of the Software.
|
762 |
+
|
763 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
764 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
765 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
766 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
767 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
768 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
769 |
+
SOFTWARE.
|
770 |
+
===
|
771 |
+
MegaDepth
|
772 |
+
MIT License
|
773 |
+
|
774 |
+
Copyright (c) 2018 Zhengqi Li
|
775 |
+
|
776 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
777 |
+
of this software and associated documentation files (the "Software"), to deal
|
778 |
+
in the Software without restriction, including without limitation the rights
|
779 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
780 |
+
copies of the Software, and to permit persons to whom the Software is
|
781 |
+
furnished to do so, subject to the following conditions:
|
782 |
+
|
783 |
+
The above copyright notice and this permission notice shall be included in all
|
784 |
+
copies or substantial portions of the Software.
|
785 |
+
|
786 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
787 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
788 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
789 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
790 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
791 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
792 |
+
SOFTWARE.
|
793 |
+
|
794 |
+
===
|
795 |
+
StaticThings3D
|
796 |
+
Apache License
|
797 |
+
Version 2.0, January 2004
|
798 |
+
http://www.apache.org/licenses/
|
799 |
+
|
800 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
801 |
+
|
802 |
+
1. Definitions.
|
803 |
+
|
804 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
805 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
806 |
+
|
807 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
808 |
+
the copyright owner that is granting the License.
|
809 |
+
|
810 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
811 |
+
other entities that control, are controlled by, or are under common
|
812 |
+
control with that entity. For the purposes of this definition,
|
813 |
+
"control" means (i) the power, direct or indirect, to cause the
|
814 |
+
direction or management of such entity, whether by contract or
|
815 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
816 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
817 |
+
|
818 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
819 |
+
exercising permissions granted by this License.
|
820 |
+
|
821 |
+
"Source" form shall mean the preferred form for making modifications,
|
822 |
+
including but not limited to software source code, documentation
|
823 |
+
source, and configuration files.
|
824 |
+
|
825 |
+
"Object" form shall mean any form resulting from mechanical
|
826 |
+
transformation or translation of a Source form, including but
|
827 |
+
not limited to compiled object code, generated documentation,
|
828 |
+
and conversions to other media types.
|
829 |
+
|
830 |
+
"Work" shall mean the work of authorship, whether in Source or
|
831 |
+
Object form, made available under the License, as indicated by a
|
832 |
+
copyright notice that is included in or attached to the work
|
833 |
+
(an example is provided in the Appendix below).
|
834 |
+
|
835 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
836 |
+
form, that is based on (or derived from) the Work and for which the
|
837 |
+
editorial revisions, annotations, elaborations, or other modifications
|
838 |
+
represent, as a whole, an original work of authorship. For the purposes
|
839 |
+
of this License, Derivative Works shall not include works that remain
|
840 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
841 |
+
the Work and Derivative Works thereof.
|
842 |
+
|
843 |
+
"Contribution" shall mean any work of authorship, including
|
844 |
+
the original version of the Work and any modifications or additions
|
845 |
+
to that Work or Derivative Works thereof, that is intentionally
|
846 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
847 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
848 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
849 |
+
means any form of electronic, verbal, or written communication sent
|
850 |
+
to the Licensor or its representatives, including but not limited to
|
851 |
+
communication on electronic mailing lists, source code control systems,
|
852 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
853 |
+
Licensor for the purpose of discussing and improving the Work, but
|
854 |
+
excluding communication that is conspicuously marked or otherwise
|
855 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
856 |
+
|
857 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
858 |
+
on behalf of whom a Contribution has been received by Licensor and
|
859 |
+
subsequently incorporated within the Work.
|
860 |
+
|
861 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
862 |
+
this License, each Contributor hereby grants to You a perpetual,
|
863 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
864 |
+
copyright license to reproduce, prepare Derivative Works of,
|
865 |
+
publicly display, publicly perform, sublicense, and distribute the
|
866 |
+
Work and such Derivative Works in Source or Object form.
|
867 |
+
|
868 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
869 |
+
this License, each Contributor hereby grants to You a perpetual,
|
870 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
871 |
+
(except as stated in this section) patent license to make, have made,
|
872 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
873 |
+
where such license applies only to those patent claims licensable
|
874 |
+
by such Contributor that are necessarily infringed by their
|
875 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
876 |
+
with the Work to which such Contribution(s) was submitted. If You
|
877 |
+
institute patent litigation against any entity (including a
|
878 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
879 |
+
or a Contribution incorporated within the Work constitutes direct
|
880 |
+
or contributory patent infringement, then any patent licenses
|
881 |
+
granted to You under this License for that Work shall terminate
|
882 |
+
as of the date such litigation is filed.
|
883 |
+
|
884 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
885 |
+
Work or Derivative Works thereof in any medium, with or without
|
886 |
+
modifications, and in Source or Object form, provided that You
|
887 |
+
meet the following conditions:
|
888 |
+
|
889 |
+
(a) You must give any other recipients of the Work or
|
890 |
+
Derivative Works a copy of this License; and
|
891 |
+
|
892 |
+
(b) You must cause any modified files to carry prominent notices
|
893 |
+
stating that You changed the files; and
|
894 |
+
|
895 |
+
(c) You must retain, in the Source form of any Derivative Works
|
896 |
+
that You distribute, all copyright, patent, trademark, and
|
897 |
+
attribution notices from the Source form of the Work,
|
898 |
+
excluding those notices that do not pertain to any part of
|
899 |
+
the Derivative Works; and
|
900 |
+
|
901 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
902 |
+
distribution, then any Derivative Works that You distribute must
|
903 |
+
include a readable copy of the attribution notices contained
|
904 |
+
within such NOTICE file, excluding those notices that do not
|
905 |
+
pertain to any part of the Derivative Works, in at least one
|
906 |
+
of the following places: within a NOTICE text file distributed
|
907 |
+
as part of the Derivative Works; within the Source form or
|
908 |
+
documentation, if provided along with the Derivative Works; or,
|
909 |
+
within a display generated by the Derivative Works, if and
|
910 |
+
wherever such third-party notices normally appear. The contents
|
911 |
+
of the NOTICE file are for informational purposes only and
|
912 |
+
do not modify the License. You may add Your own attribution
|
913 |
+
notices within Derivative Works that You distribute, alongside
|
914 |
+
or as an addendum to the NOTICE text from the Work, provided
|
915 |
+
that such additional attribution notices cannot be construed
|
916 |
+
as modifying the License.
|
917 |
+
|
918 |
+
You may add Your own copyright statement to Your modifications and
|
919 |
+
may provide additional or different license terms and conditions
|
920 |
+
for use, reproduction, or distribution of Your modifications, or
|
921 |
+
for any such Derivative Works as a whole, provided Your use,
|
922 |
+
reproduction, and distribution of the Work otherwise complies with
|
923 |
+
the conditions stated in this License.
|
924 |
+
|
925 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
926 |
+
any Contribution intentionally submitted for inclusion in the Work
|
927 |
+
by You to the Licensor shall be under the terms and conditions of
|
928 |
+
this License, without any additional terms or conditions.
|
929 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
930 |
+
the terms of any separate license agreement you may have executed
|
931 |
+
with Licensor regarding such Contributions.
|
932 |
+
|
933 |
+
6. Trademarks. This License does not grant permission to use the trade
|
934 |
+
names, trademarks, service marks, or product names of the Licensor,
|
935 |
+
except as required for reasonable and customary use in describing the
|
936 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
937 |
+
|
938 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
939 |
+
agreed to in writing, Licensor provides the Work (and each
|
940 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
941 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
942 |
+
implied, including, without limitation, any warranties or conditions
|
943 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
944 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
945 |
+
appropriateness of using or redistributing the Work and assume any
|
946 |
+
risks associated with Your exercise of permissions under this License.
|
947 |
+
|
948 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
949 |
+
whether in tort (including negligence), contract, or otherwise,
|
950 |
+
unless required by applicable law (such as deliberate and grossly
|
951 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
952 |
+
liable to You for damages, including any direct, indirect, special,
|
953 |
+
incidental, or consequential damages of any character arising as a
|
954 |
+
result of this License or out of the use or inability to use the
|
955 |
+
Work (including but not limited to damages for loss of goodwill,
|
956 |
+
work stoppage, computer failure or malfunction, or any and all
|
957 |
+
other commercial damages or losses), even if such Contributor
|
958 |
+
has been advised of the possibility of such damages.
|
959 |
+
|
960 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
961 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
962 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
963 |
+
or other liability obligations and/or rights consistent with this
|
964 |
+
License. However, in accepting such obligations, You may act only
|
965 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
966 |
+
of any other Contributor, and only if You agree to indemnify,
|
967 |
+
defend, and hold each Contributor harmless for any liability
|
968 |
+
incurred by, or claims asserted against, such Contributor by reason
|
969 |
+
of your accepting any such warranty or additional liability.
|
970 |
+
|
971 |
+
===
|
972 |
+
WildRGB-D
|
973 |
+
https://github.com/wildrgbd/wildrgbd/
|
974 |
+
MIT License
|
975 |
+
|
976 |
+
Copyright (c) 2024 rowdataset
|
977 |
+
|
978 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
979 |
+
of this software and associated documentation files (the "Software"), to deal
|
980 |
+
in the Software without restriction, including without limitation the rights
|
981 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
982 |
+
copies of the Software, and to permit persons to whom the Software is
|
983 |
+
furnished to do so, subject to the following conditions:
|
984 |
+
|
985 |
+
The above copyright notice and this permission notice shall be included in all
|
986 |
+
copies or substantial portions of the Software.
|
987 |
+
|
988 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
989 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
990 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
991 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
992 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
993 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
994 |
+
SOFTWARE.
|
995 |
+
|
996 |
+
===
|
997 |
+
TartanAir
|
998 |
+
Creative Commons Attribution 4.0 International License: http://creativecommons.org/licenses/by/4.0/
|
999 |
+
|
1000 |
+
===
|
1001 |
+
UnrealStereo4K
|
1002 |
+
https://github.com/fabiotosi92/SMD-Nets
|
1003 |
+
MIT License
|
1004 |
+
|
1005 |
+
Copyright (c) 2021 Fabio Tosi
|
1006 |
+
|
1007 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
1008 |
+
of this software and associated documentation files (the "Software"), to deal
|
1009 |
+
in the Software without restriction, including without limitation the rights
|
1010 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
1011 |
+
copies of the Software, and to permit persons to whom the Software is
|
1012 |
+
furnished to do so, subject to the following conditions:
|
1013 |
+
|
1014 |
+
The above copyright notice and this permission notice shall be included in all
|
1015 |
+
copies or substantial portions of the Software.
|
1016 |
+
|
1017 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
1018 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
1019 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
1020 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
1021 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
1022 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
1023 |
+
SOFTWARE.
|
1024 |
+
|
1025 |
+
===
|
1026 |
+
Virtual KITTI 2
|
1027 |
+
Creative Commons Attribution-NonCommercial-ShareAlike 3.0: http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode
|
1028 |
+
|
1029 |
+
===
|
1030 |
+
DL3DV
|
1031 |
+
DL3DV-10K Term of use and Creative Commons Attribution-NonCommercial 4.0 International License.
|
1032 |
+
|
1033 |
+
Terms of Use
|
1034 |
+
|
1035 |
+
Researcher shall use the Dataset only for non-commercial research and educational purposes.
|
1036 |
+
DL3DV-10K organization makes no representations or warranties regarding the dataset, including but not limited to warranties of non-infringement or fitness for a particular purpose.
|
1037 |
+
Researcher accepts full responsibility for his/her/their use of the Dataset and shall defend and indemnify DL3DV-10K organization, including its members, employees, Trustees, officers and agents, against any and all claims arising from Researcher's use of the Dataset, including but not limited to Researcher's use of any copies of copyrighted 3D models that he/she/they may create from the dataset.
|
1038 |
+
Researcher may provide research associates and colleagues with access to the Dataset, after receiving entity has also agreed to and signed these terms and conditions. Sharing the data otherwise is strictly prohibited.
|
1039 |
+
Following General Data Protection Regulation, Researcher must ensure that they can delete all person-specific data upon request.
|
1040 |
+
DL3DV-10K organization reserves the right to terminate Researcher's access to the Dataset at any time.
|
1041 |
+
If Researcher is employed by a for-profit, commercial entity, Researcher's employer shall also be bound by these terms and conditions, and Researcher hereby represents that he/she/they is/are fully authorized to enter into this agreement on behalf of such employer.
|
1042 |
+
The law of the Indiana State shall apply to all disputes under this agreement.
|
1043 |
+
|
1044 |
+
Creative Commons Attribution-NonCommercial 4.0 International Public License
|
1045 |
+
|
1046 |
+
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
|
1047 |
+
|
1048 |
+
Section 1 -- Definitions.
|
1049 |
+
|
1050 |
+
a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
|
1051 |
+
|
1052 |
+
b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
|
1053 |
+
|
1054 |
+
c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
|
1055 |
+
|
1056 |
+
e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
|
1057 |
+
|
1058 |
+
f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
|
1059 |
+
|
1060 |
+
g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
|
1061 |
+
|
1062 |
+
h. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
|
1063 |
+
|
1064 |
+
i. NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
|
1065 |
+
|
1066 |
+
j. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
|
1067 |
+
|
1068 |
+
k. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
|
1069 |
+
|
1070 |
+
l. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
|
1071 |
+
|
1072 |
+
Section 2 -- Scope.
|
1073 |
+
|
1074 |
+
a. License grant.
|
1075 |
+
|
1076 |
+
1. Subject to the terms and conditions of this Public License,
|
1077 |
+
the Licensor hereby grants You a worldwide, royalty-free,
|
1078 |
+
non-sublicensable, non-exclusive, irrevocable license to
|
1079 |
+
exercise the Licensed Rights in the Licensed Material to:
|
1080 |
+
|
1081 |
+
a. reproduce and Share the Licensed Material, in whole or
|
1082 |
+
in part, for NonCommercial purposes only; and
|
1083 |
+
|
1084 |
+
b. produce, reproduce, and Share Adapted Material for
|
1085 |
+
NonCommercial purposes only.
|
1086 |
+
|
1087 |
+
2. Exceptions and Limitations. For the avoidance of doubt, where
|
1088 |
+
Exceptions and Limitations apply to Your use, this Public
|
1089 |
+
License does not apply, and You do not need to comply with
|
1090 |
+
its terms and conditions.
|
1091 |
+
|
1092 |
+
3. Term. The term of this Public License is specified in Section
|
1093 |
+
6(a).
|
1094 |
+
|
1095 |
+
4. Media and formats; technical modifications allowed. The
|
1096 |
+
Licensor authorizes You to exercise the Licensed Rights in
|
1097 |
+
all media and formats whether now known or hereafter created,
|
1098 |
+
and to make technical modifications necessary to do so. The
|
1099 |
+
Licensor waives and/or agrees not to assert any right or
|
1100 |
+
authority to forbid You from making technical modifications
|
1101 |
+
necessary to exercise the Licensed Rights, including
|
1102 |
+
technical modifications necessary to circumvent Effective
|
1103 |
+
Technological Measures. For purposes of this Public License,
|
1104 |
+
simply making modifications authorized by this Section 2(a)
|
1105 |
+
(4) never produces Adapted Material.
|
1106 |
+
|
1107 |
+
5. Downstream recipients.
|
1108 |
+
|
1109 |
+
a. Offer from the Licensor -- Licensed Material. Every
|
1110 |
+
recipient of the Licensed Material automatically
|
1111 |
+
receives an offer from the Licensor to exercise the
|
1112 |
+
Licensed Rights under the terms and conditions of this
|
1113 |
+
Public License.
|
1114 |
+
|
1115 |
+
b. No downstream restrictions. You may not offer or impose
|
1116 |
+
any additional or different terms or conditions on, or
|
1117 |
+
apply any Effective Technological Measures to, the
|
1118 |
+
Licensed Material if doing so restricts exercise of the
|
1119 |
+
Licensed Rights by any recipient of the Licensed
|
1120 |
+
Material.
|
1121 |
+
|
1122 |
+
6. No endorsement. Nothing in this Public License constitutes or
|
1123 |
+
may be construed as permission to assert or imply that You
|
1124 |
+
are, or that Your use of the Licensed Material is, connected
|
1125 |
+
with, or sponsored, endorsed, or granted official status by,
|
1126 |
+
the Licensor or others designated to receive attribution as
|
1127 |
+
provided in Section 3(a)(1)(A)(i).
|
1128 |
+
|
1129 |
+
b. Other rights.
|
1130 |
+
|
1131 |
+
1. Moral rights, such as the right of integrity, are not
|
1132 |
+
licensed under this Public License, nor are publicity,
|
1133 |
+
privacy, and/or other similar personality rights; however, to
|
1134 |
+
the extent possible, the Licensor waives and/or agrees not to
|
1135 |
+
assert any such rights held by the Licensor to the limited
|
1136 |
+
extent necessary to allow You to exercise the Licensed
|
1137 |
+
Rights, but not otherwise.
|
1138 |
+
|
1139 |
+
2. Patent and trademark rights are not licensed under this
|
1140 |
+
Public License.
|
1141 |
+
|
1142 |
+
3. To the extent possible, the Licensor waives any right to
|
1143 |
+
collect royalties from You for the exercise of the Licensed
|
1144 |
+
Rights, whether directly or through a collecting society
|
1145 |
+
under any voluntary or waivable statutory or compulsory
|
1146 |
+
licensing scheme. In all other cases the Licensor expressly
|
1147 |
+
reserves any right to collect such royalties, including when
|
1148 |
+
the Licensed Material is used other than for NonCommercial
|
1149 |
+
purposes.
|
1150 |
+
|
1151 |
+
Section 3 -- License Conditions.
|
1152 |
+
|
1153 |
+
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
|
1154 |
+
|
1155 |
+
a. Attribution.
|
1156 |
+
|
1157 |
+
1. If You Share the Licensed Material (including in modified
|
1158 |
+
form), You must:
|
1159 |
+
|
1160 |
+
a. retain the following if it is supplied by the Licensor
|
1161 |
+
with the Licensed Material:
|
1162 |
+
|
1163 |
+
i. identification of the creator(s) of the Licensed
|
1164 |
+
Material and any others designated to receive
|
1165 |
+
attribution, in any reasonable manner requested by
|
1166 |
+
the Licensor (including by pseudonym if
|
1167 |
+
designated);
|
1168 |
+
|
1169 |
+
ii. a copyright notice;
|
1170 |
+
|
1171 |
+
iii. a notice that refers to this Public License;
|
1172 |
+
|
1173 |
+
iv. a notice that refers to the disclaimer of
|
1174 |
+
warranties;
|
1175 |
+
|
1176 |
+
v. a URI or hyperlink to the Licensed Material to the
|
1177 |
+
extent reasonably practicable;
|
1178 |
+
|
1179 |
+
b. indicate if You modified the Licensed Material and
|
1180 |
+
retain an indication of any previous modifications; and
|
1181 |
+
|
1182 |
+
c. indicate the Licensed Material is licensed under this
|
1183 |
+
Public License, and include the text of, or the URI or
|
1184 |
+
hyperlink to, this Public License.
|
1185 |
+
|
1186 |
+
2. You may satisfy the conditions in Section 3(a)(1) in any
|
1187 |
+
reasonable manner based on the medium, means, and context in
|
1188 |
+
which You Share the Licensed Material. For example, it may be
|
1189 |
+
reasonable to satisfy the conditions by providing a URI or
|
1190 |
+
hyperlink to a resource that includes the required
|
1191 |
+
information.
|
1192 |
+
|
1193 |
+
3. If requested by the Licensor, You must remove any of the
|
1194 |
+
information required by Section 3(a)(1)(A) to the extent
|
1195 |
+
reasonably practicable.
|
1196 |
+
|
1197 |
+
4. If You Share Adapted Material You produce, the Adapter's
|
1198 |
+
License You apply must not prevent recipients of the Adapted
|
1199 |
+
Material from complying with this Public License.
|
1200 |
+
|
1201 |
+
Section 4 -- Sui Generis Database Rights.
|
1202 |
+
|
1203 |
+
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
|
1204 |
+
|
1205 |
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
|
1206 |
+
|
1207 |
+
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
|
1208 |
+
|
1209 |
+
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
|
1210 |
+
|
1211 |
+
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
|
1212 |
+
|
1213 |
+
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
1214 |
+
|
1215 |
+
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
1216 |
+
|
1217 |
+
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
1218 |
+
|
1219 |
+
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
|
1220 |
+
|
1221 |
+
Section 6 -- Term and Termination.
|
1222 |
+
|
1223 |
+
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
|
1224 |
+
|
1225 |
+
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
|
1226 |
+
|
1227 |
+
1. automatically as of the date the violation is cured, provided
|
1228 |
+
it is cured within 30 days of Your discovery of the
|
1229 |
+
violation; or
|
1230 |
+
|
1231 |
+
2. upon express reinstatement by the Licensor.
|
1232 |
+
|
1233 |
+
For the avoidance of doubt, this Section 6(b) does not affect any
|
1234 |
+
right the Licensor may have to seek remedies for Your violations
|
1235 |
+
of this Public License.
|
1236 |
+
|
1237 |
+
c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
|
1238 |
+
|
1239 |
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
|
1240 |
+
|
1241 |
+
Section 7 -- Other Terms and Conditions.
|
1242 |
+
|
1243 |
+
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
|
1244 |
+
|
1245 |
+
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
|
1246 |
+
|
1247 |
+
Section 8 -- Interpretation.
|
1248 |
+
|
1249 |
+
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
|
1250 |
+
|
1251 |
+
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
|
1252 |
+
|
1253 |
+
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
|
1254 |
+
|
1255 |
+
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
|
1256 |
+
|
1257 |
+
===
|
1258 |
+
Niantic Map Free Relocalization Dataset License Agreement
|
1259 |
+
This Niantic Map Free Relocalization Dataset License Agreement ("Agreement") is an agreement between you and Niantic, Inc. (“Niantic” or “we”). By downloading or otherwise using Niantic’s Map-Free Relocalization dataset or dataset-derived materials (collectively, the "Dataset") you agree to:
|
1260 |
+
|
1261 |
+
1. Purpose and Restrictions. You may only use the Dataset only for non-commercial purposes, such as academic research at educational and not-for-profit research institutions, teaching, public demonstrations, and personal experimentation. Non-commercial use expressly excludes any profit-making or commercial activities, including without limitation sale, license, manufacture or development of commercial products, use in commercially-sponsored research, use at a laboratory or other facility owned or controlled (whether in whole or in part) by a commercial entity, provision of consulting service, use for or on behalf of any commercial entity, and use in consulting service, use for or on behalf of any commercial entity, use in research where a commercial party obtains rights to research results or any other benefit. Notwithstanding the foregoing restrictions, you can use this Dataset for publishing comparison results for academic papers, including retraining your models on this Dataset.
|
1262 |
+
|
1263 |
+
2. License. Subject to this Agreement, Niantic grants you a non-exclusive, non-transferable, non-sublicensable right to download and use the Dataset for the purpose stated in Section 1 of this Agreement. All rights not expressly granted to you in this Agreement are reserved.
|
1264 |
+
|
1265 |
+
3. Condition of Use. You must not use the Dataset in a way that could diminish, tarnish, or in any way harm Niantic’s reputation or image.
|
1266 |
+
|
1267 |
+
4. No Warranties. The Dataset comes “as is”, and you will use it at your own risk. Niantic makes no representations or warranties regarding the Dataset, including but not limited to warranties of non-infringement or fitness for a particular purpose. Neither Niantic nor any contributor to the Dataset will be liable for any damages related to the Dataset or this Agreement, including direct, indirect, special, consequential or incidental damages, to the maximum extent the law permits, no matter what legal theory they are based on. We are not obligated to (and will not) provide technical support for the Dataset.
|
1268 |
+
|
1269 |
+
5. Indemnity. You accept full responsibility for your use of the Dataset and shall defend and indemnify Niantic, including its employees, officers and agents, against any and all claims arising from your use of the Dataset.
|
1270 |
+
|
1271 |
+
6. Removal. Niantic reserves the right to remove access to the Dataset at any time without cause. If you have downloaded a copy of the Dataset prior to such removal, you may use such a copy subject to this Agreement, but you may not distribute your copy.
|
1272 |
+
|
1273 |
+
7. Termination. This Agreement will terminate immediately upon your commercial use of the Dataset.
|
1274 |
+
|
1275 |
+
8. Authorized Representative. If you are employed by a for-profit, commercial entity, your employer shall also be bound by the terms and conditions of this Agreement, and you hereby represent that you are fully authorized to enter into this Agreement on behalf of such employer.
|
1276 |
+
|
1277 |
+
9. Survivability. Sections 2, 4, 5, 6, 7, 8, 9, and 10 of this Agreement survive the termination of this Agreement.
|
1278 |
+
|
1279 |
+
10. Misc. This Agreement is governed and construed in all respects in accordance with the laws of the State of California, USA without regard to conflicts of law. If any provision of this Agreement is deemed unenforceable or contrary to law, the rest of this Agreement shall remain in full effect and enforceable. If you do not agree to this Agreement, do not download or use the Dataset. The Dataset is protected by copyright and other intellectual property laws and is licensed, not sold.
|
1280 |
+
|
1281 |
+
===
|
1282 |
+
NVIDIA Source Code License for SegFormer
|
1283 |
+
|
1284 |
+
1. Definitions
|
1285 |
+
|
1286 |
+
“Licensor” means any person or entity that distributes its Work.
|
1287 |
+
|
1288 |
+
“Software” means the original work of authorship made available under this License.
|
1289 |
+
|
1290 |
+
“Work” means the Software and any additions to or derivative works of the Software that are made available under
|
1291 |
+
this License.
|
1292 |
+
|
1293 |
+
The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the meaning as provided under
|
1294 |
+
U.S. copyright law; provided, however, that for the purposes of this License, derivative works shall not include
|
1295 |
+
works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work.
|
1296 |
+
|
1297 |
+
Works, including the Software, are “made available” under this License by including in or with the Work either
|
1298 |
+
(a) a copyright notice referencing the applicability of this License to the Work, or (b) a copy of this License.
|
1299 |
+
|
1300 |
+
2. License Grant
|
1301 |
+
|
1302 |
+
2.1 Copyright Grant. Subject to the terms and conditions of this License, each Licensor grants to you a perpetual,
|
1303 |
+
worldwide, non-exclusive, royalty-free, copyright license to reproduce, prepare derivative works of, publicly
|
1304 |
+
display, publicly perform, sublicense and distribute its Work and any resulting derivative works in any form.
|
1305 |
+
|
1306 |
+
3. Limitations
|
1307 |
+
|
1308 |
+
3.1 Redistribution. You may reproduce or distribute the Work only if (a) you do so under this License, (b) you
|
1309 |
+
include a complete copy of this License with your distribution, and (c) you retain without modification any
|
1310 |
+
copyright, patent, trademark, or attribution notices that are present in the Work.
|
1311 |
+
|
1312 |
+
3.2 Derivative Works. You may specify that additional or different terms apply to the use, reproduction, and
|
1313 |
+
distribution of your derivative works of the Work (“Your Terms”) only if (a) Your Terms provide that the use
|
1314 |
+
limitation in Section 3.3 applies to your derivative works, and (b) you identify the specific derivative works
|
1315 |
+
that are subject to Your Terms. Notwithstanding Your Terms, this License (including the redistribution
|
1316 |
+
requirements in Section 3.1) will continue to apply to the Work itself.
|
1317 |
+
|
1318 |
+
3.3 Use Limitation. The Work and any derivative works thereof only may be used or intended for use
|
1319 |
+
non-commercially. Notwithstanding the foregoing, NVIDIA and its affiliates may use the Work and any derivative
|
1320 |
+
works commercially. As used herein, “non-commercially” means for research or evaluation purposes only.
|
1321 |
+
|
1322 |
+
3.4 Patent Claims. If you bring or threaten to bring a patent claim against any Licensor (including any claim,
|
1323 |
+
cross-claim or counterclaim in a lawsuit) to enforce any patents that you allege are infringed by any Work, then
|
1324 |
+
your rights under this License from such Licensor (including the grant in Section 2.1) will terminate immediately.
|
1325 |
+
|
1326 |
+
3.5 Trademarks. This License does not grant any rights to use any Licensor’s or its affiliates’ names, logos,
|
1327 |
+
or trademarks, except as necessary to reproduce the notices described in this License.
|
1328 |
+
|
1329 |
+
3.6 Termination. If you violate any term of this License, then your rights under this License (including the
|
1330 |
+
grant in Section 2.1) will terminate immediately.
|
1331 |
+
|
1332 |
+
4. Disclaimer of Warranty.
|
1333 |
+
|
1334 |
+
THE WORK IS PROVIDED “AS IS” WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
|
1335 |
+
WARRANTIES OR CONDITIONS OF M ERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT. YOU
|
1336 |
+
BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER THIS LICENSE.
|
1337 |
+
|
1338 |
+
5. Limitation of Liability.
|
1339 |
+
|
1340 |
+
EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL THEORY, WHETHER IN TORT (INCLUDING
|
1341 |
+
NEGLIGENCE), CONTRACT, OR OTHERWISE SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
|
1342 |
+
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATED TO THIS LICENSE, THE USE OR
|
1343 |
+
INABILITY TO USE THE WORK (INCLUDING BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION, LOST PROFITS OR
|
1344 |
+
DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER COMM ERCIAL DAMAGES OR LOSSES), EVEN IF THE LICENSOR HAS BEEN
|
1345 |
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
1346 |
+
|
1347 |
+
===
|
1348 |
+
CosXL License Agreement
|
1349 |
+
|
1350 |
+
|
1351 |
+
STABILITY AI NON-COMMERCIAL RESEARCH COMMUNITY LICENSE AGREEMENT Dated: April 7th, 2024
|
1352 |
+
By clicking “I Accept” below or by using or distributing any portion or element of the Models, Software, Software Products or Derivative Works, you agree to the terms of this License. If you do not agree to this License, then you do not have any rights to use the Software Products or Derivative Works through this License, and you must immediately cease using the Software Products or Derivative Works. If you are agreeing to be bound by the terms of this License on behalf of your employer or other entity, you represent and warrant to Stability AI that you have full legal authority to bind your employer or such entity to this License. If you do not have the requisite authority, you may not accept the License or access the Software Products or Derivative Works on behalf of your employer or other entity.
|
1353 |
+
"Agreement" means this Stable Non-Commercial Research Community License Agreement.
|
1354 |
+
“AUP” means the Stability AI Acceptable Use Policy available at https://stability.ai/use-policy, as may be updated from time to time.
|
1355 |
+
"Derivative Work(s)” means (a) any derivative work of the Software Products as recognized by U.S. copyright laws and (b) any modifications to a Model, and any other model created which is based on or derived from the Model or the Model’s output. For clarity, Derivative Works do not include the output of any Model.
|
1356 |
+
“Documentation” means any specifications, manuals, documentation, and other written information provided by Stability AI related to the Software.
|
1357 |
+
"Licensee" or "you" means you, or your employer or any other person or entity (if you are entering into this Agreement on such person or entity's behalf), of the age required under applicable laws, rules or regulations to provide legal consent and that has legal authority to bind your employer or such other person or entity if you are entering in this Agreement on their behalf.
|
1358 |
+
“Model(s)" means, collectively, Stability AI’s proprietary models and algorithms, including machine-learning models, trained model weights and other elements of the foregoing, made available under this Agreement.
|
1359 |
+
“Non-Commercial Uses” means exercising any of the rights granted herein for the purpose of research or non-commercial purposes. Non-Commercial Uses does not include any production use of the Software Products or any Derivative Works.
|
1360 |
+
"Stability AI" or "we" means Stability AI Ltd. and its affiliates.
|
1361 |
+
|
1362 |
+
"Software" means Stability AI’s proprietary software made available under this Agreement.
|
1363 |
+
“Software Products” means the Models, Software and Documentation, individually or in any combination.
|
1364 |
+
|
1365 |
+
License Rights and Redistribution.
|
1366 |
+
a. Subject to your compliance with this Agreement, the AUP (which is hereby incorporated herein by reference), and the Documentation, Stability AI grants you a non-exclusive, worldwide, non-transferable, non-sublicensable, revocable, royalty free and limited license under Stability AI’s intellectual property or other rights owned or controlled by Stability AI embodied in the Software Products to use, reproduce, distribute, and create Derivative Works of, the Software Products, in each case for Non-Commercial Uses only.
|
1367 |
+
b. You may not use the Software Products or Derivative Works to enable third parties to use the Software Products or Derivative Works as part of your hosted service or via your APIs, whether you are adding substantial additional functionality thereto or not. Merely distributing the Software Products or Derivative Works for download online without offering any related service (ex. by distributing the Models on HuggingFace) is not a violation of this subsection. If you wish to use the Software Products or any Derivative Works for commercial or production use or you wish to make the Software Products or any Derivative Works available to third parties via your hosted service or your APIs, contact Stability AI at https://stability.ai/contact.
|
1368 |
+
c. If you distribute or make the Software Products, or any Derivative Works thereof, available to a third party, the Software Products, Derivative Works, or any portion thereof, respectively, will remain subject to this Agreement and you must (i) provide a copy of this Agreement to such third party, and (ii) retain the following attribution notice within a "Notice" text file distributed as a part of such copies: "This Stability AI Model is licensed under the Stability AI Non-Commercial Research Community License, Copyright (c) Stability AI Ltd. All Rights Reserved.” If you create a Derivative Work of a Software Product, you may add your own attribution notices to the Notice file included with the Software Product, provided that you clearly indicate which attributions apply to the Software Product and you must state in the NOTICE file that you changed the Software Product and how it was modified.
|
1369 |
+
Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE SOFTWARE PRODUCTS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE SOFTWARE PRODUCTS, DERIVATIVE WORKS OR ANY OUTPUT OR RESULTS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE SOFTWARE PRODUCTS, DERIVATIVE WORKS AND ANY OUTPUT AND RESULTS. 3. Limitation of Liability. IN NO EVENT WILL STABILITY AI OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF STABILITY AI OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING. 4. Intellectual Property.
|
1370 |
+
a. No trademark licenses are granted under this Agreement, and in connection with the Software Products or Derivative Works, neither Stability AI nor Licensee may use any name or mark owned by or associated with the other or any of its affiliates, except as required for reasonable and customary use in describing and redistributing the Software Products or Derivative Works.
|
1371 |
+
b. Subject to Stability AI’s ownership of the Software Products and Derivative Works made by or for Stability AI, with respect to any Derivative Works that are made by you, as between you and Stability AI, you are and will be the owner of such Derivative Works
|
1372 |
+
c. If you institute litigation or other proceedings against Stability AI (including a cross-claim or counterclaim in a lawsuit) alleging that the Software Products, Derivative Works or associated outputs or results, or any portion of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or claim is filed or instituted. You will indemnify and hold harmless Stability AI from and against any claim by any third party arising out of or related to your use or distribution of the Software Products or Derivative Works in violation of this Agreement.
|
1373 |
+
Term and Termination. The term of this Agreement will commence upon your acceptance of this Agreement or access to the Software Products and will continue in full force and effect until terminated in accordance with the terms and conditions herein. Stability AI may terminate this Agreement if you are in breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete and cease use of any Software Products or Derivative Works. Sections 2-4 shall survive the termination of this Agreement.
|
1374 |
+
Governing Law. This Agreement will be governed by and construed in accordance with the laws of the United States and the State of California without regard to choice of law
|
1375 |
+
principles.
|
1376 |
+
|
src/mast3r_src/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
DUSt3R, Copyright (c) 2024-present Naver Corporation, is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license.
|
2 |
+
|
3 |
+
A summary of the CC BY-NC-SA 4.0 license is located here:
|
4 |
+
https://creativecommons.org/licenses/by-nc-sa/4.0/
|
5 |
+
|
6 |
+
The CC BY-NC-SA 4.0 license is located here:
|
7 |
+
https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
|
src/mast3r_src/NOTICE
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MASt3R
|
2 |
+
Copyright 2024-present NAVER Corp.
|
3 |
+
|
4 |
+
This project contains subcomponents with separate copyright notices and license terms.
|
5 |
+
Your use of the source code for these subcomponents is subject to the terms and conditions of the following licenses.
|
6 |
+
|
7 |
+
====
|
8 |
+
|
9 |
+
naver/dust3r
|
10 |
+
https://github.com/naver/dust3r/
|
11 |
+
|
12 |
+
Creative Commons Attribution-NonCommercial-ShareAlike 4.0
|
13 |
+
|
14 |
+
====
|
15 |
+
|
16 |
+
naver/croco
|
17 |
+
https://github.com/naver/croco/
|
18 |
+
|
19 |
+
Creative Commons Attribution-NonCommercial-ShareAlike 4.0
|
20 |
+
|
21 |
+
====
|
22 |
+
|
23 |
+
pytorch/pytorch
|
24 |
+
https://github.com/pytorch/pytorch
|
25 |
+
|
26 |
+
From PyTorch:
|
27 |
+
|
28 |
+
Copyright (c) 2016- Facebook, Inc (Adam Paszke)
|
29 |
+
Copyright (c) 2014- Facebook, Inc (Soumith Chintala)
|
30 |
+
Copyright (c) 2011-2014 Idiap Research Institute (Ronan Collobert)
|
31 |
+
Copyright (c) 2012-2014 Deepmind Technologies (Koray Kavukcuoglu)
|
32 |
+
Copyright (c) 2011-2012 NEC Laboratories America (Koray Kavukcuoglu)
|
33 |
+
Copyright (c) 2011-2013 NYU (Clement Farabet)
|
34 |
+
Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert, Leon Bottou, Iain Melvin, Jason Weston)
|
35 |
+
Copyright (c) 2006 Idiap Research Institute (Samy Bengio)
|
36 |
+
Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert, Samy Bengio, Johnny Mariethoz)
|
37 |
+
|
38 |
+
From Caffe2:
|
39 |
+
|
40 |
+
Copyright (c) 2016-present, Facebook Inc. All rights reserved.
|
41 |
+
|
42 |
+
All contributions by Facebook:
|
43 |
+
Copyright (c) 2016 Facebook Inc.
|
44 |
+
|
45 |
+
All contributions by Google:
|
46 |
+
Copyright (c) 2015 Google Inc.
|
47 |
+
All rights reserved.
|
48 |
+
|
49 |
+
All contributions by Yangqing Jia:
|
50 |
+
Copyright (c) 2015 Yangqing Jia
|
51 |
+
All rights reserved.
|
52 |
+
|
53 |
+
All contributions by Kakao Brain:
|
54 |
+
Copyright 2019-2020 Kakao Brain
|
55 |
+
|
56 |
+
All contributions by Cruise LLC:
|
57 |
+
Copyright (c) 2022 Cruise LLC.
|
58 |
+
All rights reserved.
|
59 |
+
|
60 |
+
All contributions from Caffe:
|
61 |
+
Copyright(c) 2013, 2014, 2015, the respective contributors
|
62 |
+
All rights reserved.
|
63 |
+
|
64 |
+
All other contributions:
|
65 |
+
Copyright(c) 2015, 2016 the respective contributors
|
66 |
+
All rights reserved.
|
67 |
+
|
68 |
+
Caffe2 uses a copyright model similar to Caffe: each contributor holds
|
69 |
+
copyright over their contributions to Caffe2. The project versioning records
|
70 |
+
all such contribution and copyright details. If a contributor wants to further
|
71 |
+
mark their specific copyright on a particular contribution, they should
|
72 |
+
indicate their copyright solely in the commit message of the change when it is
|
73 |
+
committed.
|
74 |
+
|
75 |
+
All rights reserved.
|
76 |
+
|
77 |
+
Redistribution and use in source and binary forms, with or without
|
78 |
+
modification, are permitted provided that the following conditions are met:
|
79 |
+
|
80 |
+
1. Redistributions of source code must retain the above copyright
|
81 |
+
notice, this list of conditions and the following disclaimer.
|
82 |
+
|
83 |
+
2. Redistributions in binary form must reproduce the above copyright
|
84 |
+
notice, this list of conditions and the following disclaimer in the
|
85 |
+
documentation and/or other materials provided with the distribution.
|
86 |
+
|
87 |
+
3. Neither the names of Facebook, Deepmind Technologies, NYU, NEC Laboratories America
|
88 |
+
and IDIAP Research Institute nor the names of its contributors may be
|
89 |
+
used to endorse or promote products derived from this software without
|
90 |
+
specific prior written permission.
|
91 |
+
|
92 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
93 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
94 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
95 |
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
96 |
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
97 |
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
98 |
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
99 |
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
100 |
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
101 |
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
102 |
+
POSSIBILITY OF SUCH DAMAGE.
|
103 |
+
|
src/mast3r_src/README.md
ADDED
@@ -0,0 +1,316 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
![banner](assets/mast3r.jpg)
|
2 |
+
|
3 |
+
Official implementation of `Grounding Image Matching in 3D with MASt3R`
|
4 |
+
[[Project page](https://dust3r.europe.naverlabs.com/)], [[MASt3R arxiv](https://arxiv.org/abs/2406.09756)], [[DUSt3R arxiv](https://arxiv.org/abs/2312.14132)]
|
5 |
+
|
6 |
+
![Example of matching results obtained from MASt3R](assets/examples.jpg)
|
7 |
+
|
8 |
+
![High level overview of MASt3R's architecture](assets/mast3r_archi.jpg)
|
9 |
+
|
10 |
+
```bibtex
|
11 |
+
@misc{mast3r_arxiv24,
|
12 |
+
title={Grounding Image Matching in 3D with MASt3R},
|
13 |
+
author={Vincent Leroy and Yohann Cabon and Jerome Revaud},
|
14 |
+
year={2024},
|
15 |
+
eprint={2406.09756},
|
16 |
+
archivePrefix={arXiv},
|
17 |
+
primaryClass={cs.CV}
|
18 |
+
}
|
19 |
+
|
20 |
+
@inproceedings{dust3r_cvpr24,
|
21 |
+
title={DUSt3R: Geometric 3D Vision Made Easy},
|
22 |
+
author={Shuzhe Wang and Vincent Leroy and Yohann Cabon and Boris Chidlovskii and Jerome Revaud},
|
23 |
+
booktitle = {CVPR},
|
24 |
+
year = {2024}
|
25 |
+
}
|
26 |
+
```
|
27 |
+
|
28 |
+
## Table of Contents
|
29 |
+
|
30 |
+
- [Table of Contents](#table-of-contents)
|
31 |
+
- [License](#license)
|
32 |
+
- [Get Started](#get-started)
|
33 |
+
- [Installation](#installation)
|
34 |
+
- [Checkpoints](#checkpoints)
|
35 |
+
- [Interactive demo](#interactive-demo)
|
36 |
+
- [Interactive demo with docker](#interactive-demo-with-docker)
|
37 |
+
- [Usage](#usage)
|
38 |
+
- [Training](#training)
|
39 |
+
- [Datasets](#datasets)
|
40 |
+
- [Demo](#demo)
|
41 |
+
- [Our Hyperparameters](#our-hyperparameters)
|
42 |
+
- [Visual Localization](#visual-localization)
|
43 |
+
- [Dataset Preparation](#dataset-preparation)
|
44 |
+
- [Example Commands](#example-commands)
|
45 |
+
|
46 |
+
## License
|
47 |
+
|
48 |
+
The code is distributed under the CC BY-NC-SA 4.0 License.
|
49 |
+
See [LICENSE](LICENSE) for more information.
|
50 |
+
|
51 |
+
```python
|
52 |
+
# Copyright (C) 2024-present Naver Corporation. All rights reserved.
|
53 |
+
# Licensed under CC BY-NC-SA 4.0 (non-commercial use only).
|
54 |
+
```
|
55 |
+
|
56 |
+
## Get Started
|
57 |
+
|
58 |
+
### Installation
|
59 |
+
|
60 |
+
1. Clone MASt3R.
|
61 |
+
```bash
|
62 |
+
git clone --recursive https://github.com/naver/mast3r
|
63 |
+
cd mast3r
|
64 |
+
# if you have already cloned mast3r:
|
65 |
+
# git submodule update --init --recursive
|
66 |
+
```
|
67 |
+
|
68 |
+
2. Create the environment, here we show an example using conda.
|
69 |
+
```bash
|
70 |
+
conda create -n mast3r python=3.11 cmake=3.14.0
|
71 |
+
conda activate mast3r
|
72 |
+
conda install pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia # use the correct version of cuda for your system
|
73 |
+
pip install -r requirements.txt
|
74 |
+
pip install -r dust3r/requirements.txt
|
75 |
+
# Optional: you can also install additional packages to:
|
76 |
+
# - add support for HEIC images
|
77 |
+
# - add required packages for visloc.py
|
78 |
+
pip install -r dust3r/requirements_optional.txt
|
79 |
+
```
|
80 |
+
|
81 |
+
3. Optional, compile the cuda kernels for RoPE (as in CroCo v2).
|
82 |
+
```bash
|
83 |
+
# DUST3R relies on RoPE positional embeddings for which you can compile some cuda kernels for faster runtime.
|
84 |
+
cd dust3r/croco/models/curope/
|
85 |
+
python setup.py build_ext --inplace
|
86 |
+
cd ../../../../
|
87 |
+
```
|
88 |
+
|
89 |
+
|
90 |
+
### Checkpoints
|
91 |
+
|
92 |
+
You can obtain the checkpoints by two ways:
|
93 |
+
|
94 |
+
1) You can use our huggingface_hub integration: the models will be downloaded automatically.
|
95 |
+
|
96 |
+
2) Otherwise, We provide several pre-trained models:
|
97 |
+
|
98 |
+
| Modelname | Training resolutions | Head | Encoder | Decoder |
|
99 |
+
|-------------|----------------------|------|---------|---------|
|
100 |
+
| [`MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric`](https://download.europe.naverlabs.com/ComputerVision/MASt3R/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric.pth) | 512x384, 512x336, 512x288, 512x256, 512x160 | CatMLP+DPT | ViT-L | ViT-B |
|
101 |
+
|
102 |
+
You can check the hyperparameters we used to train these models in the [section: Our Hyperparameters](#our-hyperparameters)
|
103 |
+
Make sure to check license of the datasets we used.
|
104 |
+
|
105 |
+
To download a specific model, for example `MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric.pth`:
|
106 |
+
```bash
|
107 |
+
mkdir -p checkpoints/
|
108 |
+
wget https://download.europe.naverlabs.com/ComputerVision/MASt3R/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric.pth -P checkpoints/
|
109 |
+
```
|
110 |
+
|
111 |
+
For these checkpoints, make sure to agree to the license of all the training datasets we used, in addition to CC-BY-NC-SA 4.0.
|
112 |
+
The mapfree dataset license in particular is very restrictive. For more information, check [CHECKPOINTS_NOTICE](CHECKPOINTS_NOTICE).
|
113 |
+
|
114 |
+
|
115 |
+
### Interactive demo
|
116 |
+
|
117 |
+
There are two demos available:
|
118 |
+
|
119 |
+
```
|
120 |
+
demo.py is the updated demo for MASt3R. It uses our new sparse global alignment method that allows you to reconstruct larger scenes
|
121 |
+
|
122 |
+
python3 demo.py --model_name MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric
|
123 |
+
|
124 |
+
# Use --weights to load a checkpoint from a local file, eg --weights checkpoints/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric.pth
|
125 |
+
# Use --local_network to make it accessible on the local network, or --server_name to specify the url manually
|
126 |
+
# Use --server_port to change the port, by default it will search for an available port starting at 7860
|
127 |
+
# Use --device to use a different device, by default it's "cuda"
|
128 |
+
|
129 |
+
demo_dust3r_ga.py is the same demo as in dust3r (+ compatibility for MASt3R models)
|
130 |
+
see https://github.com/naver/dust3r?tab=readme-ov-file#interactive-demo for details
|
131 |
+
```
|
132 |
+
### Interactive demo with docker
|
133 |
+
|
134 |
+
TODO
|
135 |
+
|
136 |
+
![demo](assets/demo.jpg)
|
137 |
+
|
138 |
+
## Usage
|
139 |
+
|
140 |
+
```python
|
141 |
+
from mast3r.model import AsymmetricMASt3R
|
142 |
+
from mast3r.fast_nn import fast_reciprocal_NNs
|
143 |
+
|
144 |
+
import mast3r.utils.path_to_dust3r
|
145 |
+
from dust3r.inference import inference
|
146 |
+
from dust3r.utils.image import load_images
|
147 |
+
|
148 |
+
if __name__ == '__main__':
|
149 |
+
device = 'cuda'
|
150 |
+
schedule = 'cosine'
|
151 |
+
lr = 0.01
|
152 |
+
niter = 300
|
153 |
+
|
154 |
+
model_name = "naver/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric"
|
155 |
+
# you can put the path to a local checkpoint in model_name if needed
|
156 |
+
model = AsymmetricMASt3R.from_pretrained(model_name).to(device)
|
157 |
+
images = load_images(['dust3r/croco/assets/Chateau1.png', 'dust3r/croco/assets/Chateau2.png'], size=512)
|
158 |
+
output = inference([tuple(images)], model, device, batch_size=1, verbose=False)
|
159 |
+
|
160 |
+
# at this stage, you have the raw dust3r predictions
|
161 |
+
view1, pred1 = output['view1'], output['pred1']
|
162 |
+
view2, pred2 = output['view2'], output['pred2']
|
163 |
+
|
164 |
+
desc1, desc2 = pred1['desc'].squeeze(0).detach(), pred2['desc'].squeeze(0).detach()
|
165 |
+
|
166 |
+
# find 2D-2D matches between the two images
|
167 |
+
matches_im0, matches_im1 = fast_reciprocal_NNs(desc1, desc2, subsample_or_initxy1=8,
|
168 |
+
device=device, dist='dot', block_size=2**13)
|
169 |
+
|
170 |
+
# ignore small border around the edge
|
171 |
+
H0, W0 = view1['true_shape'][0]
|
172 |
+
valid_matches_im0 = (matches_im0[:, 0] >= 3) & (matches_im0[:, 0] < int(W0) - 3) & (
|
173 |
+
matches_im0[:, 1] >= 3) & (matches_im0[:, 1] < int(H0) - 3)
|
174 |
+
|
175 |
+
H1, W1 = view2['true_shape'][0]
|
176 |
+
valid_matches_im1 = (matches_im1[:, 0] >= 3) & (matches_im1[:, 0] < int(W1) - 3) & (
|
177 |
+
matches_im1[:, 1] >= 3) & (matches_im1[:, 1] < int(H1) - 3)
|
178 |
+
|
179 |
+
valid_matches = valid_matches_im0 & valid_matches_im1
|
180 |
+
matches_im0, matches_im1 = matches_im0[valid_matches], matches_im1[valid_matches]
|
181 |
+
|
182 |
+
# visualize a few matches
|
183 |
+
import numpy as np
|
184 |
+
import torch
|
185 |
+
import torchvision.transforms.functional
|
186 |
+
from matplotlib import pyplot as pl
|
187 |
+
|
188 |
+
n_viz = 20
|
189 |
+
num_matches = matches_im0.shape[0]
|
190 |
+
match_idx_to_viz = np.round(np.linspace(0, num_matches - 1, n_viz)).astype(int)
|
191 |
+
viz_matches_im0, viz_matches_im1 = matches_im0[match_idx_to_viz], matches_im1[match_idx_to_viz]
|
192 |
+
|
193 |
+
image_mean = torch.as_tensor([0.5, 0.5, 0.5], device='cpu').reshape(1, 3, 1, 1)
|
194 |
+
image_std = torch.as_tensor([0.5, 0.5, 0.5], device='cpu').reshape(1, 3, 1, 1)
|
195 |
+
|
196 |
+
viz_imgs = []
|
197 |
+
for i, view in enumerate([view1, view2]):
|
198 |
+
rgb_tensor = view['img'] * image_std + image_mean
|
199 |
+
viz_imgs.append(rgb_tensor.squeeze(0).permute(1, 2, 0).cpu().numpy())
|
200 |
+
|
201 |
+
H0, W0, H1, W1 = *viz_imgs[0].shape[:2], *viz_imgs[1].shape[:2]
|
202 |
+
img0 = np.pad(viz_imgs[0], ((0, max(H1 - H0, 0)), (0, 0), (0, 0)), 'constant', constant_values=0)
|
203 |
+
img1 = np.pad(viz_imgs[1], ((0, max(H0 - H1, 0)), (0, 0), (0, 0)), 'constant', constant_values=0)
|
204 |
+
img = np.concatenate((img0, img1), axis=1)
|
205 |
+
pl.figure()
|
206 |
+
pl.imshow(img)
|
207 |
+
cmap = pl.get_cmap('jet')
|
208 |
+
for i in range(n_viz):
|
209 |
+
(x0, y0), (x1, y1) = viz_matches_im0[i].T, viz_matches_im1[i].T
|
210 |
+
pl.plot([x0, x1 + W0], [y0, y1], '-+', color=cmap(i / (n_viz - 1)), scalex=False, scaley=False)
|
211 |
+
pl.show(block=True)
|
212 |
+
```
|
213 |
+
![matching example on croco pair](assets/matching.jpg)
|
214 |
+
|
215 |
+
## Training
|
216 |
+
|
217 |
+
In this section, we present a short demonstration to get started with training MASt3R.
|
218 |
+
|
219 |
+
### Datasets
|
220 |
+
|
221 |
+
See [Datasets section in DUSt3R](https://github.com/naver/dust3r/tree/datasets?tab=readme-ov-file#datasets)
|
222 |
+
|
223 |
+
### Demo
|
224 |
+
|
225 |
+
Like for the DUSt3R training demo, we're going to download and prepare the same subset of [CO3Dv2](https://github.com/facebookresearch/co3d) - [Creative Commons Attribution-NonCommercial 4.0 International](https://github.com/facebookresearch/co3d/blob/main/LICENSE) and launch the training code on it.
|
226 |
+
It is the exact same process as DUSt3R.
|
227 |
+
The demo model will be trained for a few epochs on a very small dataset.
|
228 |
+
It will not be very good.
|
229 |
+
|
230 |
+
```bash
|
231 |
+
# download and prepare the co3d subset
|
232 |
+
mkdir -p data/co3d_subset
|
233 |
+
cd data/co3d_subset
|
234 |
+
git clone https://github.com/facebookresearch/co3d
|
235 |
+
cd co3d
|
236 |
+
python3 ./co3d/download_dataset.py --download_folder ../ --single_sequence_subset
|
237 |
+
rm ../*.zip
|
238 |
+
cd ../../..
|
239 |
+
|
240 |
+
python3 datasets_preprocess/preprocess_co3d.py --co3d_dir data/co3d_subset --output_dir data/co3d_subset_processed --single_sequence_subset
|
241 |
+
|
242 |
+
# download the pretrained dust3r checkpoint
|
243 |
+
mkdir -p checkpoints/
|
244 |
+
wget https://download.europe.naverlabs.com/ComputerVision/DUSt3R/DUSt3R_ViTLarge_BaseDecoder_512_dpt.pth -P checkpoints/
|
245 |
+
|
246 |
+
# for this example we'll do fewer epochs, for the actual hyperparameters we used in the paper, see the next section: "Our Hyperparameters"
|
247 |
+
torchrun --nproc_per_node=4 train.py \
|
248 |
+
--train_dataset "1000 @ Co3d(split='train', ROOT='data/co3d_subset_processed', aug_crop='auto', aug_monocular=0.005, aug_rot90='diff', mask_bg='rand', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], n_corres=8192, nneg=0.5, transform=ColorJitter)" \
|
249 |
+
--test_dataset "100 @ Co3d(split='test', ROOT='data/co3d_subset_processed', resolution=(512,384), n_corres=1024, seed=777)" \
|
250 |
+
--model "AsymmetricMASt3R(pos_embed='RoPE100', patch_embed_cls='ManyAR_PatchEmbed', img_size=(512, 512), head_type='catmlp+dpt', output_mode='pts3d+desc24', depth_mode=('exp', -inf, inf), conf_mode=('exp', 1, inf), enc_embed_dim=1024, enc_depth=24, enc_num_heads=16, dec_embed_dim=768, dec_depth=12, dec_num_heads=12, two_confs=True)" \
|
251 |
+
--train_criterion "ConfLoss(Regr3D(L21, norm_mode='?avg_dis'), alpha=0.2) + 0.075*ConfMatchingLoss(MatchingLoss(InfoNCE(mode='proper', temperature=0.05), negatives_padding=0, blocksize=8192), alpha=10.0, confmode='mean')" \
|
252 |
+
--test_criterion "Regr3D_ScaleShiftInv(L21, norm_mode='?avg_dis', gt_scale=True, sky_loss_value=0) + -1.*MatchingLoss(APLoss(nq='torch', fp=torch.float16), negatives_padding=12288)" \
|
253 |
+
--pretrained "checkpoints/DUSt3R_ViTLarge_BaseDecoder_512_dpt.pth" \
|
254 |
+
--lr 0.0001 --min_lr 1e-06 --warmup_epochs 1 --epochs 10 --batch_size 4 --accum_iter 4 \
|
255 |
+
--save_freq 1 --keep_freq 5 --eval_freq 1 \
|
256 |
+
--output_dir "checkpoints/mast3r_demo"
|
257 |
+
|
258 |
+
```
|
259 |
+
|
260 |
+
### Our Hyperparameters
|
261 |
+
We didn't release all the training datasets, but here are the commands we used for training our models:
|
262 |
+
|
263 |
+
```bash
|
264 |
+
# MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric - train mast3r with metric regression and matching loss
|
265 |
+
# we used cosxl to generate variations of DL3DV: "foggy", "night", "rainy", "snow", "sunny" but we were not convinced by it.
|
266 |
+
|
267 |
+
torchrun --nproc_per_node=8 train.py \
|
268 |
+
--train_dataset "57_000 @ Habitat512(1_000_000, split='train', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 68_400 @ BlendedMVS(split='train', mask_sky=True, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 68_400 @ MegaDepth(split='train', mask_sky=True, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 45_600 @ ARKitScenes(split='train', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 22_800 @ Co3d(split='train', mask_bg='rand', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 22_800 @ StaticThings3D(mask_bg='rand', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 45_600 @ ScanNetpp(split='train', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 45_600 @ TartanAir(pairs_subset='', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 4_560 @ UnrealStereo4K(resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 1_140 @ VirtualKitti(optical_center_is_centered=True, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 22_800 @ WildRgbd(split='train', mask_bg='rand', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 145_920 @ NianticMapFree(split='train', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 57_000 @ DL3DV(split='nlight', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 57_000 @ DL3DV(split='not-nlight', cosxl_augmentations=None, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5) + 34_200 @ InternalUnreleasedDataset(resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], aug_crop='auto', aug_monocular=0.005, transform=ColorJitter, n_corres=8192, nneg=0.5)" \
|
269 |
+
--test_dataset "Habitat512(1_000, split='val', resolution=(512,384), seed=777, n_corres=1024) + 1_000 @ BlendedMVS(split='val', resolution=(512,384), mask_sky=True, seed=777, n_corres=1024) + 1_000 @ ARKitScenes(split='test', resolution=(512,384), seed=777, n_corres=1024) + 1_000 @ MegaDepth(split='val', mask_sky=True, resolution=(512,336), seed=777, n_corres=1024) + 1_000 @ Co3d(split='test', resolution=(512,384), mask_bg='rand', seed=777, n_corres=1024)" \
|
270 |
+
--model "AsymmetricMASt3R(pos_embed='RoPE100', patch_embed_cls='ManyAR_PatchEmbed', img_size=(512, 512), head_type='catmlp+dpt', output_mode='pts3d+desc24', depth_mode=('exp', -inf, inf), conf_mode=('exp', 1, inf), enc_embed_dim=1024, enc_depth=24, enc_num_heads=16, dec_embed_dim=768, dec_depth=12, dec_num_heads=12, two_confs=True, desc_conf_mode=('exp', 0, inf))" \
|
271 |
+
--train_criterion "ConfLoss(Regr3D(L21, norm_mode='?avg_dis'), alpha=0.2, loss_in_log=False) + 0.075*ConfMatchingLoss(MatchingLoss(InfoNCE(mode='proper', temperature=0.05), negatives_padding=0, blocksize=8192), alpha=10.0, confmode='mean')" \
|
272 |
+
--test_criterion "Regr3D(L21, norm_mode='?avg_dis', gt_scale=True, sky_loss_value=0) + -1.*MatchingLoss(APLoss(nq='torch', fp=torch.float16), negatives_padding=12288)" \
|
273 |
+
--pretrained "checkpoints/DUSt3R_ViTLarge_BaseDecoder_512_dpt.pth" \
|
274 |
+
--lr 0.0001 --min_lr 1e-06 --warmup_epochs 8 --epochs 50 --batch_size 4 --accum_iter 2 \
|
275 |
+
--save_freq 1 --keep_freq 5 --eval_freq 1 --print_freq=10 \
|
276 |
+
--output_dir "checkpoints/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric"
|
277 |
+
|
278 |
+
```
|
279 |
+
|
280 |
+
## Visual Localization
|
281 |
+
|
282 |
+
### Dataset preparation
|
283 |
+
|
284 |
+
See [Visloc section in DUSt3R](https://github.com/naver/dust3r/tree/dust3r_visloc#dataset-preparation)
|
285 |
+
|
286 |
+
### Example Commands
|
287 |
+
|
288 |
+
With `visloc.py` you can run our visual localization experiments on Aachen-Day-Night, InLoc, Cambridge Landmarks and 7 Scenes.
|
289 |
+
|
290 |
+
|
291 |
+
```bash
|
292 |
+
# Aachen-Day-Night-v1.1:
|
293 |
+
# scene in 'day' 'night'
|
294 |
+
# scene can also be 'all'
|
295 |
+
python3 visloc.py --model_name MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric --dataset "VislocAachenDayNight('/path/to/prepared/Aachen-Day-Night-v1.1/', subscene='${scene}', pairsfile='fire_top50', topk=20)" --pixel_tol 5 --pnp_mode poselib --reprojection_error_diag_ratio 0.008 --output_dir /path/to/output/Aachen-Day-Night-v1.1/${scene}/loc
|
296 |
+
|
297 |
+
# or with coarse to fine:
|
298 |
+
|
299 |
+
python3 visloc.py --model_name MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric --dataset "VislocAachenDayNight('/path/to/prepared/Aachen-Day-Night-v1.1/', subscene='${scene}', pairsfile='fire_top50', topk=20)" --pixel_tol 5 --pnp_mode poselib --reprojection_error_diag_ratio 0.008 --output_dir /path/to/output/Aachen-Day-Night-v1.1/${scene}/loc --coarse_to_fine --max_batch_size 48 --c2f_crop_with_homography
|
300 |
+
|
301 |
+
# InLoc
|
302 |
+
python3 visloc.py --model_name MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric --dataset "VislocInLoc('/path/to/prepared/InLoc/', pairsfile='pairs-query-netvlad40-temporal', topk=20)" --pixel_tol 5 --pnp_mode poselib --reprojection_error_diag_ratio 0.008 --output_dir /path/to/output/InLoc/loc
|
303 |
+
|
304 |
+
# or with coarse to fine:
|
305 |
+
|
306 |
+
python3 visloc.py --model_name MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric --dataset "VislocInLoc('/path/to/prepared/InLoc/', pairsfile='pairs-query-netvlad40-temporal', topk=20)" --pixel_tol 5 --pnp_mode poselib --reprojection_error_diag_ratio 0.008 --output_dir /path/to/output/InLoc/loc --coarse_to_fine --max_image_size 1200 --max_batch_size 48 --c2f_crop_with_homography
|
307 |
+
|
308 |
+
# 7-scenes:
|
309 |
+
# scene in 'chess' 'fire' 'heads' 'office' 'pumpkin' 'redkitchen' 'stairs'
|
310 |
+
python3 visloc.py --model_name MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric --dataset "VislocSevenScenes('/path/to/prepared/7-scenes/', subscene='${scene}', pairsfile='APGeM-LM18_top20', topk=1)" --pixel_tol 5 --pnp_mode poselib --reprojection_error_diag_ratio 0.008 --output_dir /path/to/output/7-scenes/${scene}/loc
|
311 |
+
|
312 |
+
# Cambridge Landmarks:
|
313 |
+
# scene in 'ShopFacade' 'GreatCourt' 'KingsCollege' 'OldHospital' 'StMarysChurch'
|
314 |
+
python3 visloc.py --model_name MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric --dataset "VislocCambridgeLandmarks('/path/to/prepared/Cambridge_Landmarks/', subscene='${scene}', pairsfile='APGeM-LM18_top20', topk=1)" --pixel_tol 5 --pnp_mode poselib --reprojection_error_diag_ratio 0.008 --output_dir /path/to/output/Cambridge_Landmarks/${scene}/loc
|
315 |
+
|
316 |
+
```
|
src/mast3r_src/assets/NLE_tower/01D90321-69C8-439F-B0B0-E87E7634741C-83120-000041DAE419D7AE.jpg
ADDED
src/mast3r_src/assets/NLE_tower/1AD85EF5-B651-4291-A5C0-7BDB7D966384-83120-000041DADF639E09.jpg
ADDED
src/mast3r_src/assets/NLE_tower/2679C386-1DC0-4443-81B5-93D7EDE4AB37-83120-000041DADB2EA917.jpg
ADDED
src/mast3r_src/assets/NLE_tower/28EDBB63-B9F9-42FB-AC86-4852A33ED71B-83120-000041DAF22407A1.jpg
ADDED
src/mast3r_src/assets/NLE_tower/91E9B685-7A7D-42D7-B933-23A800EE4129-83120-000041DAE12C8176.jpg
ADDED
src/mast3r_src/assets/NLE_tower/CDBBD885-54C3-4EB4-9181-226059A60EE0-83120-000041DAE0C3D612.jpg
ADDED
src/mast3r_src/assets/NLE_tower/FF5599FD-768B-431A-AB83-BDA5FB44CB9D-83120-000041DADDE35483.jpg
ADDED
src/mast3r_src/assets/demo.jpg
ADDED
src/mast3r_src/assets/examples.jpg
ADDED
src/mast3r_src/assets/mast3r.jpg
ADDED
src/mast3r_src/assets/mast3r_archi.jpg
ADDED
src/mast3r_src/assets/matching.jpg
ADDED
src/mast3r_src/demo.py
ADDED
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
# Copyright (C) 2024-present Naver Corporation. All rights reserved.
|
3 |
+
# Licensed under CC BY-NC-SA 4.0 (non-commercial use only).
|
4 |
+
#
|
5 |
+
# --------------------------------------------------------
|
6 |
+
# gradio demo
|
7 |
+
# --------------------------------------------------------
|
8 |
+
import math
|
9 |
+
import gradio
|
10 |
+
import os
|
11 |
+
import torch
|
12 |
+
import numpy as np
|
13 |
+
import tempfile
|
14 |
+
import functools
|
15 |
+
import trimesh
|
16 |
+
import copy
|
17 |
+
from scipy.spatial.transform import Rotation
|
18 |
+
|
19 |
+
from mast3r.cloud_opt.sparse_ga import sparse_global_alignment
|
20 |
+
from mast3r.cloud_opt.tsdf_optimizer import TSDFPostProcess
|
21 |
+
|
22 |
+
from mast3r.model import AsymmetricMASt3R
|
23 |
+
from mast3r.utils.misc import hash_md5
|
24 |
+
import mast3r.utils.path_to_dust3r # noqa
|
25 |
+
from dust3r.image_pairs import make_pairs
|
26 |
+
from dust3r.utils.image import load_images
|
27 |
+
from dust3r.utils.device import to_numpy
|
28 |
+
from dust3r.viz import add_scene_cam, CAM_COLORS, OPENGL, pts3d_to_trimesh, cat_meshes
|
29 |
+
from dust3r.demo import get_args_parser as dust3r_get_args_parser
|
30 |
+
|
31 |
+
import matplotlib.pyplot as pl
|
32 |
+
pl.ion()
|
33 |
+
|
34 |
+
torch.backends.cuda.matmul.allow_tf32 = True # for gpu >= Ampere and pytorch >= 1.12
|
35 |
+
batch_size = 1
|
36 |
+
|
37 |
+
|
38 |
+
def get_args_parser():
|
39 |
+
parser = dust3r_get_args_parser()
|
40 |
+
parser.add_argument('--share', action='store_true')
|
41 |
+
|
42 |
+
actions = parser._actions
|
43 |
+
for action in actions:
|
44 |
+
if action.dest == 'model_name':
|
45 |
+
action.choices = ["MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric"]
|
46 |
+
# change defaults
|
47 |
+
parser.prog = 'mast3r demo'
|
48 |
+
return parser
|
49 |
+
|
50 |
+
|
51 |
+
def _convert_scene_output_to_glb(outdir, imgs, pts3d, mask, focals, cams2world, cam_size=0.05,
|
52 |
+
cam_color=None, as_pointcloud=False,
|
53 |
+
transparent_cams=False, silent=False):
|
54 |
+
assert len(pts3d) == len(mask) <= len(imgs) <= len(cams2world) == len(focals)
|
55 |
+
pts3d = to_numpy(pts3d)
|
56 |
+
imgs = to_numpy(imgs)
|
57 |
+
focals = to_numpy(focals)
|
58 |
+
cams2world = to_numpy(cams2world)
|
59 |
+
|
60 |
+
scene = trimesh.Scene()
|
61 |
+
|
62 |
+
# full pointcloud
|
63 |
+
if as_pointcloud:
|
64 |
+
pts = np.concatenate([p[m.ravel()] for p, m in zip(pts3d, mask)])
|
65 |
+
col = np.concatenate([p[m] for p, m in zip(imgs, mask)])
|
66 |
+
pct = trimesh.PointCloud(pts.reshape(-1, 3), colors=col.reshape(-1, 3))
|
67 |
+
scene.add_geometry(pct)
|
68 |
+
else:
|
69 |
+
meshes = []
|
70 |
+
for i in range(len(imgs)):
|
71 |
+
meshes.append(pts3d_to_trimesh(imgs[i], pts3d[i].reshape(imgs[i].shape), mask[i]))
|
72 |
+
mesh = trimesh.Trimesh(**cat_meshes(meshes))
|
73 |
+
scene.add_geometry(mesh)
|
74 |
+
|
75 |
+
# add each camera
|
76 |
+
for i, pose_c2w in enumerate(cams2world):
|
77 |
+
if isinstance(cam_color, list):
|
78 |
+
camera_edge_color = cam_color[i]
|
79 |
+
else:
|
80 |
+
camera_edge_color = cam_color or CAM_COLORS[i % len(CAM_COLORS)]
|
81 |
+
add_scene_cam(scene, pose_c2w, camera_edge_color,
|
82 |
+
None if transparent_cams else imgs[i], focals[i],
|
83 |
+
imsize=imgs[i].shape[1::-1], screen_width=cam_size)
|
84 |
+
|
85 |
+
rot = np.eye(4)
|
86 |
+
rot[:3, :3] = Rotation.from_euler('y', np.deg2rad(180)).as_matrix()
|
87 |
+
scene.apply_transform(np.linalg.inv(cams2world[0] @ OPENGL @ rot))
|
88 |
+
outfile = os.path.join(outdir, 'scene.glb')
|
89 |
+
if not silent:
|
90 |
+
print('(exporting 3D scene to', outfile, ')')
|
91 |
+
scene.export(file_obj=outfile)
|
92 |
+
return outfile
|
93 |
+
|
94 |
+
|
95 |
+
def get_3D_model_from_scene(outdir, silent, scene, min_conf_thr=2, as_pointcloud=False, mask_sky=False,
|
96 |
+
clean_depth=False, transparent_cams=False, cam_size=0.05, TSDF_thresh=0):
|
97 |
+
"""
|
98 |
+
extract 3D_model (glb file) from a reconstructed scene
|
99 |
+
"""
|
100 |
+
if scene is None:
|
101 |
+
return None
|
102 |
+
|
103 |
+
# get optimized values from scene
|
104 |
+
rgbimg = scene.imgs
|
105 |
+
focals = scene.get_focals().cpu()
|
106 |
+
cams2world = scene.get_im_poses().cpu()
|
107 |
+
|
108 |
+
# 3D pointcloud from depthmap, poses and intrinsics
|
109 |
+
if TSDF_thresh > 0:
|
110 |
+
tsdf = TSDFPostProcess(scene, TSDF_thresh=TSDF_thresh)
|
111 |
+
pts3d, _, confs = to_numpy(tsdf.get_dense_pts3d(clean_depth=clean_depth))
|
112 |
+
else:
|
113 |
+
pts3d, _, confs = to_numpy(scene.get_dense_pts3d(clean_depth=clean_depth))
|
114 |
+
msk = to_numpy([c > min_conf_thr for c in confs])
|
115 |
+
return _convert_scene_output_to_glb(outdir, rgbimg, pts3d, msk, focals, cams2world, as_pointcloud=as_pointcloud,
|
116 |
+
transparent_cams=transparent_cams, cam_size=cam_size, silent=silent)
|
117 |
+
|
118 |
+
|
119 |
+
def get_reconstructed_scene(outdir, model, device, silent, image_size, filelist, optim_level, lr1, niter1, lr2, niter2,
|
120 |
+
min_conf_thr, matching_conf_thr, as_pointcloud, mask_sky, clean_depth, transparent_cams,
|
121 |
+
cam_size, scenegraph_type, winsize, win_cyclic, refid, TSDF_thresh, shared_intrinsics,
|
122 |
+
**kw):
|
123 |
+
"""
|
124 |
+
from a list of images, run mast3r inference, sparse global aligner.
|
125 |
+
then run get_3D_model_from_scene
|
126 |
+
"""
|
127 |
+
imgs = load_images(filelist, size=image_size, verbose=not silent)
|
128 |
+
if len(imgs) == 1:
|
129 |
+
imgs = [imgs[0], copy.deepcopy(imgs[0])]
|
130 |
+
imgs[1]['idx'] = 1
|
131 |
+
filelist = [filelist[0], filelist[0] + '_2']
|
132 |
+
|
133 |
+
scene_graph_params = [scenegraph_type]
|
134 |
+
if scenegraph_type in ["swin", "logwin"]:
|
135 |
+
scene_graph_params.append(str(winsize))
|
136 |
+
elif scenegraph_type == "oneref":
|
137 |
+
scene_graph_params.append(str(refid))
|
138 |
+
if scenegraph_type in ["swin", "logwin"] and not win_cyclic:
|
139 |
+
scene_graph_params.append('noncyclic')
|
140 |
+
scene_graph = '-'.join(scene_graph_params)
|
141 |
+
pairs = make_pairs(imgs, scene_graph=scene_graph, prefilter=None, symmetrize=True)
|
142 |
+
if optim_level == 'coarse':
|
143 |
+
niter2 = 0
|
144 |
+
# Sparse GA (forward mast3r -> matching -> 3D optim -> 2D refinement -> triangulation)
|
145 |
+
scene = sparse_global_alignment(filelist, pairs, os.path.join(outdir, 'cache'),
|
146 |
+
model, lr1=lr1, niter1=niter1, lr2=lr2, niter2=niter2, device=device,
|
147 |
+
opt_depth='depth' in optim_level, shared_intrinsics=shared_intrinsics,
|
148 |
+
matching_conf_thr=matching_conf_thr, **kw)
|
149 |
+
outfile = get_3D_model_from_scene(outdir, silent, scene, min_conf_thr, as_pointcloud, mask_sky,
|
150 |
+
clean_depth, transparent_cams, cam_size, TSDF_thresh)
|
151 |
+
return scene, outfile
|
152 |
+
|
153 |
+
|
154 |
+
def set_scenegraph_options(inputfiles, win_cyclic, refid, scenegraph_type):
|
155 |
+
num_files = len(inputfiles) if inputfiles is not None else 1
|
156 |
+
show_win_controls = scenegraph_type in ["swin", "logwin"]
|
157 |
+
show_winsize = scenegraph_type in ["swin", "logwin"]
|
158 |
+
show_cyclic = scenegraph_type in ["swin", "logwin"]
|
159 |
+
max_winsize, min_winsize = 1, 1
|
160 |
+
if scenegraph_type == "swin":
|
161 |
+
if win_cyclic:
|
162 |
+
max_winsize = max(1, math.ceil((num_files - 1) / 2))
|
163 |
+
else:
|
164 |
+
max_winsize = num_files - 1
|
165 |
+
elif scenegraph_type == "logwin":
|
166 |
+
if win_cyclic:
|
167 |
+
half_size = math.ceil((num_files - 1) / 2)
|
168 |
+
max_winsize = max(1, math.ceil(math.log(half_size, 2)))
|
169 |
+
else:
|
170 |
+
max_winsize = max(1, math.ceil(math.log(num_files, 2)))
|
171 |
+
winsize = gradio.Slider(label="Scene Graph: Window Size", value=max_winsize,
|
172 |
+
minimum=min_winsize, maximum=max_winsize, step=1, visible=show_winsize)
|
173 |
+
win_cyclic = gradio.Checkbox(value=win_cyclic, label="Cyclic sequence", visible=show_cyclic)
|
174 |
+
win_col = gradio.Column(visible=show_win_controls)
|
175 |
+
refid = gradio.Slider(label="Scene Graph: Id", value=0, minimum=0,
|
176 |
+
maximum=num_files - 1, step=1, visible=scenegraph_type == 'oneref')
|
177 |
+
return win_col, winsize, win_cyclic, refid
|
178 |
+
|
179 |
+
|
180 |
+
def main_demo(tmpdirname, model, device, image_size, server_name, server_port, silent=False, share=False):
|
181 |
+
if not silent:
|
182 |
+
print('Outputing stuff in', tmpdirname)
|
183 |
+
|
184 |
+
recon_fun = functools.partial(get_reconstructed_scene, tmpdirname, model, device, silent, image_size)
|
185 |
+
model_from_scene_fun = functools.partial(get_3D_model_from_scene, tmpdirname, silent)
|
186 |
+
with gradio.Blocks(css=""".gradio-container {margin: 0 !important; min-width: 100%};""", title="MASt3R Demo") as demo:
|
187 |
+
# scene state is save so that you can change conf_thr, cam_size... without rerunning the inference
|
188 |
+
scene = gradio.State(None)
|
189 |
+
gradio.HTML('<h2 style="text-align: center;">MASt3R Demo</h2>')
|
190 |
+
with gradio.Column():
|
191 |
+
inputfiles = gradio.File(file_count="multiple")
|
192 |
+
with gradio.Row():
|
193 |
+
with gradio.Column():
|
194 |
+
with gradio.Row():
|
195 |
+
lr1 = gradio.Slider(label="Coarse LR", value=0.07, minimum=0.01, maximum=0.2, step=0.01)
|
196 |
+
niter1 = gradio.Number(value=500, precision=0, minimum=0, maximum=10_000,
|
197 |
+
label="num_iterations", info="For coarse alignment!")
|
198 |
+
lr2 = gradio.Slider(label="Fine LR", value=0.014, minimum=0.005, maximum=0.05, step=0.001)
|
199 |
+
niter2 = gradio.Number(value=200, precision=0, minimum=0, maximum=100_000,
|
200 |
+
label="num_iterations", info="For refinement!")
|
201 |
+
optim_level = gradio.Dropdown(["coarse", "refine", "refine+depth"],
|
202 |
+
value='refine', label="OptLevel",
|
203 |
+
info="Optimization level")
|
204 |
+
with gradio.Row():
|
205 |
+
matching_conf_thr = gradio.Slider(label="Matching Confidence Thr", value=5.,
|
206 |
+
minimum=0., maximum=30., step=0.1,
|
207 |
+
info="Before Fallback to Regr3D!")
|
208 |
+
shared_intrinsics = gradio.Checkbox(value=False, label="Shared intrinsics",
|
209 |
+
info="Only optimize one set of intrinsics for all views")
|
210 |
+
scenegraph_type = gradio.Dropdown(["complete", "swin", "logwin", "oneref"],
|
211 |
+
value='complete', label="Scenegraph",
|
212 |
+
info="Define how to make pairs",
|
213 |
+
interactive=True)
|
214 |
+
with gradio.Column(visible=False) as win_col:
|
215 |
+
winsize = gradio.Slider(label="Scene Graph: Window Size", value=1,
|
216 |
+
minimum=1, maximum=1, step=1)
|
217 |
+
win_cyclic = gradio.Checkbox(value=False, label="Cyclic sequence")
|
218 |
+
refid = gradio.Slider(label="Scene Graph: Id", value=0,
|
219 |
+
minimum=0, maximum=0, step=1, visible=False)
|
220 |
+
|
221 |
+
run_btn = gradio.Button("Run")
|
222 |
+
|
223 |
+
with gradio.Row():
|
224 |
+
# adjust the confidence threshold
|
225 |
+
min_conf_thr = gradio.Slider(label="min_conf_thr", value=1.5, minimum=0.0, maximum=10, step=0.1)
|
226 |
+
# adjust the camera size in the output pointcloud
|
227 |
+
cam_size = gradio.Slider(label="cam_size", value=0.2, minimum=0.001, maximum=1.0, step=0.001)
|
228 |
+
TSDF_thresh = gradio.Slider(label="TSDF Threshold", value=0., minimum=0., maximum=1., step=0.01)
|
229 |
+
with gradio.Row():
|
230 |
+
as_pointcloud = gradio.Checkbox(value=True, label="As pointcloud")
|
231 |
+
# two post process implemented
|
232 |
+
mask_sky = gradio.Checkbox(value=False, label="Mask sky")
|
233 |
+
clean_depth = gradio.Checkbox(value=True, label="Clean-up depthmaps")
|
234 |
+
transparent_cams = gradio.Checkbox(value=False, label="Transparent cameras")
|
235 |
+
|
236 |
+
outmodel = gradio.Model3D()
|
237 |
+
|
238 |
+
# events
|
239 |
+
scenegraph_type.change(set_scenegraph_options,
|
240 |
+
inputs=[inputfiles, win_cyclic, refid, scenegraph_type],
|
241 |
+
outputs=[win_col, winsize, win_cyclic, refid])
|
242 |
+
inputfiles.change(set_scenegraph_options,
|
243 |
+
inputs=[inputfiles, win_cyclic, refid, scenegraph_type],
|
244 |
+
outputs=[win_col, winsize, win_cyclic, refid])
|
245 |
+
win_cyclic.change(set_scenegraph_options,
|
246 |
+
inputs=[inputfiles, win_cyclic, refid, scenegraph_type],
|
247 |
+
outputs=[win_col, winsize, win_cyclic, refid])
|
248 |
+
run_btn.click(fn=recon_fun,
|
249 |
+
inputs=[inputfiles, optim_level, lr1, niter1, lr2, niter2, min_conf_thr, matching_conf_thr,
|
250 |
+
as_pointcloud, mask_sky, clean_depth, transparent_cams, cam_size,
|
251 |
+
scenegraph_type, winsize, win_cyclic, refid, TSDF_thresh, shared_intrinsics],
|
252 |
+
outputs=[scene, outmodel])
|
253 |
+
min_conf_thr.release(fn=model_from_scene_fun,
|
254 |
+
inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
255 |
+
clean_depth, transparent_cams, cam_size, TSDF_thresh],
|
256 |
+
outputs=outmodel)
|
257 |
+
cam_size.change(fn=model_from_scene_fun,
|
258 |
+
inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
259 |
+
clean_depth, transparent_cams, cam_size, TSDF_thresh],
|
260 |
+
outputs=outmodel)
|
261 |
+
TSDF_thresh.change(fn=model_from_scene_fun,
|
262 |
+
inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
263 |
+
clean_depth, transparent_cams, cam_size, TSDF_thresh],
|
264 |
+
outputs=outmodel)
|
265 |
+
as_pointcloud.change(fn=model_from_scene_fun,
|
266 |
+
inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
267 |
+
clean_depth, transparent_cams, cam_size, TSDF_thresh],
|
268 |
+
outputs=outmodel)
|
269 |
+
mask_sky.change(fn=model_from_scene_fun,
|
270 |
+
inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
271 |
+
clean_depth, transparent_cams, cam_size, TSDF_thresh],
|
272 |
+
outputs=outmodel)
|
273 |
+
clean_depth.change(fn=model_from_scene_fun,
|
274 |
+
inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
275 |
+
clean_depth, transparent_cams, cam_size, TSDF_thresh],
|
276 |
+
outputs=outmodel)
|
277 |
+
transparent_cams.change(model_from_scene_fun,
|
278 |
+
inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
279 |
+
clean_depth, transparent_cams, cam_size, TSDF_thresh],
|
280 |
+
outputs=outmodel)
|
281 |
+
demo.launch(share=True, server_name=server_name, server_port=server_port)
|
282 |
+
|
283 |
+
|
284 |
+
if __name__ == '__main__':
|
285 |
+
parser = get_args_parser()
|
286 |
+
args = parser.parse_args()
|
287 |
+
|
288 |
+
if args.server_name is not None:
|
289 |
+
server_name = args.server_name
|
290 |
+
else:
|
291 |
+
server_name = '0.0.0.0' if args.local_network else '127.0.0.1'
|
292 |
+
|
293 |
+
if args.weights is not None:
|
294 |
+
weights_path = args.weights
|
295 |
+
else:
|
296 |
+
weights_path = "naver/" + args.model_name
|
297 |
+
|
298 |
+
model = AsymmetricMASt3R.from_pretrained(weights_path).to(args.device)
|
299 |
+
chkpt_tag = hash_md5(weights_path)
|
300 |
+
|
301 |
+
# mast3r will write the 3D model inside tmpdirname/chkpt_tag
|
302 |
+
if args.tmp_dir is not None:
|
303 |
+
tmpdirname = args.tmp_dir
|
304 |
+
cache_path = os.path.join(tmpdirname, chkpt_tag)
|
305 |
+
os.makedirs(cache_path, exist_ok=True)
|
306 |
+
main_demo(cache_path, model, args.device, args.image_size, server_name, args.server_port, silent=args.silent,
|
307 |
+
share=args.share)
|
308 |
+
else:
|
309 |
+
with tempfile.TemporaryDirectory(suffix='_mast3r_gradio_demo') as tmpdirname:
|
310 |
+
cache_path = os.path.join(tmpdirname, chkpt_tag)
|
311 |
+
os.makedirs(cache_path, exist_ok=True)
|
312 |
+
main_demo(tmpdirname, model, args.device, args.image_size,
|
313 |
+
server_name, args.server_port, silent=args.silent,
|
314 |
+
share=args.share)
|
src/mast3r_src/demo_dust3r_ga.py
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
# Copyright (C) 2024-present Naver Corporation. All rights reserved.
|
3 |
+
# Licensed under CC BY-NC-SA 4.0 (non-commercial use only).
|
4 |
+
#
|
5 |
+
# --------------------------------------------------------
|
6 |
+
# mast3r gradio demo executable
|
7 |
+
# --------------------------------------------------------
|
8 |
+
import os
|
9 |
+
import torch
|
10 |
+
import tempfile
|
11 |
+
|
12 |
+
import mast3r.utils.path_to_dust3r # noqa
|
13 |
+
from dust3r.model import AsymmetricCroCo3DStereo
|
14 |
+
from mast3r.model import AsymmetricMASt3R
|
15 |
+
from dust3r.demo import get_args_parser as dust3r_get_args_parser
|
16 |
+
from dust3r.demo import main_demo
|
17 |
+
|
18 |
+
import matplotlib.pyplot as pl
|
19 |
+
pl.ion()
|
20 |
+
|
21 |
+
torch.backends.cuda.matmul.allow_tf32 = True # for gpu >= Ampere and pytorch >= 1.12
|
22 |
+
|
23 |
+
|
24 |
+
def get_args_parser():
|
25 |
+
parser = dust3r_get_args_parser()
|
26 |
+
|
27 |
+
actions = parser._actions
|
28 |
+
for action in actions:
|
29 |
+
if action.dest == 'model_name':
|
30 |
+
action.choices.append('MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric')
|
31 |
+
# change defaults
|
32 |
+
parser.prog = 'mast3r demo'
|
33 |
+
return parser
|
34 |
+
|
35 |
+
|
36 |
+
if __name__ == '__main__':
|
37 |
+
parser = get_args_parser()
|
38 |
+
args = parser.parse_args()
|
39 |
+
|
40 |
+
if args.tmp_dir is not None:
|
41 |
+
tmp_path = args.tmp_dir
|
42 |
+
os.makedirs(tmp_path, exist_ok=True)
|
43 |
+
tempfile.tempdir = tmp_path
|
44 |
+
|
45 |
+
if args.server_name is not None:
|
46 |
+
server_name = args.server_name
|
47 |
+
else:
|
48 |
+
server_name = '0.0.0.0' if args.local_network else '127.0.0.1'
|
49 |
+
|
50 |
+
if args.weights is not None:
|
51 |
+
weights_path = args.weights
|
52 |
+
else:
|
53 |
+
weights_path = "naver/" + args.model_name
|
54 |
+
|
55 |
+
try:
|
56 |
+
model = AsymmetricMASt3R.from_pretrained(weights_path).to(args.device)
|
57 |
+
except Exception as e:
|
58 |
+
model = AsymmetricCroCo3DStereo.from_pretrained(weights_path).to(args.device)
|
59 |
+
|
60 |
+
# dust3r will write the 3D model inside tmpdirname
|
61 |
+
with tempfile.TemporaryDirectory(suffix='dust3r_gradio_demo') as tmpdirname:
|
62 |
+
if not args.silent:
|
63 |
+
print('Outputing stuff in', tmpdirname)
|
64 |
+
main_demo(tmpdirname, model, args.device, args.image_size, server_name, args.server_port, silent=args.silent)
|
src/mast3r_src/dust3r/.gitignore
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
data/
|
2 |
+
checkpoints/
|
3 |
+
|
4 |
+
# Byte-compiled / optimized / DLL files
|
5 |
+
__pycache__/
|
6 |
+
*.py[cod]
|
7 |
+
*$py.class
|
8 |
+
|
9 |
+
# C extensions
|
10 |
+
*.so
|
11 |
+
|
12 |
+
# Distribution / packaging
|
13 |
+
.Python
|
14 |
+
build/
|
15 |
+
develop-eggs/
|
16 |
+
dist/
|
17 |
+
downloads/
|
18 |
+
eggs/
|
19 |
+
.eggs/
|
20 |
+
lib/
|
21 |
+
lib64/
|
22 |
+
parts/
|
23 |
+
sdist/
|
24 |
+
var/
|
25 |
+
wheels/
|
26 |
+
pip-wheel-metadata/
|
27 |
+
share/python-wheels/
|
28 |
+
*.egg-info/
|
29 |
+
.installed.cfg
|
30 |
+
*.egg
|
31 |
+
MANIFEST
|
32 |
+
|
33 |
+
# PyInstaller
|
34 |
+
# Usually these files are written by a python script from a template
|
35 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
36 |
+
*.manifest
|
37 |
+
*.spec
|
38 |
+
|
39 |
+
# Installer logs
|
40 |
+
pip-log.txt
|
41 |
+
pip-delete-this-directory.txt
|
42 |
+
|
43 |
+
# Unit test / coverage reports
|
44 |
+
htmlcov/
|
45 |
+
.tox/
|
46 |
+
.nox/
|
47 |
+
.coverage
|
48 |
+
.coverage.*
|
49 |
+
.cache
|
50 |
+
nosetests.xml
|
51 |
+
coverage.xml
|
52 |
+
*.cover
|
53 |
+
*.py,cover
|
54 |
+
.hypothesis/
|
55 |
+
.pytest_cache/
|
56 |
+
|
57 |
+
# Translations
|
58 |
+
*.mo
|
59 |
+
*.pot
|
60 |
+
|
61 |
+
# Django stuff:
|
62 |
+
*.log
|
63 |
+
local_settings.py
|
64 |
+
db.sqlite3
|
65 |
+
db.sqlite3-journal
|
66 |
+
|
67 |
+
# Flask stuff:
|
68 |
+
instance/
|
69 |
+
.webassets-cache
|
70 |
+
|
71 |
+
# Scrapy stuff:
|
72 |
+
.scrapy
|
73 |
+
|
74 |
+
# Sphinx documentation
|
75 |
+
docs/_build/
|
76 |
+
|
77 |
+
# PyBuilder
|
78 |
+
target/
|
79 |
+
|
80 |
+
# Jupyter Notebook
|
81 |
+
.ipynb_checkpoints
|
82 |
+
|
83 |
+
# IPython
|
84 |
+
profile_default/
|
85 |
+
ipython_config.py
|
86 |
+
|
87 |
+
# pyenv
|
88 |
+
.python-version
|
89 |
+
|
90 |
+
# pipenv
|
91 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
92 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
93 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
94 |
+
# install all needed dependencies.
|
95 |
+
#Pipfile.lock
|
96 |
+
|
97 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
98 |
+
__pypackages__/
|
99 |
+
|
100 |
+
# Celery stuff
|
101 |
+
celerybeat-schedule
|
102 |
+
celerybeat.pid
|
103 |
+
|
104 |
+
# SageMath parsed files
|
105 |
+
*.sage.py
|
106 |
+
|
107 |
+
# Environments
|
108 |
+
.env
|
109 |
+
.venv
|
110 |
+
env/
|
111 |
+
venv/
|
112 |
+
ENV/
|
113 |
+
env.bak/
|
114 |
+
venv.bak/
|
115 |
+
|
116 |
+
# Spyder project settings
|
117 |
+
.spyderproject
|
118 |
+
.spyproject
|
119 |
+
|
120 |
+
# Rope project settings
|
121 |
+
.ropeproject
|
122 |
+
|
123 |
+
# mkdocs documentation
|
124 |
+
/site
|
125 |
+
|
126 |
+
# mypy
|
127 |
+
.mypy_cache/
|
128 |
+
.dmypy.json
|
129 |
+
dmypy.json
|
130 |
+
|
131 |
+
# Pyre type checker
|
132 |
+
.pyre/
|
src/mast3r_src/dust3r/.gitmodules
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
[submodule "croco"]
|
2 |
+
path = croco
|
3 |
+
url = https://github.com/naver/croco
|
src/mast3r_src/dust3r/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
DUSt3R, Copyright (c) 2024-present Naver Corporation, is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license.
|
2 |
+
|
3 |
+
A summary of the CC BY-NC-SA 4.0 license is located here:
|
4 |
+
https://creativecommons.org/licenses/by-nc-sa/4.0/
|
5 |
+
|
6 |
+
The CC BY-NC-SA 4.0 license is located here:
|
7 |
+
https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
|
src/mast3r_src/dust3r/NOTICE
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
DUSt3R
|
2 |
+
Copyright 2024-present NAVER Corp.
|
3 |
+
|
4 |
+
This project contains subcomponents with separate copyright notices and license terms.
|
5 |
+
Your use of the source code for these subcomponents is subject to the terms and conditions of the following licenses.
|
6 |
+
|
7 |
+
====
|
8 |
+
|
9 |
+
naver/croco
|
10 |
+
https://github.com/naver/croco/
|
11 |
+
|
12 |
+
Creative Commons Attribution-NonCommercial-ShareAlike 4.0
|
src/mast3r_src/dust3r/README.md
ADDED
@@ -0,0 +1,388 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
![demo](assets/dust3r.jpg)
|
2 |
+
|
3 |
+
Official implementation of `DUSt3R: Geometric 3D Vision Made Easy`
|
4 |
+
[[Project page](https://dust3r.europe.naverlabs.com/)], [[DUSt3R arxiv](https://arxiv.org/abs/2312.14132)]
|
5 |
+
|
6 |
+
![Example of reconstruction from two images](assets/pipeline1.jpg)
|
7 |
+
|
8 |
+
![High level overview of DUSt3R capabilities](assets/dust3r_archi.jpg)
|
9 |
+
|
10 |
+
```bibtex
|
11 |
+
@inproceedings{dust3r_cvpr24,
|
12 |
+
title={DUSt3R: Geometric 3D Vision Made Easy},
|
13 |
+
author={Shuzhe Wang and Vincent Leroy and Yohann Cabon and Boris Chidlovskii and Jerome Revaud},
|
14 |
+
booktitle = {CVPR},
|
15 |
+
year = {2024}
|
16 |
+
}
|
17 |
+
|
18 |
+
@misc{dust3r_arxiv23,
|
19 |
+
title={DUSt3R: Geometric 3D Vision Made Easy},
|
20 |
+
author={Shuzhe Wang and Vincent Leroy and Yohann Cabon and Boris Chidlovskii and Jerome Revaud},
|
21 |
+
year={2023},
|
22 |
+
eprint={2312.14132},
|
23 |
+
archivePrefix={arXiv},
|
24 |
+
primaryClass={cs.CV}
|
25 |
+
}
|
26 |
+
```
|
27 |
+
|
28 |
+
## Table of Contents
|
29 |
+
|
30 |
+
- [Table of Contents](#table-of-contents)
|
31 |
+
- [License](#license)
|
32 |
+
- [Get Started](#get-started)
|
33 |
+
- [Installation](#installation)
|
34 |
+
- [Checkpoints](#checkpoints)
|
35 |
+
- [Interactive demo](#interactive-demo)
|
36 |
+
- [Interactive demo with docker](#interactive-demo-with-docker)
|
37 |
+
- [Usage](#usage)
|
38 |
+
- [Training](#training)
|
39 |
+
- [Datasets](#datasets)
|
40 |
+
- [Demo](#demo)
|
41 |
+
- [Our Hyperparameters](#our-hyperparameters)
|
42 |
+
|
43 |
+
## License
|
44 |
+
|
45 |
+
The code is distributed under the CC BY-NC-SA 4.0 License.
|
46 |
+
See [LICENSE](LICENSE) for more information.
|
47 |
+
|
48 |
+
```python
|
49 |
+
# Copyright (C) 2024-present Naver Corporation. All rights reserved.
|
50 |
+
# Licensed under CC BY-NC-SA 4.0 (non-commercial use only).
|
51 |
+
```
|
52 |
+
|
53 |
+
## Get Started
|
54 |
+
|
55 |
+
### Installation
|
56 |
+
|
57 |
+
1. Clone DUSt3R.
|
58 |
+
```bash
|
59 |
+
git clone --recursive https://github.com/naver/dust3r
|
60 |
+
cd dust3r
|
61 |
+
# if you have already cloned dust3r:
|
62 |
+
# git submodule update --init --recursive
|
63 |
+
```
|
64 |
+
|
65 |
+
2. Create the environment, here we show an example using conda.
|
66 |
+
```bash
|
67 |
+
conda create -n dust3r python=3.11 cmake=3.14.0
|
68 |
+
conda activate dust3r
|
69 |
+
conda install pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia # use the correct version of cuda for your system
|
70 |
+
pip install -r requirements.txt
|
71 |
+
# Optional: you can also install additional packages to:
|
72 |
+
# - add support for HEIC images
|
73 |
+
# - add pyrender, used to render depthmap in some datasets preprocessing
|
74 |
+
# - add required packages for visloc.py
|
75 |
+
pip install -r requirements_optional.txt
|
76 |
+
```
|
77 |
+
|
78 |
+
3. Optional, compile the cuda kernels for RoPE (as in CroCo v2).
|
79 |
+
```bash
|
80 |
+
# DUST3R relies on RoPE positional embeddings for which you can compile some cuda kernels for faster runtime.
|
81 |
+
cd croco/models/curope/
|
82 |
+
python setup.py build_ext --inplace
|
83 |
+
cd ../../../
|
84 |
+
```
|
85 |
+
|
86 |
+
### Checkpoints
|
87 |
+
|
88 |
+
You can obtain the checkpoints by two ways:
|
89 |
+
|
90 |
+
1) You can use our huggingface_hub integration: the models will be downloaded automatically.
|
91 |
+
|
92 |
+
2) Otherwise, We provide several pre-trained models:
|
93 |
+
|
94 |
+
| Modelname | Training resolutions | Head | Encoder | Decoder |
|
95 |
+
|-------------|----------------------|------|---------|---------|
|
96 |
+
| [`DUSt3R_ViTLarge_BaseDecoder_224_linear.pth`](https://download.europe.naverlabs.com/ComputerVision/DUSt3R/DUSt3R_ViTLarge_BaseDecoder_224_linear.pth) | 224x224 | Linear | ViT-L | ViT-B |
|
97 |
+
| [`DUSt3R_ViTLarge_BaseDecoder_512_linear.pth`](https://download.europe.naverlabs.com/ComputerVision/DUSt3R/DUSt3R_ViTLarge_BaseDecoder_512_linear.pth) | 512x384, 512x336, 512x288, 512x256, 512x160 | Linear | ViT-L | ViT-B |
|
98 |
+
| [`DUSt3R_ViTLarge_BaseDecoder_512_dpt.pth`](https://download.europe.naverlabs.com/ComputerVision/DUSt3R/DUSt3R_ViTLarge_BaseDecoder_512_dpt.pth) | 512x384, 512x336, 512x288, 512x256, 512x160 | DPT | ViT-L | ViT-B |
|
99 |
+
|
100 |
+
You can check the hyperparameters we used to train these models in the [section: Our Hyperparameters](#our-hyperparameters)
|
101 |
+
|
102 |
+
To download a specific model, for example `DUSt3R_ViTLarge_BaseDecoder_512_dpt.pth`:
|
103 |
+
```bash
|
104 |
+
mkdir -p checkpoints/
|
105 |
+
wget https://download.europe.naverlabs.com/ComputerVision/DUSt3R/DUSt3R_ViTLarge_BaseDecoder_512_dpt.pth -P checkpoints/
|
106 |
+
```
|
107 |
+
|
108 |
+
For the checkpoints, make sure to agree to the license of all the public training datasets and base checkpoints we used, in addition to CC-BY-NC-SA 4.0. Again, see [section: Our Hyperparameters](#our-hyperparameters) for details.
|
109 |
+
|
110 |
+
### Interactive demo
|
111 |
+
|
112 |
+
In this demo, you should be able run DUSt3R on your machine to reconstruct a scene.
|
113 |
+
First select images that depicts the same scene.
|
114 |
+
|
115 |
+
You can adjust the global alignment schedule and its number of iterations.
|
116 |
+
|
117 |
+
> [!NOTE]
|
118 |
+
> If you selected one or two images, the global alignment procedure will be skipped (mode=GlobalAlignerMode.PairViewer)
|
119 |
+
|
120 |
+
Hit "Run" and wait.
|
121 |
+
When the global alignment ends, the reconstruction appears.
|
122 |
+
Use the slider "min_conf_thr" to show or remove low confidence areas.
|
123 |
+
|
124 |
+
```bash
|
125 |
+
python3 demo.py --model_name DUSt3R_ViTLarge_BaseDecoder_512_dpt
|
126 |
+
|
127 |
+
# Use --weights to load a checkpoint from a local file, eg --weights checkpoints/DUSt3R_ViTLarge_BaseDecoder_512_dpt.pth
|
128 |
+
# Use --image_size to select the correct resolution for the selected checkpoint. 512 (default) or 224
|
129 |
+
# Use --local_network to make it accessible on the local network, or --server_name to specify the url manually
|
130 |
+
# Use --server_port to change the port, by default it will search for an available port starting at 7860
|
131 |
+
# Use --device to use a different device, by default it's "cuda"
|
132 |
+
```
|
133 |
+
|
134 |
+
### Interactive demo with docker
|
135 |
+
|
136 |
+
To run DUSt3R using Docker, including with NVIDIA CUDA support, follow these instructions:
|
137 |
+
|
138 |
+
1. **Install Docker**: If not already installed, download and install `docker` and `docker compose` from the [Docker website](https://www.docker.com/get-started).
|
139 |
+
|
140 |
+
2. **Install NVIDIA Docker Toolkit**: For GPU support, install the NVIDIA Docker toolkit from the [Nvidia website](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html).
|
141 |
+
|
142 |
+
3. **Build the Docker image and run it**: `cd` into the `./docker` directory and run the following commands:
|
143 |
+
|
144 |
+
```bash
|
145 |
+
cd docker
|
146 |
+
bash run.sh --with-cuda --model_name="DUSt3R_ViTLarge_BaseDecoder_512_dpt"
|
147 |
+
```
|
148 |
+
|
149 |
+
Or if you want to run the demo without CUDA support, run the following command:
|
150 |
+
|
151 |
+
```bash
|
152 |
+
cd docker
|
153 |
+
bash run.sh --model_name="DUSt3R_ViTLarge_BaseDecoder_512_dpt"
|
154 |
+
```
|
155 |
+
|
156 |
+
By default, `demo.py` is lanched with the option `--local_network`.
|
157 |
+
Visit `http://localhost:7860/` to access the web UI (or replace `localhost` with the machine's name to access it from the network).
|
158 |
+
|
159 |
+
`run.sh` will launch docker-compose using either the [docker-compose-cuda.yml](docker/docker-compose-cuda.yml) or [docker-compose-cpu.ym](docker/docker-compose-cpu.yml) config file, then it starts the demo using [entrypoint.sh](docker/files/entrypoint.sh).
|
160 |
+
|
161 |
+
|
162 |
+
![demo](assets/demo.jpg)
|
163 |
+
|
164 |
+
## Usage
|
165 |
+
|
166 |
+
```python
|
167 |
+
from dust3r.inference import inference
|
168 |
+
from dust3r.model import AsymmetricCroCo3DStereo
|
169 |
+
from dust3r.utils.image import load_images
|
170 |
+
from dust3r.image_pairs import make_pairs
|
171 |
+
from dust3r.cloud_opt import global_aligner, GlobalAlignerMode
|
172 |
+
|
173 |
+
if __name__ == '__main__':
|
174 |
+
device = 'cuda'
|
175 |
+
batch_size = 1
|
176 |
+
schedule = 'cosine'
|
177 |
+
lr = 0.01
|
178 |
+
niter = 300
|
179 |
+
|
180 |
+
model_name = "naver/DUSt3R_ViTLarge_BaseDecoder_512_dpt"
|
181 |
+
# you can put the path to a local checkpoint in model_name if needed
|
182 |
+
model = AsymmetricCroCo3DStereo.from_pretrained(model_name).to(device)
|
183 |
+
# load_images can take a list of images or a directory
|
184 |
+
images = load_images(['croco/assets/Chateau1.png', 'croco/assets/Chateau2.png'], size=512)
|
185 |
+
pairs = make_pairs(images, scene_graph='complete', prefilter=None, symmetrize=True)
|
186 |
+
output = inference(pairs, model, device, batch_size=batch_size)
|
187 |
+
|
188 |
+
# at this stage, you have the raw dust3r predictions
|
189 |
+
view1, pred1 = output['view1'], output['pred1']
|
190 |
+
view2, pred2 = output['view2'], output['pred2']
|
191 |
+
# here, view1, pred1, view2, pred2 are dicts of lists of len(2)
|
192 |
+
# -> because we symmetrize we have (im1, im2) and (im2, im1) pairs
|
193 |
+
# in each view you have:
|
194 |
+
# an integer image identifier: view1['idx'] and view2['idx']
|
195 |
+
# the img: view1['img'] and view2['img']
|
196 |
+
# the image shape: view1['true_shape'] and view2['true_shape']
|
197 |
+
# an instance string output by the dataloader: view1['instance'] and view2['instance']
|
198 |
+
# pred1 and pred2 contains the confidence values: pred1['conf'] and pred2['conf']
|
199 |
+
# pred1 contains 3D points for view1['img'] in view1['img'] space: pred1['pts3d']
|
200 |
+
# pred2 contains 3D points for view2['img'] in view1['img'] space: pred2['pts3d_in_other_view']
|
201 |
+
|
202 |
+
# next we'll use the global_aligner to align the predictions
|
203 |
+
# depending on your task, you may be fine with the raw output and not need it
|
204 |
+
# with only two input images, you could use GlobalAlignerMode.PairViewer: it would just convert the output
|
205 |
+
# if using GlobalAlignerMode.PairViewer, no need to run compute_global_alignment
|
206 |
+
scene = global_aligner(output, device=device, mode=GlobalAlignerMode.PointCloudOptimizer)
|
207 |
+
loss = scene.compute_global_alignment(init="mst", niter=niter, schedule=schedule, lr=lr)
|
208 |
+
|
209 |
+
# retrieve useful values from scene:
|
210 |
+
imgs = scene.imgs
|
211 |
+
focals = scene.get_focals()
|
212 |
+
poses = scene.get_im_poses()
|
213 |
+
pts3d = scene.get_pts3d()
|
214 |
+
confidence_masks = scene.get_masks()
|
215 |
+
|
216 |
+
# visualize reconstruction
|
217 |
+
scene.show()
|
218 |
+
|
219 |
+
# find 2D-2D matches between the two images
|
220 |
+
from dust3r.utils.geometry import find_reciprocal_matches, xy_grid
|
221 |
+
pts2d_list, pts3d_list = [], []
|
222 |
+
for i in range(2):
|
223 |
+
conf_i = confidence_masks[i].cpu().numpy()
|
224 |
+
pts2d_list.append(xy_grid(*imgs[i].shape[:2][::-1])[conf_i]) # imgs[i].shape[:2] = (H, W)
|
225 |
+
pts3d_list.append(pts3d[i].detach().cpu().numpy()[conf_i])
|
226 |
+
reciprocal_in_P2, nn2_in_P1, num_matches = find_reciprocal_matches(*pts3d_list)
|
227 |
+
print(f'found {num_matches} matches')
|
228 |
+
matches_im1 = pts2d_list[1][reciprocal_in_P2]
|
229 |
+
matches_im0 = pts2d_list[0][nn2_in_P1][reciprocal_in_P2]
|
230 |
+
|
231 |
+
# visualize a few matches
|
232 |
+
import numpy as np
|
233 |
+
from matplotlib import pyplot as pl
|
234 |
+
n_viz = 10
|
235 |
+
match_idx_to_viz = np.round(np.linspace(0, num_matches-1, n_viz)).astype(int)
|
236 |
+
viz_matches_im0, viz_matches_im1 = matches_im0[match_idx_to_viz], matches_im1[match_idx_to_viz]
|
237 |
+
|
238 |
+
H0, W0, H1, W1 = *imgs[0].shape[:2], *imgs[1].shape[:2]
|
239 |
+
img0 = np.pad(imgs[0], ((0, max(H1 - H0, 0)), (0, 0), (0, 0)), 'constant', constant_values=0)
|
240 |
+
img1 = np.pad(imgs[1], ((0, max(H0 - H1, 0)), (0, 0), (0, 0)), 'constant', constant_values=0)
|
241 |
+
img = np.concatenate((img0, img1), axis=1)
|
242 |
+
pl.figure()
|
243 |
+
pl.imshow(img)
|
244 |
+
cmap = pl.get_cmap('jet')
|
245 |
+
for i in range(n_viz):
|
246 |
+
(x0, y0), (x1, y1) = viz_matches_im0[i].T, viz_matches_im1[i].T
|
247 |
+
pl.plot([x0, x1 + W0], [y0, y1], '-+', color=cmap(i / (n_viz - 1)), scalex=False, scaley=False)
|
248 |
+
pl.show(block=True)
|
249 |
+
|
250 |
+
```
|
251 |
+
![matching example on croco pair](assets/matching.jpg)
|
252 |
+
|
253 |
+
## Training
|
254 |
+
|
255 |
+
In this section, we present a short demonstration to get started with training DUSt3R.
|
256 |
+
|
257 |
+
### Datasets
|
258 |
+
At this moment, we have added the following training datasets:
|
259 |
+
- [CO3Dv2](https://github.com/facebookresearch/co3d) - [Creative Commons Attribution-NonCommercial 4.0 International](https://github.com/facebookresearch/co3d/blob/main/LICENSE)
|
260 |
+
- [ARKitScenes](https://github.com/apple/ARKitScenes) - [Creative Commons Attribution-NonCommercial-ShareAlike 4.0](https://github.com/apple/ARKitScenes/tree/main?tab=readme-ov-file#license)
|
261 |
+
- [ScanNet++](https://kaldir.vc.in.tum.de/scannetpp/) - [non-commercial research and educational purposes](https://kaldir.vc.in.tum.de/scannetpp/static/scannetpp-terms-of-use.pdf)
|
262 |
+
- [BlendedMVS](https://github.com/YoYo000/BlendedMVS) - [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/)
|
263 |
+
- [WayMo Open dataset](https://github.com/waymo-research/waymo-open-dataset) - [Non-Commercial Use](https://waymo.com/open/terms/)
|
264 |
+
- [Habitat-Sim](https://github.com/facebookresearch/habitat-sim/blob/main/DATASETS.md)
|
265 |
+
- [MegaDepth](https://www.cs.cornell.edu/projects/megadepth/)
|
266 |
+
- [StaticThings3D](https://github.com/lmb-freiburg/robustmvd/blob/master/rmvd/data/README.md#staticthings3d)
|
267 |
+
- [WildRGB-D](https://github.com/wildrgbd/wildrgbd/)
|
268 |
+
|
269 |
+
For each dataset, we provide a preprocessing script in the `datasets_preprocess` directory and an archive containing the list of pairs when needed.
|
270 |
+
You have to download the datasets yourself from their official sources, agree to their license, download our list of pairs, and run the preprocessing script.
|
271 |
+
|
272 |
+
Links:
|
273 |
+
|
274 |
+
[ARKitScenes pairs](https://download.europe.naverlabs.com/ComputerVision/DUSt3R/arkitscenes_pairs.zip)
|
275 |
+
[ScanNet++ pairs](https://download.europe.naverlabs.com/ComputerVision/DUSt3R/scannetpp_pairs.zip)
|
276 |
+
[BlendedMVS pairs](https://download.europe.naverlabs.com/ComputerVision/DUSt3R/blendedmvs_pairs.npy)
|
277 |
+
[WayMo Open dataset pairs](https://download.europe.naverlabs.com/ComputerVision/DUSt3R/waymo_pairs.npz)
|
278 |
+
[Habitat metadata](https://download.europe.naverlabs.com/ComputerVision/DUSt3R/habitat_5views_v1_512x512_metadata.tar.gz)
|
279 |
+
[MegaDepth pairs](https://download.europe.naverlabs.com/ComputerVision/DUSt3R/megadepth_pairs.npz)
|
280 |
+
[StaticThings3D pairs](https://download.europe.naverlabs.com/ComputerVision/DUSt3R/staticthings_pairs.npy)
|
281 |
+
|
282 |
+
> [!NOTE]
|
283 |
+
> They are not strictly equivalent to what was used to train DUSt3R, but they should be close enough.
|
284 |
+
|
285 |
+
### Demo
|
286 |
+
For this training demo, we're going to download and prepare a subset of [CO3Dv2](https://github.com/facebookresearch/co3d) - [Creative Commons Attribution-NonCommercial 4.0 International](https://github.com/facebookresearch/co3d/blob/main/LICENSE) and launch the training code on it.
|
287 |
+
The demo model will be trained for a few epochs on a very small dataset.
|
288 |
+
It will not be very good.
|
289 |
+
|
290 |
+
```bash
|
291 |
+
# download and prepare the co3d subset
|
292 |
+
mkdir -p data/co3d_subset
|
293 |
+
cd data/co3d_subset
|
294 |
+
git clone https://github.com/facebookresearch/co3d
|
295 |
+
cd co3d
|
296 |
+
python3 ./co3d/download_dataset.py --download_folder ../ --single_sequence_subset
|
297 |
+
rm ../*.zip
|
298 |
+
cd ../../..
|
299 |
+
|
300 |
+
python3 datasets_preprocess/preprocess_co3d.py --co3d_dir data/co3d_subset --output_dir data/co3d_subset_processed --single_sequence_subset
|
301 |
+
|
302 |
+
# download the pretrained croco v2 checkpoint
|
303 |
+
mkdir -p checkpoints/
|
304 |
+
wget https://download.europe.naverlabs.com/ComputerVision/CroCo/CroCo_V2_ViTLarge_BaseDecoder.pth -P checkpoints/
|
305 |
+
|
306 |
+
# the training of dust3r is done in 3 steps.
|
307 |
+
# for this example we'll do fewer epochs, for the actual hyperparameters we used in the paper, see the next section: "Our Hyperparameters"
|
308 |
+
# step 1 - train dust3r for 224 resolution
|
309 |
+
torchrun --nproc_per_node=4 train.py \
|
310 |
+
--train_dataset "1000 @ Co3d(split='train', ROOT='data/co3d_subset_processed', aug_crop=16, mask_bg='rand', resolution=224, transform=ColorJitter)" \
|
311 |
+
--test_dataset "100 @ Co3d(split='test', ROOT='data/co3d_subset_processed', resolution=224, seed=777)" \
|
312 |
+
--model "AsymmetricCroCo3DStereo(pos_embed='RoPE100', img_size=(224, 224), head_type='linear', output_mode='pts3d', depth_mode=('exp', -inf, inf), conf_mode=('exp', 1, inf), enc_embed_dim=1024, enc_depth=24, enc_num_heads=16, dec_embed_dim=768, dec_depth=12, dec_num_heads=12)" \
|
313 |
+
--train_criterion "ConfLoss(Regr3D(L21, norm_mode='avg_dis'), alpha=0.2)" \
|
314 |
+
--test_criterion "Regr3D_ScaleShiftInv(L21, gt_scale=True)" \
|
315 |
+
--pretrained "checkpoints/CroCo_V2_ViTLarge_BaseDecoder.pth" \
|
316 |
+
--lr 0.0001 --min_lr 1e-06 --warmup_epochs 1 --epochs 10 --batch_size 16 --accum_iter 1 \
|
317 |
+
--save_freq 1 --keep_freq 5 --eval_freq 1 \
|
318 |
+
--output_dir "checkpoints/dust3r_demo_224"
|
319 |
+
|
320 |
+
# step 2 - train dust3r for 512 resolution
|
321 |
+
torchrun --nproc_per_node=4 train.py \
|
322 |
+
--train_dataset "1000 @ Co3d(split='train', ROOT='data/co3d_subset_processed', aug_crop=16, mask_bg='rand', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter)" \
|
323 |
+
--test_dataset "100 @ Co3d(split='test', ROOT='data/co3d_subset_processed', resolution=(512,384), seed=777)" \
|
324 |
+
--model "AsymmetricCroCo3DStereo(pos_embed='RoPE100', patch_embed_cls='ManyAR_PatchEmbed', img_size=(512, 512), head_type='linear', output_mode='pts3d', depth_mode=('exp', -inf, inf), conf_mode=('exp', 1, inf), enc_embed_dim=1024, enc_depth=24, enc_num_heads=16, dec_embed_dim=768, dec_depth=12, dec_num_heads=12)" \
|
325 |
+
--train_criterion "ConfLoss(Regr3D(L21, norm_mode='avg_dis'), alpha=0.2)" \
|
326 |
+
--test_criterion "Regr3D_ScaleShiftInv(L21, gt_scale=True)" \
|
327 |
+
--pretrained "checkpoints/dust3r_demo_224/checkpoint-best.pth" \
|
328 |
+
--lr 0.0001 --min_lr 1e-06 --warmup_epochs 1 --epochs 10 --batch_size 4 --accum_iter 4 \
|
329 |
+
--save_freq 1 --keep_freq 5 --eval_freq 1 \
|
330 |
+
--output_dir "checkpoints/dust3r_demo_512"
|
331 |
+
|
332 |
+
# step 3 - train dust3r for 512 resolution with dpt
|
333 |
+
torchrun --nproc_per_node=4 train.py \
|
334 |
+
--train_dataset "1000 @ Co3d(split='train', ROOT='data/co3d_subset_processed', aug_crop=16, mask_bg='rand', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter)" \
|
335 |
+
--test_dataset "100 @ Co3d(split='test', ROOT='data/co3d_subset_processed', resolution=(512,384), seed=777)" \
|
336 |
+
--model "AsymmetricCroCo3DStereo(pos_embed='RoPE100', patch_embed_cls='ManyAR_PatchEmbed', img_size=(512, 512), head_type='dpt', output_mode='pts3d', depth_mode=('exp', -inf, inf), conf_mode=('exp', 1, inf), enc_embed_dim=1024, enc_depth=24, enc_num_heads=16, dec_embed_dim=768, dec_depth=12, dec_num_heads=12)" \
|
337 |
+
--train_criterion "ConfLoss(Regr3D(L21, norm_mode='avg_dis'), alpha=0.2)" \
|
338 |
+
--test_criterion "Regr3D_ScaleShiftInv(L21, gt_scale=True)" \
|
339 |
+
--pretrained "checkpoints/dust3r_demo_512/checkpoint-best.pth" \
|
340 |
+
--lr 0.0001 --min_lr 1e-06 --warmup_epochs 1 --epochs 10 --batch_size 2 --accum_iter 8 \
|
341 |
+
--save_freq 1 --keep_freq 5 --eval_freq 1 \
|
342 |
+
--output_dir "checkpoints/dust3r_demo_512dpt"
|
343 |
+
|
344 |
+
```
|
345 |
+
|
346 |
+
### Our Hyperparameters
|
347 |
+
|
348 |
+
Here are the commands we used for training the models:
|
349 |
+
|
350 |
+
```bash
|
351 |
+
# NOTE: ROOT path omitted for datasets
|
352 |
+
# 224 linear
|
353 |
+
torchrun --nproc_per_node 8 train.py \
|
354 |
+
--train_dataset=" + 100_000 @ Habitat(1_000_000, split='train', aug_crop=16, resolution=224, transform=ColorJitter) + 100_000 @ BlendedMVS(split='train', aug_crop=16, resolution=224, transform=ColorJitter) + 100_000 @ MegaDepth(split='train', aug_crop=16, resolution=224, transform=ColorJitter) + 100_000 @ ARKitScenes(aug_crop=256, resolution=224, transform=ColorJitter) + 100_000 @ Co3d(split='train', aug_crop=16, mask_bg='rand', resolution=224, transform=ColorJitter) + 100_000 @ StaticThings3D(aug_crop=256, mask_bg='rand', resolution=224, transform=ColorJitter) + 100_000 @ ScanNetpp(split='train', aug_crop=256, resolution=224, transform=ColorJitter) + 100_000 @ InternalUnreleasedDataset(aug_crop=128, resolution=224, transform=ColorJitter) " \
|
355 |
+
--test_dataset=" Habitat(1_000, split='val', resolution=224, seed=777) + 1_000 @ BlendedMVS(split='val', resolution=224, seed=777) + 1_000 @ MegaDepth(split='val', resolution=224, seed=777) + 1_000 @ Co3d(split='test', mask_bg='rand', resolution=224, seed=777) " \
|
356 |
+
--train_criterion="ConfLoss(Regr3D(L21, norm_mode='avg_dis'), alpha=0.2)" \
|
357 |
+
--test_criterion="Regr3D_ScaleShiftInv(L21, gt_scale=True)" \
|
358 |
+
--model="AsymmetricCroCo3DStereo(pos_embed='RoPE100', img_size=(224, 224), head_type='linear', output_mode='pts3d', depth_mode=('exp', -inf, inf), conf_mode=('exp', 1, inf), enc_embed_dim=1024, enc_depth=24, enc_num_heads=16, dec_embed_dim=768, dec_depth=12, dec_num_heads=12)" \
|
359 |
+
--pretrained="checkpoints/CroCo_V2_ViTLarge_BaseDecoder.pth" \
|
360 |
+
--lr=0.0001 --min_lr=1e-06 --warmup_epochs=10 --epochs=100 --batch_size=16 --accum_iter=1 \
|
361 |
+
--save_freq=5 --keep_freq=10 --eval_freq=1 \
|
362 |
+
--output_dir="checkpoints/dust3r_224"
|
363 |
+
|
364 |
+
# 512 linear
|
365 |
+
torchrun --nproc_per_node 8 train.py \
|
366 |
+
--train_dataset=" + 10_000 @ Habitat(1_000_000, split='train', aug_crop=16, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ BlendedMVS(split='train', aug_crop=16, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ MegaDepth(split='train', aug_crop=16, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ ARKitScenes(aug_crop=256, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ Co3d(split='train', aug_crop=16, mask_bg='rand', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ StaticThings3D(aug_crop=256, mask_bg='rand', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ ScanNetpp(split='train', aug_crop=256, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ InternalUnreleasedDataset(aug_crop=128, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) " \
|
367 |
+
--test_dataset=" Habitat(1_000, split='val', resolution=(512,384), seed=777) + 1_000 @ BlendedMVS(split='val', resolution=(512,384), seed=777) + 1_000 @ MegaDepth(split='val', resolution=(512,336), seed=777) + 1_000 @ Co3d(split='test', resolution=(512,384), seed=777) " \
|
368 |
+
--train_criterion="ConfLoss(Regr3D(L21, norm_mode='avg_dis'), alpha=0.2)" \
|
369 |
+
--test_criterion="Regr3D_ScaleShiftInv(L21, gt_scale=True)" \
|
370 |
+
--model="AsymmetricCroCo3DStereo(pos_embed='RoPE100', patch_embed_cls='ManyAR_PatchEmbed', img_size=(512, 512), head_type='linear', output_mode='pts3d', depth_mode=('exp', -inf, inf), conf_mode=('exp', 1, inf), enc_embed_dim=1024, enc_depth=24, enc_num_heads=16, dec_embed_dim=768, dec_depth=12, dec_num_heads=12)" \
|
371 |
+
--pretrained="checkpoints/dust3r_224/checkpoint-best.pth" \
|
372 |
+
--lr=0.0001 --min_lr=1e-06 --warmup_epochs=20 --epochs=100 --batch_size=4 --accum_iter=2 \
|
373 |
+
--save_freq=10 --keep_freq=10 --eval_freq=1 --print_freq=10 \
|
374 |
+
--output_dir="checkpoints/dust3r_512"
|
375 |
+
|
376 |
+
# 512 dpt
|
377 |
+
torchrun --nproc_per_node 8 train.py \
|
378 |
+
--train_dataset=" + 10_000 @ Habitat(1_000_000, split='train', aug_crop=16, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ BlendedMVS(split='train', aug_crop=16, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ MegaDepth(split='train', aug_crop=16, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ ARKitScenes(aug_crop=256, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ Co3d(split='train', aug_crop=16, mask_bg='rand', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ StaticThings3D(aug_crop=256, mask_bg='rand', resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ ScanNetpp(split='train', aug_crop=256, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) + 10_000 @ InternalUnreleasedDataset(aug_crop=128, resolution=[(512, 384), (512, 336), (512, 288), (512, 256), (512, 160)], transform=ColorJitter) " \
|
379 |
+
--test_dataset=" Habitat(1_000, split='val', resolution=(512,384), seed=777) + 1_000 @ BlendedMVS(split='val', resolution=(512,384), seed=777) + 1_000 @ MegaDepth(split='val', resolution=(512,336), seed=777) + 1_000 @ Co3d(split='test', resolution=(512,384), seed=777) " \
|
380 |
+
--train_criterion="ConfLoss(Regr3D(L21, norm_mode='avg_dis'), alpha=0.2)" \
|
381 |
+
--test_criterion="Regr3D_ScaleShiftInv(L21, gt_scale=True)" \
|
382 |
+
--model="AsymmetricCroCo3DStereo(pos_embed='RoPE100', patch_embed_cls='ManyAR_PatchEmbed', img_size=(512, 512), head_type='dpt', output_mode='pts3d', depth_mode=('exp', -inf, inf), conf_mode=('exp', 1, inf), enc_embed_dim=1024, enc_depth=24, enc_num_heads=16, dec_embed_dim=768, dec_depth=12, dec_num_heads=12)" \
|
383 |
+
--pretrained="checkpoints/dust3r_512/checkpoint-best.pth" \
|
384 |
+
--lr=0.0001 --min_lr=1e-06 --warmup_epochs=15 --epochs=90 --batch_size=4 --accum_iter=2 \
|
385 |
+
--save_freq=5 --keep_freq=10 --eval_freq=1 --print_freq=10 \
|
386 |
+
--output_dir="checkpoints/dust3r_512dpt"
|
387 |
+
|
388 |
+
```
|
src/mast3r_src/dust3r/assets/demo.jpg
ADDED
src/mast3r_src/dust3r/assets/dust3r.jpg
ADDED
src/mast3r_src/dust3r/assets/dust3r_archi.jpg
ADDED
src/mast3r_src/dust3r/assets/matching.jpg
ADDED
src/mast3r_src/dust3r/assets/pipeline1.jpg
ADDED
src/mast3r_src/dust3r/croco/LICENSE
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
CroCo, Copyright (c) 2022-present Naver Corporation, is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license.
|
2 |
+
|
3 |
+
A summary of the CC BY-NC-SA 4.0 license is located here:
|
4 |
+
https://creativecommons.org/licenses/by-nc-sa/4.0/
|
5 |
+
|
6 |
+
The CC BY-NC-SA 4.0 license is located here:
|
7 |
+
https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
|
8 |
+
|
9 |
+
|
10 |
+
SEE NOTICE BELOW WITH RESPECT TO THE FILE: models/pos_embed.py, models/blocks.py
|
11 |
+
|
12 |
+
***************************
|
13 |
+
|
14 |
+
NOTICE WITH RESPECT TO THE FILE: models/pos_embed.py
|
15 |
+
|
16 |
+
This software is being redistributed in a modifiled form. The original form is available here:
|
17 |
+
|
18 |
+
https://github.com/facebookresearch/mae/blob/main/util/pos_embed.py
|
19 |
+
|
20 |
+
This software in this file incorporates parts of the following software available here:
|
21 |
+
|
22 |
+
Transformer: https://github.com/tensorflow/models/blob/master/official/legacy/transformer/model_utils.py
|
23 |
+
available under the following license: https://github.com/tensorflow/models/blob/master/LICENSE
|
24 |
+
|
25 |
+
MoCo v3: https://github.com/facebookresearch/moco-v3
|
26 |
+
available under the following license: https://github.com/facebookresearch/moco-v3/blob/main/LICENSE
|
27 |
+
|
28 |
+
DeiT: https://github.com/facebookresearch/deit
|
29 |
+
available under the following license: https://github.com/facebookresearch/deit/blob/main/LICENSE
|
30 |
+
|
31 |
+
|
32 |
+
ORIGINAL COPYRIGHT NOTICE AND PERMISSION NOTICE AVAILABLE HERE IS REPRODUCE BELOW:
|
33 |
+
|
34 |
+
https://github.com/facebookresearch/mae/blob/main/LICENSE
|
35 |
+
|
36 |
+
Attribution-NonCommercial 4.0 International
|
37 |
+
|
38 |
+
***************************
|
39 |
+
|
40 |
+
NOTICE WITH RESPECT TO THE FILE: models/blocks.py
|
41 |
+
|
42 |
+
This software is being redistributed in a modifiled form. The original form is available here:
|
43 |
+
|
44 |
+
https://github.com/rwightman/pytorch-image-models
|
45 |
+
|
46 |
+
ORIGINAL COPYRIGHT NOTICE AND PERMISSION NOTICE AVAILABLE HERE IS REPRODUCE BELOW:
|
47 |
+
|
48 |
+
https://github.com/rwightman/pytorch-image-models/blob/master/LICENSE
|
49 |
+
|
50 |
+
Apache License
|
51 |
+
Version 2.0, January 2004
|
52 |
+
http://www.apache.org/licenses/
|
src/mast3r_src/dust3r/croco/NOTICE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
CroCo
|
2 |
+
Copyright 2022-present NAVER Corp.
|
3 |
+
|
4 |
+
This project contains subcomponents with separate copyright notices and license terms.
|
5 |
+
Your use of the source code for these subcomponents is subject to the terms and conditions of the following licenses.
|
6 |
+
|
7 |
+
====
|
8 |
+
|
9 |
+
facebookresearch/mae
|
10 |
+
https://github.com/facebookresearch/mae
|
11 |
+
|
12 |
+
Attribution-NonCommercial 4.0 International
|
13 |
+
|
14 |
+
====
|
15 |
+
|
16 |
+
rwightman/pytorch-image-models
|
17 |
+
https://github.com/rwightman/pytorch-image-models
|
18 |
+
|
19 |
+
Apache License
|
20 |
+
Version 2.0, January 2004
|
21 |
+
http://www.apache.org/licenses/
|
src/mast3r_src/dust3r/croco/README.MD
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# CroCo + CroCo v2 / CroCo-Stereo / CroCo-Flow
|
2 |
+
|
3 |
+
[[`CroCo arXiv`](https://arxiv.org/abs/2210.10716)] [[`CroCo v2 arXiv`](https://arxiv.org/abs/2211.10408)] [[`project page and demo`](https://croco.europe.naverlabs.com/)]
|
4 |
+
|
5 |
+
This repository contains the code for our CroCo model presented in our NeurIPS'22 paper [CroCo: Self-Supervised Pre-training for 3D Vision Tasks by Cross-View Completion](https://openreview.net/pdf?id=wZEfHUM5ri) and its follow-up extension published at ICCV'23 [Improved Cross-view Completion Pre-training for Stereo Matching and Optical Flow](https://openaccess.thecvf.com/content/ICCV2023/html/Weinzaepfel_CroCo_v2_Improved_Cross-view_Completion_Pre-training_for_Stereo_Matching_and_ICCV_2023_paper.html), refered to as CroCo v2:
|
6 |
+
|
7 |
+
![image](assets/arch.jpg)
|
8 |
+
|
9 |
+
```bibtex
|
10 |
+
@inproceedings{croco,
|
11 |
+
title={{CroCo: Self-Supervised Pre-training for 3D Vision Tasks by Cross-View Completion}},
|
12 |
+
author={{Weinzaepfel, Philippe and Leroy, Vincent and Lucas, Thomas and Br\'egier, Romain and Cabon, Yohann and Arora, Vaibhav and Antsfeld, Leonid and Chidlovskii, Boris and Csurka, Gabriela and Revaud J\'er\^ome}},
|
13 |
+
booktitle={{NeurIPS}},
|
14 |
+
year={2022}
|
15 |
+
}
|
16 |
+
|
17 |
+
@inproceedings{croco_v2,
|
18 |
+
title={{CroCo v2: Improved Cross-view Completion Pre-training for Stereo Matching and Optical Flow}},
|
19 |
+
author={Weinzaepfel, Philippe and Lucas, Thomas and Leroy, Vincent and Cabon, Yohann and Arora, Vaibhav and Br{\'e}gier, Romain and Csurka, Gabriela and Antsfeld, Leonid and Chidlovskii, Boris and Revaud, J{\'e}r{\^o}me},
|
20 |
+
booktitle={ICCV},
|
21 |
+
year={2023}
|
22 |
+
}
|
23 |
+
```
|
24 |
+
|
25 |
+
## License
|
26 |
+
|
27 |
+
The code is distributed under the CC BY-NC-SA 4.0 License. See [LICENSE](LICENSE) for more information.
|
28 |
+
Some components are based on code from [MAE](https://github.com/facebookresearch/mae) released under the CC BY-NC-SA 4.0 License and [timm](https://github.com/rwightman/pytorch-image-models) released under the Apache 2.0 License.
|
29 |
+
Some components for stereo matching and optical flow are based on code from [unimatch](https://github.com/autonomousvision/unimatch) released under the MIT license.
|
30 |
+
|
31 |
+
## Preparation
|
32 |
+
|
33 |
+
1. Install dependencies on a machine with a NVidia GPU using e.g. conda. Note that `habitat-sim` is required only for the interactive demo and the synthetic pre-training data generation. If you don't plan to use it, you can ignore the line installing it and use a more recent python version.
|
34 |
+
|
35 |
+
```bash
|
36 |
+
conda create -n croco python=3.7 cmake=3.14.0
|
37 |
+
conda activate croco
|
38 |
+
conda install habitat-sim headless -c conda-forge -c aihabitat
|
39 |
+
conda install pytorch torchvision -c pytorch
|
40 |
+
conda install notebook ipykernel matplotlib
|
41 |
+
conda install ipywidgets widgetsnbextension
|
42 |
+
conda install scikit-learn tqdm quaternion opencv # only for pretraining / habitat data generation
|
43 |
+
|
44 |
+
```
|
45 |
+
|
46 |
+
2. Compile cuda kernels for RoPE
|
47 |
+
|
48 |
+
CroCo v2 relies on RoPE positional embeddings for which you need to compile some cuda kernels.
|
49 |
+
```bash
|
50 |
+
cd models/curope/
|
51 |
+
python setup.py build_ext --inplace
|
52 |
+
cd ../../
|
53 |
+
```
|
54 |
+
|
55 |
+
This can be a bit long as we compile for all cuda architectures, feel free to update L9 of `models/curope/setup.py` to compile for specific architectures only.
|
56 |
+
You might also need to set the environment `CUDA_HOME` in case you use a custom cuda installation.
|
57 |
+
|
58 |
+
In case you cannot provide, we also provide a slow pytorch version, which will be automatically loaded.
|
59 |
+
|
60 |
+
3. Download pre-trained model
|
61 |
+
|
62 |
+
We provide several pre-trained models:
|
63 |
+
|
64 |
+
| modelname | pre-training data | pos. embed. | Encoder | Decoder |
|
65 |
+
|------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------------|---------|---------|
|
66 |
+
| [`CroCo.pth`](https://download.europe.naverlabs.com/ComputerVision/CroCo/CroCo.pth) | Habitat | cosine | ViT-B | Small |
|
67 |
+
| [`CroCo_V2_ViTBase_SmallDecoder.pth`](https://download.europe.naverlabs.com/ComputerVision/CroCo/CroCo_V2_ViTBase_SmallDecoder.pth) | Habitat + real | RoPE | ViT-B | Small |
|
68 |
+
| [`CroCo_V2_ViTBase_BaseDecoder.pth`](https://download.europe.naverlabs.com/ComputerVision/CroCo/CroCo_V2_ViTBase_BaseDecoder.pth) | Habitat + real | RoPE | ViT-B | Base |
|
69 |
+
| [`CroCo_V2_ViTLarge_BaseDecoder.pth`](https://download.europe.naverlabs.com/ComputerVision/CroCo/CroCo_V2_ViTLarge_BaseDecoder.pth) | Habitat + real | RoPE | ViT-L | Base |
|
70 |
+
|
71 |
+
To download a specific model, i.e., the first one (`CroCo.pth`)
|
72 |
+
```bash
|
73 |
+
mkdir -p pretrained_models/
|
74 |
+
wget https://download.europe.naverlabs.com/ComputerVision/CroCo/CroCo.pth -P pretrained_models/
|
75 |
+
```
|
76 |
+
|
77 |
+
## Reconstruction example
|
78 |
+
|
79 |
+
Simply run after downloading the `CroCo_V2_ViTLarge_BaseDecoder` pretrained model (or update the corresponding line in `demo.py`)
|
80 |
+
```bash
|
81 |
+
python demo.py
|
82 |
+
```
|
83 |
+
|
84 |
+
## Interactive demonstration of cross-view completion reconstruction on the Habitat simulator
|
85 |
+
|
86 |
+
First download the test scene from Habitat:
|
87 |
+
```bash
|
88 |
+
python -m habitat_sim.utils.datasets_download --uids habitat_test_scenes --data-path habitat-sim-data/
|
89 |
+
```
|
90 |
+
|
91 |
+
Then, run the Notebook demo `interactive_demo.ipynb`.
|
92 |
+
|
93 |
+
In this demo, you should be able to sample a random reference viewpoint from an [Habitat](https://github.com/facebookresearch/habitat-sim) test scene. Use the sliders to change viewpoint and select a masked target view to reconstruct using CroCo.
|
94 |
+
![croco_interactive_demo](https://user-images.githubusercontent.com/1822210/200516576-7937bc6a-55f8-49ed-8618-3ddf89433ea4.jpg)
|
95 |
+
|
96 |
+
## Pre-training
|
97 |
+
|
98 |
+
### CroCo
|
99 |
+
|
100 |
+
To pre-train CroCo, please first generate the pre-training data from the Habitat simulator, following the instructions in [datasets/habitat_sim/README.MD](datasets/habitat_sim/README.MD) and then run the following command:
|
101 |
+
```
|
102 |
+
torchrun --nproc_per_node=4 pretrain.py --output_dir ./output/pretraining/
|
103 |
+
```
|
104 |
+
|
105 |
+
Our CroCo pre-training was launched on a single server with 4 GPUs.
|
106 |
+
It should take around 10 days with A100 or 15 days with V100 to do the 400 pre-training epochs, but decent performances are obtained earlier in training.
|
107 |
+
Note that, while the code contains the same scaling rule of the learning rate as MAE when changing the effective batch size, we did not experimented if it is valid in our case.
|
108 |
+
The first run can take a few minutes to start, to parse all available pre-training pairs.
|
109 |
+
|
110 |
+
### CroCo v2
|
111 |
+
|
112 |
+
For CroCo v2 pre-training, in addition to the generation of the pre-training data from the Habitat simulator above, please pre-extract the crops from the real datasets following the instructions in [datasets/crops/README.MD](datasets/crops/README.MD).
|
113 |
+
Then, run the following command for the largest model (ViT-L encoder, Base decoder):
|
114 |
+
```
|
115 |
+
torchrun --nproc_per_node=8 pretrain.py --model "CroCoNet(enc_embed_dim=1024, enc_depth=24, enc_num_heads=16, dec_embed_dim=768, dec_num_heads=12, dec_depth=12, pos_embed='RoPE100')" --dataset "habitat_release+ARKitScenes+MegaDepth+3DStreetView+IndoorVL" --warmup_epochs 12 --max_epoch 125 --epochs 250 --amp 0 --keep_freq 5 --output_dir ./output/pretraining_crocov2/
|
116 |
+
```
|
117 |
+
|
118 |
+
Our CroCo v2 pre-training was launched on a single server with 8 GPUs for the largest model, and on a single server with 4 GPUs for the smaller ones, keeping a batch size of 64 per gpu in all cases.
|
119 |
+
The largest model should take around 12 days on A100.
|
120 |
+
Note that, while the code contains the same scaling rule of the learning rate as MAE when changing the effective batch size, we did not experimented if it is valid in our case.
|
121 |
+
|
122 |
+
## Stereo matching and Optical flow downstream tasks
|
123 |
+
|
124 |
+
For CroCo-Stereo and CroCo-Flow, please refer to [stereoflow/README.MD](stereoflow/README.MD).
|
src/mast3r_src/dust3r/croco/assets/Chateau1.png
ADDED
src/mast3r_src/dust3r/croco/assets/Chateau2.png
ADDED
src/mast3r_src/dust3r/croco/assets/arch.jpg
ADDED
src/mast3r_src/dust3r/croco/croco-stereo-flow-demo.ipynb
ADDED
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "markdown",
|
5 |
+
"id": "9bca0f41",
|
6 |
+
"metadata": {},
|
7 |
+
"source": [
|
8 |
+
"# Simple inference example with CroCo-Stereo or CroCo-Flow"
|
9 |
+
]
|
10 |
+
},
|
11 |
+
{
|
12 |
+
"cell_type": "code",
|
13 |
+
"execution_count": null,
|
14 |
+
"id": "80653ef7",
|
15 |
+
"metadata": {},
|
16 |
+
"outputs": [],
|
17 |
+
"source": [
|
18 |
+
"# Copyright (C) 2022-present Naver Corporation. All rights reserved.\n",
|
19 |
+
"# Licensed under CC BY-NC-SA 4.0 (non-commercial use only)."
|
20 |
+
]
|
21 |
+
},
|
22 |
+
{
|
23 |
+
"cell_type": "markdown",
|
24 |
+
"id": "4f033862",
|
25 |
+
"metadata": {},
|
26 |
+
"source": [
|
27 |
+
"First download the model(s) of your choice by running\n",
|
28 |
+
"```\n",
|
29 |
+
"bash stereoflow/download_model.sh crocostereo.pth\n",
|
30 |
+
"bash stereoflow/download_model.sh crocoflow.pth\n",
|
31 |
+
"```"
|
32 |
+
]
|
33 |
+
},
|
34 |
+
{
|
35 |
+
"cell_type": "code",
|
36 |
+
"execution_count": null,
|
37 |
+
"id": "1fb2e392",
|
38 |
+
"metadata": {},
|
39 |
+
"outputs": [],
|
40 |
+
"source": [
|
41 |
+
"import torch\n",
|
42 |
+
"use_gpu = torch.cuda.is_available() and torch.cuda.device_count()>0\n",
|
43 |
+
"device = torch.device('cuda:0' if use_gpu else 'cpu')\n",
|
44 |
+
"import matplotlib.pylab as plt"
|
45 |
+
]
|
46 |
+
},
|
47 |
+
{
|
48 |
+
"cell_type": "code",
|
49 |
+
"execution_count": null,
|
50 |
+
"id": "e0e25d77",
|
51 |
+
"metadata": {},
|
52 |
+
"outputs": [],
|
53 |
+
"source": [
|
54 |
+
"from stereoflow.test import _load_model_and_criterion\n",
|
55 |
+
"from stereoflow.engine import tiled_pred\n",
|
56 |
+
"from stereoflow.datasets_stereo import img_to_tensor, vis_disparity\n",
|
57 |
+
"from stereoflow.datasets_flow import flowToColor\n",
|
58 |
+
"tile_overlap=0.7 # recommended value, higher value can be slightly better but slower"
|
59 |
+
]
|
60 |
+
},
|
61 |
+
{
|
62 |
+
"cell_type": "markdown",
|
63 |
+
"id": "86a921f5",
|
64 |
+
"metadata": {},
|
65 |
+
"source": [
|
66 |
+
"### CroCo-Stereo example"
|
67 |
+
]
|
68 |
+
},
|
69 |
+
{
|
70 |
+
"cell_type": "code",
|
71 |
+
"execution_count": null,
|
72 |
+
"id": "64e483cb",
|
73 |
+
"metadata": {},
|
74 |
+
"outputs": [],
|
75 |
+
"source": [
|
76 |
+
"image1 = np.asarray(Image.open('<path_to_left_image>'))\n",
|
77 |
+
"image2 = np.asarray(Image.open('<path_to_right_image>'))"
|
78 |
+
]
|
79 |
+
},
|
80 |
+
{
|
81 |
+
"cell_type": "code",
|
82 |
+
"execution_count": null,
|
83 |
+
"id": "f0d04303",
|
84 |
+
"metadata": {},
|
85 |
+
"outputs": [],
|
86 |
+
"source": [
|
87 |
+
"model, _, cropsize, with_conf, task, tile_conf_mode = _load_model_and_criterion('stereoflow_models/crocostereo.pth', None, device)\n"
|
88 |
+
]
|
89 |
+
},
|
90 |
+
{
|
91 |
+
"cell_type": "code",
|
92 |
+
"execution_count": null,
|
93 |
+
"id": "47dc14b5",
|
94 |
+
"metadata": {},
|
95 |
+
"outputs": [],
|
96 |
+
"source": [
|
97 |
+
"im1 = img_to_tensor(image1).to(device).unsqueeze(0)\n",
|
98 |
+
"im2 = img_to_tensor(image2).to(device).unsqueeze(0)\n",
|
99 |
+
"with torch.inference_mode():\n",
|
100 |
+
" pred, _, _ = tiled_pred(model, None, im1, im2, None, conf_mode=tile_conf_mode, overlap=tile_overlap, crop=cropsize, with_conf=with_conf, return_time=False)\n",
|
101 |
+
"pred = pred.squeeze(0).squeeze(0).cpu().numpy()"
|
102 |
+
]
|
103 |
+
},
|
104 |
+
{
|
105 |
+
"cell_type": "code",
|
106 |
+
"execution_count": null,
|
107 |
+
"id": "583b9f16",
|
108 |
+
"metadata": {},
|
109 |
+
"outputs": [],
|
110 |
+
"source": [
|
111 |
+
"plt.imshow(vis_disparity(pred))\n",
|
112 |
+
"plt.axis('off')"
|
113 |
+
]
|
114 |
+
},
|
115 |
+
{
|
116 |
+
"cell_type": "markdown",
|
117 |
+
"id": "d2df5d70",
|
118 |
+
"metadata": {},
|
119 |
+
"source": [
|
120 |
+
"### CroCo-Flow example"
|
121 |
+
]
|
122 |
+
},
|
123 |
+
{
|
124 |
+
"cell_type": "code",
|
125 |
+
"execution_count": null,
|
126 |
+
"id": "9ee257a7",
|
127 |
+
"metadata": {},
|
128 |
+
"outputs": [],
|
129 |
+
"source": [
|
130 |
+
"image1 = np.asarray(Image.open('<path_to_first_image>'))\n",
|
131 |
+
"image2 = np.asarray(Image.open('<path_to_second_image>'))"
|
132 |
+
]
|
133 |
+
},
|
134 |
+
{
|
135 |
+
"cell_type": "code",
|
136 |
+
"execution_count": null,
|
137 |
+
"id": "d5edccf0",
|
138 |
+
"metadata": {},
|
139 |
+
"outputs": [],
|
140 |
+
"source": [
|
141 |
+
"model, _, cropsize, with_conf, task, tile_conf_mode = _load_model_and_criterion('stereoflow_models/crocoflow.pth', None, device)\n"
|
142 |
+
]
|
143 |
+
},
|
144 |
+
{
|
145 |
+
"cell_type": "code",
|
146 |
+
"execution_count": null,
|
147 |
+
"id": "b19692c3",
|
148 |
+
"metadata": {},
|
149 |
+
"outputs": [],
|
150 |
+
"source": [
|
151 |
+
"im1 = img_to_tensor(image1).to(device).unsqueeze(0)\n",
|
152 |
+
"im2 = img_to_tensor(image2).to(device).unsqueeze(0)\n",
|
153 |
+
"with torch.inference_mode():\n",
|
154 |
+
" pred, _, _ = tiled_pred(model, None, im1, im2, None, conf_mode=tile_conf_mode, overlap=tile_overlap, crop=cropsize, with_conf=with_conf, return_time=False)\n",
|
155 |
+
"pred = pred.squeeze(0).permute(1,2,0).cpu().numpy()"
|
156 |
+
]
|
157 |
+
},
|
158 |
+
{
|
159 |
+
"cell_type": "code",
|
160 |
+
"execution_count": null,
|
161 |
+
"id": "26f79db3",
|
162 |
+
"metadata": {},
|
163 |
+
"outputs": [],
|
164 |
+
"source": [
|
165 |
+
"plt.imshow(flowToColor(pred))\n",
|
166 |
+
"plt.axis('off')"
|
167 |
+
]
|
168 |
+
}
|
169 |
+
],
|
170 |
+
"metadata": {
|
171 |
+
"kernelspec": {
|
172 |
+
"display_name": "Python 3 (ipykernel)",
|
173 |
+
"language": "python",
|
174 |
+
"name": "python3"
|
175 |
+
},
|
176 |
+
"language_info": {
|
177 |
+
"codemirror_mode": {
|
178 |
+
"name": "ipython",
|
179 |
+
"version": 3
|
180 |
+
},
|
181 |
+
"file_extension": ".py",
|
182 |
+
"mimetype": "text/x-python",
|
183 |
+
"name": "python",
|
184 |
+
"nbconvert_exporter": "python",
|
185 |
+
"pygments_lexer": "ipython3",
|
186 |
+
"version": "3.9.7"
|
187 |
+
}
|
188 |
+
},
|
189 |
+
"nbformat": 4,
|
190 |
+
"nbformat_minor": 5
|
191 |
+
}
|
src/mast3r_src/dust3r/croco/datasets/__init__.py
ADDED
File without changes
|
src/mast3r_src/dust3r/croco/datasets/crops/README.MD
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## Generation of crops from the real datasets
|
2 |
+
|
3 |
+
The instructions below allow to generate the crops used for pre-training CroCo v2 from the following real-world datasets: ARKitScenes, MegaDepth, 3DStreetView and IndoorVL.
|
4 |
+
|
5 |
+
### Download the metadata of the crops to generate
|
6 |
+
|
7 |
+
First, download the metadata and put them in `./data/`:
|
8 |
+
```
|
9 |
+
mkdir -p data
|
10 |
+
cd data/
|
11 |
+
wget https://download.europe.naverlabs.com/ComputerVision/CroCo/data/crop_metadata.zip
|
12 |
+
unzip crop_metadata.zip
|
13 |
+
rm crop_metadata.zip
|
14 |
+
cd ..
|
15 |
+
```
|
16 |
+
|
17 |
+
### Prepare the original datasets
|
18 |
+
|
19 |
+
Second, download the original datasets in `./data/original_datasets/`.
|
20 |
+
```
|
21 |
+
mkdir -p data/original_datasets
|
22 |
+
```
|
23 |
+
|
24 |
+
##### ARKitScenes
|
25 |
+
|
26 |
+
Download the `raw` dataset from https://github.com/apple/ARKitScenes/blob/main/DATA.md and put it in `./data/original_datasets/ARKitScenes/`.
|
27 |
+
The resulting file structure should be like:
|
28 |
+
```
|
29 |
+
./data/original_datasets/ARKitScenes/
|
30 |
+
└───Training
|
31 |
+
└───40753679
|
32 |
+
│ │ ultrawide
|
33 |
+
│ │ ...
|
34 |
+
└───40753686
|
35 |
+
│
|
36 |
+
...
|
37 |
+
```
|
38 |
+
|
39 |
+
##### MegaDepth
|
40 |
+
|
41 |
+
Download `MegaDepth v1 Dataset` from https://www.cs.cornell.edu/projects/megadepth/ and put it in `./data/original_datasets/MegaDepth/`.
|
42 |
+
The resulting file structure should be like:
|
43 |
+
|
44 |
+
```
|
45 |
+
./data/original_datasets/MegaDepth/
|
46 |
+
└───0000
|
47 |
+
│ └───images
|
48 |
+
│ │ │ 1000557903_87fa96b8a4_o.jpg
|
49 |
+
│ │ └ ...
|
50 |
+
│ └─── ...
|
51 |
+
└───0001
|
52 |
+
│ │
|
53 |
+
│ └ ...
|
54 |
+
└─── ...
|
55 |
+
```
|
56 |
+
|
57 |
+
##### 3DStreetView
|
58 |
+
|
59 |
+
Download `3D_Street_View` dataset from https://github.com/amir32002/3D_Street_View and put it in `./data/original_datasets/3DStreetView/`.
|
60 |
+
The resulting file structure should be like:
|
61 |
+
|
62 |
+
```
|
63 |
+
./data/original_datasets/3DStreetView/
|
64 |
+
└───dataset_aligned
|
65 |
+
│ └───0002
|
66 |
+
│ │ │ 0000002_0000001_0000002_0000001.jpg
|
67 |
+
│ │ └ ...
|
68 |
+
│ └─── ...
|
69 |
+
└───dataset_unaligned
|
70 |
+
│ └───0003
|
71 |
+
│ │ │ 0000003_0000001_0000002_0000001.jpg
|
72 |
+
│ │ └ ...
|
73 |
+
│ └─── ...
|
74 |
+
```
|
75 |
+
|
76 |
+
##### IndoorVL
|
77 |
+
|
78 |
+
Download the `IndoorVL` datasets using [Kapture](https://github.com/naver/kapture).
|
79 |
+
|
80 |
+
```
|
81 |
+
pip install kapture
|
82 |
+
mkdir -p ./data/original_datasets/IndoorVL
|
83 |
+
cd ./data/original_datasets/IndoorVL
|
84 |
+
kapture_download_dataset.py update
|
85 |
+
kapture_download_dataset.py install "HyundaiDepartmentStore_*"
|
86 |
+
kapture_download_dataset.py install "GangnamStation_*"
|
87 |
+
cd -
|
88 |
+
```
|
89 |
+
|
90 |
+
### Extract the crops
|
91 |
+
|
92 |
+
Now, extract the crops for each of the dataset:
|
93 |
+
```
|
94 |
+
for dataset in ARKitScenes MegaDepth 3DStreetView IndoorVL;
|
95 |
+
do
|
96 |
+
python3 datasets/crops/extract_crops_from_images.py --crops ./data/crop_metadata/${dataset}/crops_release.txt --root-dir ./data/original_datasets/${dataset}/ --output-dir ./data/${dataset}_crops/ --imsize 256 --nthread 8 --max-subdir-levels 5 --ideal-number-pairs-in-dir 500;
|
97 |
+
done
|
98 |
+
```
|
99 |
+
|
100 |
+
##### Note for IndoorVL
|
101 |
+
|
102 |
+
Due to some legal issues, we can only release 144,228 pairs out of the 1,593,689 pairs used in the paper.
|
103 |
+
To account for it in terms of number of pre-training iterations, the pre-training command in this repository uses 125 training epochs including 12 warm-up epochs and learning rate cosine schedule of 250, instead of 100, 10 and 200 respectively.
|
104 |
+
The impact on the performance is negligible.
|