未验证 提交 9c11ddca 编写于 作者: F Felix 提交者: GitHub

Update __init__.py

上级 b0708e6e
......@@ -24,31 +24,13 @@ from . import samplers
# dataset
from .datasets.imagenet_dataset import ImageNetDataset
from .dataset.multilabel_dataset import MultiLabelDataset
from .datasets.common_dataset import create_operators
# sampler
from .samplers import DistributedRandomIdentitySampler
from .preprocess import transform
def create_operators(params):
"""
create operators based on the config
Args:
params(list): a dict list, used to create some operators
"""
assert isinstance(params, list), ('operator config should be a list')
ops = []
for operator in params:
print(operator)
assert isinstance(operator,
dict) and len(operator) == 1, "yaml format error"
op_name = list(operator)[0]
param = {} if operator[op_name] is None else operator[op_name]
op = getattr(preprocess, op_name)(**param)
ops.append(op)
return ops
def build_dataloader(config, mode, device, seed=None):
assert mode in ['Train', 'Eval', 'Test'], "Mode should be Train, Eval or Test."
# build dataset
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册