def draw_loss(X,Y,Z):fig = plt.figure()ax = fig.add_subplot(111, projection=\'3d\')# X, Y, Z = axes3d.get_test_data(0.05)##### Grab some test data.surf = ax.plot_surface(X, Y, Z, cmap=cm.coolwarm,linewidth=0, antialiased=False)# Customize the z axis.#ax.set_zlim(-1.01, 1.01)ax.zaxis.set_major_locator(LinearLocator(10))ax.zaxis.set_major_formatter(FormatStrFormatter(\'%.02f\'))# Add a color bar which maps values to colors.fig.colorbar(surf, shrink=0.5, aspect=5)plt.show()
def cal_Z(C, L):# C,L 转为 S,E# SE计算对应的iouS,E = CL2XY(C,L)DIoU = cal_diou(S,E)return 1-DIoU
c = np.arange(0.0, 1.0, 0.02)l = np.arange(0.0, 1.0, 0.02)C,L = np.meshgrid(c,l)Z = cal_Z(C,L)draw_loss(C,L,Z)