Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created December 5, 2020 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/7568f8a54c5ab9e10bb805a3a3147f4a to your computer and use it in GitHub Desktop.
Save amankharwal/7568f8a54c5ab9e10bb805a3a3147f4a to your computer and use it in GitHub Desktop.
# In this section you will have to add another dimension to the data
# So, for example, if your array is (10000, 28, 28)
# You will need to make it (10000, 28, 28, 1)
#training_images = np.expand_dims(training_images, axis=3)
#testing_images = np.expand_dims(testing_images, axis=3)
training_images = data_train.iloc[:,1:].values
training_labels = data_train.iloc[:,0].values
testing_images = data_test.iloc[:,1:].values
testing_labels = data_test.iloc[:,0].values
training_images = training_images.reshape(-1,28,28,1)
testing_images = testing_images.reshape(-1,28,28,1)
print(training_images.shape)
print(training_labels.shape)
print(testing_images.shape)
print(testing_labels.shape)
# Their output should be:
# (27455, 28, 28, 1)
# (27455,)
# (7172, 28, 28, 1)
# (7172,)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment