Skip to content

Instantly share code, notes, and snippets.

@nestorsgarzonc
Last active July 24, 2020 17:38
Show Gist options
  • Select an option

  • Save nestorsgarzonc/946c4318c0f05d9ab13248657afd57b1 to your computer and use it in GitHub Desktop.

Select an option

Save nestorsgarzonc/946c4318c0f05d9ab13248657afd57b1 to your computer and use it in GitHub Desktop.
#https://keras.io/api/preprocessing/image/
TRAINING_DIR = "/tmp/cats-v-dogs/training"
train_datagen = ImageDataGenerator(rescale=1.0/255.0)
# NOTE: YOU MUST USE A BATCH SIZE OF 10 (batch_size=10) FOR THE
train_generator = train_datagen.flow_from_directory(TRAINING_DIR,
batch_size=10,
class_mode="categorical",
color_mode: "grayscale",
target_size=(1020, 480)
)
import tensorflow as tf
tf.keras.preprocessing.image_dataset_from_directory(
directory, labels='inferred', label_mode='int', class_names=None,
color_mode='rgb', batch_size=32, image_size=(256, 256), shuffle=True, seed=None,
validation_split=None, subset=None, interpolation='bilinear', follow_links=False
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment