File size: 1,007 Bytes
3446cc1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # nuScenes dev-kit.
# Code written by Holger Caesar, 2019.
import json
import os
from nuscenes.eval.detection.data_classes import DetectionConfig
def config_factory(configuration_name: str) -> DetectionConfig:
"""
Creates a DetectionConfig instance that can be used to initialize a NuScenesEval instance.
Note that this only works if the config file is located in the nuscenes/eval/detection/configs folder.
:param configuration_name: Name of desired configuration in eval_detection_configs.
:return: DetectionConfig instance.
"""
# Check if config exists.
this_dir = os.path.dirname(os.path.abspath(__file__))
cfg_path = os.path.join(this_dir, 'configs', '%s.json' % configuration_name)
assert os.path.exists(cfg_path), \
'Requested unknown configuration {}'.format(configuration_name)
# Load config file and deserialize it.
with open(cfg_path, 'r') as f:
data = json.load(f)
cfg = DetectionConfig.deserialize(data)
return cfg
|