|
a |
|
b/ViTPose/tools/analysis/print_config.py |
|
|
1 |
# Copyright (c) OpenMMLab. All rights reserved. |
|
|
2 |
import argparse |
|
|
3 |
|
|
|
4 |
from mmcv import Config, DictAction |
|
|
5 |
|
|
|
6 |
|
|
|
7 |
def parse_args(): |
|
|
8 |
parser = argparse.ArgumentParser(description='Print the whole config') |
|
|
9 |
parser.add_argument('config', help='config file path') |
|
|
10 |
parser.add_argument( |
|
|
11 |
'--options', nargs='+', action=DictAction, help='arguments in dict') |
|
|
12 |
args = parser.parse_args() |
|
|
13 |
|
|
|
14 |
return args |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
def main(): |
|
|
18 |
args = parse_args() |
|
|
19 |
|
|
|
20 |
cfg = Config.fromfile(args.config) |
|
|
21 |
if args.options is not None: |
|
|
22 |
cfg.merge_from_dict(args.options) |
|
|
23 |
print(f'Config:\n{cfg.pretty_text}') |
|
|
24 |
|
|
|
25 |
|
|
|
26 |
if __name__ == '__main__': |
|
|
27 |
main() |