Skip to content

Instantly share code, notes, and snippets.

@Johnson145
Forked from vertix/tf_models_preprocessing.py
Last active May 9, 2018 09:57
Show Gist options
  • Save Johnson145/272377c6deff9cb96cc0aeed42922e41 to your computer and use it in GitHub Desktop.
Save Johnson145/272377c6deff9cb96cc0aeed42922e41 to your computer and use it in GitHub Desktop.
Using tf_models.slim.preprocessing
# You need to add your local TF-models slim directory to PYTHON_PATH
# or just run script from this directory.
import tensorflow as tf
from preprocessing import inception_preprocessing
# you can use any uint8 tensor of matching dimensions
single_image = tf.placeholder(tf.uint8, shape=(None, None, 3))
# Augmentation operations are created here
# (no batch support here)
augmented_image = inception_preprocessing.preprocess_image(
single_image, height=299, width=299, is_training=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment