MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / benchmark_eval

Function benchmark_eval

tools/benchmark.py:123–150  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

121
122@torch.no_grad()
123def benchmark_eval(args):
124 cfg = setup(args)
125 model = build_model(cfg)
126 model.eval()
127 logger.info("Model:\n{}".format(model))
128 DetectionCheckpointer(model).load(cfg.MODEL.WEIGHTS)
129
130 cfg.defrost()
131 cfg.DATALOADER.NUM_WORKERS = 0
132 data_loader = build_detection_test_loader(cfg, cfg.DATASETS.TEST[0])
133 dummy_data = list(itertools.islice(data_loader, 100))
134
135 def f():
136 while True:
137 yield from DatasetFromList(dummy_data, copy=False)
138
139 for _ in range(5): # warmup
140 model(dummy_data[0])
141
142 max_iter = 400
143 timer = Timer()
144 with tqdm.tqdm(total=max_iter) as pbar:
145 for idx, d in enumerate(f()):
146 if idx == max_iter:
147 break
148 model(d)
149 pbar.update()
150 logger.info("{} iters in {} seconds.".format(max_iter, timer.seconds()))
151
152
153if __name__ == "__main__":

Callers

nothing calls this directly

Calls 7

build_modelFunction · 0.90
fFunction · 0.85
loadMethod · 0.80
setupFunction · 0.70
updateMethod · 0.45

Tested by

no test coverage detected