|
| 1 | +import numpy as np |
| 2 | +import matplotlib.pyplot as plt |
| 3 | +from matplotlib import cm |
| 4 | + |
| 5 | + |
| 6 | +data = { |
| 7 | + 'RHD': [0.6564078157637292, 0.7067105576267153, 0.7490415377700219, 0.783810581423019, 0.813027154226488, 0.836995320060284, 0.8577245445651887, 0.8741836545834325, 0.8881441527193887, 0.8998175616720869, 0.9100896327437138, 0.9187752835726184, 0.9261389175325877, 0.9324317178287195, 0.9379180878348008, 0.9425451468760742], |
| 8 | + 'STB': [0.7323492063492063, 0.7761904761904762, 0.8114920634920635, 0.841015873015873, 0.8640952380952381, 0.8826825396825397, 0.8992380952380953, 0.9118888888888889, 0.9234761904761905, 0.9322698412698412, 0.9411428571428572, 0.9485873015873015, 0.9547936507936507, 0.9609047619047619, 0.9655238095238096, 0.9693015873015873], |
| 9 | + 'DO': [0.8161910144108505, 0.8587877931619101, 0.8924837524724498, 0.9169256852218141, 0.9356456626165583, 0.9489968917773383, 0.9583922011867759, 0.9655269850240181, 0.9708957332579825, 0.9742158801921447, 0.977606668550438, 0.9791607798813224, 0.9812800226052557, 0.9829047753602712, 0.9837524724498445, 0.9843176038428935], |
| 10 | + 'ED': [0.6108895439569967, 0.6606554534419976, 0.7024449453788798, 0.7398994277787411, 0.7724986994971389, 0.7964279521414948, 0.8172359979191954, 0.8319750303450668, 0.8449800589561297, 0.8545170799375759, 0.864054100919022, 0.873764522281949, 0.8801803363967401, 0.8838217444078377, 0.8883301543263395, 0.8923183631003988] |
| 11 | +} |
| 12 | + |
| 13 | + |
| 14 | +def calculate_auc(xs, ys): |
| 15 | + length = xs[-1] - xs[0] |
| 16 | + area = 0 |
| 17 | + for i in range(len(ys) - 1): |
| 18 | + area += (ys[i] + ys[i + 1]) * (xs[i + 1] - xs[i]) / 2 / length |
| 19 | + return area |
| 20 | + |
| 21 | + |
| 22 | +def plot_pck(): |
| 23 | + for name, ys in data.items(): |
| 24 | + xs = np.linspace(20, 50, len(ys)) |
| 25 | + label = name + (' (AUC=%.3f)' % calculate_auc(xs, ys)) |
| 26 | + plt.plot(xs, ys, label=label) |
| 27 | + plt.legend() |
| 28 | + plt.xlabel('Error thresholds (mm)') |
| 29 | + plt.ylabel('3D PCK') |
| 30 | + plt.grid(linestyle='-.') |
| 31 | + plt.tight_layout() |
| 32 | + plt.show() |
| 33 | + |
| 34 | + |
| 35 | +if __name__ == '__main__': |
| 36 | + plot_pck() |
0 commit comments