#!/usr/bin/python # -*- coding: UTF-8 -*- # 文件名:PaintRoc.py import os import pylab as pl import pylab as pl1 #roc曲线 #文件名 file_x = open('C:\\work\\1220\\x\\x.txt')#file_y = open('E:\\model_output_log\\y\\_iter_36000_yhand_output.txt') dir = 'C:\\work\\1220\\y\\' #dir = 'D:\\2017111701\\model\\' x1 = [] object_dic = {} no_object_dic = {} fig = pl.figure() x_number= [] y_number= [] for distance in range(50):y_number.append(distance*0.02) for distance in range(100):x_number.append(distance* 0.01) try:# 绘制第一副图像的第一条直线 for line in file_x:x1.append(float(line[0:9]))for root, dirs, files in os.walk(dir):temp = 'no phone' number = 0 line_color = ['pink','green','red','blue','purple','chocolate','','','','','','','','','','','','','','','','']for file in files:filepath = os.path.join(root, file)file_y = open(filepath)y1 = []for line in file_y:y1.append(float(line[0:9]))# 控制图像颜色line_color和最大正确率计算列表no_object_list、object_list temp = filepl.plot(x1, y1, label=temp) #pl.plot(x1, y1, line_color[number], label=temp) #pl.plot([x1[0], y1[0], ], [0, y1[0]], 'k--', linewidth=1.5) temp = "" number = number + 1 #line_color = 'ro-' file_y.close()finally:file_x.close()#for key in no_object_dic.keys(): #pl.annotate("sdf",0,1) #pl.plot([0.999,0.999,],[0,0.999],'k--',linewidth=2.5)#绘制曲线 #pl.xticks(x1, rotation=0) 绘制x轴坐标 pl.xticks(x_number, rotation=0) pl.yticks(y_number, rotation=0) #pl.margins(0.08) pl.title('Prediction Second|PTR') # give plot a title pl.xlabel('Prediction ') # make axis labels pl.ylabel('PTR ') pl.subplots_adjust(None,None,None, None, 0.2, 0.2) pl.xlim(0.5, 1) # set axis limits pl.ylim(0.002, 1) pl.legend(loc='upper left') # upper left 标识线条 pl.show() fig.savefig('E:\\paint\\model_8\\1.jpg') #pl.plot(x1, y1,'ro', label="point")# 画点 #print("最值====",max(y1)) #pl.show()# show the plot on the screen #pl1.show()
详细解决方案
绘制多条loss曲线(y:迭代次数和x:阀值)
热度:19 发布时间:2023-09-30 22:23:00.0