Takes the template and probe features from two datasets and feeds them from one group

This algorithm is a sequential one. The platform will call its process() method once per data incoming on its inputs.

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: probe

Endpoint Name Data Format Nature
client_id system/uint64/1 Input
image system/array_2d_uint8/1 Input
template_ids system/array_1d_uint64/1 Input
is_positive system/boolean/1 Output
probe_image system/array_2d_uint8/1 Output
template_images system/array_3d_uint8/1 Output

Group: template

Endpoint Name Data Format Nature
template_id system/uint64/1 Input
template_image system/array_2d_uint8/1 Input
xxxxxxxxxx
32
 
1
from collections import defaultdict
2
3
4
class Algorithm:
5
    def __init__(self):
6
        self.templates = defaultdict(list)
7
8
    def prepare(self, data_loaders):
9
        # Load template images
10
        # import ipdb; ipdb.set_trace()
11
        template_image_loader = data_loaders.loaderOf("template_image")
12
        for i in range(template_image_loader.count()):
13
            data = template_image_loader[i][0]
14
            template_image = data["template_image"].value
15
            template_id = data["template_id"].value
16
            self.templates[template_id].append(template_image)
17
        return True
18
19
    def process(self, inputs, data_loaders, outputs):
20
21
        client_id = inputs["client_id"].data.value
22
        probe_image = inputs["image"].data.value
23
        template_ids = inputs["template_ids"].data.value
24
        for template_id in template_ids:
25
            template_images = self.templates[template_id]
26
            is_positive = template_id == client_id
27
            # Writes the output
28
            outputs["probe_image"].write({"value": probe_image})
29
            outputs["template_images"].write({"value": template_images})
30
            outputs["is_positive"].write({"value": is_positive})
31
        return True
32

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
amohammadi/amohammadi/atnt_facenet/1/atnt_facenet_1 atnt/5@idiap,facenet-20170512-110547/1@facenet-20170512-110547 amohammadi/eer_analyzer/1
amohammadi/amohammadi/atnt_eigenfaces/1/atnt1 atnt/6@idiap amohammadi/eer_analyzer/1
Created with Raphaël 2.1.2[compare]amohammadi/joint_template_probe_feeder/12021Jan28

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