本文整理匯總了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