import numpy as np
import pandas as pd
from keras.utils import np_utils
np.random.seed(10)#随机10

from keras.datasets import mnist

(X_train_image,Y_train_image),(X_test_label,Y_test_label) =mnist.load_data()

print(X_train_image.shape)

import matplotlib.pyplot as plt
def plot_image(image):
    fig =plt.gcf()
    fig.set_size_inches(2,2)
    plt.imshow(image,cmap='binary')
    plt.show()

plot_image(X_train_image[0])

Y_train_image[0]

 

import matplotlib.pyplot as plt
def plot_images_labels_prediction(images,labels,prediction,idx,num=10):
    
    fig =plt.gcf()
    fig.set_size_inches(12,14)
    if num>25:
        num=25
    for i in range(0,num):
        ax =plt.subplot(5,5,1+i)
        ax.imshow(images[idx],cmap='binary')
        title="labels="+str(labels[idx])
        if len(prediction)>0:
             title+=",prediction="+str(prediction[idx])
                
        ax.set_title(title,fontsize=10)
        ax.set_xticks([])
        ax.set_yticks([])
        idx+=1
    plt.show()

 

plot_images_labels_prediction(X_train_image,Y_train_image,[],0)

 

TensorFlpw Keras 深度学习人工智能实践应用 6.3源码

TensorFlpw Keras 深度学习人工智能实践应用 6.3源码

 

相关文章:

  • 2021-12-14
  • 2022-01-17
  • 2021-08-15
  • 2022-02-25
  • 2022-12-23
  • 2021-10-07
  • 2021-08-03
  • 2021-11-12
猜你喜欢
  • 2021-10-20
  • 2022-12-23
  • 2021-12-03
  • 2021-05-19
  • 2022-12-23
  • 2021-04-05
  • 2021-11-09
相关资源
相似解决方案