Coverage for src/bob/bio/face/reports/ijbc.py: 0%

26 statements  

« prev     ^ index     » next       coverage.py v7.6.0, created at 2024-07-13 00:04 +0200

1import matplotlib.pyplot as plt 

2 

3from matplotlib.backends.backend_pdf import PdfPages 

4 

5from bob.bio.base.score.load import cmc 

6from bob.measure import plot 

7 

8 

9def ijbc_report(scores_dev, output_filename, titles, figsize=(8, 6)): 

10 colors = plt.cm.tab10.colors 

11 

12 # Plotting 

13 pdf = PdfPages(output_filename) 

14 

15 # Figure for eval plot 

16 fig = plt.figure(figsize=figsize) 

17 ax = fig.add_subplot(111) 

18 

19 for d_scores, title, color in zip(scores_dev, titles, colors): 

20 cmc_scores = cmc(d_scores) 

21 

22 plot.detection_identification_curve( 

23 cmc_scores, rank=1, logx=True, color=color, label=title, linewidth=2 

24 ) 

25 

26 pass 

27 

28 pass 

29 

30 # Plot finalization 

31 ax.set_xlabel("False Positive Identification Rate", fontsize=18) 

32 ax.set_ylabel("True Positive Identification Rate", fontsize=18) 

33 

34 x_ticks = [0.0001, 0.001, 0.01, 0.1, 1] 

35 ax.set_xticks(x_ticks) 

36 ax.set_xticklabels( 

37 ["$10^{-4}$", "$10^{-3}$", "$10^{-2}$", "$10^{-1}$", "$10^{0}$"], 

38 fontsize=14, 

39 ) 

40 

41 y_ticks = [0, 0.2, 0.4, 0.6, 0.8, 1] 

42 ax.set_yticks(y_ticks) 

43 ax.set_yticklabels([f"{round(y*100,0)}" for y in y_ticks], fontsize=14) 

44 

45 plt.legend() 

46 plt.grid() 

47 

48 pdf.savefig(fig) 

49 pdf.close()