Exemple #1
0
    def test_run_pipeline_saver(self):
        reduced_features = RecursiveFeatureElimination(n_features=1)
        pipeline = Pipeline('name_pipeline', [
            reduced_features,
            PipelineSaver('dim_reduction', 'dim_reduction')
        ])
        pipeline.fit(self.X)
        pipeline.save('/tmp/test_rfe_pipeline_saver')

        loaded_pipeline = Pipeline(
            'name_pipeline',
            [PipelineLoader('dim_reduction', 'dim_reduction')])
        loaded_pipeline.load('/tmp/test_rfe_pipeline_saver')
        Y = loaded_pipeline.run(self.X)
        np.testing.assert_equal(
            Y['features'],
            np.array(([[0.2], [0.1], [0.1], [0.2], [0.9], [0.8]])))
        np.testing.assert_equal(Y['labels'], np.array([0, 0, 0, 0, 1, 1]))
        np.testing.assert_equal(Y['access_ids'], np.array([0, 0, 1, 1, 2, 2]))
        np.testing.assert_equal(Y['indices'], np.array(
            [2]))  # indices of the selected features
Exemple #2
0
#	 * you can use on the same list labels (e.g 'replay-attack', 'replay-mobile', etc) and bob.gradiant.core.Database classes. e.g databases_list = [ MyDatabase('path/to/database'), 'replay-mobile']
#	 * databases paths must be defined as a environment variables. (REPLAY_ATTACK_PATH, REPLAY_MOBILE_PATH, MSU_MFSD_PATH, OULU_NPU_PATH)
#os.environ['REPLAY_ATTACK_PATH'] = '<path-to-database>' (if not defined)
#os.environ['REPLAY_MOBILE_PATH'] = '<path-to-database>' (if not defined)
#os.environ['MSU_MFSD_PATH'] = '<path-to-database>' (if not defined)
#os.environ['OULU_NPU_PATH'] = '<path-to-database>' (if not defined)
databases_list = ['oulu-npu']
protocols_list = ['grandtest']

#Feature extraction:
from bob.chapter.hobpad2.facepadprotocols import IqmFeaturesExtractor
feature_extractor = IqmFeaturesExtractor()

#Pipeline:
from bob.gradiant.pipelines import Pipeline, AverageScoreFusion
pipeline = Pipeline('iqm_from_scores_pretrained', [AverageScoreFusion()])

#Result base path:
result_path = 'result/iqm_from_scores_pretrained'

#Framerate and time parameters:
framerate_list = [5, 10, 15, 20, 25]
total_time_acquisition_list = [500, 1000, 1500, 2000]

#-----------------------------------------------------------------

#OPTIONAL ARGUMENTS:

#Verbose (only True/False are valid):
verbose = True
Exemple #3
0
# Configuration file automatically generated at 2017-12-29
#-----------------------------------------------------------------

#REQUIRED ARGUMENTS:

#Database and protocol:
databases_list = ['oulu-npu']
protocols_list = ['grandtest']

#Feature extraction:
from bob.chapter.hobpad2.facepadprotocols import IqmFeaturesExtractor
feature_extractor = IqmFeaturesExtractor()

#Pipeline:
from bob.gradiant.pipelines import Pipeline, AverageScoreFusion
pipeline = Pipeline('gradiant_from_scores_pretrained',[AverageScoreFusion()])

#Result base path:
result_path = 'result/gradiant_from_scores_pretrained'

#Framerate and time parameters:
framerate_list = [5, 10, 15, 20, 25]
total_time_acquisition_list = [500, 1000, 1500, 2000]

#-----------------------------------------------------------------

#OPTIONAL ARGUMENTS:

#Verbose (only True/False are valid):
verbose = True
# Configuration file automatically generated at 2017-12-29
#-----------------------------------------------------------------

#REQUIRED ARGUMENTS:

#Database and protocol:
databases_list = ['oulu-npu']
protocols_list = ['grandtest']

#Feature extraction:
from bob.chapter.hobpad2.facepadprotocols import IqmFeaturesExtractor
feature_extractor = IqmFeaturesExtractor()

#Pipeline:
from bob.gradiant.pipelines import Pipeline, AverageScoreFusion
pipeline = Pipeline('gradiant_from_scores', [AverageScoreFusion()])

#Result base path:
result_path = 'result/gradiant_from_scores'

#Framerate and time parameters:
framerate_list = [5, 10, 15, 20, 25]
total_time_acquisition_list = [500, 1000, 1500, 2000]

#-----------------------------------------------------------------

#OPTIONAL ARGUMENTS:

#Verbose (only True/False are valid):
verbose = True
    os.path.abspath(os.path.dirname(__file__)), 'database_paths.json')

# Database and protocol:
databases_list = ['aggregate-database']
protocols_list = ['grandtest']

# Feature extraction:
from bob.gradiant.pad.evaluator import DummyFeaturesExtractor

feature_extractor = DummyFeaturesExtractor()

# Pipeline:
from bob.gradiant.pipelines import Pipeline, Pca, LinearSvc

pipeline = Pipeline(
    'pipeline_pca095_linear_svc',
    [Pca(name='Pca', n_components=0.95),
     LinearSvc(name='LinearSvc')])

# Result base path:
result_path = 'result'

# Framerate and time parameters:
framerate_list = [10, 15]
total_time_acquisition_list = [500, 1000]

# -----------------------------------------------------------------

# OPTIONAL ARGUMENTS:

# Verbose (only True/False are valid):
verbose = True