本文整理汇总了Python中mmdet.utils.build_from_cfg方法的典型用法代码示例。如果您正苦于以下问题:Python utils.build_from_cfg方法的具体用法?Python utils.build_from_cfg怎么用?Python utils.build_from_cfg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mmdet.utils
的用法示例。
在下文中一共展示了utils.build_from_cfg方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build
# 需要导入模块: from mmdet import utils [as 别名]
# 或者: from mmdet.utils import build_from_cfg [as 别名]
def build(cfg, registry, default_args=None):
if isinstance(cfg, list):
modules = [
build_from_cfg(cfg_, registry, default_args) for cfg_ in cfg
]
return nn.Sequential(*modules)
else:
return build_from_cfg(cfg, registry, default_args)
示例2: build_dataset
# 需要导入模块: from mmdet import utils [as 别名]
# 或者: from mmdet.utils import build_from_cfg [as 别名]
def build_dataset(cfg):
if cfg['type'] == 'RepeatDataset':
dataset = RepeatDataset(build_dataset(cfg['dataset']), cfg['times'])
elif isinstance(cfg['ann_file'], (list, tuple)):
dataset = _concat_dataset(cfg)
else:
dataset = build_from_cfg(cfg, DATASETS)
# ipdb.set_trace(context=35)
return dataset
示例3: build_dataset
# 需要导入模块: from mmdet import utils [as 别名]
# 或者: from mmdet.utils import build_from_cfg [as 别名]
def build_dataset(cfg, default_args=None):
if isinstance(cfg, (list, tuple)):
dataset = ConcatDataset([build_dataset(c, default_args) for c in cfg])
elif cfg['type'] == 'RepeatDataset':
dataset = RepeatDataset(
build_dataset(cfg['dataset'], default_args), cfg['times'])
elif isinstance(cfg['ann_file'], (list, tuple)):
dataset = _concat_dataset(cfg, default_args)
else:
dataset = build_from_cfg(cfg, DATASETS, default_args)
return dataset
示例4: __init__
# 需要导入模块: from mmdet import utils [as 别名]
# 或者: from mmdet.utils import build_from_cfg [as 别名]
def __init__(self, transforms):
assert isinstance(transforms, collections.abc.Sequence)
self.transforms = []
for transform in transforms:
if isinstance(transform, dict):
transform = build_from_cfg(transform, PIPELINES)
self.transforms.append(transform)
elif callable(transform):
self.transforms.append(transform)
else:
raise TypeError('transform must be callable or a dict')
示例5: build_dataset
# 需要导入模块: from mmdet import utils [as 别名]
# 或者: from mmdet.utils import build_from_cfg [as 别名]
def build_dataset(cfg):
if cfg['type'] == 'RepeatDataset':
dataset = RepeatDataset(build_dataset(cfg['dataset']), cfg['times'])
elif isinstance(cfg['ann_file'], (list, tuple)):
dataset = _concat_dataset(cfg)
else:
dataset = build_from_cfg(cfg, DATASETS)
return dataset