$ pip install pyannote.db.sre # install from pip, or
$ pip install -e . # install a local copy
Tell pyannote
where to look for NIST SRE audio files.
Note that SRE08 data, SRE10 data, and data used for training are probably located in different folders.
So, the paths to the data may look like this:
$ cat ~/.pyannote/db.yml
SRE:
- /path/to/nist_sre/SRE08/train/data/short2/{uri}.sph
- /path/to/nist_sre/SRE08/test/data/summed/{uri}.sph
- /path/to/nist_sre/SRE10/eval/data/phonecall/tel/{uri}.sp
- /path/to/nist_sre/SRE10/eval/data/summed/{uri}.sph
- /path/to/nist_sre/training_sets/{uri}.sph
SRE database has Dev set from SRE08 data and Test set from SRE10 data.
Protocol is initialized as follows:
>>> from pyannote.database import get_protocol, FileFinder
>>> preprocessors = {'audio': FileFinder()}
>>> protocol = get_protocol('SRE.SpeakerDiarization.Fullset',
... preprocessors=preprocessors)
>>> # initialize evaluation metric
>>> from pyannote.metrics.diarization import DiarizationErrorRate
>>> metric = DiarizationErrorRate()
>>>
>>> # iterate over each file of the test set
>>> for test_file in protocol.test():
...
... # process test file
... audio = test_file['audio']
... hypothesis = process_file(audio)
...
... # evaluate hypothesis
... reference = test_file['annotation']
... uem = test_file['annotated']
... metric(reference, hypothesis, uem=uem)
>>>
>>> # report results
>>> metric.report(display=True)
Protocol is initialized as follows:
>>> from pyannote.database import get_protocol, FileFinder
>>> preprocessors = {'audio': FileFinder()}
>>> protocol = get_protocol('SRE.SpeakerSpotting.Fullset',
... preprocessors=preprocessors)
>>> # dictionary meant to store all target models
>>> models = {}
>>>
>>> # iterate over all enrolments
>>> for current_enrolment in protocol.test_enrolment():
...
... # target identifier
... target = current_enrolment['model_id']
... # the same speaker may be enrolled several times using different target
... # identifiers. in other words, two different identifiers does not
... # necessarily not mean two different speakers.
...
... # path to audio file to use for enrolment
... audio = current_enrolment['audio']
...
... # pyannote.core.Timeline containing target speech turns
... # See http://pyannote.github.io/pyannote-core/structure.html#timeline
... enrol_with = current_enrolment['enrol_with']
...
... # this is where enrolment actually happens and model is stored
... models[target] = enrol(audio, enrol_with)
The following pseudo-code shows what the enrol
function could look like:
>>> def enrol(audio, enrol_with):