Commit 65ac8dbc authored by Philip ABBET's avatar Philip ABBET

Add banca/3 (api change: beat.backend.python v1.4.2)

parent 32b5f73c
{
"description": "The BANCA Database of Faces",
"root_folder": "/idiap/group/biometric/databases/banca/english/images/images",
"protocols": [
{
"name": "P",
"template": "advanced_face_recognition",
"sets": [
{
"name": "train",
"template": "train",
"view": "Train",
"parameters": {
"protocol": "P"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "P",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "P",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "P",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "P",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
}
]
},
{
"name": "G",
"template": "advanced_face_recognition",
"sets": [
{
"name": "train",
"template": "train",
"view": "Train",
"parameters": {
"protocol": "G"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "G",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "G",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "G",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "G",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
}
]
},
{
"name": "Mc",
"template": "advanced_face_recognition",
"sets": [
{
"name": "train",
"template": "train",
"view": "Train",
"parameters": {
"protocol": "Mc"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "Mc",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "Mc",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "Mc",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "Mc",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
}
]
},
{
"name": "Md",
"template": "advanced_face_recognition",
"sets": [
{
"name": "train",
"template": "train",
"view": "Train",
"parameters": {
"protocol": "Md"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "Md",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "Md",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "Md",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "Md",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
}
]
},
{
"name": "Ma",
"template": "advanced_face_recognition",
"sets": [
{
"name": "train",
"template": "train",
"view": "Train",
"parameters": {
"protocol": "Ma"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "Ma",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "Ma",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "Ma",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "Ma",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
}
]
},
{
"name": "Ud",
"template": "advanced_face_recognition",
"sets": [
{
"name": "train",
"template": "train",
"view": "Train",
"parameters": {
"protocol": "Ud"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "Ud",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "Ud",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "Ud",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "Ud",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
}
]
},
{
"name": "Ua",
"template": "advanced_face_recognition",
"sets": [
{
"name": "train",
"template": "train",
"view": "Train",
"parameters": {
"protocol": "Ua"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "Ua",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "dev_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "Ua",
"group": "dev"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_templates",
"template": "templates",
"view": "Templates",
"parameters": {
"protocol": "Ua",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_id": "{{ system_user.username }}/uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
},
{
"name": "test_probes",
"template": "probes",
"view": "Probes",
"parameters": {
"protocol": "Ua",
"group": "eval"
},
"outputs": {
"file_id": "{{ system_user.username }}/uint64/1",
"probe_id": "{{ system_user.username }}/uint64/1",
"client_id": "{{ system_user.username }}/uint64/1",
"template_ids": "{{ system_user.username }}/array_1d_uint64/1",
"image": "{{ system_user.username }}/array_3d_uint8/1",
"eye_centers": "{{ system_user.username }}/eye_positions/1"
}
}
]
}
]
}
###############################################################################
# #
# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ #
# Contact: beat.support@idiap.ch #
# #
# This file is part of the beat.examples module of the BEAT platform. #
# #
# Commercial License Usage #
# Licensees holding valid commercial BEAT licenses may use this file in #
# accordance with the terms contained in a written agreement between you #
# and Idiap. For further information contact tto@idiap.ch #
# #
# Alternatively, this file may be used under the terms of the GNU Affero #
# Public License version 3 as published by the Free Software and appearing #
# in the file LICENSE.AGPL included in the packaging of this file. #
# The BEAT platform is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
# or FITNESS FOR A PARTICULAR PURPOSE. #
# #
# You should have received a copy of the GNU Affero Public License along #
# with the BEAT platform. If not, see http://www.gnu.org/licenses/. #
# #
###############################################################################
import numpy as np
import bob.io.base
import bob.io.image
import bob.db.banca
#----------------------------------------------------------
def get_client_end_index(objs, client_id, client_start_index,
start_index, end_index):
client_end_index = client_start_index
while client_end_index + 1 <= end_index:
obj = objs[client_end_index + 1 - start_index]
if isinstance(obj, tuple):
obj = obj[1]
if obj.client_id != client_id:
return client_end_index
client_end_index += 1
return end_index
#----------------------------------------------------------
def get_value_end_index(objs, value, index_in_tuple, value_start_index,
start_index, end_index):
value_end_index = value_start_index
while value_end_index + 1 <= end_index:
id = objs[value_end_index + 1 - start_index][index_in_tuple]
if id != value:
return value_end_index
value_end_index += 1
return end_index
#----------------------------------------------------------
class Train:
"""Outputs:
- image: "{{ system_user.username }}/array_3d_uint8/1"
- file_id: "{{ system_user.username }}/uint64/1"
- eye_centers: "{{ system_user.username }}/eye_positions/1"
- client_id: "{{ system_user.username }}/uint64/1"
One "file_id" is associated with a given "image".
One "eye_centers" is associated with a given "image".
Several "image" are associated with a given "client_id".
--------------- --------------- --------------- --------------- --------------- ---------------
| image | | image | | image | | image | | image | | image |
--------------- --------------- --------------- --------------- --------------- ---------------
--------------- --------------- --------------- --------------- --------------- ---------------
| file_id | | file_id | | file_id | | file_id | | file_id | | file_id |
--------------- --------------- --------------- --------------- --------------- ---------------
--------------- --------------- --------------- --------------- --------------- ---------------
| eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers | | eye_centers |
--------------- --------------- --------------- --------------- --------------- ---------------
----------------------------------------------- -----------------------------------------------
| client_id | | client_id |
----------------------------------------------- -----------------------------------------------
"""
def setup(self, root_folder, outputs, parameters, force_start_index=None,
force_end_index=None):