| 123 | |
| 124 | |
| 125 | def plot_cost_matrix(matrix, gt_keypoint_names, pred_keypoint_names, conversion_plot_out_path): |
| 126 | |
| 127 | matrix /= np.max(matrix) |
| 128 | fig, ax = plt.subplots() |
| 129 | ax.pcolor(matrix, cmap=plt.cm.Blues, vmin=0, vmax=1) |
| 130 | ax.set_xticks(np.arange(matrix.shape[1]) + 0.5, minor=False) |
| 131 | ax.set_yticks(np.arange(matrix.shape[0]) + 0.5, minor=False) |
| 132 | ax.set_xlim(0, int(matrix.shape[1])) |
| 133 | ax.set_ylim(0, int(matrix.shape[0])) |
| 134 | ax.set_yticklabels(pred_keypoint_names, minor=False) |
| 135 | ax.set_xticklabels(gt_keypoint_names, minor=False) |
| 136 | ax.set_title("cost matrix") |
| 137 | plt.xticks(rotation=90) |
| 138 | fig = plt.gcf() |
| 139 | fig.tight_layout() |
| 140 | |
| 141 | plt.savefig(conversion_plot_out_path, dpi=300) |
| 142 | |
| 143 | |
| 144 | def keypoint_matching( |