Python data_utils.name_to_batch() Examples
The following are 13
code examples of data_utils.name_to_batch().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
data_utils
, or try the search function
.
Example #1
Source File: names.py From DOTA_models with Apache License 2.0 | 5 votes |
def namignize(names, checkpoint_path, config): """Recognizes names and prints the Perplexity of the model for each names in the list Args: names: a list of names in the model format checkpoint_path: the path to restore the trained model from, should not include the model name, just the path to config: one of the above configs that specify the model and how it should be run and trained Returns: None """ with tf.Graph().as_default(), tf.Session() as session: with tf.variable_scope("model"): m = NamignizerModel(is_training=False, config=config) m.saver.restore(session, checkpoint_path) for name in names: x, y = data_utils.name_to_batch(name, m.batch_size, m.num_steps) cost, loss, _ = session.run([m.cost, m.loss, tf.no_op()], {m.input_data: x, m.targets: y, m.weights: np.concatenate(( np.ones(len(name)), np.zeros(m.batch_size * m.num_steps - len(name))))}) print("Name {} gives us a perplexity of {}".format( name, np.exp(cost)))
Example #2
Source File: names.py From yolo_v2 with Apache License 2.0 | 5 votes |
def namignize(names, checkpoint_path, config): """Recognizes names and prints the Perplexity of the model for each names in the list Args: names: a list of names in the model format checkpoint_path: the path to restore the trained model from, should not include the model name, just the path to config: one of the above configs that specify the model and how it should be run and trained Returns: None """ with tf.Graph().as_default(), tf.Session() as session: with tf.variable_scope("model"): m = NamignizerModel(is_training=False, config=config) m.saver.restore(session, checkpoint_path) for name in names: x, y = data_utils.name_to_batch(name, m.batch_size, m.num_steps) cost, loss, _ = session.run([m.cost, m.loss, tf.no_op()], {m.input_data: x, m.targets: y, m.weights: np.concatenate(( np.ones(len(name)), np.zeros(m.batch_size * m.num_steps - len(name))))}) print("Name {} gives us a perplexity of {}".format( name, np.exp(cost)))
Example #3
Source File: names.py From Gun-Detector with Apache License 2.0 | 5 votes |
def namignize(names, checkpoint_path, config): """Recognizes names and prints the Perplexity of the model for each names in the list Args: names: a list of names in the model format checkpoint_path: the path to restore the trained model from, should not include the model name, just the path to config: one of the above configs that specify the model and how it should be run and trained Returns: None """ with tf.Graph().as_default(), tf.Session() as session: with tf.variable_scope("model"): m = NamignizerModel(is_training=False, config=config) m.saver.restore(session, checkpoint_path) for name in names: x, y = data_utils.name_to_batch(name, m.batch_size, m.num_steps) cost, loss, _ = session.run([m.cost, m.loss, tf.no_op()], {m.input_data: x, m.targets: y, m.weights: np.concatenate(( np.ones(len(name)), np.zeros(m.batch_size * m.num_steps - len(name))))}) print("Name {} gives us a perplexity of {}".format( name, np.exp(cost)))
Example #4
Source File: names.py From Action_Recognition_Zoo with MIT License | 5 votes |
def namignize(names, checkpoint_path, config): """Recognizes names and prints the Perplexity of the model for each names in the list Args: names: a list of names in the model format checkpoint_path: the path to restore the trained model from, should not include the model name, just the path to config: one of the above configs that specify the model and how it should be run and trained Returns: None """ with tf.Graph().as_default(), tf.Session() as session: with tf.variable_scope("model"): m = NamignizerModel(is_training=False, config=config) m.saver.restore(session, checkpoint_path) for name in names: x, y = data_utils.name_to_batch(name, m.batch_size, m.num_steps) cost, loss, _ = session.run([m.cost, m.loss, tf.no_op()], {m.input_data: x, m.targets: y, m.initial_state: m.initial_state.eval(), m.weights: np.concatenate(( np.ones(len(name)), np.zeros(m.batch_size * m.num_steps - len(name))))}) print("Name {} gives us a perplexity of {}".format( name, np.exp(cost)))
Example #5
Source File: names.py From ECO-pytorch with BSD 2-Clause "Simplified" License | 5 votes |
def namignize(names, checkpoint_path, config): """Recognizes names and prints the Perplexity of the model for each names in the list Args: names: a list of names in the model format checkpoint_path: the path to restore the trained model from, should not include the model name, just the path to config: one of the above configs that specify the model and how it should be run and trained Returns: None """ with tf.Graph().as_default(), tf.Session() as session: with tf.variable_scope("model"): m = NamignizerModel(is_training=False, config=config) m.saver.restore(session, checkpoint_path) for name in names: x, y = data_utils.name_to_batch(name, m.batch_size, m.num_steps) cost, loss, _ = session.run([m.cost, m.loss, tf.no_op()], {m.input_data: x, m.targets: y, m.initial_state: m.initial_state.eval(), m.weights: np.concatenate(( np.ones(len(name)), np.zeros(m.batch_size * m.num_steps - len(name))))}) print("Name {} gives us a perplexity of {}".format( name, np.exp(cost)))
Example #6
Source File: names.py From hands-detection with MIT License | 5 votes |
def namignize(names, checkpoint_path, config): """Recognizes names and prints the Perplexity of the model for each names in the list Args: names: a list of names in the model format checkpoint_path: the path to restore the trained model from, should not include the model name, just the path to config: one of the above configs that specify the model and how it should be run and trained Returns: None """ with tf.Graph().as_default(), tf.Session() as session: with tf.variable_scope("model"): m = NamignizerModel(is_training=False, config=config) m.saver.restore(session, checkpoint_path) for name in names: x, y = data_utils.name_to_batch(name, m.batch_size, m.num_steps) cost, loss, _ = session.run([m.cost, m.loss, tf.no_op()], {m.input_data: x, m.targets: y, m.weights: np.concatenate(( np.ones(len(name)), np.zeros(m.batch_size * m.num_steps - len(name))))}) print("Name {} gives us a perplexity of {}".format( name, np.exp(cost)))
Example #7
Source File: names.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def namignize(names, checkpoint_path, config): """Recognizes names and prints the Perplexity of the model for each names in the list Args: names: a list of names in the model format checkpoint_path: the path to restore the trained model from, should not include the model name, just the path to config: one of the above configs that specify the model and how it should be run and trained Returns: None """ with tf.Graph().as_default(), tf.Session() as session: with tf.variable_scope("model"): m = NamignizerModel(is_training=False, config=config) m.saver.restore(session, checkpoint_path) for name in names: x, y = data_utils.name_to_batch(name, m.batch_size, m.num_steps) cost, loss, _ = session.run([m.cost, m.loss, tf.no_op()], {m.input_data: x, m.targets: y, m.weights: np.concatenate(( np.ones(len(name)), np.zeros(m.batch_size * m.num_steps - len(name))))}) print("Name {} gives us a perplexity of {}".format( name, np.exp(cost)))
Example #8
Source File: names.py From object_detection_with_tensorflow with MIT License | 5 votes |
def namignize(names, checkpoint_path, config): """Recognizes names and prints the Perplexity of the model for each names in the list Args: names: a list of names in the model format checkpoint_path: the path to restore the trained model from, should not include the model name, just the path to config: one of the above configs that specify the model and how it should be run and trained Returns: None """ with tf.Graph().as_default(), tf.Session() as session: with tf.variable_scope("model"): m = NamignizerModel(is_training=False, config=config) m.saver.restore(session, checkpoint_path) for name in names: x, y = data_utils.name_to_batch(name, m.batch_size, m.num_steps) cost, loss, _ = session.run([m.cost, m.loss, tf.no_op()], {m.input_data: x, m.targets: y, m.weights: np.concatenate(( np.ones(len(name)), np.zeros(m.batch_size * m.num_steps - len(name))))}) print("Name {} gives us a perplexity of {}".format( name, np.exp(cost)))
Example #9
Source File: names.py From AI_Reader with Apache License 2.0 | 5 votes |
def namignize(names, checkpoint_path, config): """Recognizes names and prints the Perplexity of the model for each names in the list Args: names: a list of names in the model format checkpoint_path: the path to restore the trained model from, should not include the model name, just the path to config: one of the above configs that specify the model and how it should be run and trained Returns: None """ with tf.Graph().as_default(), tf.Session() as session: with tf.variable_scope("model"): m = NamignizerModel(is_training=False, config=config) m.saver.restore(session, checkpoint_path) for name in names: x, y = data_utils.name_to_batch(name, m.batch_size, m.num_steps) cost, loss, _ = session.run([m.cost, m.loss, tf.no_op()], {m.input_data: x, m.targets: y, m.initial_state: m.initial_state.eval(), m.weights: np.concatenate(( np.ones(len(name)), np.zeros(m.batch_size * m.num_steps - len(name))))}) print("Name {} gives us a perplexity of {}".format( name, np.exp(cost)))
Example #10
Source File: names.py From HumanRecognition with MIT License | 5 votes |
def namignize(names, checkpoint_path, config): """Recognizes names and prints the Perplexity of the model for each names in the list Args: names: a list of names in the model format checkpoint_path: the path to restore the trained model from, should not include the model name, just the path to config: one of the above configs that specify the model and how it should be run and trained Returns: None """ with tf.Graph().as_default(), tf.Session() as session: with tf.variable_scope("model"): m = NamignizerModel(is_training=False, config=config) m.saver.restore(session, checkpoint_path) for name in names: x, y = data_utils.name_to_batch(name, m.batch_size, m.num_steps) cost, loss, _ = session.run([m.cost, m.loss, tf.no_op()], {m.input_data: x, m.targets: y, m.weights: np.concatenate(( np.ones(len(name)), np.zeros(m.batch_size * m.num_steps - len(name))))}) print("Name {} gives us a perplexity of {}".format( name, np.exp(cost)))
Example #11
Source File: names.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def namignize(names, checkpoint_path, config): """Recognizes names and prints the Perplexity of the model for each names in the list Args: names: a list of names in the model format checkpoint_path: the path to restore the trained model from, should not include the model name, just the path to config: one of the above configs that specify the model and how it should be run and trained Returns: None """ with tf.Graph().as_default(), tf.Session() as session: with tf.variable_scope("model"): m = NamignizerModel(is_training=False, config=config) m.saver.restore(session, checkpoint_path) for name in names: x, y = data_utils.name_to_batch(name, m.batch_size, m.num_steps) cost, loss, _ = session.run([m.cost, m.loss, tf.no_op()], {m.input_data: x, m.targets: y, m.weights: np.concatenate(( np.ones(len(name)), np.zeros(m.batch_size * m.num_steps - len(name))))}) print("Name {} gives us a perplexity of {}".format( name, np.exp(cost)))
Example #12
Source File: names.py From models with Apache License 2.0 | 5 votes |
def namignize(names, checkpoint_path, config): """Recognizes names and prints the Perplexity of the model for each names in the list Args: names: a list of names in the model format checkpoint_path: the path to restore the trained model from, should not include the model name, just the path to config: one of the above configs that specify the model and how it should be run and trained Returns: None """ with tf.Graph().as_default(), tf.Session() as session: with tf.variable_scope("model"): m = NamignizerModel(is_training=False, config=config) m.saver.restore(session, checkpoint_path) for name in names: x, y = data_utils.name_to_batch(name, m.batch_size, m.num_steps) cost, loss, _ = session.run([m.cost, m.loss, tf.no_op()], {m.input_data: x, m.targets: y, m.weights: np.concatenate(( np.ones(len(name)), np.zeros(m.batch_size * m.num_steps - len(name))))}) print("Name {} gives us a perplexity of {}".format( name, np.exp(cost)))
Example #13
Source File: names.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def namignize(names, checkpoint_path, config): """Recognizes names and prints the Perplexity of the model for each names in the list Args: names: a list of names in the model format checkpoint_path: the path to restore the trained model from, should not include the model name, just the path to config: one of the above configs that specify the model and how it should be run and trained Returns: None """ with tf.Graph().as_default(), tf.Session() as session: with tf.variable_scope("model"): m = NamignizerModel(is_training=False, config=config) m.saver.restore(session, checkpoint_path) for name in names: x, y = data_utils.name_to_batch(name, m.batch_size, m.num_steps) cost, loss, _ = session.run([m.cost, m.loss, tf.no_op()], {m.input_data: x, m.targets: y, m.weights: np.concatenate(( np.ones(len(name)), np.zeros(m.batch_size * m.num_steps - len(name))))}) print("Name {} gives us a perplexity of {}".format( name, np.exp(cost)))