def score(self, score_request):
    'Compare templates to produce scores.'
    score_type = self.scoreType()
    result = geo.Matrix()
    if (score_type not in [fsd.SERVER]):
        raise NotImplementedError(('Score type <%s> not implemented.' % (score_type,)))
    if (len(score_request.template_probes.templates) == 0):
        raise ValueError('no probe templates were found in the arguments.')
    if (len(score_request.template_gallery.templates) == 0):
        raise ValueError('no gallery templates were found in the arguments.')
    '\n        if min(len(score_request.face_probes.face_records),len(score_request.template_probes.templates)) != 0:\n            raise ValueError("probes argument cannot have both face_probes and template_probes defined.")\n        if max(len(score_request.face_probes.face_records),len(score_request.template_probes.templates)) == 0:\n            raise ValueError("no probe templates were found in the arguments.")\n        if min(len(score_request.face_gallery.face_records),len(score_request.template_gallery.templates)) != 0:\n            raise ValueError("gallery argument cannot have both face_gallery and template_gallery defined.")\n        if max(len(score_request.face_gallery.face_records),len(score_request.template_gallery.templates)) == 0:\n            raise ValueError("no gallery templates were found in the arguments.")\n        '
    if (score_type == fsd.SERVER):
        sim_mat = np.zeros((len(score_request.template_probes.templates), len(score_request.template_gallery.templates)), dtype=np.float32)
        roc_probe_template = roc.roc_template()
        roc_gallery_template = roc.roc_template()
        sm_metric = roc.new_roc_similarity()
        for p in range(0, len(score_request.template_probes.templates)):
            self._rocUnFlatten(score_request.template_probes.templates[p].buffer, roc_probe_template)
            for g in range(0, len(score_request.template_gallery.templates)):
                self._rocUnFlatten(score_request.template_gallery.templates[g].buffer, roc_gallery_template)
                roc.roc_compare_templates(roc_probe_template, roc_gallery_template, sm_metric)
                sim_mat[(p, g)] = roc.roc_similarity_value(sm_metric)
        roc.delete_roc_similarity(sm_metric)
        roc.roc_free_template(roc_probe_template)
        roc.roc_free_template(roc_gallery_template)
    else:
        NotImplementedError(('ScoreType %s is not implemented.' % (score_type,)))
    sim_mat[(sim_mat == (- 1.0))] = 0.0
    dist_mat = (1.0 - sim_mat)
    return pt.matrix_np2proto(dist_mat)
Compare templates to produce scores.
def score(self, score_request):
    
    score_type = self.scoreType()
    result = geo.Matrix()
    if (score_type not in [fsd.SERVER]):
        raise NotImplementedError(('Score type <%s> not implemented.' % (score_type,)))
    if (len(score_request.template_probes.templates) == 0):
        raise ValueError('no probe templates were found in the arguments.')
    if (len(score_request.template_gallery.templates) == 0):
        raise ValueError('no gallery templates were found in the arguments.')
    '\n        if min(len(score_request.face_probes.face_records),len(score_request.template_probes.templates)) != 0:\n            raise ValueError("probes argument cannot have both face_probes and template_probes defined.")\n        if max(len(score_request.face_probes.face_records),len(score_request.template_probes.templates)) == 0:\n            raise ValueError("no probe templates were found in the arguments.")\n        if min(len(score_request.face_gallery.face_records),len(score_request.template_gallery.templates)) != 0:\n            raise ValueError("gallery argument cannot have both face_gallery and template_gallery defined.")\n        if max(len(score_request.face_gallery.face_records),len(score_request.template_gallery.templates)) == 0:\n            raise ValueError("no gallery templates were found in the arguments.")\n        '
    if (score_type == fsd.SERVER):
        sim_mat = np.zeros((len(score_request.template_probes.templates), len(score_request.template_gallery.templates)), dtype=np.float32)
        roc_probe_template = roc.roc_template()
        roc_gallery_template = roc.roc_template()
        sm_metric = roc.new_roc_similarity()
        for p in range(0, len(score_request.template_probes.templates)):
            self._rocUnFlatten(score_request.template_probes.templates[p].buffer, roc_probe_template)
            for g in range(0, len(score_request.template_gallery.templates)):
                self._rocUnFlatten(score_request.template_gallery.templates[g].buffer, roc_gallery_template)
                roc.roc_compare_templates(roc_probe_template, roc_gallery_template, sm_metric)
                sim_mat[(p, g)] = roc.roc_similarity_value(sm_metric)
        roc.delete_roc_similarity(sm_metric)
        roc.roc_free_template(roc_probe_template)
        roc.roc_free_template(roc_gallery_template)
    else:
        NotImplementedError(('ScoreType %s is not implemented.' % (score_type,)))
    sim_mat[(sim_mat == (- 1.0))] = 0.0
    dist_mat = (1.0 - sim_mat)
    return pt.matrix_np2proto(dist_mat)