标签:open set 模式 art clear desktop get poc str
在训练神经网络时,我们常常希望在图中看到loss减小的动态过程,这时我们可用plt.ion()函数打开交互式模式,在交互式模式下可动态地展示图像。
import matplotlib.pyplot as plt x = list(range(1, 21)) # epoch array loss = [2 / (i**2) for i in x] # loss values array plt.ion() for i in range(1, len(x)): ix = x[:i] iy = loss[:i] plt.title("loss") plt.plot(ix, iy) plt.xlabel("epoch") plt.ylabel("loss") plt.pause(0.5) plt.ioff() plt.show()
此程序来自这篇博客。
import matplotlib.pyplot as plt import cv2 img1 = cv2.imread(‘/Users/wangpeng/Desktop/all/CS/HDR/hdr_opencv/img_0.033.jpg‘) img2 = cv2.imread(‘/Users/wangpeng/Desktop/all/CS/HDR/hdr_opencv/img_2.5.jpg‘) img3 = cv2.imread(‘/Users/wangpeng/Desktop/all/CS/HDR/hdr_opencv/img_15.jpg‘) lst = [img1, img2, img3] f, a = plt.subplots(1, 1, figsize=(5, 5)) plt.ion() for i in range(3): a.clear() a.imshow(lst[i]); a.set_xticks(()); a.set_yticks(()) plt.pause(0.5) plt.ioff() plt.show()
标签:open set 模式 art clear desktop get poc str
原文地址:https://www.cnblogs.com/picassooo/p/12563378.html