This algorithm is a legacy one. The API has changed since its implementation. New versions and forks will need to be updated.

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.

Group: main

Endpoint Name Data Format Nature
scores_dev1 tutorial/probe_scores/1 Input
scores_dev2 tutorial/probe_scores/1 Input
machine tutorial/linear_machine/1 Output
xxxxxxxxxx
82
 
1
class Algorithm:
2
3
    def __init__(self):
4
        self.positives_dev1 = []
5
        self.negatives_dev1 = []
6
        
7
        self.positives_dev2 = []
8
        self.negatives_dev2 = []
9
        
10
        self.machine = None
11
        
12
13
    def accumulate_scores(self, inputs, input_name):
14
15
        positives_test = []
16
        negatives_test = []
17
18
        # accumulate the test scores
19
        data_test = inputs[input_name].data
20
        positives_test.extend([k.score for k in data_test.scores if k.template_identity == data_test.client_identity])
21
        negatives_test.extend([k.score for k in data_test.scores if k.template_identity != data_test.client_identity])
22
        
23
        return positives_test,negatives_test
24
    
25
    
26
    #def compute_fused_scores(self, machine, inputs, input_name1, input_name2):        
27
        #while inputs[input_name].hasMoreData():
28
            
29
    
30
    def compute_znorm(self, positives, negatives):
31
        import numpy
32
        
33
        data = numpy.concatenate((positives, negatives),axis=0)
34
        
35
        mean = numpy.mean(data, axis=0)
36
        std  = numpy.std(data, axis=0)
37
        
38
        return mean, std    
39
    
40
    def process(self, inputs, outputs):
41
        
42
        import numpy
43
        import bob
44
        
45
        #Loading the inputs
46
        self.positives_dev1, self.negatives_dev1 = self.accumulate_scores(inputs, "scores_dev1")
47
        self.positives_dev2, self.negatives_dev2 = self.accumulate_scores(inputs, "scores_dev2")
48
        
49
        
50
        # once all values are received, compute the fusion        
51
        if not(inputs.hasMoreData()):
52
        
53
            #Preparing data for fusion
54
            positives_dev = numpy.zeros(shape=(len(self.positives_dev1),2))
55
            negatives_dev = numpy.zeros(shape=(len(self.negatives_dev1),2))
56
        
57
            positives_dev[:,0] = self.positives_dev1
58
            positives_dev[:,1] = self.positives_dev2
59
            negatives_dev[:,0] = self.negatives_dev1
60
            negatives_dev[:,1] = self.negatives_dev2
61
        
62
        
63
            #normalizing data
64
            subtract, divide = self.compute_znorm(positives_dev,negatives_dev)
65
            positives_dev = numpy.divide(positives_dev-subtract, divide)
66
            negatives_dev = numpy.divide(negatives_dev-subtract, divide)
67
68
        
69
            #Training the logistic regression machine
70
            trainer = bob.trainer.CGLogRegTrainer()
71
            machine = trainer.train(negatives_dev, positives_dev)
72
        
73
            outputs["machine"].write({
74
                'input_subtract': subtract,
75
                'input_divide':   divide,
76
                'weights':        machine.weights,
77
                'biases':         machine.biases,
78
            })        
79
        
80
        
81
        return True
82

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

Could not find any documentation for this object.

Experiments

Updated Name Databases/Protocols Analyzers
smarcel/tpereira/full_isv_multi/2/btas2015_face-periocular_mobio-female_det mobio/1@female tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv_multi/2/btas2015_face-periocular_cpqd-smartphone-male_det cpqd/1@smartphone_male tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv_multi/2/btas2015_face-periocular_mobio-male_det mobio/1@male tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv_multi/2/btas2015_face-periocular_cpqd-smartphone-female_det cpqd/1@smartphone_female tutorial/eerhter_postperf_iso/1
tpereira/tpereira/full_isv_multi/2/btas2015_face-periocular_mobio-female_det mobio/1@female tutorial/eerhter_postperf_iso/1
Created with Raphaël 2.1.2[compare]tpereira/llr_score_fusion/1tpereira/llr_score_projection_dev/102015Jun29

This table shows the number of times this algorithm has been successfully run using the given environment. Note this does not provide sufficient information to evaluate if the algorithm will run when submitted to different conditions.

Terms of Service | Contact Information | BEAT platform version 2.2.1b0 | © Idiap Research Institute - 2013-2025