Skip to content
Snippets Groups Projects

WIP: Support for cascade fusion of PAD and Bio

Closed Amir MOHAMMADI requested to merge bio-pad into master
5 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
49 57 if args.eval_files:
50 58 check_consistency(gen_le, zei_le, atk_le)
51 59
52 scores_train = get_scores(score_lines_list_train)
60 scores_train = get_scores(gen_lt, zei_lt, atk_lt)
61 # scores_train = get_scores(score_lines_list_train)
53 62 train_neg = get_scores(zei_lt, atk_lt)
  • 118 154 score_lines['score'] = fused_scores_eval
    119 155 create_directories_safe(os.path.dirname(args.fused_eval_file))
    120 156 dump_score(args.fused_eval_file, score_lines)
    157 # to separate scores for licit and spoof scenarios
    158 start_zei = len(gen_le[0])
    159 start_atk = start_zei + len(zei_le[0])
    160 dump_score(args.fused_eval_file + '-licit', score_lines[0:start_atk])
    161 import numpy
    162 dump_score(args.fused_eval_file + '-spoof', numpy.append(score_lines[0:start_zei], score_lines[start_atk:-1]))
  • 206 bob.core.log.add_command_line_option(parser)
    207
    208 # parse command line options
    209 args = parser.parse_args(command_line_parameters)
    210 bob.core.log.set_verbosity_level(logger, args.verbose)
    211
    212 # load the algorithm
    213 algorithm = bob.fusion.base.algorithm.Algorithm()
    214 algorithm = algorithm.load(args.model_file)
    215
    216 hdf5_path = os.path.splitext(args.model_file)[0] + '.hdf5'
    217 machine = None
    218 # if os.path.isfile(hdf5_path):
    219 # hdf5file = bob.io.base.HDF5File(hdf5_path)
    220 # machine = bob.learn.linear.Machine(hdf5file)
    221
  • 249 # plot the decision boundary
    250 do_grouping = True
    251 if args.group < 1:
    252 do_grouping = False
    253
    254 plot_boundary_decision(
    255 algorithm, scores, score_labels, args.threshold,
    256 do_grouping=do_grouping,
    257 npoints=args.group,
    258 seed=0,
    259 gformat=args.grouping
    260 )
    261 plt.savefig(args.output)
    262 plt.close()
    263
    264 if machine is not None:
  • 13
    14 class CascadeFuse(Algorithm):
    15 """weighted sum (default: mean)"""
    16
    17 def __init__(self, *args, **kwargs):
    18 super(CascadeFuse, self).__init__(
    19 classifier=self,
    20 *args, **kwargs)
    21
    22 def fit(self, X, y):
    23 # no training for this approach
    24 pass
    25
    26 def decision_function(self, scores):
    27 # we assume that scores in 1st column are used to decide outcome
    28 return [score_set[0] if score_set[0] < 0.2 else score_set[1] for score_set in scores]
  • @amohammadi I told you the code is not finished at all. There is a reason why I did not want to push it. If you do not need it, don't use it and delete the branch. I will push once I am happy with it and you can ask all your questions. Right now, the code is 'as is' and I am not able to clarify anything.

  • added 1 commit

    • a979befc - LLR calibration and harmonic mean

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Please register or sign in to reply
    Loading