示例#1
0
    def test_init_correct_params_but_database_path_not_defined(self):

        replay_path = None
        if "REPLAY_ATTACK_PATH" in os.environ:
            replay_path = os.environ["REPLAY_ATTACK_PATH"]
            del os.environ["REPLAY_ATTACK_PATH"]

        self.assertRaises(
            EnvironmentError, lambda: Configuration(
                'ACE',
                self.database_paths_filename, ['replay-attack'],
                self.protocols,
                self.feature_extractor,
                self.pipeline,
                self.result_path,
                access_grid_config=self.access_grid_config,
                verbose=self.verbose,
                number_threads=self.number_threads,
                use_data_augmentation=self.use_data_augmentation,
                skip_features_extraction=self.skip_features_extraction,
                dict_extracted_features_paths=self.
                dict_extracted_features_paths,
                skip_training=self.skip_training,
                skip_scores_prediction=self.skip_scores_prediction,
                dict_scores_prediction=self.dict_scores_prediction,
                recreate=self.recreate))

        if replay_path:
            os.environ["REPLAY_ATTACK_PATH"] = replay_path
def main():
    args = evaluator_parser()
    if args.verbose:
        logging.basicConfig(level=logging.INFO)

    configuration = Configuration.fromfilename('FE', args.config_file)
    logging.info(configuration)
    configuration.save_to_file()

    features_extraction_protocol = FeaturesExtractionProtocol(configuration)
    features_extraction_protocol.run()
def main():
    args = evaluator_parser()
    if args.verbose:
        logging.basicConfig(level=logging.INFO)

    configuration = Configuration.fromfilename('ACE', args.config_file)
    logging.info(configuration)
    configuration.save_to_file()

    algorithmic_constrained_evaluation_protocol = AlgorithmicConstrainedEvaluationProtocol(
        configuration)
    algorithmic_constrained_evaluation_protocol.run()
示例#4
0
 def test_init_incorrect_databases_param_no_exist(self):
     self.assertRaises(
         ValueError, lambda: Configuration(
             'ACE',
             self.database_paths_filename, ['no_exist_database'],
             self.protocols,
             self.feature_extractor,
             self.pipeline,
             self.result_path,
             access_grid_config=self.access_grid_config,
             verbose=self.verbose,
             number_threads=self.number_threads,
             use_data_augmentation=self.use_data_augmentation,
             skip_features_extraction=self.skip_features_extraction,
             dict_extracted_features_paths=self.
             dict_extracted_features_paths,
             skip_training=self.skip_training,
             skip_scores_prediction=self.skip_scores_prediction,
             dict_scores_prediction=self.dict_scores_prediction,
             recreate=self.recreate))
示例#5
0
 def test_init_incorrect_result_path_param(self):
     os.environ["REPLAY_ATTACK_PATH"] = "resources"
     self.assertRaises(
         TypeError, lambda: Configuration(
             'ACE',
             self.database_paths_filename,
             self.databases,
             self.protocols,
             self.feature_extractor,
             self.pipeline, ['WRONG_PARAM'],
             access_grid_config=self.access_grid_config,
             verbose=self.verbose,
             number_threads=self.number_threads,
             use_data_augmentation=self.use_data_augmentation,
             skip_features_extraction=self.skip_features_extraction,
             dict_extracted_features_paths=self.
             dict_extracted_features_paths,
             skip_training=self.skip_training,
             skip_scores_prediction=self.skip_scores_prediction,
             dict_scores_prediction=self.dict_scores_prediction,
             recreate=self.recreate))
     del os.environ["REPLAY_ATTACK_PATH"]
示例#6
0
 def test_should_check_if_database_paths_are_loaded_as_global_env(self):
     if "REPLAY_ATTACK_PATH" in os.environ.keys():
         del os.environ["REPLAY_ATTACK_PATH"]
     _ = Configuration(
         'ACE',
         self.database_paths_filename,
         self.databases,
         self.protocols,
         self.feature_extractor,
         self.pipeline,
         self.result_path,
         access_grid_config=self.access_grid_config,
         verbose=self.verbose,
         number_threads=self.number_threads,
         use_data_augmentation=self.use_data_augmentation,
         skip_features_extraction=self.skip_features_extraction,
         dict_extracted_features_paths=self.dict_extracted_features_paths,
         skip_training=self.skip_training,
         skip_scores_prediction=self.skip_scores_prediction,
         dict_scores_prediction=self.dict_scores_prediction,
         recreate=True)
     self.assertTrue(os.environ["REPLAY_ATTACK_PATH"] == "resources")
     del os.environ["REPLAY_ATTACK_PATH"]
示例#7
0
 def test_init_fromfilename_correct_params(self):
     Configuration.fromfilename('ACE', self.configuration_file)
示例#8
0
 def test_print_to_file(self):
     filename_result = 'result/configuration.txt'
     configuration = Configuration.fromfilename('ACE',
                                                self.configuration_file)
     configuration.save_to_file(filename_result)
     self.assertTrue(os.path.isfile(filename_result))
示例#9
0
 def test_init_fromfilename_wrong_type_evaluation(self):
     self.assertRaises(
         ValueError, lambda: Configuration.fromfilename(
             'WRONG', self.configuration_file))
示例#10
0
 def test_init_fromfilename_wrong_path(self):
     self.assertRaises(IOError,
                       lambda: Configuration.fromfilename('ACE', 'WRONG'))
示例#11
0
 def get_configuration(cls, type_evaluation):
     return Configuration.fromfilename(type_evaluation,
                                       cls.configuration_file)