title: How to save prediction result of the CNN model in the image format?
body: <p>I have been working with a CNN in Keras and I want to save the predictions as png images. This is my code to create the model and run the prediction:</p>
  <pre><code> history = model.fit(
          train_generator,
          steps_per_epoch=train_steps,
          epochs=epochs,
          validation_data=validation_generator,
          validation_steps=valid_steps)
  
      pred= model.predict(X_test)
  </code></pre>
  <p>I used following code based on below link and the pred folder remains empty. (<a href="https://stackoverflow.com/questions/52620222/how-to-save-output-prediction-of-the-cnn-model-in-the-form-of-an-image">How to save output (prediction) of the CNN model in the form of an image?</a>)</p>
  <pre><code>images = []
  for i in range(len(images)*2):
          pred.append(id_to_name[np.argmax(predictions[i // 2])])
          plt.imsave(('pred/ {}.png'.format(str(i // 2)+id_to_name[np.argmax(predictions[i // 2])])),images[i // 2])
  </code></pre>
  <p>Could you please tell how to save the model.predict predictions in the form of png images?</p>