Reshaping the arrays for processing with Keras