import matplotlib.pyplot as plt
networks = ['A', 'B', 'C','D','E','F','G','H','I','J','K']
mIoU = [1, 2, 3, 4,5,6,7,8,9,10,11]
params = [1, 2, 3, 4,5,6,7,8,9,10,11]
flops = [1, 2, 3, 4,5,6,7,8,9,10,11]
time = [1, 2, 3, 4,5,6,7,8,9,10,11]
plt.style.use('seaborn')
fig, axs = plt.subplots(2, 2, figsize=(12, 8))
sci_nature_colors = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf']
bars = axs[0, 0].bar(networks, mIoU, color=sci_nature_colors)
axs[0, 0].set_title('mIoU Comparison')
axs[0, 0].set_ylabel('mIoU (%)')
axs[0, 0].tick_params(axis='x', rotation=45)
bars = axs[0, 1].bar(networks, params, color=sci_nature_colors)
axs[0, 1].set_title('Parameter Comparison')
axs[0, 1].set_ylabel('Params (M)')
axs[0, 1].tick_params(axis='x', rotation=45)
bars = axs[1, 0].bar(networks, flops, color=sci_nature_colors)
axs[1, 0].set_title('FLOPs Comparison')
axs[1, 0].set_ylabel('FLOPs (G)')
axs[1, 0].tick_params(axis='x', rotation=45)
bars = axs[1, 1].bar(networks, time, color=sci_nature_colors)
axs[1, 1].set_title('Time Comparison')
axs[1, 1].set_ylabel('Time (s)')
axs[1, 1].tick_params(axis='x', rotation=45)
for ax in axs.flat:
for bar in ax.patches:
height = bar.get_height()
ax.annotate('%.3f' % height,
xy=(bar.get_x() + bar.get_width() / 2, height),
xytext=(0, 3),
textcoords="offset points",
ha='center', va='bottom')
plt.tight_layout()
fig.patch.set_facecolor('#f2f2f2')
font = {'family': 'sans-serif', 'weight': 'normal', 'size': 12}
plt.rc('font', **font)
for ax in axs.flat:
ax.grid(axis='y', linestyle='--', alpha=0.7)
ax.grid(visible=True, which='major', linestyle='-')
ax.grid(visible=True, which='minor', linestyle='--', alpha=0.5)
ax.minorticks_on()
plt.savefig('network_comparison.png', dpi=300, bbox_inches='tight')
plt.show()