WIP: Support for cascade fusion of PAD and Bio
Merge request reports
Activity
@pkorshunov please revert the spacing changes that you did so that I can see a smaller diff.
Reassigned to @pkorshunov
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) @pkorshunov this was a bug that I fixed. Why did you revert it? eb7aef84
@amohammadi This implementation ensures that first are genuine scores, then zero-effort impostors, and then attacks. I think it is to allow the situation when the original score files are not sorted correctly.
@pkorshunov I cannot merge this unless you revert this part back. This was a bug which I fixed and we cannot revert it. The way you have changed it now it will make the score go out of order.
- Resolved by Pavel KORSHUNOV
- Resolved by Pavel KORSHUNOV
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])) changed this line in version 2 of the diff
- Resolved by Pavel KORSHUNOV
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: machine always None at this state of code.
Edited by Amir MOHAMMADI
- bob/fusion/base/algorithm/CascadeFuse.py 0 → 100644
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] changed this line in version 2 of the diff
@amohammadi changed the code and added comments
@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.
assigned to @amohammadi
assigned to @pkorshunov