MCPcopy Create free account
hub / github.com/MAC-VO/MAC-VO / test_matching

Function test_matching

Scripts/UnitTest/test_stereo_depth.py:16–42  ·  view source on GitHub ↗
(config: str)

Source from the content-addressed store, hash-verified

14 [(str(f),) for f in Path("./Scripts/UnitTest/assets/test_module_config/Depth").glob("*.yaml")]
15)
16def test_matching(config: str):
17 cfg, _ = load_config(Path(config))
18 seq = TartanAirV2_StereoSequence(dict(
19 root="./Scripts/UnitTest/assets/test_sequence/TartanAir2_abs_P000",
20 compressed=True,
21 gtFlow=False, gtDepth=True, gtPose=True
22 ))
23
24 frameA = seq[0]
25 stereo_depth = IStereoDepth.instantiate(cfg.type, cfg.args)
26 depth_output = stereo_depth.estimate(frameA.stereo)
27
28 assert depth_output.depth is not None
29 B, C, H, W = seq[0].stereo.imageL.shape
30
31 # Check flow shape validity
32 assert depth_output.depth.shape == torch.Size([B, 1, H, W])
33
34 if depth_output.cov is not None:
35 assert depth_output.cov.shape == torch.Size([B, 1, H, W])
36
37 if depth_output.mask is not None:
38 assert depth_output.mask.shape == torch.Size([B, 1, H, W])
39 assert depth_output.mask.dtype == torch.bool
40
41 del stereo_depth
42 torch.cuda.empty_cache()

Callers

nothing calls this directly

Calls 4

load_configFunction · 0.90
instantiateMethod · 0.80
estimateMethod · 0.45

Tested by

no test coverage detected