MCPcopy Create free account
hub / github.com/YXB-NKU/Strip-R-CNN / parse_args

Function parse_args

tools/analysis_tools/benchmark.py:18–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17
18def parse_args():
19 parser = argparse.ArgumentParser(description='mmrotate benchmark a model')
20 parser.add_argument('config', help='test config file path')
21 parser.add_argument('checkpoint', help='checkpoint file')
22 parser.add_argument(
23 '--repeat-num',
24 type=int,
25 default=1,
26 help='number of repeat times of measurement for averaging the results')
27 parser.add_argument(
28 '--max-iter', type=int, default=2000, help='num of max iter')
29 parser.add_argument(
30 '--log-interval', type=int, default=50, help='interval of logging')
31 parser.add_argument(
32 '--fuse-conv-bn',
33 action='store_true',
34 help='Whether to fuse conv and bn, this will slightly increase'
35 'the inference speed')
36 parser.add_argument(
37 '--use-fp16',
38 action='store_true',
39 help='Whether to use fp16 to inference')
40 parser.add_argument(
41 '--cfg-options',
42 nargs='+',
43 action=DictAction,
44 help='override some settings in the used config, the key-value pair '
45 'in xxx=yyy format will be merged into config file. If the value to '
46 'be overwritten is a list, it should be like key="[a,b]" or key=a,b '
47 'It also allows nested list/tuple values, e.g. key="[(a,b),(c,d)]" '
48 'Note that the quotation marks are necessary and that no white space '
49 'is allowed.')
50 parser.add_argument(
51 '--launcher',
52 choices=['none', 'pytorch', 'slurm', 'mpi'],
53 default='none',
54 help='job launcher')
55 parser.add_argument('--local_rank', type=int, default=0)
56 args = parser.parse_args()
57 if 'LOCAL_RANK' not in os.environ:
58 os.environ['LOCAL_RANK'] = str(args.local_rank)
59 return args
60
61
62def measure_inference_speed(cfg, checkpoint, max_iter, log_interval,

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected