Guest User

Untitled

a guest
Oct 21st, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. # 可视化准确率,绘制验证数据准确率折线图
  2. # 将每个Epoch的准确率添加到列表里面
  3.  
  4. import matplotlib.pyplot as plt
  5. import numpy as np
  6. acc_list1 = [0.1, 0.1, 0.5, 0.69, 0.88]
  7. acc_list2 = [0.3, 0.4, 0.5, 0.69, 0.98]
  8. num_epochs = 5
  9. plt.title("Accuracy")
  10. plt.xlabel("Training Epochs")
  11. plt.ylabel("Accuracy")
  12. plt.plot(range(1, num_epochs + 1), acc_list1, label="method_1")
  13. plt.plot(range(1, num_epochs + 1), acc_list2, label="method_2")
  14. plt.ylim((0, 1.0))
  15. plt.xticks(np.arange(1, num_epochs + 1, 1.0))
  16. plt.legend()
  17. plt.show()
  18.  
  19.  
  20.  
  21. # 人脸关键点可视化
  22. # 显示图像,在图像上绘制出点
  23. # landmarks为坐标 x,y 的格式的列表
  24. def show_landmarks(image, landmarks):
  25. """显示带标记点的图片"""
  26. plt.imshow(image)
  27. plt.scatter(landmarks[:, 0], landmarks[:, 1], s=10, marker='.', c='r')
  28. plt.pause(0.001) # 暂停一下, 使plots更新
  29.  
  30. plt.figure()
  31. show_landmarks(image, landmarks)
  32. plt.show()
Add Comment
Please, Sign In to add comment