Skip to content

`Algorithm.read_probe` should not exist

This is something that I had in mind when designing the Algorithm, but which I postponed far too long by now, and it regularly bites me:

In the Algorithm, the read_probe function should not exist. Instead, the according functions of the Extractor.read_feature or Algorithm.read_feature should be called instead. For model enrollment, this is already done: https://gitlab.idiap.ch/bob/bob.bio.base/blob/master/bob/bio/base/tools/algorithm.py#L247

For probes, I was too lazy to implement this correctly, and added an Algorithm.read_probe function instead. In most cases, this works as expected. But when data structures are more complex, then the algorithm needs to know, how to read the features. For example, in bob.bio.face.algoritm.GaborJet, the read_probe function: https://gitlab.idiap.ch/bob/bob.bio.face/blob/master/bob/bio/face/algorithm/GaborJet.py#L204 is an exact copy of the bob.bio.face.extractor.GridGraph.read_feature function: https://gitlab.idiap.ch/bob/bob.bio.face/blob/master/bob/bio/face/extractor/GridGraph.py#L221

The reason, why I was too lazy to implement it correctly is that during scoring, the probes are read in the innermost function: https://gitlab.idiap.ch/bob/bob.bio.base/blob/master/bob/bio/base/tools/scoring.py#L16 and I didn't want to pass the reader through all the function calls. Stupid me. Since now so many more packages have been written, which use the bad implementation, fixing this is a major issue:

  • Fix the scoring script to use the correct reader
  • Remove the read_probe from the Algorithm base class and all derived classes in all packages
  • Fix the verify.py script and all derived scripts to pass the extractor to the scoring function
  • Check all the test cases and assure that Algorithm.read_probe is replaced with the according call to Extractor.read_feature or Algorithm.read_feature