同一笔记本中的相同代码在colab上运行良好,而在我的本地环境中却什么也没有

时间:2019-03-17 07:36:33

标签: python tensorflow matplotlib

我正在尝试使用Keras调整深度神经网络。

import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (12.0, 9.0)

idx = 2 # image index that you want to display

img = np.empty(3, dtype=object)
img[0] = X[idx]
img[1] = Y[idx].reshape(Y[idx].shape[0],Y[idx].shape[1])
img[2] = pred[idx].reshape(pred[idx].shape[0],pred[idx].shape[1])
title = ['input', 'ground-truth', 'result']
for i in range(3):
  plt.subplot(1, 3, i+1)
  if i==0:
    plt.imshow(img[i].astype('uint8'))
  else:
    plt.imshow(img[i], cmap='gray')

  plt.axis('off')
  plt.title(title[i])
plt.show()

完整的代码在此colab link中,该代码在colab上很好用。

enter image description here

相同的代码在我的本地环境中什么都不会产生(结果图)。

enter image description here

任何线索都会受到赞赏。

0 个答案:

没有答案