Now the special preprocessor will look something like this:
from bob.bio.base.preprocessor import Preprocessor
from bob.bio.base import load
def load_projected_data(biofile, directory, extension):
# directory will point to the "projected" folder here
path = biofile.make_path(directory, extension)
data = load(path) # You may need to call Algorith.read_feature or something like that here instead. This is a simple version.
return data, str(biofile.client_id) # return the client_id here
class Protector(Preprocessor):
def __init__(self, read_original_data=None):
if read_original_data is None:
read_original_data = load_projected_data
super(Protector, self).__init__(read_original_data=read_original_data)
self.client_seeds = {} # keep track of the clients that you have seen.
def __call__(self, data, annotations=None):
data, client_id = data
if client_id not in self.client_seeds:
self.client_seeds[client_id] = my_new_seed()
return my_protect(data, self.client_seeds[client_id]) # protect the data here with a client specific seed
Let me know if I am not clear.
Now changing bob.bio.base to include the step 2 of above in its toolchain so it looks less hacky would be more sensible IMHO.
Best,
Amir