import pandas as pd
import matplotlib.pyplot as plt# 读取CSV文件
df1 = pd.read_csv(r'E:\xianyu\yolo.csv')
df2 = pd.read_csv(r'E:\xianyu\final.csv')# 获取列名
columns = df1.columns# 循环绘制每一列的对比图
for column in columns:plt.figure(figsize=(8, 5))plt.plot(df1[column], label='Ours', marker='o', color='red')plt.plot(df2[column], label='Yolov5s', marker='x', color='blue') # 将颜色改为红色plt.title(f'Comparison of {column}')plt.xlabel('Epochs')plt.ylabel('Values')plt.legend()plt.show()