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