Coverage for src/bob/bio/spear/config/pipeline/mfcc60_gmm_mini.py: 0%
12 statements
« prev ^ index » next coverage.py v7.6.5, created at 2024-11-14 22:07 +0100
« prev ^ index » next coverage.py v7.6.5, created at 2024-11-14 22:07 +0100
1#!/usr/bin/env python
2# @author: Yannick Dayer <yannick.dayer@idiap.ch>
3# @date: Fri 02 Jul 2021 15:41:48 UTC+02
5"""Creates a biometric PipelineSimple for the `bob bio pipeline simple` command.
7These parameters were chosen to rapidly test the pipeline.
9This pipeline is composed of the following steps:
10 - annotator: Energy_2Gauss (VAD on 2 Gaussians)
11 - extractor: Cepstral (MFCC, 60 features)
12 - algorithm: GMM (trained in the pipeline as a Transformer, and used as
13 BioAlgorithm for enrollment and scoring)
14"""
16from sklearn.pipeline import Pipeline
18from bob.bio.base.algorithm import GMM
19from bob.bio.base.pipelines import PipelineSimple
20from bob.bio.spear.annotator import Energy_2Gauss
21from bob.bio.spear.extractor import Cepstral
22from bob.learn.em import KMeansMachine
23from bob.pipelines import wrap
25# Number of Gaussians for the UBM (used by kmeans and GMM)
26n_gaussians = 8
28# Kmeans machine used for GMM initialization
29kmeans_trainer = KMeansMachine(
30 n_clusters=n_gaussians,
31 max_iter=5,
32 convergence_threshold=0.0,
33 init_max_iter=5,
34 oversampling_factor=2,
35)
37# Algorithm used for enrollment and scoring, trained first as a Transformer.
38bioalgorithm = GMM(
39 n_gaussians=n_gaussians,
40 max_fitting_steps=5,
41 enroll_iterations=1,
42 convergence_threshold=0.0, # Maximum number of iterations as stopping criterion
43 k_means_trainer=kmeans_trainer,
44)
46# Transformer part of PipelineSimple
47transformer = Pipeline(
48 [
49 ("annotator", wrap(["sample"], Energy_2Gauss())),
50 ("extractor", wrap(["sample"], Cepstral())),
51 ("algorithm_trainer", wrap(["sample"], bioalgorithm)),
52 ]
53)
56# PipelineSimple instance used by `execute_pipeline_simple` or the `pipeline simple` command
57pipeline = PipelineSimple(transformer, bioalgorithm)