Home > other >  Tensorflow2.0 how according to the trained model mnist dataset, do a single prediction for how to wr
Tensorflow2.0 how according to the trained model mnist dataset, do a single prediction for how to wr

Time:10-11

# download and install TensorFlow 2 packages, will TensorFlow import procedures:
The from __future__ import absolute_import, division, print_function unicode_literals
# Install TensorFlow
The import tensorflow as tf
The from keras. Applications. Imagenet_utils import decode_predictions
The import matplotlib. Pyplot as PLT
The from PIL import Image

# save the model:
Keras_model_path="keras_save"
# now, from the file to load model:
The model=tf. Keras. Models. Load_model (keras_model_path)
# a single image prediction
Data_dir=r 'D: \ \ images shuzitest \ shuzi \ IM10 JPG'
  • Related