本文整理匯總了Python中utils.util.GetFilesRecursively方法的典型用法代碼示例。如果您正苦於以下問題:Python util.GetFilesRecursively方法的具體用法?Python util.GetFilesRecursively怎麽用?Python util.GetFilesRecursively使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類utils.util
的用法示例。
在下文中一共展示了util.GetFilesRecursively方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from utils import util [as 別名]
# 或者: from utils.util import GetFilesRecursively [as 別名]
def main(_):
# Parse config dict from yaml config files / command line flags.
config = util.ParseConfigsToLuaTable(FLAGS.config_paths, FLAGS.model_params)
num_views = config.data.num_views
validation_records = util.GetFilesRecursively(config.data.validation)
batch_size = config.data.batch_size
checkpointdir = FLAGS.checkpointdir
# If evaluating a specific checkpoint, do that.
if FLAGS.checkpoint_iter:
checkpoint_path = os.path.join(
'%s/model.ckpt-%s' % (checkpointdir, FLAGS.checkpoint_iter))
evaluate_once(
config, checkpointdir, validation_records, checkpoint_path, batch_size,
num_views)
else:
for checkpoint_path in tf.contrib.training.checkpoints_iterator(
checkpointdir):
evaluate_once(
config, checkpointdir, validation_records, checkpoint_path,
batch_size, num_views)
示例2: evaluate
# 需要導入模塊: from utils import util [as 別名]
# 或者: from utils.util import GetFilesRecursively [as 別名]
def evaluate(self):
"""Runs `Estimator` validation.
"""
config = self._config
# Get a list of validation tfrecords.
validation_dir = config.data.validation
validation_records = util.GetFilesRecursively(validation_dir)
# Define batch size.
self._batch_size = config.data.batch_size
# Create a subclass-defined training input function.
validation_input_fn = self.construct_input_fn(
validation_records, False)
# Create the estimator.
estimator = self._build_estimator(is_training=False)
# Run validation.
eval_batch_size = config.data.batch_size
num_eval_samples = config.val.num_eval_samples
num_eval_batches = int(num_eval_samples / eval_batch_size)
estimator.evaluate(input_fn=validation_input_fn, steps=num_eval_batches)
示例3: get_labeled_tables
# 需要導入模塊: from utils import util [as 別名]
# 或者: from utils.util import GetFilesRecursively [as 別名]
def get_labeled_tables(config):
"""Gets either labeled test or validation tables, based on flags."""
# Get a list of filenames corresponding to labeled data.
mode = FLAGS.mode
if mode == 'validation':
labeled_tables = util.GetFilesRecursively(config.data.labeled.validation)
elif mode == 'test':
labeled_tables = util.GetFilesRecursively(config.data.labeled.test)
else:
raise ValueError('Unknown dataset: %s' % mode)
return labeled_tables
示例4: main
# 需要導入模塊: from utils import util [as 別名]
# 或者: from utils.util import GetFilesRecursively [as 別名]
def main(_):
# Parse config dict from yaml config files / command line flags.
config = util.ParseConfigsToLuaTable(FLAGS.config_paths, FLAGS.model_params)
# Get tables to embed.
query_records_dir = FLAGS.query_records_dir
query_records = util.GetFilesRecursively(query_records_dir)
target_records_dir = FLAGS.target_records_dir
target_records = util.GetFilesRecursively(target_records_dir)
height = config.data.raw_height
width = config.data.raw_width
mode = FLAGS.mode
if mode == 'multi':
# Generate videos where target set is composed of multiple videos.
MultiImitationVideos(query_records, target_records, config,
height, width)
elif mode == 'single':
# Generate videos where target set is a single video.
SingleImitationVideos(query_records, target_records, config,
height, width)
elif mode == 'same':
# Generate videos where target set is the same as query, but diff view.
SameSequenceVideos(query_records, config, height, width)
else:
raise ValueError('Unknown mode %s' % mode)
示例5: train
# 需要導入模塊: from utils import util [as 別名]
# 或者: from utils.util import GetFilesRecursively [as 別名]
def train(self):
"""Runs training."""
# Get a list of training tfrecords.
config = self._config
training_dir = config.data.training
training_records = util.GetFilesRecursively(training_dir)
# Define batch size.
self._batch_size = config.data.batch_size
# Create a subclass-defined training input function.
train_input_fn = self.construct_input_fn(
training_records, is_training=True)
# Create the estimator.
estimator = self._build_estimator(is_training=True)
train_hooks = None
if config.use_tpu:
# TPU training initializes pretrained weights using a custom train hook.
train_hooks = []
if tf.train.latest_checkpoint(self._logdir) is None:
train_hooks.append(
InitFromPretrainedCheckpointHook(
config[config.embedder_strategy].pretrained_checkpoint))
# Run training.
estimator.train(input_fn=train_input_fn, hooks=train_hooks,
steps=config.learning.max_step)