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