diff --git a/bob/bio/base/extractor/Extractor.py b/bob/bio/base/extractor/Extractor.py index fc09fb62135f97465942d16e75dd576631aa523e..6c13fd0696d3443adeda7174f1a7c12ee8bd6345 100644 --- a/bob/bio/base/extractor/Extractor.py +++ b/bob/bio/base/extractor/Extractor.py @@ -142,7 +142,7 @@ class Extractor (object): pass - def train(self, training_data, extractor_file): + def train(self, training_data): """This function can be overwritten to train the feature extractor. If you do this, please also register the function by calling this base class constructor and enabling the training by ``requires_training = True``. @@ -154,8 +154,16 @@ class Extractor (object): Data will be provided in a single list, if ``split_training_features_by_client = False`` was specified in the constructor, otherwise the data will be split into lists, each of which contains the data of a single (training-)client. + """ + raise NotImplementedError("Please overwrite this function in your derived class, or unset the 'requires_training' option in the constructor.") + + + def save(self, extractor_file): + """ extractor_file : str The file to write. This file should be readable with the :py:meth:`load` function. - """ + + """ raise NotImplementedError("Please overwrite this function in your derived class, or unset the 'requires_training' option in the constructor.") + diff --git a/bob/bio/base/tools/extractor.py b/bob/bio/base/tools/extractor.py index 7f822c4918cf862360606e05cb1d63ad64f36423..49859b82c07848efd80c636bb1fa0a131bb6b21c 100644 --- a/bob/bio/base/tools/extractor.py +++ b/bob/bio/base/tools/extractor.py @@ -52,8 +52,8 @@ def train_extractor(extractor, preprocessor, allow_missing_files = False, force else: logger.info("- Extraction: training extractor '%s' using %d training files:", fs.extractor_file, len(train_files)) # train model - extractor.train(train_data, fs.extractor_file) - + extractor.train(train_data) + extractor.save(fs.extractor_file) def extract(extractor, preprocessor, groups=None, indices = None, allow_missing_files = False, force = False):