diff --git a/bob/bio/base/test/dummy/preprocessor.py b/bob/bio/base/test/dummy/preprocessor.py index 7ccfcdcb7bd60750203bcf883b4d38ed1b973cb4..89376c31d59dd215b321153a6c56dbda75f32e0e 100644 --- a/bob/bio/base/test/dummy/preprocessor.py +++ b/bob/bio/base/test/dummy/preprocessor.py @@ -1,15 +1,19 @@ from bob.bio.base.preprocessor import Preprocessor +import numpy +numpy.random.seed(10) class DummyPreprocessor (Preprocessor): - def __init__(self, return_none=False, **kwargs): + def __init__(self, return_none=False, probability_of_none=1, **kwargs): Preprocessor.__init__(self) self.return_none = return_none + self.probability_of_none = probability_of_none def __call__(self, data, annotation): """Does nothing, simply converts the data type of the data, ignoring any annotation.""" if self.return_none: - return None + return numpy.random.choice([None, data], p=[self.probability_of_none, 1-self.probability_of_none]) + return data diff --git a/bob/bio/base/tools/preprocessor.py b/bob/bio/base/tools/preprocessor.py index 045d1e71937598702f6480d68311740ac4cc7857..1f7374cf98a3d9135035eabfb76fd140491094d2 100644 --- a/bob/bio/base/tools/preprocessor.py +++ b/bob/bio/base/tools/preprocessor.py @@ -68,6 +68,7 @@ def preprocess(preprocessor, groups = None, indices = None, allow_missing_files if not utils.check_file(preprocessed_data_file, force, preprocessor.min_preprocessed_file_size): logger.debug("... Processing original data file '%s'", file_name) + data = preprocessor.read_original_data(file_object, original_directory, original_extension) # create output directory before reading the data file (is sometimes required, when relative directories are specified, especially, including a .. somewhere) bob.io.base.create_directories_safe(os.path.dirname(preprocessed_data_file)) diff --git a/setup.py b/setup.py index f1a05cce60c7e8b6f8df75976322c01fddfa91bb..ca69ef786d52d4959fa331a1a0b83a735202c9a0 100644 --- a/setup.py +++ b/setup.py @@ -124,7 +124,7 @@ setup( ], # declare database to bob 'bob.db': [ - 'bio_filelist = bob.bio.base.database.filelist.driver:Interface', + 'bio_filelist = bob.bio.base.database.filelist.driver:Interface', ], },