| import numpy as np |
| import matplotlib.pyplot as plt |
|
|
|
|
| def main(): |
| labels = ['R1@0.5', 'R1@0.7', 'mAP@0.5', 'mAP@0.75', 'mAP'] |
| alpha_values = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0] |
| data = { |
| "R1@0.5": [72.06, 72.19, 72.45, 72.58, 73.23, 72.71], |
| "R1@0.7": [57.16, 57.42, 58.52, 57.74, 57.23, 56.77], |
| "mAP@0.5": [72.45, 72.53, 73.08, 73.71, 73.41, 72.88], |
| "mAP@0.75": [54.9, 55.56, 55.77, 56.39, 55.38, 54.76], |
| "mAP": [52.63, 52.71, 53.08, 54.18, 53.11, 52.52], |
| } |
|
|
| |
| colors = { |
| "R1@0.5": (126 / 255, 153 / 255, 244 / 255), |
| "R1@0.7": (204 / 255, 124 / 255, 113 / 255), |
| "mAP@0.5": (122 / 255, 182 / 255, 86 / 255), |
| "mAP@0.75": (146 / 255, 94 / 255, 176 / 255), |
| "mAP": (165 / 255, 174 / 255, 183 / 255), |
| } |
|
|
| |
| fig, axes = plt.subplots(2, 2, figsize=(10, 8)) |
| axes = axes.flatten() |
| |
| |
| metrics_to_show = ["R1@0.5", "mAP@0.5", "mAP@0.75", "mAP"] |
| |
| |
| markers = ['o', 's', '^', 'D'] |
| |
| for idx, metric in enumerate(metrics_to_show): |
| ax = axes[idx] |
| values = data[metric] |
| color = colors[metric] |
| marker = markers[idx] |
| |
| ax.plot(alpha_values, values, linewidth=3.0, color=color, marker=marker, markersize=8, |
| markerfacecolor='white', markeredgecolor=color, markeredgewidth=1.5) |
| ax.set_xlabel('α', fontsize=14, fontweight='bold') |
| ax.set_ylabel('Score (%)', fontsize=14, fontweight='bold') |
| ax.set_title(metric, fontsize=16, fontweight='bold') |
| ax.set_xticks(alpha_values) |
| ax.tick_params(axis='both', labelsize=12) |
| |
| |
| plt.tight_layout() |
| plt.savefig("line_chart.pdf", bbox_inches='tight', pad_inches=0.2) |
| plt.savefig("line_chart.svg", bbox_inches='tight', pad_inches=0.2) |
| plt.show() |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|
|
|