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

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
features system/array_2d_floats/1 Input
projections chichan/a-collection-of-data/2 Output

Unnamed group

Endpoint Name Data Format Nature
subspace chichan/a-collection-of-linear_machines/1 Input
xxxxxxxxxx
58
 
1
import bob
2
import numpy
3
4
5
6
def linear_machines_from_data(data):
7
    """Unmangles a bob.machine.LinearMachine from a BEAT Data object"""
8
    machines={}
9
    data_array=data.machine_array
10
    num_of_machine= len(data_array)
11
12
    if num_of_machine>0 :
13
        for i in xrange(num_of_machine) :
14
            machine= None
15
            machine = bob.machine.LinearMachine(data_array[i].weights)
16
            machine.biases = data_array[i].biases
17
            machine.input_subtract = data_array[i].input_subtract
18
            machine.input_divide = data_array[i].input_divide
19
            machines[i]=machine
20
            print machines[i].biases
21
        print machines[num_of_machine-1].biases
22
23
    return machines
24
25
def data_projections(self, data):
26
    features=[]
27
    for i in xrange(data.shape[0]):
28
        features.append({'value': self.machines[i].forward(data[i])})
29
30
        
31
    return features
32
33
class Algorithm:
34
35
    def __init__(self):
36
        self.machines            = None
37
        self.projections        = None
38
        self.current_projection = 0
39
40
41
    def process(self, inputs, outputs):
42
43
        # retrieve the linear machine once
44
        if self.machines is None:
45
            inputs['subspace'].next()
46
            self.machines = linear_machines_from_data(inputs['subspace'].data)
47
48
49
        # collect all the image projections for the current template
50
        features = inputs['features'].data.value
51
        projections = data_projections(self, features)
52
53
        outputs["projections"].write({
54
                "data_array" : projections
55
            })
56
57
        return True
58

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

This algorithm linearizes and accumulates images into a buffer, before applying a linear transformation (e.g. using a projection matrix computed by principal component analysis). The linear transformation relies on the Bob library.

The inputs are:

  • image: an image as a two-dimensional arrays of floats (64 bits)
  • id: an identifier which is used as follows: all images with the
    same identifier are accumulated into the same buffer
  • subspace: a linear transformation as a collection of weights,
    biases, input subtraction and input division factors.

The output projections is a two-dimensional array of floats (64 bits), the number of rows corresponding to the number of accumulated images (with the same identifier), and the number of columns to the output dimensionality after applying the linear transformation.

Experiments

Updated Name Databases/Protocols Analyzers
smarcel/chichan/full_pre_mlbphs_projection/2/mobio-f_TT_MLBPH_PCA98_LDA300_postperf-iso mobio/2@female tutorial/eerhter_postperf_iso/1
smarcel/chichan/full_pre_mlbphs_projection/2/mobio-m_TT_MLBPH_PCA98_LDA300_postperf-iso mobio/2@male tutorial/eerhter_postperf_iso/1
smarcel/chichan/full_pre_mlbphs_projection/2/mobio-m_TT_MLBPH_PCA98_postperf-iso mobio/2@male tutorial/eerhter_postperf_iso/1
smarcel/chichan/full_pre_mlbphs_projection/2/mobio-f_TT_MLBPH_PCA98_postperf-iso mobio/2@female tutorial/eerhter_postperf_iso/1
chichan/chichan/full_pre_mlbphs_projection/2/Prep_MLBPH_XM2VTS_nouniform_PCA xm2vts/1@darkened-lp1,xm2vts/1@lp1 tutorial/eerhter_postperf/1
chichan/chichan/full_pre_mlbphs_projection/2/Prep_MLBPH_XM2VTS_LDA xm2vts/1@darkened-lp1,xm2vts/1@lp1 tutorial/eerhter_postperf/1
chichan/chichan/full_pre_mlbphs_projection/2/Prep_MLBPH_XM2VTS_no_uniform_p98LDA xm2vts/1@darkened-lp1,xm2vts/1@lp1 tutorial/eerhter_postperf/1
chichan/chichan/full_pre_mlbphs_projection/2/Prep_MLBPH_XM2VTS_PCA xm2vts/1@darkened-lp1,xm2vts/1@lp1 tutorial/eerhter_postperf/1
Created with Raphaël 2.1.2[compare]chichan/comp_linear_machine_projection/372015Nov25

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