Python preprocessing.unscale_jpeg_encode() Examples
The following are 6
code examples of preprocessing.unscale_jpeg_encode().
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
preprocessing
, or try the search function
.
Example #1
Source File: base_estimator.py From yolo_v2 with Apache License 2.0 | 5 votes |
def _setup_np_inference(self, np_images, checkpoint_path): """Sets up and restores inference graph, creates and caches a Session.""" tf.logging.info('Restoring model weights.') # Define inference over an image placeholder. _, height, width, _ = np.shape(np_images) image_placeholder = tf.placeholder( tf.float32, shape=(None, height, width, 3)) # Preprocess batch. preprocessed = self.preprocess_data(image_placeholder, is_training=False) # Unscale and jpeg encode preprocessed images for display purposes. im_strings = preprocessing.unscale_jpeg_encode(preprocessed) # Do forward pass to get embeddings. embeddings = self.forward(preprocessed, is_training=False) # Create a saver to restore model variables. tf.train.get_or_create_global_step() saver = tf.train.Saver(tf.all_variables()) self._image_placeholder = image_placeholder self._batch_encoded = embeddings self._np_inf_tensor_dict = { 'embeddings': embeddings, 'raw_image_strings': im_strings, } # Create a session and restore model variables. self._sess = tf.Session() saver.restore(self._sess, checkpoint_path)
Example #2
Source File: base_estimator.py From Gun-Detector with Apache License 2.0 | 5 votes |
def _setup_np_inference(self, np_images, checkpoint_path): """Sets up and restores inference graph, creates and caches a Session.""" tf.logging.info('Restoring model weights.') # Define inference over an image placeholder. _, height, width, _ = np.shape(np_images) image_placeholder = tf.placeholder( tf.float32, shape=(None, height, width, 3)) # Preprocess batch. preprocessed = self.preprocess_data(image_placeholder, is_training=False) # Unscale and jpeg encode preprocessed images for display purposes. im_strings = preprocessing.unscale_jpeg_encode(preprocessed) # Do forward pass to get embeddings. embeddings = self.forward(preprocessed, is_training=False) # Create a saver to restore model variables. tf.train.get_or_create_global_step() saver = tf.train.Saver(tf.all_variables()) self._image_placeholder = image_placeholder self._batch_encoded = embeddings self._np_inf_tensor_dict = { 'embeddings': embeddings, 'raw_image_strings': im_strings, } # Create a session and restore model variables. self._sess = tf.Session() saver.restore(self._sess, checkpoint_path)
Example #3
Source File: base_estimator.py From object_detection_with_tensorflow with MIT License | 5 votes |
def _setup_np_inference(self, np_images, checkpoint_path): """Sets up and restores inference graph, creates and caches a Session.""" tf.logging.info('Restoring model weights.') # Define inference over an image placeholder. _, height, width, _ = np.shape(np_images) image_placeholder = tf.placeholder( tf.float32, shape=(None, height, width, 3)) # Preprocess batch. preprocessed = self.preprocess_data(image_placeholder, is_training=False) # Unscale and jpeg encode preprocessed images for display purposes. im_strings = preprocessing.unscale_jpeg_encode(preprocessed) # Do forward pass to get embeddings. embeddings = self.forward(preprocessed, is_training=False) # Create a saver to restore model variables. tf.train.get_or_create_global_step() saver = tf.train.Saver(tf.all_variables()) self._image_placeholder = image_placeholder self._batch_encoded = embeddings self._np_inf_tensor_dict = { 'embeddings': embeddings, 'raw_image_strings': im_strings, } # Create a session and restore model variables. self._sess = tf.Session() saver.restore(self._sess, checkpoint_path)
Example #4
Source File: base_estimator.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def _setup_np_inference(self, np_images, checkpoint_path): """Sets up and restores inference graph, creates and caches a Session.""" tf.logging.info('Restoring model weights.') # Define inference over an image placeholder. _, height, width, _ = np.shape(np_images) image_placeholder = tf.placeholder( tf.float32, shape=(None, height, width, 3)) # Preprocess batch. preprocessed = self.preprocess_data(image_placeholder, is_training=False) # Unscale and jpeg encode preprocessed images for display purposes. im_strings = preprocessing.unscale_jpeg_encode(preprocessed) # Do forward pass to get embeddings. embeddings = self.forward(preprocessed, is_training=False) # Create a saver to restore model variables. tf.train.get_or_create_global_step() saver = tf.train.Saver(tf.all_variables()) self._image_placeholder = image_placeholder self._batch_encoded = embeddings self._np_inf_tensor_dict = { 'embeddings': embeddings, 'raw_image_strings': im_strings, } # Create a session and restore model variables. self._sess = tf.Session() saver.restore(self._sess, checkpoint_path)
Example #5
Source File: base_estimator.py From models with Apache License 2.0 | 5 votes |
def _setup_np_inference(self, np_images, checkpoint_path): """Sets up and restores inference graph, creates and caches a Session.""" tf.logging.info('Restoring model weights.') # Define inference over an image placeholder. _, height, width, _ = np.shape(np_images) image_placeholder = tf.placeholder( tf.float32, shape=(None, height, width, 3)) # Preprocess batch. preprocessed = self.preprocess_data(image_placeholder, is_training=False) # Unscale and jpeg encode preprocessed images for display purposes. im_strings = preprocessing.unscale_jpeg_encode(preprocessed) # Do forward pass to get embeddings. embeddings = self.forward(preprocessed, is_training=False) # Create a saver to restore model variables. tf.train.get_or_create_global_step() saver = tf.train.Saver(tf.all_variables()) self._image_placeholder = image_placeholder self._batch_encoded = embeddings self._np_inf_tensor_dict = { 'embeddings': embeddings, 'raw_image_strings': im_strings, } # Create a session and restore model variables. self._sess = tf.Session() saver.restore(self._sess, checkpoint_path)
Example #6
Source File: base_estimator.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def _setup_np_inference(self, np_images, checkpoint_path): """Sets up and restores inference graph, creates and caches a Session.""" tf.logging.info('Restoring model weights.') # Define inference over an image placeholder. _, height, width, _ = np.shape(np_images) image_placeholder = tf.placeholder( tf.float32, shape=(None, height, width, 3)) # Preprocess batch. preprocessed = self.preprocess_data(image_placeholder, is_training=False) # Unscale and jpeg encode preprocessed images for display purposes. im_strings = preprocessing.unscale_jpeg_encode(preprocessed) # Do forward pass to get embeddings. embeddings = self.forward(preprocessed, is_training=False) # Create a saver to restore model variables. tf.train.get_or_create_global_step() saver = tf.train.Saver(tf.all_variables()) self._image_placeholder = image_placeholder self._batch_encoded = embeddings self._np_inf_tensor_dict = { 'embeddings': embeddings, 'raw_image_strings': im_strings, } # Create a session and restore model variables. self._sess = tf.Session() saver.restore(self._sess, checkpoint_path)