本文整理匯總了Python中util.log.warning方法的典型用法代碼示例。如果您正苦於以下問題:Python log.warning方法的具體用法?Python log.warning怎麽用?Python log.warning使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類util.log
的用法示例。
在下文中一共展示了log.warning方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', type=int, default=16)
parser.add_argument('--checkpoint_path', type=str)
parser.add_argument('--train_dir', type=str)
parser.add_argument('--dataset', type=str, default='ImageNet', choices=['ImageNet'])
parser.add_argument('--data_id', nargs='*', default=None)
config = parser.parse_args()
if config.dataset == 'ImageNet':
import datasets.ImageNet as dataset
else:
raise ValueError(config.dataset)
_, dataset = dataset.create_default_splits(ratio=0.999)
image, _, label, _ = dataset.get_data(dataset.ids[0], dataset.ids[0])
config.data_info = np.concatenate([np.asarray(image.shape), np.asarray(label.shape)])
evaler = Evaler(config, dataset)
log.warning("dataset: %s", dataset)
evaler.eval_run()
示例2: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
config, model, dataset_train, dataset_test = argparser(is_train=False)
evaler = Evaler(config, model, dataset_test)
log.warning("dataset: %s", config.dataset)
evaler.eval_run()
示例3: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
config, model, dataset_train, dataset_test = argparser(is_train=True)
trainer = Trainer(config, model, dataset_train, dataset_test)
log.warning("dataset: %s, learning_rate_g: %f, learning_rate_d: %f",
config.dataset, config.learning_rate_g, config.learning_rate_d)
trainer.train()
示例4: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', type=int, default=256)
parser.add_argument('--prefix', type=str, default='default')
parser.add_argument('--checkpoint_path', type=str, default=None)
parser.add_argument('--train_dir', type=str)
parser.add_argument('--dataset', type=str, default='MNIST', choices=['MNIST', 'SVHN', 'CIFAR10'])
parser.add_argument('--reconstruct', action='store_true', default=False)
parser.add_argument('--generate', action='store_true', default=False)
parser.add_argument('--interpolate', action='store_true', default=False)
parser.add_argument('--data_id', nargs='*', default=None)
config = parser.parse_args()
if config.dataset == 'MNIST':
import datasets.mnist as dataset
elif config.dataset == 'SVHN':
import datasets.svhn as dataset
elif config.dataset == 'CIFAR10':
import datasets.cifar10 as dataset
else:
raise ValueError(config.dataset)
config.conv_info = dataset.get_conv_info()
config.deconv_info = dataset.get_deconv_info()
dataset_train, dataset_test = dataset.create_default_splits()
m, l = dataset_train.get_data(dataset_train.ids[0])
config.data_info = np.concatenate([np.asarray(m.shape), np.asarray(l.shape)])
evaler = Evaler(config, dataset_test, dataset_train)
log.warning("dataset: %s", config.dataset)
evaler.eval_run()
示例5: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', type=int, default=16)
parser.add_argument('--prefix', type=str, default='default')
parser.add_argument('--checkpoint', type=str, default=None)
parser.add_argument('--dataset', type=str, default='MNIST', choices=['MNIST', 'SVHN', 'CIFAR10'])
parser.add_argument('--learning_rate', type=float, default=1e-4)
parser.add_argument('--alpha', type=float, default=1.0)
parser.add_argument('--lr_weight_decay', action='store_true', default=False)
parser.add_argument('--dump_result', action='store_true', default=False)
config = parser.parse_args()
if config.dataset == 'MNIST':
import datasets.mnist as dataset
elif config.dataset == 'SVHN':
import datasets.svhn as dataset
elif config.dataset == 'CIFAR10':
import datasets.cifar10 as dataset
else:
raise ValueError(config.dataset)
config.conv_info = dataset.get_conv_info()
config.deconv_info = dataset.get_deconv_info()
dataset_train, dataset_test = dataset.create_default_splits()
m, l = dataset_train.get_data(dataset_train.ids[0])
config.data_info = np.concatenate([np.asarray(m.shape), np.asarray(l.shape)])
trainer = Trainer(config,
dataset_train, dataset_test)
log.warning("dataset: %s, learning_rate: %f",
config.dataset, config.learning_rate)
trainer.train(dataset_train)
示例6: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', type=int, default=16)
parser.add_argument('--prefix', type=str, default='default')
parser.add_argument('--checkpoint', type=str, default=None)
parser.add_argument('--dataset', type=str, default='ImageNet', choices=['ImageNet'])
parser.add_argument('--learning_rate', type=float, default=1e-4)
parser.add_argument('--lr_weight_decay', action='store_true', default=False)
config = parser.parse_args()
if config.dataset == 'ImageNet':
import datasets.ImageNet as dataset
elif config.dataset == 'SVHN':
import datasets.svhn as dataset
elif config.dataset == 'CIFAR10':
import datasets.cifar10 as dataset
else:
raise ValueError(config.dataset)
dataset_train, dataset_test = dataset.create_default_splits()
image, _, label, _ = dataset_train.get_data(dataset_train.ids[0], dataset_train.ids[0])
config.data_info = np.concatenate([np.asarray(image.shape), np.asarray(label.shape)])
trainer = Trainer(config,
dataset_train, dataset_test)
log.warning("dataset: %s, learning_rate: %f",
config.dataset, config.learning_rate)
trainer.train(dataset_train)
示例7: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', type=int, default=16)
parser.add_argument('--prefix', type=str, default='default')
parser.add_argument('--checkpoint', type=str)
parser.add_argument('--dataset', type=str, default='ImageNet', choices=['ImageNet'])
parser.add_argument('--learning_rate', type=float, default=1e-4)
parser.add_argument('--lr_weight_decay', action='store_true', default=False)
config = parser.parse_args()
if config.dataset == 'ImageNet':
import datasets.ImageNet as dataset
else:
raise ValueError(config.dataset)
if not config.checkpoint:
raise ValueError('Please specify a valid checkpoint: {}'.format(config.checkpoint))
dataset_train, dataset_test = dataset.create_default_splits()
image, _, label, _ = dataset_train.get_data(dataset_train.ids[0], dataset_train.ids[0])
config.data_info = np.concatenate([np.asarray(image.shape), np.asarray(label.shape)])
trainer = Trainer(config,
dataset_train, dataset_test)
log.warning("dataset: %s, learning_rate: %f",
config.dataset, config.learning_rate)
trainer.train(dataset_train)
示例8: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
config, model, _, dataset_test = argparser(is_train=False)
evaler = Evaler(config, model, dataset_test)
log.warning("dataset: %s", config.dataset)
evaler.eval_run()
示例9: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
config, model, dataset_train, dataset_test = argparser(is_train=False)
trainer = Trainer(config, model, dataset_train, dataset_test)
log.warning("dataset: %s", config.dataset)
trainer.train()
示例10: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', type=int, default=64)
parser.add_argument('--prefix', type=str, default='default')
parser.add_argument('--checkpoint', type=str, default=None)
parser.add_argument('--dataset', type=str, default='MNIST', choices=['MNIST', 'SVHN', 'CIFAR10'])
parser.add_argument('--learning_rate', type=float, default=1e-4)
parser.add_argument('--lr_weight_decay', action='store_true', default=False)
parser.add_argument('--activation', type=str, default='selu', choices=['relu', 'lrelu', 'selu'])
config = parser.parse_args()
if config.dataset == 'MNIST':
import datasets.mnist as dataset
elif config.dataset == 'SVHN':
import datasets.svhn as dataset
elif config.dataset == 'CIFAR10':
import datasets.cifar10 as dataset
else:
raise ValueError(config.dataset)
config.data_info = dataset.get_data_info()
config.conv_info = dataset.get_conv_info()
config.visualize_shape = dataset.get_vis_info()
dataset_train, dataset_test = dataset.create_default_splits()
trainer = Trainer(config,
dataset_train, dataset_test)
log.warning("dataset: %s, learning_rate: %f", config.dataset, config.learning_rate)
trainer.train()
示例11: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', type=int, default=50)
parser.add_argument('--model', type=str, default='conv', choices=['rn', 'baseline'])
parser.add_argument('--checkpoint_path', type=str)
parser.add_argument('--train_dir', type=str)
parser.add_argument('--dataset_path', type=str, default='Sort-of-CLEVR_default')
parser.add_argument('--data_id', nargs='*', default=None)
config = parser.parse_args()
path = os.path.join('./datasets', config.dataset_path)
if check_data_path(path):
import sort_of_clevr as dataset
else:
raise ValueError(path)
config.data_info = dataset.get_data_info()
config.conv_info = dataset.get_conv_info()
dataset_train, dataset_test = dataset.create_default_splits(path)
evaler = Evaler(config, dataset_test)
log.warning("dataset: %s", config.dataset_path)
evaler.eval_run()
示例12: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', type=int, default=16)
parser.add_argument('--model', type=str, default='rn', choices=['rn', 'baseline'])
parser.add_argument('--prefix', type=str, default='default')
parser.add_argument('--checkpoint', type=str, default=None)
parser.add_argument('--dataset_path', type=str, default='Sort-of-CLEVR_default')
parser.add_argument('--learning_rate', type=float, default=2.5e-4)
parser.add_argument('--lr_weight_decay', action='store_true', default=False)
config = parser.parse_args()
path = os.path.join('./datasets', config.dataset_path)
if check_data_path(path):
import sort_of_clevr as dataset
else:
raise ValueError(path)
config.data_info = dataset.get_data_info()
config.conv_info = dataset.get_conv_info()
dataset_train, dataset_test = dataset.create_default_splits(path)
trainer = Trainer(config,
dataset_train, dataset_test)
log.warning("dataset: %s, learning_rate: %f",
config.dataset_path, config.learning_rate)
trainer.train()
示例13: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', type=int, default=64)
parser.add_argument('--output_file', type=str, default=None)
parser.add_argument('--checkpoint_path', type=str)
parser.add_argument('--train_dir', type=str)
parser.add_argument('--dataset', type=str, default='CIFAR10', choices=['MNIST', 'Fashion', 'SVHN', 'CIFAR10'])
parser.add_argument('--max_steps', type=int, default=1)
config = parser.parse_args()
if config.dataset == 'mnist':
import datasets.mnist as dataset
elif config.dataset == 'Fashion':
import datasets.fashion_mnist as dataset
elif config.dataset == 'SVHN':
import datasets.svhn as dataset
elif config.dataset == 'CIFAR10':
import datasets.cifar10 as dataset
else:
raise ValueError(config.dataset)
config.data_info = dataset.get_data_info()
config.conv_info = dataset.get_conv_info()
config.deconv_info = dataset.get_deconv_info()
dataset_train, dataset_test = dataset.create_default_splits()
evaler = Evaler(config, dataset_test)
log.warning("dataset: %s", config.dataset)
evaler.eval_run()
示例14: main
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def main():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', type=int, default=64)
parser.add_argument('--prefix', type=str, default='default')
parser.add_argument('--checkpoint', type=str, default=None)
parser.add_argument('--dataset', type=str, default='CIFAR10',
choices=['MNIST', 'Fashion', 'SVHN', 'CIFAR10'])
parser.add_argument('--learning_rate', type=float, default=1e-4)
parser.add_argument('--update_rate', type=int, default=5)
parser.add_argument('--lr_weight_decay', action='store_true', default=False)
config = parser.parse_args()
if config.dataset == 'MNIST':
import datasets.mnist as dataset
elif config.dataset == 'Fashion':
import datasets.fashion_mnist as dataset
elif config.dataset == 'SVHN':
import datasets.svhn as dataset
elif config.dataset == 'CIFAR10':
import datasets.cifar10 as dataset
else:
raise ValueError(config.dataset)
config.data_info = dataset.get_data_info()
config.conv_info = dataset.get_conv_info()
config.deconv_info = dataset.get_deconv_info()
dataset_train, dataset_test = dataset.create_default_splits()
trainer = Trainer(config,
dataset_train, dataset_test)
log.warning("dataset: %s, learning_rate: %f", config.dataset, config.learning_rate)
trainer.train()
示例15: eval_run
# 需要導入模塊: from util import log [as 別名]
# 或者: from util.log import warning [as 別名]
def eval_run(self):
# load checkpoint
if self.checkpoint_path:
self.saver.restore(self.session, self.checkpoint_path)
log.info("Loaded from checkpoint!")
log.infov("Start Inference and Evaluation")
log.info("# of testing examples = %d", len(self.dataset))
length_dataset = len(self.dataset)
max_steps = int(length_dataset / self.batch_size) + 1
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(self.session,
coord=coord, start=True)
evaler = EvalManager()
if not (self.config.interpolate or self.config.generate or self.config.reconstruct):
raise ValueError('Please specify at least one task by indicating' +
'--reconstruct, --generate, or --interpolate.')
return
if self.config.reconstruct:
try:
for s in xrange(max_steps):
step, loss, step_time, batch_chunk, prediction_pred, prediction_gt = \
self.run_single_step(self.batch)
self.log_step_message(s, loss, step_time)
evaler.add_batch(batch_chunk['id'], prediction_pred, prediction_gt)
except Exception as e:
coord.request_stop(e)
evaler.report()
log.warning('Completed reconstruction.')
if self.config.generate:
x = self.generator(self.batch_size)
img = self.image_grid(x)
imageio.imwrite('generate_{}.png'.format(self.config.prefix), img)
log.warning('Completed generation. Generated samples are save' +
'as generate_{}.png'.format(self.config.prefix))
if self.config.interpolate:
x = self.interpolator(self.dataset_train, self.batch_size)
img = self.image_grid(x)
imageio.imwrite('interpolate_{}.png'.format(self.config.prefix), img)
log.warning('Completed interpolation. Interpolated samples are save' +
'as interpolate_{}.png'.format(self.config.prefix))
coord.request_stop()
try:
coord.join(threads, stop_grace_period_secs=3)
except RuntimeError as e:
log.warn(str(e))
log.infov("Completed evaluation.")