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

Function test_frontend

Scripts/UnitTest/test_frontend.py:16–50  ·  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/Frontend").glob("*.yaml")]
15)
16def test_frontend(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=True, gtDepth=False, gtPose=True,
22 ))
23
24 frameA, frameB = seq[0], seq[1]
25 frontend = IFrontend.instantiate(cfg.type, cfg.args)
26 depth_output, flow_output = frontend.estimate_pair(frameA.stereo, frameB.stereo)
27 B, C, H, W = seq[0].stereo.imageL.shape
28
29 # Depth shape validity
30 assert depth_output.depth.shape == torch.Size([B, 1, H, W])
31
32 if depth_output.cov is not None:
33 assert depth_output.cov.shape == torch.Size([B, 1, H, W])
34
35 if depth_output.mask is not None:
36 assert depth_output.mask.shape == torch.Size([B, 1, H, W])
37 assert depth_output.mask.dtype == torch.bool
38
39 # Flow shape validity
40 assert flow_output.flow.shape == torch.Size([B, 2, H, W])
41
42 if flow_output.cov is not None:
43 assert flow_output.cov.shape == torch.Size([B, 3, H, W])
44
45 if flow_output.mask is not None:
46 assert flow_output.mask.shape == torch.Size([B, 1, H, W])
47 assert flow_output.mask.dtype == torch.bool
48
49 del frontend
50 torch.cuda.empty_cache()

Callers

nothing calls this directly

Calls 4

load_configFunction · 0.90
instantiateMethod · 0.80
estimate_pairMethod · 0.45

Tested by

no test coverage detected