File size: 1,081 Bytes
fabf9c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

def heatmap(file_path, output_path):
    df = pd.read_excel(file_path)

    counts = [0] * 9
    for i in range(9):
        for j in range(200 * i, 200 * (i+1)):
            if df.iloc[j]["answer"] in df.iloc[j]["prediction"]:
                counts[i] += 1
        counts[i] = counts[i] / 200
    matrix = [counts[0:3], counts[3:6], counts[6:9]]

    # 绘图
    plt.figure(figsize=(6, 6))
    ax = sns.heatmap(matrix, annot=False, fmt="d", cmap="OrRd", xticklabels=[0,1,2], yticklabels=[0,1,2], vmin=0.7, vmax=0.8)
    ax.set_aspect("equal")
    plt.title("Correct Predictions Heatmap")
    plt.xlabel("Column")
    plt.ylabel("Row")
    plt.savefig(output_path)


# Qwen2.5-VL-7B-Instruct
qwen_file_path = "./Qwen2.5-VL-7B-Instruct_ShapeGrid_sudoku_ShapeGrid.xlsx"
output_path = "./heatmap_full.png"
heatmap(qwen_file_path, output_path)


# MiniCPM-o-2_6
minicpm_file_path = "./MiniCPM-o-2_6_ShapeGrid_sudoku_ShapeGrid.xlsx"
output_path = "./heatmap_slice.png"
heatmap(minicpm_file_path, output_path)