Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Converting a pandas dataframe with each row being a vector image to a 4D tensor for CNN use in Keras
# Transforming a 60000x784 dataframe to a 60000x28x28x1 4D tensor for Keras modelling
train_img = X_train.values.reshape(X_train.shape[0], 28, 28, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment