Advertisement
manul1537

Untitled

May 29th, 2024 (edited)
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. from tensorflow.keras.preprocessing.image import ImageDataGenerator
  2. import numpy as np
  3. from PIL import Image
  4. import matplotlib.pyplot as plt
  5.  
  6. datagen = ImageDataGenerator(rescale=1./255, validation_split=0.25)
  7.  
  8. train_datagen_flow = datagen.flow_from_directory(
  9.     '/datasets/fruits_small/',
  10.    
  11.     target_size=(150, 150),
  12.     batch_size=16,
  13.     class_mode='sparse',
  14.     subset='training',
  15.     seed=12345)
  16.  
  17. val_datagen_flow = datagen.flow_from_directory(
  18.     '/datasets/fruits_small/',
  19.     target_size=(150, 150),
  20.     batch_size=16,
  21.     class_mode='sparse',
  22.     subset='validation',
  23.     seed=12345)
  24.  
  25. print(train_datagen_flow[0])
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement