Commit 2e3db8fc authored by Guillaume HEUSCH's avatar Guillaume HEUSCH

more on fr-pad: espc (basic) code ok

parent fc7dbff0
Pipeline #25389 passed with stage
in 58 seconds
This diff is collapsed.
......@@ -112,13 +112,53 @@ def scatter_plot(fr_scores, pad_scores):
fig, ax1 = pyplot.subplots(figsize=(7,5))
def espc():
licit_dev_neg = input_scores[0][0]
licit_dev_pos = input_scores[0][1]
licit_eval_neg = input_scores[1][0]
licit_eval_pos = input_scores[1][1]
spoof_dev_neg = input_scores[2][0]
spoof_dev_pos = input_scores[2][1]
spoof_eval_neg = input_scores[3][0]
spoof_eval_pos = input_scores[3][1]
def sort_spoof_scores(scores):
scores_attack = []
scores_genuine = []
for s in scores:
if s['real_id'] == 'attack':
scores_attack.append(s['score'])
else:
scores_genuine.append(s['score'])
return scores_attack, scores_genuine
def sort_licit_scores(scores):
scores_zei = []
scores_genuine = []
for s in scores:
if s['claim_id'] == s['real_id']:
scores_genuine.append(s['score'])
else:
scores_zei.append(s['score'])
return scores_zei, scores_genuine
def plot_espc(licit_dev, licit_eval, spoof_dev, spoof_eval):
licit_dev_neg, licit_dev_pos = sort_licit_scores(licit_dev)
licit_eval_neg, licit_eval_pos = sort_licit_scores(licit_eval)
spoof_dev_neg, spoof_dev_pos = sort_spoof_scores(spoof_dev)
spoof_eval_neg, spoof_eval_pos = sort_spoof_scores(spoof_eval)
from error_utils import epsc_thresholds
points = 10
omega, beta, thrs = epsc_thresholds(
licit_dev_neg,
licit_dev_pos,
spoof_dev_neg,
spoof_dev_pos,
points=points,
criteria='eer',
beta=0.5)
from error_utils import all_error_rates
errors = all_error_rates(licit_eval_neg, licit_eval_pos, spoof_eval_neg,
spoof_eval_pos, thrs, omega, beta)
# plot
from matplotlib import pyplot
fig, ax1 = pyplot.subplots(figsize=(7,5))
ax1.plot(omega, 100. * errors[4].flatten())
ax2 = ax1.twinx()
ax2.plot(omega, 100. * errors[2].flatten())
pyplot.show()
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