Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lab-speaker-recognition
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
biometric-resources
lab-speaker-recognition
Commits
35dea031
Commit
35dea031
authored
Oct 12, 2018
by
Sushil Bhattacharjee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated notebooks
parent
32daf068
Pipeline
#24273
failed with stage
in 2 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
144 additions
and
3044 deletions
+144
-3044
notebooks/data/voxforge_denoised_scores_dev.txt
notebooks/data/voxforge_denoised_scores_dev.txt
+0
-3000
notebooks/model.07_asv_intro.ipynb
notebooks/model.07_asv_intro.ipynb
+72
-27
notebooks/model.08_asv_expts.ipynb
notebooks/model.08_asv_expts.ipynb
+72
-17
No files found.
notebooks/data/voxforge_denoised_scores_dev.txt
deleted
100644 → 0
View file @
32daf068
This source diff could not be displayed because it is too large. You can
view the blob
instead.
notebooks/model.07_asv_intro.ipynb
View file @
35dea031
...
...
@@ -88,41 +88,49 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Algorithm:\n",
"\n",
"Input: x: speech_sample, u:UBM, s:speaker_model\n",
"## Training UBM for VoxForge dataset\n",
"\n",
"1. Define a threshold c2.\n",
"2. Compute F: array of MFCC features from x\n",
"2. Compute A = ln(p(F|speaker_model)): log(probability that speech-sample was produced by speaker-model of claimed-identity)\n",
"3. Compute B = ln(p(F|UBM)): log(probability that speech was produced by some other person in the world)\n",
"4. Return score = (A - B)\n"
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##
Training UBM for VoxForge dataset
\n",
"##
Enrollment Procedure
\n",
"\n",
""
"Input: x: speech_sample, u: UBM, i: identity\n",
"\n",
"1. Compute F: array of MFCC features from x\n",
"2. Apply MAP adaptation on UBM_GMM to generate Speaker_GMM\n",
"3. Store Speaker_GMM model for Speaker-i.\n",
"\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##
Given
:\n",
"##
Probe Algorithm
:\n",
"\n",
"1. Pre-computed features: one feature-set per presentation audio.\n",
"2. Pre-computed UBM: GMM with 64 components\n",
"3. Pre-trained threshold, determined using 'dev' set.\n",
"4. Pre-enrolled speakers in 'eval' set.\n",
"Input: x: speech_sample, u: UBM, s: Speaker_model of 'claimed identity'\n",
"\n",
"## To do:\n",
"1. For each enrolled speaker:\n",
" 2. For feature-set of every probe-sample in 'eval' set:\n",
" 3. Determine if sample came from enrolled speaker"
"1. Define a threshold c2.\n",
"2. Compute F: array of MFCC features from x\n",
"2. Compute A = ln(p(F|speaker_model)): log(probability that speech-sample was produced by speaker-model of claimed-identity)\n",
"3. Compute B = ln(p(F|UBM)): log(probability that speech was produced by some other person in the world)\n",
"4. Return score = (A - B)\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Select Threshold Using 'Dev' Set"
]
},
{
...
...
@@ -131,6 +139,7 @@
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import os\n",
"\n",
"code_dir = os.getcwd()\n",
...
...
@@ -152,15 +161,18 @@
"import re, sys\n",
"import numpy\n",
"from pathlib import Path\n",
"from speaker_lib import load_scores\n",
"\n",
"my_file_name = \"data/voxforge_denoised_scores_dev.txt\"\n",
"%print(\"My file is %s\" %my_file_name)\n",
"my_file = Path(my_file_name)\n",
"assert my_file.is_file(), \"File %s does not exist. Quitting.\" %my_file_name\n",
"my_file_name = \"data/voxforge_denoised_16K_scores_dev.txt\"\n",
"#print(\"My file is %s\" %my_file_name)\n",
"#my_file = Path(my_file_name)\n",
"#assert my_file.is_file(), \"File %s does not exist. Quitting.\" %my_file_name\n",
"#\n",
"#dsf = open(\"data/voxforge_denoised_16K_scores_dev.txt\", \"r\")\n",
"#x = dsf.readlines()\n",
"#dsf.close()\n",
"\n",
"dsf = open(\"data/voxforge_denoised_scores_dev.txt\", \"r\")\n",
"x = dsf.readlines()\n",
"dsf.close()\n",
"dev_zei_scores, dev_gen_scores = load_scores(my_file_name)\n",
"\n",
"dev_gen_scores = [float(line.split()[3]) for line in x if line.split()[0] == line.split()[1]]\n",
"dev_zei_scores = [float(line.split()[3]) for line in x if line.split()[0] != line.split()[1]]\n",
...
...
@@ -173,7 +185,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Score Distribution for 'dev' set"
"## Plot Score Distribution for 'dev' set\n",
"\n",
"Green: histogram of scores of genuine presentations\n",
"Blue: histogram of scores of zero-effort-impostor presentations "
]
},
{
...
...
@@ -193,6 +208,19 @@
"print(\"Threshold for FMR=0.01% on dev-set:\" '{:6.2f}'.format(dev_fmr_001))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plot the Detection Error Tradeoff (DET) Curve\n",
"\n",
"There are two kinds of detection error:\n",
" - Genuine presentation classified as Impostor: False non-match rate (FNMR)\n",
" - Impostor presentation classified as Genuine: False Match Rate (FMR)\n",
"\n",
"DET curve shows how much FNMR you should expect as you adjust the Threshold (left to right) to achieve a desired FMR."
]
},
{
"cell_type": "code",
"execution_count": null,
...
...
@@ -202,6 +230,23 @@
"plots.plot_det(dev_zero_effort_impostor_scores, dev_genuine_scores)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Given:\n",
"\n",
"1. Pre-computed features: one feature-set per presentation audio.\n",
"2. Pre-computed UBM: GMM with 64 components\n",
"3. Pre-trained threshold, determined using 'dev' set.\n",
"4. Pre-enrolled speakers in 'eval' set.\n",
"\n",
"## To do:\n",
"1. For each enrolled speaker:\n",
" 2. For feature-set of every probe-sample in 'eval' set:\n",
" 3. Determine if sample came from enrolled speaker"
]
},
{
"cell_type": "code",
"execution_count": null,
...
...
notebooks/model.08_asv_expts.ipynb
View file @
35dea031
...
...
@@ -78,22 +78,31 @@
"outputs": [],
"source": [
"from pathlib import Path\n",
"import numpy\n",
"from speaker_lib import load_scores\n",
"\n",
"my_file_name = \"data/voxforge_denoised_scores_dev.txt\"\n",
"my_file = Path(my_file_name)\n",
"assert my_file.is_file(), \"File %s does not exist. Quitting.\" %my_file_name\n",
"\n",
"dsf = open(\"data/voxforge_denoised_scores_dev.txt\", \"r\")\n",
"x = dsf.readlines()\n",
"dsf.close()\n",
"\n",
"dev_gen_scores = [float(line.split()[3]) for line in x if line.split()[0] == line.split()[1]]\n",
"dev_zei_scores = [float(line.split()[3]) for line in x if line.split()[0] != line.split()[1]]\n",
"my_file_name = \"data/voxforge_denoised_16K_scores_dev.txt\"\n",
"# we assume that the file is in the 4-column format devised for bob-score-files.\n",
"\n",
"dev_genuine_scores = numpy.array(dev_gen_scores)\n",
"dev_zero_effort_imposter_scores = numpy.array(dev_zei_scores)\n",
"dev_fmr_01 = bob.measure.far_threshold (dev_zero_effort_imposter_scores, dev_genuine_scores, 0.1)\n",
"dev_fmr_001 = bob.measure.far_threshold(dev_zero_effort_imposter_scores, dev_genuine_scores, 0.01)\n",
"#def load_scores(score_filename):\n",
"# my_file = Path(score_filename)\n",
"# assert my_file.is_file(), \"File %s does not exist. Quitting.\" %score_filename\n",
"# \n",
"# dsf = open(score_filename, \"r\")\n",
"# x = dsf.readlines()\n",
"# dsf.close()\n",
"# \n",
"# gen_scores = [float(line.split()[3]) for line in x if line.split()[0] == line.split()[1]]\n",
"# zei_scores = [float(line.split()[3]) for line in x if line.split()[0] != line.split()[1]]\n",
"# \n",
"# return numpy.array(zei_scores), numpy.array(gen_scores)\n",
" \n",
"dev16K_zei_scores, dev16K_gen_scores = load_scores(my_file_name)\n",
"#genuine_scores = numpy.array(dev16K_gen_scores)\n",
"#zero_effort_imposter_scores = numpy.array(dev16K_zei_scores)\n",
"dev_fmr_01 = bob.measure.far_threshold (dev16K_zei_scores, dev16K_gen_scores, 0.1)\n",
"dev_fmr_001 = bob.measure.far_threshold(dev16K_zei_scores, dev16K_gen_scores, 0.01)\n",
" \n",
"print(\"Thresholds from dev set:\")\n",
"print(\"FMR @ 0.1%:\" '{:6.2f}'.format(dev_fmr_01))\n",
"print(\"FMR @ 0.01%:\" '{:6.2f}'.format(dev_fmr_001))"
...
...
@@ -164,7 +173,7 @@
"metadata": {},
"outputs": [],
"source": [
"#
Plotting score distr#ibution
\n",
"#
group the score-distributions, for ease of manipulation...
\n",
"zero_effort_scores = []\n",
"genuine_scores = []\n",
"for n in client_list:\n",
...
...
@@ -173,8 +182,26 @@
"\n",
"eval_genuine_scores = numpy.array(genuine_scores)\n",
"eval_zero_effort_scores = numpy.array(zero_effort_scores)\n",
"# plot_hist(zero_effort_scores, genuine_scores, fmr_01=None, fmr_001=None):\n",
"plots.plot_hist(eval_zero_effort_scores, eval_genuine_scores, fmr_01=dev_fmr_01, fmr_001=dev_fmr_001)"
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plot the score-distributions for genuine and ZEI presentations in 'eval' set\n",
"\n",
"The vertical lines represent the score-thresholds obtained from the 'dev' set."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"#plots.plot_hist(eval_zero_effort_scores, eval_genuine_scores, fmr_01=dev_fmr_01, fmr_001=dev_fmr_001)"
]
},
{
...
...
@@ -183,6 +210,8 @@
"metadata": {},
"outputs": [],
"source": [
"print(len(eval_zero_effort_scores))\n",
"print(len(eval_genuine_scores))\n",
"plots.plot_roc(eval_zero_effort_scores, eval_genuine_scores)"
]
},
...
...
@@ -203,6 +232,32 @@
"source": [
"add epc"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"score_file_list = ['scores_vf_denoised_8k_dev.txt', 'voxforge_denoised_16K_scores_dev.txt']\n",
"labels = ['8K', '16K']\n",
"plots.plot_multidet(score_file_list, labels, base_path=\"./data\")\n",
"plots.plot_multiroc(score_file_list, labels, base_path=\"./data\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment