I'm definitely in over my head with this one. I've been playing around with Tensorflow's assorted image genorator tutorials and its great, but I get stuck when I try to use my own image dataset for the DC GAN tutorial. MNIST works great, as does the celeb faces. But when I built my own folder structure nothing I can do imports the images to use. Here's where I'm at thus far:
#IMPORT PHOTOS
import pathlib
data_dir = "/Users/..../PATTERNS"
data_dir = pathlib.Path(data_dir)
train_images = tf.keras.preprocessing.image_dataset_from_directory(
data_dir,
labels="inferred",
label_mode="int",
class_names=None,
color_mode="rgb",
batch_size=32,
image_size=(100, 100),
shuffle=True,
seed=None,
validation_split=None,
subset=None,
interpolation="bilinear",
follow_links=False,
)
# up until this point everything works
BUFFER_SIZE = 60000
BATCH_SIZE = 256
train_images = train_images.reshape(train_images.shape[0], 28, 28, 1).astype('float32')
train_images = (train_images - 127.5) / 127.5 # Normalize the images to [-1, 1]
# Batch and shuffle the data
train_dataset = tf.data.Dataset.from_tensor_slices(dataset).shuffle(BUFFER_SIZE).batch(BATCH_SIZE)
then I get the error message: AttributeError: 'BatchDataset' object has no attribute 'reshape'
I've tried a handful of other tutorials and done a ton of googling, but no answers yet. Any help would be greatly appreciated. Thanks!