Commit 46e57f6c authored by Guillaume HEUSCH's avatar Guillaume HEUSCH

started fr-pad

parent 3128c18b
Pipeline #25266 passed with stage
in 1 minute and 2 seconds
......@@ -102,3 +102,58 @@ def compare_dets(scores_neg, scores_pos, labels, ax_lim=[0.01, 90, 0.01, 90]):
pyplot.legend()
pyplot.grid(True)
pyplot.show()
def get_scores_complete(score_file):
scores_it = bob.bio.base.score.load.four_column(score_file)
scores = []
for s in scores_it:
score_item = {}
score_item['claim_id'] = s[0]
score_item['real_id'] = s[1]
score_item['file'] = s[2]
score_item['score'] = s[3]
scores.append(score_item)
return scores
# get positives and negatives
def positives_negatives(scores):
positives = []
negatives = []
for s in scores:
if s['claim_id'] == s['real_id']:
positives.append(s['score'])
else:
negatives.append(s['score'])
return positives, negatives
def plot_scores_distributions_zei_genuine(negatives, positives, 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, label='Genuine')
pyplot.hist(negatives, density=True, color='r', bins=n_bins, alpha=0.4, label='Zero-Effort Impostors')
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()
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()
......@@ -383,7 +383,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
"version": "3.6.6"
}
},
"nbformat": 4,
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