This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
augmented_image = inception_preprocessing.preprocess_image( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def augment(images, labels, | |
resize=None, # (width, height) tuple or None | |
horizontal_flip=False, | |
vertical_flip=False, | |
rotate=0, # Maximum rotation angle in degrees | |
crop_probability=0, # How often we do crops | |
crop_min_percent=0.6, # Minimum linear dimension of a crop | |
crop_max_percent=1., # Maximum linear dimension of a crop | |
mixup=0): # Mixup coeffecient, see https://arxiv.org/abs/1710.09412.pdf | |
if resize is not None: |