Download 3.py from slongle/3DEval: direct link, hf CLI and curl.
- Browser
- Download file 739 Bytes
-
https://huggingface.co/datasets/slongle/3DEval/resolve/main/3.py
- Command line
-
hf download hf://datasets/slongle/3DEval/3.py
-
curl -L -o 3.py https://huggingface.co/datasets/slongle/3DEval/resolve/main/3.py
739 Bytes
| import json | |
| import numpy as np | |
| from matplotlib import pyplot as plt | |
| result = json.load(open("correct_result.json")) | |
| ''' | |
| correct = [] | |
| wrong = [] | |
| for i in range(len(result)): | |
| for j in range(3): | |
| if result[i][j]: | |
| correct.append((i + 1, j + 1)) | |
| else: | |
| wrong.append((i + 1, j + 1)) | |
| plt.scatter(*zip(*correct), color="green") | |
| plt.scatter(*zip(*wrong), color="red") | |
| plt.xlim(0, len(result) + 1) # x轴范围 | |
| plt.ylim(0, 4) # y轴范围 | |
| ''' | |
| mat = np.array(result).T | |
| fig, ax = plt.subplots() | |
| sc = ax.matshow(mat) | |
| # cbar = plt.colorbar(sc, ax=ax, ticks=[0, 1]) | |
| # cbar.ax.set_yticklabels(['错误', '正确']) | |
| plt.savefig("correct.png") | |
| print(mat[0, :].mean(), mat[1, :].mean(), mat[2, :].mean()) | |