Commit 205bc2f6 authored by Guillaume HEUSCH's avatar Guillaume HEUSCH

added scores for fr-pad + first plots (distributions with IAMPR)

parent b3a6ad85
Pipeline #25326 failed with stage
in 2 seconds
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -142,18 +142,71 @@ def plot_scores_distributions_zei_genuine(negatives, positives, title='Score Dis
pyplot.ylabel("Probability Density")
pyplot.legend()
def calc_pass_rate(threshold, attacks):
return sum(1 for i in attacks if i >= threshold) / float(attacks.size)
def get_iampr_line(fig, attacks):
ax = fig.get_axes()
x_limits = ax[0].get_xlim()
ntick = 100
step = (x_limits[1] - x_limits[0]) / float(ntick)
thres = [(k * step) + x_limits[0] for k in range(2, ntick - 1)]
mix_prob_y = []
for k in thres:
mix_prob_y.append(100. * calc_pass_rate(k, numpy.array(attacks)))
return thres, mix_prob_y
def plot_scores_distributions_zei_attacks_genuine(negatives, positives, attacks, title='Score Distribution', n_bins=50, threshold_height=1):
# compute the threshold on the dev set
threshold = bob.measure.eer_threshold(negatives, positives)
pyplot.figure(figsize=(7,5))
pyplot.hist(positives, density=True, color='g', bins=n_bins, alpha=0.7, label='Genuine')
pyplot.hist(negatives, density=True, color='r', bins=n_bins, alpha=0.4, label='Zero-Effort Impostors')
pyplot.hist(attacks, density=True, color='gray', bins=n_bins, alpha=0.7, hatch='\\\\', label='Presentation Attacks')
pyplot.vlines(threshold, 0, threshold_height, colors='r', linestyles='dashed', label='EER Threshold')
pyplot.title('Development set')
pyplot.xlabel("Score Value")
pyplot.ylabel("Probability Density")
pyplot.legend()
fig, ax1 = pyplot.subplots(figsize=(7,5))
ax1.hist(positives, density=True, color='g', bins=n_bins, alpha=0.7, label='Genuine')
ax1.hist(negatives, density=True, color='r', bins=n_bins, alpha=0.4, label='Zero-Effort Impostors')
ax1.hist(attacks, density=True, color='gray', bins=n_bins, alpha=0.7, hatch='\\\\', label='Presentation Attacks')
ax1.vlines(threshold, 0, threshold_height, colors='r', linestyles='dashed', label='EER Threshold')
ax1.set_xlabel("Score Value")
ax1.set_ylabel("Probability Density")
ax2 = ax1.twinx()
points, iampr = get_iampr_line(fig, attacks)
ax2.plot(points, iampr, color='b', label ='IAMPR')
ax2.set_ylabel('IAMPR')
ax1.legend(loc=6)
ax2.legend()
pyplot.show()
#f = pyplot.figure(figsize=(7,5))
#pyplot.hist(positives, density=True, color='g', bins=n_bins, alpha=0.7, label='Genuine')
#pyplot.hist(negatives, density=True, color='r', bins=n_bins, alpha=0.4, label='Zero-Effort Impostors')
#pyplot.hist(attacks, density=True, color='gray', bins=n_bins, alpha=0.7, hatch='\\\\', label='Presentation Attacks')
#pyplot.vlines(threshold, 0, threshold_height, colors='r', linestyles='dashed', label='EER Threshold')
#ax = f.get_axes()
#prob_ax = ax[0].twinx()
#points, iampr = get_iampr_line(f, attacks)
#pyplot.plot(points, iampr, color='b')
#pyplot.plot()
#pyplot.title('Development set')
#pyplot.xlabel("Score Value")
#pyplot.ylabel("Probability Density")
#pyplot.legend()
def epsc(scores):
"""
scores: list
licit dev, licit-eval, spoof-dev, spoof-eval
"""
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment