import matplotlib.pyplot as plt import seaborn as sns import pandas as pd # 设置数据 resolution = [336.00, 448.00, 560.00, 672.00, 784.00, 896.00, 1024.00] # 数据:RoI Thing roi_thing = { "Resolution": resolution, "CLIPself": [65.90, 69.50, 70.90, 71.70, 72.00, 72.60, 72.30], "RegionCLIP": [66.40, 70.00, 71.20, 72.10, 72.10, 72.00, 71.90], "DeCLIP": [68.90, 72.10, 74.30, 75.20, 75.50, 75.70, 75.40] } # 数据:Mask Thing mask_thing = { "Resolution": resolution, "CLIPself": [60.10, 66.00, 69.50, 71.40, 72.70, 74.00, 74.60], "RegionCLIP": [60.60, 66.90, 69.70, 72.50, 73.50, 73.90, 74.70], "DeCLIP": [62.9, 69.0, 72.10, 75.2, 76.3, 77.5, 77.20] } # 数据:Mask Stuff mask_stuff = { "Resolution": resolution, "CLIPself": [40.80, 43.10, 44.60, 45.40, 45.90, 46.50, 46.90], "RegionCLIP": [28.20, 30.10, 30.30, 31.10, 32.50, 35.00, 34.80], "DeCLIP": [47.4, 50.6, 52.2, 54.0, 54.4, 55.9, 56.0] } # 将数据转换为 pandas DataFrame df_roi_thing = pd.DataFrame(roi_thing) df_mask_thing = pd.DataFrame(mask_thing) df_mask_stuff = pd.DataFrame(mask_stuff) # 设置绘图风格和颜色 sns.set_style("whitegrid") # 定义新的颜色、线条样式和标记符号 color_palette = ['#1f77b4', '#ff7f0e', '#2ca02c'] # 参考图的颜色 line_styles = ['--', '--', '--'] markers = ['o', 's', '^'] # 设置全局字体和线宽 plt.rcParams.update({ 'font.size': 10, # 字体大小 'axes.labelsize': 10, 'lines.linewidth': 2.5, # 线条宽度 'legend.fontsize': 12, # 图例字体大小 'xtick.labelsize': 10, # x轴刻度字体大小 'ytick.labelsize': 10, # y轴刻度字体大小 'grid.color': 'gray', # 网格线颜色 'grid.alpha': 0.3, # 调整网格线透明度 }) # 绘制 RoI Thing 折线图并保存 plt.figure(figsize=(4, 3)) # 调整图的大小 plt.plot(df_roi_thing['Resolution'], df_roi_thing['DeCLIP'], linestyle=line_styles[2], marker=markers[2], color=color_palette[2], label='DeCLIP') plt.plot(df_roi_thing['Resolution'], df_roi_thing['CLIPself'], linestyle=line_styles[0], marker=markers[0], color=color_palette[0], label='CLIPself') plt.plot(df_roi_thing['Resolution'], df_roi_thing['RegionCLIP'], linestyle=line_styles[1], marker=markers[1], color=color_palette[1], label='RegionCLIP') plt.xlabel('Resolution') plt.ylabel(' RoI Align (Thing) mAcc') # 统一纵坐标标签 plt.xticks(resolution) plt.grid(True, linestyle='--', color='gray', alpha=0.3) # 更淡的网格 # plt.legend(loc='lower right') plt.legend(loc='best',fontsize=12,framealpha=0.5) plt.tight_layout() plt.savefig('roi_thing.pdf', dpi=300) # 保存为PDF plt.close() # 绘制 Mask Thing 折线图并保存 plt.figure(figsize=(4, 3)) plt.plot(df_mask_thing['Resolution'], df_mask_thing['DeCLIP'], linestyle=line_styles[2], marker=markers[2], color=color_palette[2], label='DeCLIP') plt.plot(df_mask_thing['Resolution'], df_mask_thing['CLIPself'], linestyle=line_styles[0], marker=markers[0], color=color_palette[0], label='CLIPself') plt.plot(df_mask_thing['Resolution'], df_mask_thing['RegionCLIP'], linestyle=line_styles[1], marker=markers[1], color=color_palette[1], label='RegionCLIP') plt.xlabel('Resolution') plt.ylabel(' Mask Pooling (Thing) mAcc') # 统一纵坐标标签 plt.xticks(resolution) plt.grid(True, linestyle='--', color='gray', alpha=0.3) # 更淡的网格 # plt.legend(loc='lower right') plt.legend(loc='best',fontsize=12,framealpha=0.5) plt.tight_layout() plt.savefig('mask_thing.pdf', dpi=300) # 保存为PDF plt.close() # 绘制 Mask Stuff 折线图并保存 plt.figure(figsize=(4, 3)) plt.plot(df_mask_stuff['Resolution'], df_mask_stuff['DeCLIP'], linestyle=line_styles[2], marker=markers[2], color=color_palette[2], label='DeCLIP') plt.plot(df_mask_stuff['Resolution'], df_mask_stuff['CLIPself'], linestyle=line_styles[0], marker=markers[0], color=color_palette[0], label='CLIPself') plt.plot(df_mask_stuff['Resolution'], df_mask_stuff['RegionCLIP'], linestyle=line_styles[1], marker=markers[1], color=color_palette[1], label='RegionCLIP') plt.xlabel('Resolution') plt.ylabel('Mask Pooling (Stuff) mAcc') # 统一纵坐标标签 plt.xticks(resolution) plt.grid(True, linestyle='--', color='gray', alpha=0.3) # 更淡的网格 # plt.legend(loc='lower right') plt.legend(loc='best', fontsize=12,framealpha=0.5) plt.tight_layout() plt.savefig('mask_stuff.pdf', dpi=300) # 保存为PDF plt.close()