diff --git a/prefix/databases/mnist/5.json b/prefix/databases/mnist/5.json new file mode 100644 index 0000000000000000000000000000000000000000..6e418818b00d1d140ff1a03c8faf552967be8565 --- /dev/null +++ b/prefix/databases/mnist/5.json @@ -0,0 +1 @@ +{"description": "The MNIST Database of Handwritten Digits", "root_folder": "/path_to_db_folder/mnist", "protocols": [{"name": "idiap", "template": "simple_digit_recognition/1", "views": {"train": {"view": "View", "parameters": {"group": "train"}}, "test": {"view": "View", "parameters": {"group": "test"}}}}], "schema_version": 2} \ No newline at end of file diff --git a/prefix/databases/mnist/5.py b/prefix/databases/mnist/5.py new file mode 100644 index 0000000000000000000000000000000000000000..bb2dc0333b98259cd6aa07a0bc03e89116891260 --- /dev/null +++ b/prefix/databases/mnist/5.py @@ -0,0 +1,111 @@ +############################################################################### +# # +# Copyright (c) 2018 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 +from collections import namedtuple + +from beat.backend.python.database import View as BaseView + +import bob.db.mnist + + +#---------------------------------------------------------- + + +class View(BaseView): + """Outputs: + - image: "{{ system_user.username }}/array_2d_uint8/1" + - id: "{{ system_user.username }}/uint64/1" + - class_id: "{{ system_user.username }}/uint64/1" + + One "id" is associated with a given "image". + Several "image" are associated with a given "class_id". + + --------------- --------------- --------------- --------------- --------------- --------------- + | image | | image | | image | | image | | image | | image | + --------------- --------------- --------------- --------------- --------------- --------------- + --------------- --------------- --------------- --------------- --------------- --------------- + | id | | id | | id | | id | | id | | id | + --------------- --------------- --------------- --------------- --------------- --------------- + ----------------------------------------------- ----------------------------------------------- + | class_id | | class_id | + ----------------------------------------------- ----------------------------------------------- + """ + + def index(self, root_folder, parameters): + Entry = namedtuple('Entry', ['class_id', 'id', 'image']) + + # Open the database and load the objects to provide via the outputs + db = bob.db.mnist.Database() + + features, labels = db.data(groups=parameters['group']) + + objs = sorted([ (labels[i], i, features[i]) for i in range(len(features)) ], + key=lambda x: (x[0], x[1])) + + return [ Entry(x[0], x[1], x[2]) for x in objs ] + + + def get(self, output, index): + obj = self.objs[index] + + if output == 'class_id': + return { + 'value': np.uint64(obj.class_id) + } + + elif output == 'id': + return { + 'value': np.uint64(obj.id) + } + + elif output == 'image': + return { + 'value': np.array(obj.image).reshape((28, 28)) + } + + +#---------------------------------------------------------- + + +def setup_tests(): + pass + + +#---------------------------------------------------------- + + +# Test the behavior of the views (on fake data) +if __name__ == '__main__': + + setup_tests() + + # Note: This database can't be tested without the actual data, since + # the actual files are needed by this implementation + + view = View() + view.objs = view.index(root_folder='', parameters=dict(group='train')) + view.get('class_id', 0) + view.get('id', 0) + view.get('image', 0) diff --git a/prefix/databases/mnist/5.rst b/prefix/databases/mnist/5.rst new file mode 100644 index 0000000000000000000000000000000000000000..2584c54faa06a406f71eb0586e54df25a8f8e659 --- /dev/null +++ b/prefix/databases/mnist/5.rst @@ -0,0 +1 @@ +The MNIST Database of Handwritten Digits \ No newline at end of file diff --git a/prefix/experiments/amohammadi/amohammadi/atnt_eigenfaces/1/atnt1.json b/prefix/experiments/amohammadi/amohammadi/atnt_eigenfaces/1/atnt1.json index d732a3e09aa666a6781eaa09226b04d376a77711..f4f6484cf7c2d4bb853b8a4b102ccccdc628bb12 100644 --- a/prefix/experiments/amohammadi/amohammadi/atnt_eigenfaces/1/atnt1.json +++ b/prefix/experiments/amohammadi/amohammadi/atnt_eigenfaces/1/atnt1.json @@ -47,17 +47,17 @@ }, "datasets": { "Probes": { - "database": "atnt/5", + "database": "atnt/6", "protocol": "idiap", "set": "probes" }, "Templates": { - "database": "atnt/5", + "database": "atnt/6", "protocol": "idiap", "set": "templates" }, "Train": { - "database": "atnt/5", + "database": "atnt/6", "protocol": "idiap", "set": "train" } @@ -73,4 +73,4 @@ "queue": "Default" }, "schema_version": 1 -} \ No newline at end of file +} diff --git a/prefix/experiments/amohammadi/amohammadi/atnt_facenet/1/atnt_facenet_1.json b/prefix/experiments/amohammadi/amohammadi/atnt_facenet/1/atnt_facenet_1.json index 10d5372b704849955f3c2476ff1c3454eb12dba6..d7bc5e151f8965e6fd12cc8c3dfac48b3ac32acf 100644 --- a/prefix/experiments/amohammadi/amohammadi/atnt_facenet/1/atnt_facenet_1.json +++ b/prefix/experiments/amohammadi/amohammadi/atnt_facenet/1/atnt_facenet_1.json @@ -2,10 +2,15 @@ "analyzers": { "analyzer": { "algorithm": "amohammadi/eer_analyzer/1", + "environment": { + "name": "Python", + "version": "2.1.0" + }, "inputs": { "is_positive": "is_positive", "score": "score" - } + }, + "queue": "Default" } }, "blocks": { diff --git a/prefix/experiments/amohammadi/amohammadi/mnist_simple/1/mnist1.json b/prefix/experiments/amohammadi/amohammadi/mnist_simple/1/mnist1.json index f790a1c87ef9609614583f287b13220294c88db1..05fad7ee6cbd7feac5348d4b2c11b8d349785c15 100644 --- a/prefix/experiments/amohammadi/amohammadi/mnist_simple/1/mnist1.json +++ b/prefix/experiments/amohammadi/amohammadi/mnist_simple/1/mnist1.json @@ -32,12 +32,12 @@ }, "datasets": { "test": { - "database": "mnist/4", + "database": "mnist/5", "protocol": "idiap", "set": "test" }, "train": { - "database": "mnist/4", + "database": "mnist/5", "protocol": "idiap", "set": "train" } @@ -50,4 +50,4 @@ "queue": "Default" }, "schema_version": 1 -} \ No newline at end of file +}