Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 可视化准确率,绘制验证数据准确率折线图
- # 将每个Epoch的准确率添加到列表里面
- import matplotlib.pyplot as plt
- import numpy as np
- acc_list1 = [0.1, 0.1, 0.5, 0.69, 0.88]
- acc_list2 = [0.3, 0.4, 0.5, 0.69, 0.98]
- num_epochs = 5
- plt.title("Accuracy")
- plt.xlabel("Training Epochs")
- plt.ylabel("Accuracy")
- plt.plot(range(1, num_epochs + 1), acc_list1, label="method_1")
- plt.plot(range(1, num_epochs + 1), acc_list2, label="method_2")
- plt.ylim((0, 1.0))
- plt.xticks(np.arange(1, num_epochs + 1, 1.0))
- plt.legend()
- plt.show()
- # 人脸关键点可视化
- # 显示图像,在图像上绘制出点
- # landmarks为坐标 x,y 的格式的列表
- def show_landmarks(image, landmarks):
- """显示带标记点的图片"""
- plt.imshow(image)
- plt.scatter(landmarks[:, 0], landmarks[:, 1], s=10, marker='.', c='r')
- plt.pause(0.001) # 暂停一下, 使plots更新
- plt.figure()
- show_landmarks(image, landmarks)
- plt.show()
Add Comment
Please, Sign In to add comment