Example #1
0
 def test_init_incorrect_databases_param_no_exist(self):
     self.assertRaises(
         ValueError, lambda: EndToEndConfiguration(
             'E2E', ['no_exist_database'],
             self.protocols,
             self.face_pad,
             self.result_path,
             framerate=self.framerate,
             total_time_acquisition=self.total_time_acquisition,
             verbose=self.verbose))
Example #2
0
 def test_init_incorrect_databases_param(self):
     self.assertRaises(
         TypeError, lambda: EndToEndConfiguration(
             'E2E',
             'WRONG_PARAM',
             self.protocols,
             self.face_pad,
             self.result_path,
             framerate=self.framerate,
             total_time_acquisition=self.total_time_acquisition,
             verbose=self.verbose))
Example #3
0
 def test_init_incorrect_result_path_param(self):
     os.environ["REPLAY_ATTACK_PATH"] = "resources"
     self.assertRaises(
         TypeError, lambda: EndToEndConfiguration(
             'E2E',
             self.databases,
             self.protocols,
             self.face_pad, ['WRONG_PARAM'],
             framerate=self.framerate,
             total_time_acquisition=self.total_time_acquisition,
             verbose=self.verbose))
     del os.environ["REPLAY_ATTACK_PATH"]
Example #4
0
def main():
    args = evaluator_parser()
    if args.verbose:
        logging.basicConfig(level=logging.INFO)

    end_to_end_configuration = EndToEndConfiguration.fromfilename(
        args.config_file)
    logging.info(end_to_end_configuration)
    end_to_end_configuration.save_to_file()

    end_to_end_evaluation_protocol = EndToEndEvaluationProtocol(
        end_to_end_configuration)
    end_to_end_evaluation_protocol.run()
Example #5
0
 def test_init_none_threshold_param(self):
     os.environ["REPLAY_ATTACK_PATH"] = "resources"
     self.assertRaises(
         TypeError, lambda: EndToEndConfiguration(
             'E2E',
             self.databases,
             self.protocols,
             self.face_pad,
             self.result_path,
             framerate=self.framerate,
             total_time_acquisition=self.total_time_acquisition,
             threshold=None,
             verbose=self.verbose))
     del os.environ["REPLAY_ATTACK_PATH"]
Example #6
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: EndToEndConfiguration(
                'E2E', ['replay-attack'],
                self.protocols,
                self.face_pad,
                self.result_path,
                framerate=self.framerate,
                total_time_acquisition=self.total_time_acquisition,
                verbose=self.verbose))

        if replay_path:
            os.environ["REPLAY_ATTACK_PATH"] = replay_path
Example #7
0
 def test_init_fromfilename_correct_params(self):
     EndToEndConfiguration.fromfilename(self.configuration_file)
Example #8
0
 def test_init_fromfilename_wrong_path(self):
     self.assertRaises(IOError,
                       lambda: EndToEndConfiguration.fromfilename('WRONG'))
Example #9
0
 def test_print_to_file(self):
     filename_result = 'result/configuration.txt'
     configuration = EndToEndConfiguration.fromfilename(
         self.configuration_file)
     configuration.save_to_file(filename_result)
     self.assertTrue(os.path.isfile(filename_result))
Example #10
0
 def get_end_to_end_configuration(cls):
     return EndToEndConfiguration.fromfilename(cls.configuration_file)