用代码yolov5生成改进前后map曲线对比图,map0.5,map0.5:0.95,很简单,小白都能看懂!

用代码yolov5生成map曲线对比图,map0.5,map0.5:0.95

  • map曲线对比图

map曲线对比图

用代码yolov5生成改进前后map曲线对比图,map0.5,map0.5:0.95,很简单,小白都能看懂!_第1张图片
用代码yolov5生成改进前后map曲线对比图,map0.5,map0.5:0.95,很简单,小白都能看懂!_第2张图片
重点csv文件在runs/train/exp中!!

import pandas as pd
import matplotlib.pyplot as plt

# Function to clean column names
def clean_column_names(df):
    df.columns = df.columns.str.strip()
    df.columns = df.columns.str.replace('\s+', '_', regex=True)

#nonoresult.csv表示原始的结果图,csv文件在runs/train/exp中
original_results = pd.read_csv("noresult.csv")
#yesyesresult.csv表示提高后的结果图,csv文件在runs/train/exp中
improved_results = pd.read_csv("yesresult.csv")

# Clean column names
clean_column_names(original_results)
clean_column_names(improved_results)

# Plot [email protected] curves
plt.figure()
#lable属性为曲线名称,自己可以定义
plt.plot(original_results['metrics/mAP_0.5'], label="Original YOLOv5")
plt.plot(improved_results['metrics/mAP_0.5'], label="Improved YOLOv5")
plt.xlabel("Epoch")
plt.ylabel("[email protected]")
plt.legend()
plt.title("[email protected] Comparison")
plt.savefig("mAP_0.5_comparison.png")

# Plot [email protected]:0.95 curves
plt.figure()
plt.plot(original_results['metrics/mAP_0.5:0.95'], label="Original YOLOv5")
plt.plot(improved_results['metrics/mAP_0.5:0.95'], label="Improved YOLOv5")
plt.xlabel("Epoch")
plt.ylabel("[email protected]:0.95")
plt.legend()
#图的标题
plt.title("[email protected]:0.95 Comparison")
#图片名称
plt.savefig("mAP_0.5_0.95_comparison.png")

你可能感兴趣的:(yolov5,YOLO,python,数据分析)