-
Notifications
You must be signed in to change notification settings - Fork 50
/
eval_roma_outdoor.py
57 lines (48 loc) · 3.17 KB
/
eval_roma_outdoor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import json
from romatch.benchmarks import MegadepthDenseBenchmark
from romatch.benchmarks import MegaDepthPoseEstimationBenchmark, HpatchesHomogBenchmark
from romatch.benchmarks import Mega1500PoseLibBenchmark
def test_mega_8_scenes(model, name):
mega_8_scenes_benchmark = MegaDepthPoseEstimationBenchmark("data/megadepth",
scene_names=['mega_8_scenes_0019_0.1_0.3.npz',
'mega_8_scenes_0025_0.1_0.3.npz',
'mega_8_scenes_0021_0.1_0.3.npz',
'mega_8_scenes_0008_0.1_0.3.npz',
'mega_8_scenes_0032_0.1_0.3.npz',
'mega_8_scenes_1589_0.1_0.3.npz',
'mega_8_scenes_0063_0.1_0.3.npz',
'mega_8_scenes_0024_0.1_0.3.npz',
'mega_8_scenes_0019_0.3_0.5.npz',
'mega_8_scenes_0025_0.3_0.5.npz',
'mega_8_scenes_0021_0.3_0.5.npz',
'mega_8_scenes_0008_0.3_0.5.npz',
'mega_8_scenes_0032_0.3_0.5.npz',
'mega_8_scenes_1589_0.3_0.5.npz',
'mega_8_scenes_0063_0.3_0.5.npz',
'mega_8_scenes_0024_0.3_0.5.npz'])
mega_8_scenes_results = mega_8_scenes_benchmark.benchmark(model, model_name=name)
print(mega_8_scenes_results)
json.dump(mega_8_scenes_results, open(f"results/mega_8_scenes_{name}.json", "w"))
def test_mega1500(model, name):
mega1500_benchmark = MegaDepthPoseEstimationBenchmark("data/megadepth")
mega1500_results = mega1500_benchmark.benchmark(model, model_name=name)
json.dump(mega1500_results, open(f"results/mega1500_{name}.json", "w"))
def test_mega1500_poselib(model, name):
mega1500_benchmark = Mega1500PoseLibBenchmark("data/megadepth")
mega1500_results = mega1500_benchmark.benchmark(model, model_name=name)
json.dump(mega1500_results, open(f"results/mega1500_{name}.json", "w"))
def test_mega_dense(model, name):
megadense_benchmark = MegadepthDenseBenchmark("data/megadepth", num_samples = 1000)
megadense_results = megadense_benchmark.benchmark(model)
json.dump(megadense_results, open(f"results/mega_dense_{name}.json", "w"))
def test_hpatches(model, name):
hpatches_benchmark = HpatchesHomogBenchmark("data/hpatches")
hpatches_results = hpatches_benchmark.benchmark(model)
json.dump(hpatches_results, open(f"results/hpatches_{name}.json", "w"))
if __name__ == "__main__":
from romatch import roma_outdoor
device = "cuda"
model = roma_outdoor(device = device, coarse_res = 672, upsample_res = 1344)
experiment_name = "roma_latest"
test_mega1500(model, experiment_name)
#test_mega1500_poselib(model, experiment_name)