Standard metrics for biometric system evaluation
Algorithms have at least one input and one output. All algorithm endpoints are organized in groups. Groups are used by the platform to indicate which inputs and outputs are synchronized together. The first group is automatically synchronized with the channel defined by the block in which the algorithm is deployed.
Endpoint Name | Data Format | Nature |
---|---|---|
scores | tutorial/multiclass_probe_scores/1 | Input |
Analyzers may produce any number of results. Once experiments using this analyzer are done, you may display the results or filter experiments using criteria based on them.
Name | Type |
---|---|
number_of_negatives | int32 |
roc | plot/scatter/1 |
number_of_positives | int32 |
cer | float32 |
xxxxxxxxxx
import bob
import numpy
class Algorithm:
def __init__(self):
self.positives = []
self.negatives = []
def process(self, inputs, output):
# accumulate the scores
data = inputs['scores'].data
real_id = data.real_identity
estimated_id = data.estimated_identity
if real_id == estimated_id:
self.positives.append(data.score)
else:
self.negatives.append(data.score)
# once all values are received, evaluate the scores
if not(inputs.hasMoreData()):
cer = len(self.negatives) / float(len(self.negatives) + len(self.positives))
roc_points = bob.measure.roc(self.negatives, self.positives, 100)
# writes the output back to the platform
output.write({
'cer': numpy.float32(cer),
'number_of_positives': numpy.int32(len(self.positives)),
'number_of_negatives': numpy.int32(len(self.negatives)),
'roc': {
"data": {
[
"label": "roc",
"x": roc_points[0],
"y": roc_points[1],
]
}
},
})
return True
The code for this algorithm in Python
The ruler at 80 columns indicate suggested POSIX line breaks (for readability).
The editor will automatically enlarge to accomodate the entirety of your input
Use keyboard shortcuts for search/replace and faster editing. For example, use Ctrl-F (PC) or Cmd-F (Mac) to search through this box
An algorithm that implements standard metrics for biometric system evaluation.
Specifically, it returns:
This implementation relies on the 'measure' package from the Bob library. See http://www.idiap.ch/software/bob/docs/releases/last/sphinx/html/measure/ for more details.