赞
踩
import numpy as np import matplotlib.pyplot as plt import re from matplotlib.pyplot import MultipleLocator input_txt = 'r3.txt' x = [] y = [] f = open(input_txt) i=0 for line in f: line = line.strip('\n') line = line.split(' ') line = " ".join(line) line = re.compile('[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]').sub(' ', line) line = line.split(' ') #if i>10: x.append(int(line[0])) y.append(float(line[1])) i=i+1 f.close plt.plot(x, y) y_major_locator=MultipleLocator(10) ax=plt.gca() ax.xaxis.set_major_locator(y_major_locator) plt.margins(0) #plt.xlim(5,40) #plt.xticks(np.arange(1, 150)) plt.xlabel("train step") plt.ylabel("loss") plt.tick_params(axis="both") plt.rcParams['figure.figsize'] = (5.0, 5.0) plt.show()
import matplotlib.pyplot as plt import re from matplotlib.pyplot import MultipleLocator input_txt1 = 'r1.txt' input_txt2 = 'r2.txt' input_txt3 = 'r3.txt' x = [] y1 = [] y2 = [] y3 = [] f = open(input_txt1) i=0 for line in f: line = line.strip('\n') line = line.split(' ') line = " ".join(line) line = re.compile('[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]').sub(' ', line) line = line.split(' ') if i>5 and i<60 : x.append(int(line[0])) y1.append(float(line[1])) i=i+1 f.close f = open(input_txt2) i=0 for line in f: line = line.strip('\n') line = line.split(' ') line = " ".join(line) line = re.compile('[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]').sub(' ', line) line = line.split(' ') if i>5 and i<60 : y2.append(float(line[1])) i=i+1 f.close f = open(input_txt3) i=0 for line in f: line = line.strip('\n') line = line.split(' ') line = " ".join(line) line = re.compile('[\\x00-\\x08\\x0b-\\x0c\\x0e-\\x1f]').sub(' ', line) line = line.split(' ') if i>5 and i<60 : y3.append(float(line[1])) i=i+1 f.close plt.rcParams['figure.figsize'] = (10.0, 5.0) plt.plot(x,y1,'b-.',label='Dense-YOLOv4') plt.plot(x,y2,'.b',label='YOLOv4') plt.plot(x,y3,'',label='SEDense-YOLOv4') plt.xlabel("train step") plt.ylabel("loss") plt.show()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。