Skip to content

Instantly share code, notes, and snippets.

@Johnson145
Johnson145 / tf_models_preprocessing.py
Last active May 9, 2018 09:57 — forked from vertix/tf_models_preprocessing.py
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)
@Johnson145
Johnson145 / tf_data_augmentation_on_gpu.py
Last active May 29, 2019 03:00 — forked from vertix/tf_data_augmentation_on_gpu.py
TF data augmentation on GPU
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:
@Johnson145
Johnson145 / CameraController.java
Created June 14, 2017 15:49
Fix exif orientation flag of images captured with the CameraKit-Android
public class CameraController implements OrientationManager.OrientationListener{
public static String TAG = CameraController.class.getCanonicalName();
/**
* This holds the actual camera view object.
*/
private CameraView cameraView;
/**