Skip to content

Instantly share code, notes, and snippets.

@novasush
Created March 7, 2020 17:52
Show Gist options
  • Save novasush/c291bc8a75f2e7ce99d36b51d212ee53 to your computer and use it in GitHub Desktop.
Save novasush/c291bc8a75f2e7ce99d36b51d212ee53 to your computer and use it in GitHub Desktop.
dataset_name = 'cats_vs_dogs'
filePath = f"{getcwd()}/../tmp2"
dataset, info = tfds.load(name=dataset_name, split=tfds.Split.TRAIN, with_info=True, data_dir=filePath)
print(info.version)
def preprocess(features):
image = features['image']
image = tf.image.resize(image, (224, 224))
image = image / 255.0
return image, features['label']
train_dataset = dataset.map(preprocess).batch(32)
#The next step will be to train the model using the following code:
model = create_model()
model.fit(train_dataset, epochs=5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment