|
import pandas as pd |
|
import matplotlib.pyplot as plt |
|
|
|
def plot_training_results(csv_path): |
|
""" |
|
Plots the training accuracy over epochs from the training results CSV file. |
|
|
|
Parameters: |
|
csv_path (str): Path to the training results CSV file. |
|
""" |
|
|
|
results = pd.read_csv(csv_path) |
|
results.columns = results.columns.str.strip() |
|
|
|
|
|
epochs = results.index + 1 |
|
mAP_0_5 = results['metrics/mAP50(B)'] |
|
mAP_0_5_0_95 = results['metrics/mAP50-95(B)'] |
|
|
|
|
|
plt.figure(figsize=(10, 5)) |
|
plt.plot(epochs, mAP_0_5, label='mAP@0.5') |
|
plt.plot(epochs, mAP_0_5_0_95, label='mAP@0.5:0.95') |
|
plt.xlabel('Epoch') |
|
plt.ylabel('Accuracy') |
|
plt.title('Accuracy Over Epochs') |
|
plt.legend() |
|
plt.grid(True) |
|
plt.show() |
|
|
|
if __name__ == "__main__": |
|
plot_training_results('runs/detect/train/results.csv') |
|
|