Skip to content

Instantly share code, notes, and snippets.

@shyamal18122000
Created August 28, 2021 21:16
Show Gist options
  • Save shyamal18122000/166fb0ed613935851f039960ff2d4493 to your computer and use it in GitHub Desktop.
Save shyamal18122000/166fb0ed613935851f039960ff2d4493 to your computer and use it in GitHub Desktop.
def preprocessing(raw):
label = tf.keras.utils.to_categorical(raw.label, 10)
num_of_images = raw.shape[0]
x_as_array = raw.values[:,1:]
x_shaped_array = x_as_array.reshape(num_of_images, 28, 28, 1)
image = x_shaped_array / 255
return image, label
X, Y = preprocessing(train_fashion_data)
X_test, Y_test = preprocessing(test_fashion_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment