本文整理汇总了Python中data.base_dataset.BaseDataset方法的典型用法代码示例。如果您正苦于以下问题:Python base_dataset.BaseDataset方法的具体用法?Python base_dataset.BaseDataset怎么用?Python base_dataset.BaseDataset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data.base_dataset
的用法示例。
在下文中一共展示了base_dataset.BaseDataset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find_dataset_using_name
# 需要导入模块: from data import base_dataset [as 别名]
# 或者: from data.base_dataset import BaseDataset [as 别名]
def find_dataset_using_name(dataset_name):
# Given the option --dataset_mode [datasetname],
# the file "data/datasetname_dataset.py"
# will be imported.
dataset_filename = "data." + dataset_name + "_dataset"
datasetlib = importlib.import_module(dataset_filename)
# In the file, the class called DatasetNameDataset() will
# be instantiated. It has to be a subclass of BaseDataset,
# and it is case-insensitive.
dataset = None
target_dataset_name = dataset_name.replace('_', '') + 'dataset'
for name, cls in datasetlib.__dict__.items():
if name.lower() == target_dataset_name.lower() \
and issubclass(cls, BaseDataset):
dataset = cls
if dataset is None:
print("In %s.py, there should be a subclass of BaseDataset with class name that matches %s in lowercase." % (dataset_filename, target_dataset_name))
exit(0)
return dataset
示例2: find_dataset_using_name
# 需要导入模块: from data import base_dataset [as 别名]
# 或者: from data.base_dataset import BaseDataset [as 别名]
def find_dataset_using_name(dataset_name):
# Given the option --dataset_mode [datasetname],
# the file "data/datasetname_dataset.py"
# will be imported.
dataset_filename = "data." + dataset_name + "_dataset"
datasetlib = importlib.import_module(dataset_filename)
# In the file, the class called DatasetNameDataset() will
# be instantiated. It has to be a subclass of BaseDataset,
# and it is case-insensitive.
dataset = None
target_dataset_name = dataset_name.replace('_', '') + 'dataset'
for name, cls in datasetlib.__dict__.items():
if name.lower() == target_dataset_name.lower() \
and issubclass(cls, BaseDataset):
dataset = cls
if dataset is None:
print("In %s.py, there should be a subclass of BaseDataset with class name that matches %s in lowercase." % (dataset_filename, target_dataset_name))
exit(0)
return dataset