MMDetection3D代码学习笔记——Config文件学习

MMDetection3D代码学习笔记——Config文件学习

1.Config文件的作用

config在MMDetection3D系列中是作为配置文件与配置文件工具使用,它支持大多数常见的配置文件的格式,如python/json/yaml。它的接口与dict对象相同,同时也允许以属性的方式访问配置参数。

2.Config在代码具体使用实例

    Example:
        >>> cfg = Config(dict(a=1, b=dict(b1=[0, 1])))
        >>> cfg.a
        1
        >>> cfg.b
        {
    
    'b1': [0, 1]}
        >>> cfg.b.b1
        [0, 1]
        >>> cfg = Config.fromfile('tests/data/config/a.py')
        >>> cfg.filename
        "/home/kchen/projects/mmcv/tests/data/config/a.py"
        >>> cfg.item4
        'test'
        >>> cfg
        "Config [path: /home/kchen/projects/mmcv/tests/data/config/a.py]: "
        "{'item1': [1, 2], 'item2': {'a': 0}, 'item3': True, 'item4': 'test'}"

猜你喜欢

转载自blog.csdn.net/m0_45388819/article/details/109909703