本文整理汇总了Python中data.DataProvider.get_instance方法的典型用法代码示例。如果您正苦于以下问题:Python DataProvider.get_instance方法的具体用法?Python DataProvider.get_instance怎么用?Python DataProvider.get_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data.DataProvider
的用法示例。
在下文中一共展示了DataProvider.get_instance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_data_providers
# 需要导入模块: from data import DataProvider [as 别名]
# 或者: from data.DataProvider import get_instance [as 别名]
def init_data_providers(self):
self.dp_params['convnet'] = self # dp aka dataprovider
try:
self.test_data_provider = DataProvider.get_instance(self.data_path, self.test_batch_range,
type=self.dp_type, dp_params=self.dp_params, test=True)
self.train_data_provider = DataProvider.get_instance(self.data_path, self.train_batch_range,
self.model_state["epoch"], self.model_state["batchnum"],
type=self.dp_type, dp_params=self.dp_params, test=False)
except DataProviderException, e:
print "Unable to create data provider: %s" % e
self.print_data_providers()
sys.exit()
示例2: init_data_providers
# 需要导入模块: from data import DataProvider [as 别名]
# 或者: from data.DataProvider import get_instance [as 别名]
def init_data_providers(self):
self.dp_params['convnet'] = self
self.dp_params['PCA_pixel_alter'] = self.PCA_pixel_alter
self.dp_params['regress_L_channel_only'] = self.regress_L_channel_only
self.dp_params['use_local_context_ftr'] = self.use_local_context_ftr
self.dp_params['use_local_context_color_ftr'] = self.use_local_context_color_ftr
if hasattr(self,'use_position_ftr'):
self.dp_params['use_position_ftr'] = self.use_position_ftr
try:
self.test_data_provider = DataProvider.get_instance(self.libmodel, self.data_path, self.test_batch_range,
type=self.dp_type, dp_params=self.dp_params, test=DataProvider.DP_TEST)
self.train_data_provider = DataProvider.get_instance(self.libmodel, self.data_path, self.train_batch_range,
self.model_state["epoch"], self.model_state["batch_idx"],
self.model_state["epochBatchPerm"],
type=self.dp_type, dp_params=self.dp_params, test=DataProvider.DP_TRAIN)
except DataProviderException, e:
print "Unable to create data provider: %s" % e
self.print_data_providers()
sys.exit()
示例3: init_data_providers
# 需要导入模块: from data import DataProvider [as 别名]
# 或者: from data.DataProvider import get_instance [as 别名]
def init_data_providers(self):
self.dp_params['convnet'] = self
self.dp_params['imgprovider'] = self.img_provider_file
try:
self.test_data_provider = DataProvider.get_instance(self.data_path_test, self.test_batch_range,
type=self.dp_type_test, dp_params=self.dp_params, test=True)
if not self.test_only:
self.train_data_provider = DataProvider.get_instance(self.data_path_train, self.train_batch_range,
self.model_state["epoch"], self.model_state["batchnum"],
type=self.dp_type_train, dp_params=self.dp_params, test=False)
self.test_batch_range = self.test_data_provider.batch_range
print "Test data provider: ", len(self.test_batch_range), " batches "
if not self.test_only:
self.train_batch_range = self.train_data_provider.batch_range
print "Training data provider: ", len(self.train_batch_range), " batches "
except DataProviderException, e:
print "Unable to create data provider: %s" % e
self.print_data_providers()
sys.exit()
示例4: init_data_providers
# 需要导入模块: from data import DataProvider [as 别名]
# 或者: from data.DataProvider import get_instance [as 别名]
def init_data_providers(self):
class Dummy:
def advance_batch(self):
pass
if self.need_gpu:
ConvNet.init_data_providers(self)
if self.op.get_value("write_features_pred") or self.op.get_value("show_preds") == 2:
self.pred_data_provider = DataProvider.get_instance(self.libmodel, self.data_path, self.pred_batch_range,
type=self.dp_type, dp_params=self.dp_params, test=DataProvider.DP_PREDICT)
else:
self.train_data_provider = self.test_data_provider = Dummy()
示例5: init_data_providers
# 需要导入模块: from data import DataProvider [as 别名]
# 或者: from data.DataProvider import get_instance [as 别名]
def init_data_providers(self):
self.dp_params['convnet'] = self
self.dp_params['imgprovider'] = self.img_provider_file
try:
if self.need_gpu:
self.test_data_provider = DataProvider.get_instance(self.data_path_test, self.test_batch_range,
type=self.dp_type_test, dp_params=self.dp_params, test=True)
self.test_batch_range = self.test_data_provider.batch_range
except Exception, e:
print "Unable to create data provider: %s" % e
self.print_data_providers()
sys.exit()