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

Function benchmark_data

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

Source from the content-addressed store, hash-verified

42
43
44def benchmark_data(args):
45 cfg = setup(args)
46
47 timer = Timer()
48 dataloader = build_detection_train_loader(cfg)
49 logger.info("Initialize loader using {} seconds.".format(timer.seconds()))
50
51 timer.reset()
52 itr = iter(dataloader)
53 for i in range(10): # warmup
54 next(itr)
55 if i == 0:
56 startup_time = timer.seconds()
57 timer = Timer()
58 max_iter = 1000
59 for _ in tqdm.trange(max_iter):
60 next(itr)
61 logger.info(
62 "{} iters ({} images) in {} seconds.".format(
63 max_iter, max_iter * cfg.SOLVER.IMS_PER_BATCH, timer.seconds()
64 )
65 )
66 logger.info("Startup time: {} seconds".format(startup_time))
67 vram = psutil.virtual_memory()
68 logger.info(
69 "RAM Usage: {:.2f}/{:.2f} GB".format(
70 (vram.total - vram.available) / 1024 ** 3, vram.total / 1024 ** 3
71 )
72 )
73
74 # test for a few more rounds
75 for _ in range(10):
76 timer = Timer()
77 max_iter = 1000
78 for _ in tqdm.trange(max_iter):
79 next(itr)
80 logger.info(
81 "{} iters ({} images) in {} seconds.".format(
82 max_iter, max_iter * cfg.SOLVER.IMS_PER_BATCH, timer.seconds()
83 )
84 )
85
86
87def benchmark_train(args):

Callers

nothing calls this directly

Calls 3

setupFunction · 0.70
resetMethod · 0.45

Tested by

no test coverage detected