def age_filter_provider(age, dataset, pseudo_random_values=None): return Filter( scenario=Scenario.GENUINE, age=age, dataset=dataset, pseudo_random_values=pseudo_random_values, )
def skin_tone_filter_provider(skin_tone, dataset, pseudo_random_values=None): return Filter( scenario=Scenario.GENUINE, skin_tone=skin_tone, dataset=dataset, pseudo_random_values=pseudo_random_values, )
def get_numpy_labels_by_dataset_and_scenario(self, scenario: Scenario): return self._get_numpy_labels_filter_by_filter( Dataset.options(), lambda option: Filter(scenario=scenario, dataset=option), unknown_label_value=-1, encode_label=True, )
def sex_filter_provider(sex, dataset, pseudo_random_values=None): return Filter( scenario=Scenario.GENUINE, sex=sex, dataset=dataset, pseudo_random_values=pseudo_random_values, )
def get_numpy_labels_by_dataset(self): return self._get_numpy_labels_filter_by_filter( Dataset.options(), lambda option: Filter(dataset=option), unknown_label_value=-1, encode_label=True, )
def get_numpy_labels(self): ids = self.scores.keys() annotations_from_ids = annotations.get_annotations_from_ids(ids) filtered_ids = self._get_filtered_ids( annotations_from_ids, Filter(scenario=Scenario.GENUINE) ) labels = [0 if id in filtered_ids else 1 for id in ids] return np.asarray(labels, dtype=np.int)
def get_attacks(self): ids = self.scores.keys() annotations_from_ids = annotations.get_annotations_from_ids(ids) filtered_ids = self._get_filtered_ids( annotations_from_ids, Filter(scenario=Scenario.GENUINE) ) scores = [score for id, score in self.scores.items() if id not in filtered_ids] return scores
def get_numpy_labels_by_skin_tone(self): return self._get_numpy_labels_filter_by_filter( SkinTone.options(), lambda option: Filter(skin_tone=option), unknown_label_value=-1, )
def get_numpy_labels_by_age(self): return self._get_numpy_labels_filter_by_filter( Age.options(), lambda option: Filter(age=option), unknown_label_value=-1 )
def get_numpy_labels_by_sex(self): return self._get_numpy_labels_filter_by_filter( Sex.options(), lambda option: Filter(sex=option), unknown_label_value=-1 )
def get_numpy_labels_by_scenario(self): return self._get_numpy_labels_filter_by_filter( Scenario.options(), lambda option: Filter(scenario=option) )