MCPcopy Create free account
hub / github.com/ADLab-AutoDrive/BEVFusion / test_single_gpu_test

Function test_single_gpu_test

tests/test_runtime/test_apis.py:98–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

96
97
98def test_single_gpu_test():
99 if not torch.cuda.is_available():
100 pytest.skip('test requires GPU and torch+cuda')
101 cfg = _get_config_module('votenet/votenet_16x8_sunrgbd-3d-10class.py')
102 cfg.model.train_cfg = None
103 model = build_detector(cfg.model, test_cfg=cfg.get('test_cfg'))
104 dataset_cfg = cfg.data.test
105 dataset_cfg.data_root = './tests/data/sunrgbd'
106 dataset_cfg.ann_file = 'tests/data/sunrgbd/sunrgbd_infos.pkl'
107 dataset = build_dataset(dataset_cfg)
108 data_loader = build_dataloader(
109 dataset,
110 samples_per_gpu=1,
111 workers_per_gpu=cfg.data.workers_per_gpu,
112 dist=False,
113 shuffle=False)
114 model = MMDataParallel(model, device_ids=[0])
115 results = single_gpu_test(model, data_loader)
116 bboxes_3d = results[0]['boxes_3d']
117 scores_3d = results[0]['scores_3d']
118 labels_3d = results[0]['labels_3d']
119 assert bboxes_3d.tensor.shape[0] >= 0
120 assert bboxes_3d.tensor.shape[1] == 7
121 assert scores_3d.shape[0] >= 0
122 assert labels_3d.shape[0] >= 0

Callers

nothing calls this directly

Calls 5

build_detectorFunction · 0.90
build_datasetFunction · 0.90
build_dataloaderFunction · 0.90
single_gpu_testFunction · 0.90
_get_config_moduleFunction · 0.70

Tested by

no test coverage detected