Coverage for src/bob/bio/spear/config/pipeline/mfcc60_isv_mini.py: 0%
14 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-31 17:59 +0200
« prev ^ index » next coverage.py v7.6.1, created at 2024-08-31 17:59 +0200
1#!/usr/bin/env python
2# @author: Yannick Dayer <yannick.dayer@idiap.ch>
3# @date: Thu 31 Mar 2022 16:56:40 UTC+02
5from sklearn.pipeline import Pipeline
7from bob.bio.base.algorithm import GMM, ISV
8from bob.bio.base.pipelines import PipelineSimple
9from bob.bio.spear.annotator import Energy_2Gauss
10from bob.bio.spear.extractor import Cepstral
11from bob.bio.spear.transformer import ReferenceIdEncoder
12from bob.learn.em import KMeansMachine
13from bob.pipelines import wrap
15SEED = 0
17ubm = GMM(
18 n_gaussians=8,
19 max_fitting_steps=2,
20 convergence_threshold=1e-3, # Maximum number of iterations as stopping criterion
21 k_means_trainer=KMeansMachine(
22 n_clusters=8,
23 max_iter=2,
24 random_state=SEED,
25 init_max_iter=5,
26 oversampling_factor=64,
27 ),
28 return_stats_in_transform=True,
29)
31bioalgorithm = ISV(
32 # ISV parameters
33 r_U=2,
34 random_state=SEED,
35 em_iterations=2,
36 enroll_iterations=1,
37 # GMM parameters
38 ubm=ubm,
39)
41transformer = Pipeline(
42 [
43 ("annotator", Energy_2Gauss()),
44 ("extractor", Cepstral()),
45 ("ubm", ubm),
46 ("template_id_encoder", ReferenceIdEncoder()),
47 ("isv", bioalgorithm),
48 ]
49)
50transformer = wrap(["sample"], transformer)
52pipeline = PipelineSimple(transformer, bioalgorithm)