easydict,顾名思义,可以很easy地使用dict,在PyPI解释:https://pypi.org/project/easydict/
EasyDict allows to access dict values as attributes (works recursively). A Javascript-like properties dot notation for python dicts.
在FasterRCNN的配置文件 config.py 中第一次见这个用法:
''' config.py '''
from easydict import EasyDict as edict
__C = edict()
cfg = __C
__C.TRAIN = edict() # access dict values as attributes(works recursively)
__C.TRAIN.LEARNING_RATE = 0.001
__C.TEST = edict()
__C.TEST.SCALES = (600,)
print(cfg)
>> {'TRAIN': {'LEARNING_RATE': 0.001}, 'TEST': {'SCALES': [600]}}
这种特性在写配置文件时地区很好用,这样在其他文件调用配置文件中设定的参数时,就会很方便:
from config import cfg