Skip to content

Commit b452ffc

Browse files
committedOct 27, 2022
Added readme for ios-logger scan inference. Fix bug for depth min/max when no valid depth exists.
1 parent 5b56c66 commit b452ffc

24 files changed

+6720
-16
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ With larger batches speed increases considerably. With batch size 8 on the non-s
5555
- [x] Simple scan for folks to quickly try the code, instead of downloading the ScanNetv2 test scenes. DONE
5656
- [x] ScanNetv2 extraction, ~~ETA 10th October~~ DONE
5757
- [ ] FPN model weights.
58-
- ~~[ ] Tutorial on how to use Scanniverse data, ETA 5th October 10th October 20th October~~ At present there is no publically available way of exporting scans from Scanniverse. You'll have to use ios-logger; NeuralRecon have a good tutorial on [this](https://github.com/zju3dv/NeuralRecon/blob/master/DEMO.md), and a dataloader that accepts the processed format is at ```datasets/arkit_dataset.py```.
58+
- ~~[ ] Tutorial on how to use Scanniverse data, ETA 5th October 10th October 20th October~~ At present there is no publically available way of exporting scans from Scanniverse. You'll have to use ios-logger; NeuralRecon have a good tutorial on [this](https://github.com/zju3dv/NeuralRecon/blob/master/DEMO.md), and a dataloader that accepts the processed format is at ```datasets/arkit_dataset.py```. UPDATE: There is now quick readme [data_scripts/IOS_LOGGER_ARKIT_README.md](data_scripts/IOS_LOGGER_ARKIT_README.md) for how to process and run inference an ios-logger scan using the script at ```data_scripts/ios_logger_preprocessing.py```.
5959

6060
## 🏃 Running out of the box!
6161

‎configs/data/arkit_dense.yaml

-9
This file was deleted.
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
!!python/object:options.Options
2+
dataset_path: /mnt/res_nas/mohameds/datasets/arkit
3+
tuple_info_file_location: data_splits/arkit/
4+
dataset_scan_split_file: data_splits/arkit/scans.txt
5+
dataset: arkit
6+
mv_tuple_file_suffix: _eight_view_deepvmvs.txt
7+
num_images_in_tuple: 8
8+
frame_tuple_type: default
9+
split: test

‎configs/data/neucon_arkit_dense.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
!!python/object:options.Options
2+
dataset_path: /mnt/res_nas/mohameds/datasets/arkit
3+
tuple_info_file_location: data_splits/arkit/
4+
dataset_scan_split_file: data_splits/arkit/scans.txt
5+
dataset: arkit
6+
mv_tuple_file_suffix: _eight_view_deepvmvs_dense.txt
7+
num_images_in_tuple: 8
8+
frame_tuple_type: dense
9+
split: test
+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Running with NeuralRecon's demo data and data from ios-logger.
2+
3+
Download the demo scene out of ios-logger from here: https://github.com/zju3dv/NeuralRecon/blob/master/DEMO.md
4+
5+
Follow the instructions in the NeuralRecon repo for how to use ios-logger to make your own captures.
6+
7+
Unzip the folder into your arkit dataset path so that it looks somthing like this:
8+
9+
```
10+
dataset_path
11+
scans
12+
neucon_demodata_b5f1
13+
...
14+
....
15+
```
16+
17+
Run the extraction script that uses modified versions of the functions provided by the NeuralRecon authors:
18+
19+
```bash
20+
python ./data_scripts/ios_logger_preprocessing.py --data_config configs/data/neucon_arkit_default.yaml
21+
```
22+
23+
Make sure you set your correct `dataset_path` folder.
24+
25+
Run tuple file generation (we've already computed one for you in data_splits):
26+
27+
```bash
28+
python ./data_scripts/generate_test_tuples.py --num_workers 16 --data_config configs/data/neucon_arkit_default.yaml
29+
```
30+
31+
Then run the model using this config file, see the full readme for more.
32+
33+
There is unfortunately a break in the pose in the NR demo scene, so you'll to trim the first 350 frames using `--skip_to_frame 350` when running dense frames and `--skip_to_frame 83` when running default.
34+
35+
Run:
36+
37+
```bash
38+
CUDA_VISIBLE_DEVICES=0 python test.py --name HERO_MODEL \
39+
--output_base_path OUTPUT_PATH \
40+
--config_file configs/models/hero_model.yaml \
41+
--load_weights_from_checkpoint weights/hero_model.ckpt \
42+
--data_config configs/data/neucon_arkit_default.yaml \
43+
--num_workers 8 \
44+
--batch_size 2 \
45+
--fast_cost_volume \
46+
--run_fusion \
47+
--depth_fuser open3d \
48+
--fuse_color \
49+
--skip_to_frame 83;
50+
```
51+
52+
```bash
53+
CUDA_VISIBLE_DEVICES=0 python test.py --name HERO_MODEL \
54+
--output_base_path OUTPUT_PATH \
55+
--config_file configs/models/hero_model.yaml \
56+
--load_weights_from_checkpoint weights/hero_model.ckpt \
57+
--data_config configs/data/neucon_arkit_dense.yaml \
58+
--num_workers 8 \
59+
--batch_size 2 \
60+
--fast_cost_volume \
61+
--run_fusion \
62+
--depth_fuser open3d \
63+
--fuse_color \
64+
--skip_to_frame 350;
65+
```
66+
67+
Should get an output that looks like this for default frames:
68+
69+
![alt text](../media/arkit_ioslogger_snapshot.png)
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import os
2+
import sys
3+
sys.path.append("/".join(sys.path[0].split("/")[:-1]))
4+
from datasets.arkit_dataset import process_data
5+
import options
6+
7+
""" Download scans and extract each to a folder with their name like so:
8+
dataset_path
9+
scans
10+
neucon_demodata_b5f1
11+
...
12+
....
13+
"""
14+
15+
option_handler = options.OptionsHandler()
16+
option_handler.parse_and_merge_options()
17+
opts = option_handler.options
18+
19+
20+
if opts.dataset_scan_split_file is not None:
21+
f = open(opts.dataset_scan_split_file, "r")
22+
scans = f.readlines()
23+
scans = [scan.strip() for scan in scans]
24+
f.close()
25+
elif opts.single_debug_scan_id is not None:
26+
scans = [opts.single_debug_scan_id]
27+
else:
28+
print("No valid scans pointers.")
29+
30+
for scan in scans:
31+
path_dir = os.path.join(opts.dataset_path, "scans", scan)
32+
process_data(path_dir)

‎data_splits/arkit/scans.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
neucon_demodata_b5f1

‎data_splits/arkit/test_eight_view_deepvmvs.txt

+1,263
Large diffs are not rendered by default.

‎data_splits/arkit/test_eight_view_deepvmvs_dense.txt

+5,300
Large diffs are not rendered by default.

‎datasets/arkit_dataset.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def __init__(self,
4444
include_high_res_color=False,
4545
pass_frame_id=False,
4646
skip_frames=None,
47+
skip_to_frame=None,
4748
verbose_init=True,
4849
min_valid_depth=1e-3,
4950
max_valid_depth=10,
@@ -64,7 +65,7 @@ def __init__(self,
6465
include_full_depth_K=include_full_depth_K,
6566
include_high_res_color=include_high_res_color,
6667
pass_frame_id=pass_frame_id, skip_frames=skip_frames,
67-
verbose_init=verbose_init,
68+
skip_to_frame=skip_to_frame, verbose_init=verbose_init,
6869
native_depth_width=native_depth_width,
6970
native_depth_height=native_depth_height
7071
)

‎datasets/colmap_dataset.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def __init__(
6565
include_high_res_color=False,
6666
pass_frame_id=False,
6767
skip_frames=None,
68+
skip_to_frame=None,
6869
verbose_init=True,
6970
native_depth_width=640,
7071
native_depth_height=480,
@@ -84,7 +85,7 @@ def __init__(
8485
include_full_depth_K=include_full_depth_K,
8586
include_high_res_color=include_high_res_color,
8687
pass_frame_id=pass_frame_id, skip_frames=skip_frames,
87-
verbose_init=verbose_init,
88+
skip_to_frame=skip_to_frame, verbose_init=verbose_init,
8889
native_depth_width=native_depth_width,
8990
native_depth_height=native_depth_height,
9091
)

‎datasets/generic_mvs_dataset.py

+12
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def __init__(self,
5959
shuffle_tuple=False,
6060
pass_frame_id=False,
6161
skip_frames=None,
62+
skip_to_frame=None,
6263
verbose_init=True,
6364
native_depth_width=640,
6465
native_depth_height=480,
@@ -140,6 +141,17 @@ def __init__(self,
140141
self.frame_tuples if limit_to_scan_id ==
141142
frame_tuple.split(" ")[0]]
142143

144+
if skip_to_frame is not None:
145+
if verbose_init:
146+
print(f"".center(80, "#"))
147+
print(f"".center(80, "#"))
148+
print(f"".center(80, "#"))
149+
print(f" Skipping to frame {skip_to_frame} ".center(80, "#"))
150+
print(f"".center(80, "#"))
151+
print(f"".center(80, "#"))
152+
print(f"".center(80, "#"), "\n")
153+
self.frame_tuples = self.frame_tuples[skip_to_frame:]
154+
143155
# optionally skip every frame with interval skip_frame
144156
if skip_frames is not None:
145157
if verbose_init:

‎datasets/scannet_dataset.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def __init__(
9494
include_high_res_color=False,
9595
pass_frame_id=False,
9696
skip_frames=None,
97+
skip_to_frame=None,
9798
verbose_init=True,
9899
min_valid_depth=1e-3,
99100
max_valid_depth=10,
@@ -113,7 +114,7 @@ def __init__(
113114
include_full_depth_K=include_full_depth_K,
114115
include_high_res_color=include_high_res_color,
115116
pass_frame_id=pass_frame_id, skip_frames=skip_frames,
116-
verbose_init=verbose_init,
117+
skip_to_frame=skip_to_frame, verbose_init=verbose_init,
117118
)
118119

119120
"""

‎datasets/scanniverse_dataset.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def __init__(
4444
include_high_res_color=False,
4545
pass_frame_id=False,
4646
skip_frames=None,
47+
skip_to_frame=None,
4748
verbose_init=True,
4849
min_valid_depth=1e-3,
4950
max_valid_depth=10,
@@ -65,7 +66,7 @@ def __init__(
6566
include_full_depth_K=include_full_depth_K,
6667
include_high_res_color=include_high_res_color,
6768
pass_frame_id=pass_frame_id, skip_frames=skip_frames,
68-
verbose_init=verbose_init,
69+
skip_to_frame=skip_to_frame, verbose_init=verbose_init,
6970
native_depth_width=native_depth_width,
7071
native_depth_height=native_depth_height,
7172
)

‎datasets/seven_scenes_dataset.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def __init__(
6464
include_high_res_color=False,
6565
pass_frame_id=False,
6666
skip_frames=None,
67+
skip_to_frame=None,
6768
verbose_init=True,
6869
min_valid_depth=1e-3,
6970
max_valid_depth=10,
@@ -83,7 +84,7 @@ def __init__(
8384
include_full_depth_K=include_full_depth_K,
8485
include_high_res_color=include_high_res_color,
8586
pass_frame_id=pass_frame_id, skip_frames=skip_frames,
86-
verbose_init=verbose_init,
87+
skip_to_frame=skip_to_frame, verbose_init=verbose_init,
8788
)
8889
"""
8990
Args:

‎datasets/vdr_dataset.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def __init__(
4646
include_high_res_color=False,
4747
pass_frame_id=False,
4848
skip_frames=None,
49+
skip_to_frame=None,
4950
verbose_init=True,
5051
native_depth_width=256,
5152
native_depth_height=192,
@@ -64,7 +65,7 @@ def __init__(
6465
include_full_depth_K=include_full_depth_K,
6566
include_high_res_color=include_high_res_color,
6667
pass_frame_id=pass_frame_id, skip_frames=skip_frames,
67-
verbose_init=verbose_init,
68+
skip_to_frame=skip_to_frame, verbose_init=verbose_init,
6869
native_depth_width=native_depth_width,
6970
native_depth_height=native_depth_height,
7071
)

‎media/arkit_ioslogger_snapshot.png

752 KB
Loading

‎options.py

+3
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ class Options():
164164
# tuples
165165
skip_frames: int = None
166166

167+
# skip to a frame in the scan
168+
skip_to_frame: int = None
169+
167170
# point cloud fusion hyperparams.
168171
pc_fusion_z_thresh: float = 0.04
169172
n_consistent_thresh: int = 3

‎pc_fusion.py

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def main(opts):
8484
include_high_res_color=True,
8585
include_full_depth_K=True,
8686
skip_frames=opts.skip_frames,
87+
skip_to_frame=opts.skip_to_frame,
8788
image_width=opts.image_width,
8889
image_height=opts.image_height,
8990
pass_frame_id=True,

‎test.py

+1
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ def main(opts):
234234
),
235235
include_full_depth_K=True,
236236
skip_frames=opts.skip_frames,
237+
skip_to_frame=opts.skip_to_frame,
237238
image_width=opts.image_width,
238239
image_height=opts.image_height,
239240
pass_frame_id=True,

‎utils/visualization_utils.py

+4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ def quick_viz_export(
9797
batch_vmin = cur_data["full_res_depth_b1hw"][valid_mask_b].min()
9898
batch_vmax = cur_data["full_res_depth_b1hw"][valid_mask_b].max()
9999

100+
if batch_vmax == batch_vmin:
101+
batch_vmin = 0.0
102+
batch_vmax = 5.0
103+
100104
for elem_ind in range(outputs["depth_pred_s0_b1hw"].shape[0]):
101105
if "frame_id_string" in cur_data:
102106
frame_id = cur_data["frame_id_string"][elem_ind]

‎visualization_scripts/generate_gt_min_max_cache.py

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def main(opts):
6565
pass_frame_id=True,
6666
include_full_depth_K=False,
6767
skip_frames=opts.skip_frames,
68+
skip_to_frame=opts.skip_to_frame,
6869
)
6970

7071
dataloader = torch.utils.data.DataLoader(

‎visualization_scripts/visualize_scene_depth_output.py

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def main(opts):
108108
include_high_res_color=True,
109109
pass_frame_id=True,
110110
include_full_depth_K=True,
111+
skip_to_frame=opts.skip_to_frame,
111112
)
112113

113114
dataloader = torch.utils.data.DataLoader(

‎visualize_live_meshing.py

+1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def main(opts):
111111
include_high_res_color=opts.fuse_color and opts.run_fusion,
112112
include_full_depth_K=True,
113113
skip_frames=opts.skip_frames,
114+
skip_to_frame=opts.skip_to_frame,
114115
image_width=opts.image_width,
115116
image_height=opts.image_height,
116117
pass_frame_id=True,

0 commit comments

Comments
 (0)
Please sign in to comment.