diff --git a/bob/db/cuhk/__init__.py b/bob/db/cuhk/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4f918fcae2af6ab4368a0524f383a30f9ab3b5f9 --- /dev/null +++ b/bob/db/cuhk/__init__.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : +# @author: Elie Khoury <Elie.Khoury@idiap.ch> +# @date: Thu Aug 22 17:43:04 CEST 2013 +# +# Copyright (C) 2012-2014 Idiap Research Institute, Martigny, Switzerland +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3 of the License. +# +# This program 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. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +""" +Details about the Voxforge database can be found here: +http://www.voxforge.org/ +""" + +from .query import Database +from bob.db.verification.filelist.models import File, Client + +def get_config(): + """Returns a string containing the configuration information. + """ + + import pkg_resources + + packages = pkg_resources.require(__name__) + this = packages[0] + deps = packages[1:] + + retval = "%s: %s (%s)\n" % (this.key, this.version, this.location) + retval += " - python dependencies:\n" + for d in deps: retval += " - %s: %s (%s)\n" % (d.key, d.version, d.location) + + return retval.strip() + +# gets sphinx autodoc done right - don't remove it +__all__ = [_ for _ in dir() if not _.startswith('_')] diff --git a/bob/db/cuhk/driver.py b/bob/db/cuhk/driver.py new file mode 100644 index 0000000000000000000000000000000000000000..d612277572e25fbea88334fc7b57b65d279212f9 --- /dev/null +++ b/bob/db/cuhk/driver.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : +# Laurent El Shafey <laurent.el-shafey@idiap.ch> +# Fri Aug 23 16:51:41 CEST 2013 +# +# Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3 of the License. +# +# This program 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. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""Commands the CASIA NIR-VIS 2.0 database can respond to. +""" + +import os +import sys +from bob.db.base.driver import Interface as BaseInterface + +def dumplist(args): + """Dumps lists of files based on your criteria""" + + from .query import Database + db = Database() + + r = db.objects( + purposes=args.purpose, + groups=args.group, + ) + + output = sys.stdout + if args.selftest: + from bob.db.base.utils import null + output = null() + + for f in r: + output.write('%s\n' % f.make_path(directory=args.directory,extension=args.extension)) + + return 0 + +def checkfiles(args): + """Checks existence of files based on your criteria""" + + from .query import Database + db = Database() + + r = db.objects() + + # go through all files, check if they are available on the filesystem + good = [] + bad = [] + for f in r: + if os.path.exists(f.make_path(args.directory, args.extension)): good.append(f) + else: bad.append(f) + + # report + output = sys.stdout + if args.selftest: + from bob.db.base.utils import null + output = null() + + if bad: + for f in bad: + output.write('Cannot find file "%s"\n' % f.make_path(args.directory, args.extension)) + output.write('%d files (out of %d) were not found at "%s"\n' % \ + (len(bad), len(r), args.directory)) + + return 0 + +class Interface(BaseInterface): + + def name(self): + return 'voxforge' + + def version(self): + import pkg_resources # part of setuptools + return pkg_resources.require('bob.db.%s' % self.name())[0].version + + def files(self): + return () + + def type(self): + return 'text' + + def add_commands(self, parser): + + from . import __doc__ as docs + + subparsers = self.setup_parser(parser, + "Voxforge database", docs) + + import argparse + + # the "dumplist" action + parser = subparsers.add_parser('dumplist', help=dumplist.__doc__) + parser.add_argument('-d', '--directory', default='', help="if given, this path will be prepended to every entry returned.") + parser.add_argument('-e', '--extension', default='', help="if given, this extension will be appended to every entry returned.") + parser.add_argument('-u', '--purpose', help="if given, this value will limit the output files to those designed for the given purposes.", choices=('enrol', 'probe', '')) + parser.add_argument('-g', '--group', help="if given, this value will limit the output files to those belonging to a particular protocolar group.", choices=('dev', 'eval', 'world', 'optional_world_1', 'optional_world_2', '')) + parser.add_argument('--self-test', dest="selftest", action='store_true', help=argparse.SUPPRESS) + parser.set_defaults(func=dumplist) #action + + # the "checkfiles" action + parser = subparsers.add_parser('checkfiles', help=checkfiles.__doc__) + parser.add_argument('-l', '--list-directory', required=True, help="The directory which contains the file lists.") + parser.add_argument('-d', '--directory', dest="directory", default='', help="if given, this path will be prepended to every entry returned.") + parser.add_argument('-e', '--extension', dest="extension", default='', help="if given, this extension will be appended to every entry returned.") + parser.add_argument('--self-test', dest="selftest", action='store_true', help=argparse.SUPPRESS) + + parser.set_defaults(func=checkfiles) #action diff --git a/bob/db/cuhk/lists/README b/bob/db/cuhk/lists/README new file mode 100644 index 0000000000000000000000000000000000000000..9ab0204d09ba9a525ff81bc9448a667650760614 --- /dev/null +++ b/bob/db/cuhk/lists/README @@ -0,0 +1,15 @@ +This database has 5 protocols. +For the moment only one protocol is developed + + +CUHK protocol, 188 pairs in total + +57 for training +56 for development +75 for testing + + + + + + diff --git a/bob/db/cuhk/lists/all-cuhk.lst b/bob/db/cuhk/lists/all-cuhk.lst new file mode 100644 index 0000000000000000000000000000000000000000..07a5976726f946848d69fab8226d1b1396bba464 --- /dev/null +++ b/bob/db/cuhk/lists/all-cuhk.lst @@ -0,0 +1,376 @@ +photos/f-005-01 f005 +sketches/F2-005-01-sz1 f005 +photos/f-006-01 f006 +sketches/F2-006-01-sz1 f006 +photos/f-007-01 f007 +sketches/F2-007-01-sz1 f007 +photos/f-008-01 f008 +sketches/F2-008-01-sz1 f008 +photos/f-009-01 f009 +sketches/F2-009-01-sz1 f009 +photos/f-010-01 f010 +sketches/F2-010-01-sz1 f010 +photos/f-011-01 f011 +sketches/F2-011-01-sz1 f011 +photos/f-012-01 f012 +sketches/F2-012-01-sz1 f012 +photos/f-013-01 f013 +sketches/F2-013-01-sz1 f013 +photos/f-014-01 f014 +sketches/F2-014-01-sz1 f014 +photos/f-015-01 f015 +sketches/F2-015-01-sz1 f015 +photos/f-016-01 f016 +sketches/F2-016-01-sz1 f016 +photos/f-017-01 f017 +sketches/F2-017-01-sz1 f017 +photos/f-018-01 f018 +sketches/F2-018-01-sz1 f018 +photos/f-019-01 f019 +sketches/F2-019-01-sz1 f019 +photos/f-020-01 f020 +sketches/F2-020-01-sz1 f020 +photos/f-021-01 f021 +sketches/F2-021-01-sz1 f021 +photos/f-022-01 f022 +sketches/F2-022-01-sz1 f022 +photos/f-023-01 f023 +sketches/F2-023-01-sz1 f023 +photos/f-024-01 f024 +sketches/F2-024-01-sz1 f024 +photos/f-025-01 f025 +sketches/F2-025-01-sz1 f025 +photos/f-026-01 f026 +sketches/F2-026-01-sz1 f026 +photos/f-027-01 f027 +sketches/F2-027-01-sz1 f027 +photos/f-028-01 f028 +sketches/F2-028-01-sz1 f028 +photos/f-029-01 f029 +sketches/F2-029-01-sz1 f029 +photos/f-030-01 f030 +sketches/F2-030-01-sz1 f030 +photos/f-031-01 f031 +sketches/F2-031-01-sz1 f031 +photos/f-032-01 f032 +sketches/F2-032-01-sz1 f032 +photos/f-033-01 f033 +sketches/F2-033-01-sz1 f033 +photos/f-034-01 f034 +sketches/F2-034-01-sz1 f034 +photos/f-035-01 f035 +sketches/F2-035-01-sz1 f035 +photos/f-036-01 f036 +sketches/F2-036-01-sz1 f036 +photos/f-037-01 f037 +sketches/F2-037-01-sz1 f037 +photos/f-038-01 f038 +sketches/F2-038-01-sz1 f038 +photos/f-039-01 f039 +sketches/f-039-01-sz1 f039 +photos/f-040-01 f040 +sketches/f-040-01-sz1 f040 +photos/f-041-01 f041 +sketches/f-041-01-sz1 f041 +photos/f-042-01 f042 +sketches/f-042-01-sz1 f042 +photos/f-043-01 f043 +sketches/f-043-01-sz1 f043 +photos/f1-001-01 f1001 +sketches/f1-001-01-sz1 f1001 +photos/f1-002-01 f1002 +sketches/f1-002-01-sz1 f1002 +photos/f1-003-01 f1003 +sketches/f1-003-01-sz1 f1003 +photos/f1-004-01 f1004 +sketches/f1-004-01-sz1 f1004 +photos/f1-005-01 f1005 +sketches/f1-005-01-sz1 f1005 +photos/f1-006-01 f1006 +sketches/f1-006-01-sz1 f1006 +photos/f1-007-01 f1007 +sketches/f1-007-01-sz1 f1007 +photos/f1-008-01 f1008 +sketches/f1-008-01-sz1 f1008 +photos/f1-009-01 f1009 +sketches/f1-009-01-sz1 f1009 +photos/f1-010-01 f1010 +sketches/f1-010-01-sz1 f1010 +photos/f1-011-01 f1011 +sketches/f1-011-01-sz1 f1011 +photos/f1-012-01 f1012 +sketches/f1-012-01-sz1 f1012 +photos/f1-013-01 f1013 +sketches/f1-013-01-sz1 f1013 +photos/f1-014-01 f1014 +sketches/f1-014-01-sz1 f1014 +photos/f1-015-01 f1015 +sketches/f1-015-01-sz1 f1015 +photos/m-008-01 m008 +sketches/M2-008-01-sz1 m008 +photos/m-009-01 m009 +sketches/M2-009-01-sz1 m009 +photos/m-010-01 m010 +sketches/M2-010-01-sz1 m010 +photos/m-011-01 m011 +sketches/M2-011-01-sz1 m011 +photos/m-012-01 m012 +sketches/M2-012-01-sz1 m012 +photos/m-013-01 m013 +sketches/M2-013-01-sz1 m013 +photos/m-014-01 m014 +sketches/M2-014-01-sz1 m014 +photos/m-015-01 m015 +sketches/M2-015-01-sz1 m015 +photos/m-016-01 m016 +sketches/M2-016-01-sz1 m016 +photos/m-017-01 m017 +sketches/M2-017-01-sz1 m017 +photos/m-018-01 m018 +sketches/M2-018-01-sz1 m018 +photos/m-019-01 m019 +sketches/M2-019-01-sz1 m019 +photos/m-021-01 m021 +sketches/M2-021-01-sz1 m021 +photos/m-022-01 m022 +sketches/M2-022-01-sz1 m022 +photos/m-023-01 m023 +sketches/M2-023-01-sz1 m023 +photos/m-024-01 m024 +sketches/M2-024-01-sz1 m024 +photos/m-025-01 m025 +sketches/M2-025-01-sz1 m025 +photos/m-026-01 m026 +sketches/M2-026-01-sz1 m026 +photos/m-027-01 m027 +sketches/M2-027-01-sz1 m027 +photos/m-028-01 m028 +sketches/M2-028-01-sz1 m028 +photos/m-029-01 m029 +sketches/M2-029-01-sz1 m029 +photos/m-030-01 m030 +sketches/M2-030-01-sz1 m030 +photos/m-031-01 m031 +sketches/M2-031-01-sz1 m031 +photos/m-032-01 m032 +sketches/M2-032-01-sz1 m032 +photos/m-033-01 m033 +sketches/M2-033-01-sz1 m033 +photos/m-034-01 m034 +sketches/M2-034-01-sz1 m034 +photos/m-035-01 m035 +sketches/M2-035-01-sz1 m035 +photos/m-036-01 m036 +sketches/M2-036-01-sz1 m036 +photos/m-037-01 m037 +sketches/M2-037-01-sz1 m037 +photos/m-038-01 m038 +sketches/M2-038-01-sz1 m038 +photos/m-039-01 m039 +sketches/M2-039-01-sz1 m039 +photos/m-040-01 m040 +sketches/M2-040-01-sz1 m040 +photos/m-041-01 m041 +sketches/M2-041-01-sz1 m041 +photos/m-042-01 m042 +sketches/M2-042-01-sz1 m042 +photos/m-043-01 m043 +sketches/M2-043-01-sz1 m043 +photos/m-044-01 m044 +sketches/M2-044-01-sz1 m044 +photos/m-045-01 m045 +sketches/M2-045-01-sz1 m045 +photos/m-046-01 m046 +sketches/M2-046-01-sz1 m046 +photos/m-047-01 m047 +sketches/M2-047-01-sz1 m047 +photos/m-048-01 m048 +sketches/M2-048-01-sz1 m048 +photos/m-049-01 m049 +sketches/M2-049-01-sz1 m049 +photos/m-050-01 m050 +sketches/M2-050-01-sz1 m050 +photos/m-051-01 m051 +sketches/M2-051-01-sz1 m051 +photos/m-052-01 m052 +sketches/M2-052-01-sz1 m052 +photos/m-053-01 m053 +sketches/M2-053-01-sz1 m053 +photos/m-054-01 m054 +sketches/M2-054-01-sz1 m054 +photos/m-055-01 m055 +sketches/M2-055-01-sz1 m055 +photos/m-056-01 m056 +sketches/M2-056-01-sz1 m056 +photos/m-057-01 m057 +sketches/M2-057-01-sz1 m057 +photos/m-058-01 m058 +sketches/M2-058-01-sz1 m058 +photos/m-059-01 m059 +sketches/M2-059-01-sz1 m059 +photos/m-060-01 m060 +sketches/M2-060-01-sz1 m060 +photos/m-061-01 m061 +sketches/M2-061-01-sz1 m061 +photos/m-062-01 m062 +sketches/M2-062-01-sz1 m062 +photos/m-063-01 m063 +sketches/m-063-01-sz1 m063 +photos/m-064-01 m064 +sketches/m-064-01-sz1 m064 +photos/m-065-01 m065 +sketches/m-065-01-sz1 m065 +photos/m-066-01 m066 +sketches/m-066-01-sz1 m066 +photos/m-067-01 m067 +sketches/m-067-01-sz1 m067 +photos/m-068-01 m068 +sketches/m-068-01-sz1 m068 +photos/m-069-01 m069 +sketches/m-069-01-sz1 m069 +photos/m-070-01 m070 +sketches/m-070-01-sz1 m070 +photos/m-071-01 m071 +sketches/m-071-01-sz1 m071 +photos/m-072-01 m072 +sketches/m-072-01-sz1 m072 +photos/m-073-01 m073 +sketches/m-073-01-sz1 m073 +photos/m-074-01 m074 +sketches/m-074-01-sz1 m074 +photos/m-075-01 m075 +sketches/m-075-01-sz1 m075 +photos/m-076-01 m076 +sketches/m-076-01-sz1 m076 +photos/m-077-01 m077 +sketches/m-077-01-sz1 m077 +photos/m-078-01 m078 +sketches/m-078-01-sz1 m078 +photos/m-079-01 m079 +sketches/m-079-01-sz1 m079 +photos/m-080-01 m080 +sketches/m-080-01-sz1 m080 +photos/m-081-01 m081 +sketches/m-081-01-sz1 m081 +photos/m-082-01 m082 +sketches/m-082-01-sz1 m082 +photos/m-083-01 m083 +sketches/m-083-01-sz1 m083 +photos/m-084-01 m084 +sketches/m-084-01-sz1 m084 +photos/m-085-01 m085 +sketches/m-085-01-sz1 m085 +photos/m-086-01 m086 +sketches/m-086-01-sz1 m086 +photos/m-087-01 m087 +sketches/m-087-01-sz1 m087 +photos/m-088-01 m088 +sketches/m-088-01-sz1 m088 +photos/m-089-01 m089 +sketches/m-089-01-sz1 m089 +photos/m-090-01 m090 +sketches/m-090-01-sz1 m090 +photos/m-091-01 m091 +sketches/m-091-01-sz1 m091 +photos/m-092-01 m092 +sketches/m-092-01-sz1 m092 +photos/m-093-01 m093 +sketches/m-093-01-sz1 m093 +photos/m-094-01 m094 +sketches/m-094-01-sz1 m094 +photos/m-095-01 m095 +sketches/m-095-01-sz1 m095 +photos/m-096-01 m096 +sketches/m-096-01-sz1 m096 +photos/m-097-01 m097 +sketches/m-097-01-sz1 m097 +photos/m-098-01 m098 +sketches/m-098-01-sz1 m098 +photos/m-099-01 m099 +sketches/m-099-01-sz1 m099 +photos/m-100-01 m100 +sketches/m-100-01-sz1 m100 +photos/m1-001-01 m1001 +sketches/m1-001-01-sz1 m1001 +photos/m1-002-01 m1002 +sketches/m1-002-01-sz1 m1002 +photos/m1-003-01 m1003 +sketches/m1-003-01-sz1 m1003 +photos/m1-004-01 m1004 +sketches/m1-004-01-sz1 m1004 +photos/m1-005-01 m1005 +sketches/m1-005-01-sz1 m1005 +photos/m1-006-01 m1006 +sketches/m1-006-01-sz1 m1006 +photos/m1-007-01 m1007 +sketches/m1-007-01-sz1 m1007 +photos/m1-008-01 m1008 +sketches/m1-008-01-sz1 m1008 +photos/m1-009-01 m1009 +sketches/m1-009-01-sz1 m1009 +photos/m1-010-01 m1010 +sketches/m1-010-01-sz1 m1010 +photos/m-101-01 m101 +sketches/m-101-01-sz1 m101 +photos/m1-011-01 m1011 +sketches/m1-011-01-sz1 m1011 +photos/m1-012-01 m1012 +sketches/m1-012-01-sz1 m1012 +photos/m1-013-01 m1013 +sketches/m1-013-01-sz1 m1013 +photos/m1-014-01 m1014 +sketches/m1-014-01-sz1 m1014 +photos/m1-015-01 m1015 +sketches/m1-015-01-sz1 m1015 +photos/m1-016-01 m1016 +sketches/m1-016-01-sz1 m1016 +photos/m1-017-01 m1017 +sketches/m1-017-01-sz1 m1017 +photos/m1-018-01 m1018 +sketches/m1-018-01-sz1 m1018 +photos/m1-019-01 m1019 +sketches/m1-019-01-sz1 m1019 +photos/m1-020-01 m1020 +sketches/m1-020-01-sz1 m1020 +photos/m1-021-01 m1021 +sketches/m1-021-01-sz1 m1021 +photos/m1-022-01 m1022 +sketches/m1-022-01-sz1 m1022 +photos/m1-023-01 m1023 +sketches/m1-023-01-sz1 m1023 +photos/m1-024-01 m1024 +sketches/m1-024-01-sz1 m1024 +photos/m1-025-01 m1025 +sketches/m1-025-01-sz1 m1025 +photos/m1-026-01 m1026 +sketches/m1-026-01-sz1 m1026 +photos/m1-027-01 m1027 +sketches/m1-027-01-sz1 m1027 +photos/m1-028-01 m1028 +sketches/m1-028-01-sz1 m1028 +photos/m1-029-01 m1029 +sketches/m1-029-01-sz1 m1029 +photos/m1-030-01 m1030 +sketches/m1-030-01-sz1 m1030 +photos/m1-031-01 m1031 +sketches/m1-031-01-sz1 m1031 +photos/m1-032-01 m1032 +sketches/m1-032-01-sz1 m1032 +photos/m1-033-01 m1033 +sketches/m1-033-01-sz1 m1033 +photos/m1-034-01 m1034 +sketches/m1-034-01-sz1 m1034 +photos/m1-035-01 m1035 +sketches/m1-035-01-sz1 m1035 +photos/m1-036-01 m1036 +sketches/m1-036-01-sz1 m1036 +photos/m1-037-01 m1037 +sketches/m1-037-01-sz1 m1037 +photos/m1-038-01 m1038 +sketches/m1-038-01-sz1 m1038 +photos/m1-039-01 m1039 +sketches/m1-039-01-sz1 m1039 +photos/m1-040-01 m1040 +sketches/m1-040-01-sz1 m1040 +photos/m1-041-01 m1041 +sketches/m1-041-01-sz1 m1041 diff --git a/bob/db/cuhk/lists/cuhk/dev/for_models.lst b/bob/db/cuhk/lists/cuhk/dev/for_models.lst new file mode 100644 index 0000000000000000000000000000000000000000..2bed37687c5ef8a860e7cbefd44747f869b321c0 --- /dev/null +++ b/bob/db/cuhk/lists/cuhk/dev/for_models.lst @@ -0,0 +1,56 @@ +photos/f-015-01 f015 f015 +photos/m-055-01 m055 m055 +photos/f-007-01 f007 f007 +photos/m1-010-01 m1010 m1010 +photos/m-048-01 m048 m048 +photos/m1-034-01 m1034 m1034 +photos/f-031-01 f031 f031 +photos/m-014-01 m014 m014 +photos/m-065-01 m065 m065 +photos/f-006-01 f006 f006 +photos/m1-015-01 m1015 m1015 +photos/m-088-01 m088 m088 +photos/m-037-01 m037 m037 +photos/m-073-01 m073 m073 +photos/f1-010-01 f1010 f1010 +photos/f-010-01 f010 f010 +photos/m-041-01 m041 m041 +photos/f-036-01 f036 f036 +photos/m-071-01 m071 m071 +photos/m-012-01 m012 m012 +photos/m-026-01 m026 m026 +photos/m-010-01 m010 m010 +photos/m-016-01 m016 m016 +photos/m-034-01 m034 m034 +photos/m-087-01 m087 m087 +photos/m-035-01 m035 m035 +photos/f-018-01 f018 f018 +photos/m-057-01 m057 m057 +photos/m-052-01 m052 m052 +photos/f-013-01 f013 f013 +photos/m1-023-01 m1023 m1023 +photos/m1-011-01 m1011 m1011 +photos/m-072-01 m072 m072 +photos/f1-005-01 f1005 f1005 +photos/m1-017-01 m1017 m1017 +photos/m-054-01 m054 m054 +photos/m-013-01 m013 m013 +photos/m-045-01 m045 m045 +photos/f-033-01 f033 f033 +photos/f-021-01 f021 f021 +photos/f-038-01 f038 f038 +photos/m-053-01 m053 m053 +photos/f-030-01 f030 f030 +photos/f-027-01 f027 f027 +photos/m-056-01 m056 m056 +photos/m-064-01 m064 m064 +photos/m1-018-01 m1018 m1018 +photos/m1-033-01 m1033 m1033 +photos/m1-001-01 m1001 m1001 +photos/m-046-01 m046 m046 +photos/m1-008-01 m1008 m1008 +photos/f-040-01 f040 f040 +photos/m-068-01 m068 m068 +photos/f-029-01 f029 f029 +photos/m-027-01 m027 m027 +photos/m-084-01 m084 m084 diff --git a/bob/db/cuhk/lists/cuhk/dev/for_probes.lst b/bob/db/cuhk/lists/cuhk/dev/for_probes.lst new file mode 100644 index 0000000000000000000000000000000000000000..e56afcc1bc1c04109ca347efe9b50da2e78ca3ed --- /dev/null +++ b/bob/db/cuhk/lists/cuhk/dev/for_probes.lst @@ -0,0 +1,56 @@ +sketches/F2-015-01-sz1 f015 +sketches/M2-055-01-sz1 m055 +sketches/F2-007-01-sz1 f007 +sketches/m1-010-01-sz1 m1010 +sketches/M2-048-01-sz1 m048 +sketches/m1-034-01-sz1 m1034 +sketches/F2-031-01-sz1 f031 +sketches/M2-014-01-sz1 m014 +sketches/m-065-01-sz1 m065 +sketches/F2-006-01-sz1 f006 +sketches/m1-015-01-sz1 m1015 +sketches/m-088-01-sz1 m088 +sketches/M2-037-01-sz1 m037 +sketches/m-073-01-sz1 m073 +sketches/f1-010-01-sz1 f1010 +sketches/F2-010-01-sz1 f010 +sketches/M2-041-01-sz1 m041 +sketches/F2-036-01-sz1 f036 +sketches/m-071-01-sz1 m071 +sketches/M2-012-01-sz1 m012 +sketches/M2-026-01-sz1 m026 +sketches/M2-010-01-sz1 m010 +sketches/M2-016-01-sz1 m016 +sketches/M2-034-01-sz1 m034 +sketches/m-087-01-sz1 m087 +sketches/M2-035-01-sz1 m035 +sketches/F2-018-01-sz1 f018 +sketches/M2-057-01-sz1 m057 +sketches/M2-052-01-sz1 m052 +sketches/F2-013-01-sz1 f013 +sketches/m1-023-01-sz1 m1023 +sketches/m1-011-01-sz1 m1011 +sketches/m-072-01-sz1 m072 +sketches/f1-005-01-sz1 f1005 +sketches/m1-017-01-sz1 m1017 +sketches/M2-054-01-sz1 m054 +sketches/M2-013-01-sz1 m013 +sketches/M2-045-01-sz1 m045 +sketches/F2-033-01-sz1 f033 +sketches/F2-021-01-sz1 f021 +sketches/F2-038-01-sz1 f038 +sketches/M2-053-01-sz1 m053 +sketches/F2-030-01-sz1 f030 +sketches/F2-027-01-sz1 f027 +sketches/M2-056-01-sz1 m056 +sketches/m-064-01-sz1 m064 +sketches/m1-018-01-sz1 m1018 +sketches/m1-033-01-sz1 m1033 +sketches/m1-001-01-sz1 m1001 +sketches/M2-046-01-sz1 m046 +sketches/m1-008-01-sz1 m1008 +sketches/f-040-01-sz1 f040 +sketches/m-068-01-sz1 m068 +sketches/F2-029-01-sz1 f029 +sketches/M2-027-01-sz1 m027 +sketches/m-084-01-sz1 m084 diff --git a/bob/db/cuhk/lists/cuhk/eval/for_models.lst b/bob/db/cuhk/lists/cuhk/eval/for_models.lst new file mode 100644 index 0000000000000000000000000000000000000000..3e719f92a5db410dacfd48edbf7ae0adffaa7dfa --- /dev/null +++ b/bob/db/cuhk/lists/cuhk/eval/for_models.lst @@ -0,0 +1,75 @@ +photos/f-035-01 f035 f035 +photos/m-008-01 m008 m008 +photos/m-082-01 m082 m082 +photos/m-096-01 m096 m096 +photos/m1-040-01 m1040 m1040 +photos/m-078-01 m078 m078 +photos/m1-004-01 m1004 m1004 +photos/f-034-01 f034 f034 +photos/m-028-01 m028 m028 +photos/m-081-01 m081 m081 +photos/m-033-01 m033 m033 +photos/m1-009-01 m1009 m1009 +photos/f1-013-01 f1013 f1013 +photos/f-039-01 f039 f039 +photos/f-012-01 f012 f012 +photos/m1-032-01 m1032 m1032 +photos/f-005-01 f005 f005 +photos/f-041-01 f041 f041 +photos/m-036-01 m036 m036 +photos/m1-006-01 m1006 m1006 +photos/m-022-01 m022 m022 +photos/m-070-01 m070 m070 +photos/f-017-01 f017 f017 +photos/m-101-01 m101 m101 +photos/m-093-01 m093 m093 +photos/m-029-01 m029 m029 +photos/f1-009-01 f1009 f1009 +photos/m-091-01 m091 m091 +photos/f1-002-01 f1002 f1002 +photos/m-018-01 m018 m018 +photos/f-022-01 f022 f022 +photos/m-089-01 m089 m089 +photos/m-066-01 m066 m066 +photos/m1-007-01 m1007 m1007 +photos/m1-038-01 m1038 m1038 +photos/m-077-01 m077 m077 +photos/m-044-01 m044 m044 +photos/m-031-01 m031 m031 +photos/m-099-01 m099 m099 +photos/m1-026-01 m1026 m1026 +photos/m-095-01 m095 m095 +photos/m1-013-01 m1013 m1013 +photos/m-090-01 m090 m090 +photos/m1-037-01 m1037 m1037 +photos/m-030-01 m030 m030 +photos/f-009-01 f009 f009 +photos/f-037-01 f037 f037 +photos/f-019-01 f019 f019 +photos/f1-003-01 f1003 f1003 +photos/m1-016-01 m1016 m1016 +photos/m1-022-01 m1022 m1022 +photos/m-069-01 m069 m069 +photos/f1-008-01 f1008 f1008 +photos/f1-015-01 f1015 f1015 +photos/f1-012-01 f1012 f1012 +photos/m1-021-01 m1021 m1021 +photos/m-015-01 m015 m015 +photos/m-032-01 m032 m032 +photos/f-043-01 f043 f043 +photos/m-058-01 m058 m058 +photos/m-025-01 m025 m025 +photos/m-062-01 m062 m062 +photos/m1-002-01 m1002 m1002 +photos/f-011-01 f011 f011 +photos/m-050-01 m050 m050 +photos/m-074-01 m074 m074 +photos/m-009-01 m009 m009 +photos/m-039-01 m039 m039 +photos/f1-014-01 f1014 f1014 +photos/m-017-01 m017 m017 +photos/f-042-01 f042 f042 +photos/m-097-01 m097 m097 +photos/m1-024-01 m1024 m1024 +photos/f-028-01 f028 f028 +photos/m-076-01 m076 m076 diff --git a/bob/db/cuhk/lists/cuhk/eval/for_probes.lst b/bob/db/cuhk/lists/cuhk/eval/for_probes.lst new file mode 100644 index 0000000000000000000000000000000000000000..2672325b979970a478a72eb5c513b4a6c166b894 --- /dev/null +++ b/bob/db/cuhk/lists/cuhk/eval/for_probes.lst @@ -0,0 +1,75 @@ +sketches/F2-035-01-sz1 f035 +sketches/M2-008-01-sz1 m008 +sketches/m-082-01-sz1 m082 +sketches/m-096-01-sz1 m096 +sketches/m1-040-01-sz1 m1040 +sketches/m-078-01-sz1 m078 +sketches/m1-004-01-sz1 m1004 +sketches/F2-034-01-sz1 f034 +sketches/M2-028-01-sz1 m028 +sketches/m-081-01-sz1 m081 +sketches/M2-033-01-sz1 m033 +sketches/m1-009-01-sz1 m1009 +sketches/f1-013-01-sz1 f1013 +sketches/f-039-01-sz1 f039 +sketches/F2-012-01-sz1 f012 +sketches/m1-032-01-sz1 m1032 +sketches/F2-005-01-sz1 f005 +sketches/f-041-01-sz1 f041 +sketches/M2-036-01-sz1 m036 +sketches/m1-006-01-sz1 m1006 +sketches/M2-022-01-sz1 m022 +sketches/m-070-01-sz1 m070 +sketches/F2-017-01-sz1 f017 +sketches/m-101-01-sz1 m101 +sketches/m-093-01-sz1 m093 +sketches/M2-029-01-sz1 m029 +sketches/f1-009-01-sz1 f1009 +sketches/m-091-01-sz1 m091 +sketches/f1-002-01-sz1 f1002 +sketches/M2-018-01-sz1 m018 +sketches/F2-022-01-sz1 f022 +sketches/m-089-01-sz1 m089 +sketches/m-066-01-sz1 m066 +sketches/m1-007-01-sz1 m1007 +sketches/m1-038-01-sz1 m1038 +sketches/m-077-01-sz1 m077 +sketches/M2-044-01-sz1 m044 +sketches/M2-031-01-sz1 m031 +sketches/m-099-01-sz1 m099 +sketches/m1-026-01-sz1 m1026 +sketches/m-095-01-sz1 m095 +sketches/m1-013-01-sz1 m1013 +sketches/m-090-01-sz1 m090 +sketches/m1-037-01-sz1 m1037 +sketches/M2-030-01-sz1 m030 +sketches/F2-009-01-sz1 f009 +sketches/F2-037-01-sz1 f037 +sketches/F2-019-01-sz1 f019 +sketches/f1-003-01-sz1 f1003 +sketches/m1-016-01-sz1 m1016 +sketches/m1-022-01-sz1 m1022 +sketches/m-069-01-sz1 m069 +sketches/f1-008-01-sz1 f1008 +sketches/f1-015-01-sz1 f1015 +sketches/f1-012-01-sz1 f1012 +sketches/m1-021-01-sz1 m1021 +sketches/M2-015-01-sz1 m015 +sketches/M2-032-01-sz1 m032 +sketches/f-043-01-sz1 f043 +sketches/M2-058-01-sz1 m058 +sketches/M2-025-01-sz1 m025 +sketches/M2-062-01-sz1 m062 +sketches/m1-002-01-sz1 m1002 +sketches/F2-011-01-sz1 f011 +sketches/M2-050-01-sz1 m050 +sketches/m-074-01-sz1 m074 +sketches/M2-009-01-sz1 m009 +sketches/M2-039-01-sz1 m039 +sketches/f1-014-01-sz1 f1014 +sketches/M2-017-01-sz1 m017 +sketches/f-042-01-sz1 f042 +sketches/m-097-01-sz1 m097 +sketches/m1-024-01-sz1 m1024 +sketches/F2-028-01-sz1 f028 +sketches/m-076-01-sz1 m076 diff --git a/bob/db/cuhk/lists/cuhk/norm/train_world.lst b/bob/db/cuhk/lists/cuhk/norm/train_world.lst new file mode 100644 index 0000000000000000000000000000000000000000..04473e236cbc49c83adfdf90ecf7f97ff18399bc --- /dev/null +++ b/bob/db/cuhk/lists/cuhk/norm/train_world.lst @@ -0,0 +1,114 @@ +photos/m-059-01 m059 +sketches/M2-059-01-sz1 m059 +photos/m1-041-01 m1041 +sketches/m1-041-01-sz1 m1041 +photos/f1-007-01 f1007 +sketches/f1-007-01-sz1 f1007 +photos/m-023-01 m023 +sketches/M2-023-01-sz1 m023 +photos/m1-020-01 m1020 +sketches/m1-020-01-sz1 m1020 +photos/f1-004-01 f1004 +sketches/f1-004-01-sz1 f1004 +photos/m1-014-01 m1014 +sketches/m1-014-01-sz1 m1014 +photos/m1-027-01 m1027 +sketches/m1-027-01-sz1 m1027 +photos/m-021-01 m021 +sketches/M2-021-01-sz1 m021 +photos/m1-005-01 m1005 +sketches/m1-005-01-sz1 m1005 +photos/m-040-01 m040 +sketches/M2-040-01-sz1 m040 +photos/m1-029-01 m1029 +sketches/m1-029-01-sz1 m1029 +photos/f-032-01 f032 +sketches/F2-032-01-sz1 f032 +photos/m1-028-01 m1028 +sketches/m1-028-01-sz1 m1028 +photos/m-080-01 m080 +sketches/m-080-01-sz1 m080 +photos/m-086-01 m086 +sketches/m-086-01-sz1 m086 +photos/m1-003-01 m1003 +sketches/m1-003-01-sz1 m1003 +photos/m1-012-01 m1012 +sketches/m1-012-01-sz1 m1012 +photos/f1-006-01 f1006 +sketches/f1-006-01-sz1 f1006 +photos/f-020-01 f020 +sketches/F2-020-01-sz1 f020 +photos/m-094-01 m094 +sketches/m-094-01-sz1 m094 +photos/m-098-01 m098 +sketches/m-098-01-sz1 m098 +photos/m-092-01 m092 +sketches/m-092-01-sz1 m092 +photos/m-042-01 m042 +sketches/M2-042-01-sz1 m042 +photos/f-025-01 f025 +sketches/F2-025-01-sz1 f025 +photos/m-047-01 m047 +sketches/M2-047-01-sz1 m047 +photos/m-079-01 m079 +sketches/m-079-01-sz1 m079 +photos/f-024-01 f024 +sketches/F2-024-01-sz1 f024 +photos/m1-035-01 m1035 +sketches/m1-035-01-sz1 m1035 +photos/m1-025-01 m1025 +sketches/m1-025-01-sz1 m1025 +photos/m-060-01 m060 +sketches/M2-060-01-sz1 m060 +photos/f-016-01 f016 +sketches/F2-016-01-sz1 f016 +photos/m-019-01 m019 +sketches/M2-019-01-sz1 m019 +photos/f-014-01 f014 +sketches/F2-014-01-sz1 f014 +photos/m1-039-01 m1039 +sketches/m1-039-01-sz1 m1039 +photos/m1-030-01 m1030 +sketches/m1-030-01-sz1 m1030 +photos/m-038-01 m038 +sketches/M2-038-01-sz1 m038 +photos/m-083-01 m083 +sketches/m-083-01-sz1 m083 +photos/m1-036-01 m1036 +sketches/m1-036-01-sz1 m1036 +photos/m-085-01 m085 +sketches/m-085-01-sz1 m085 +photos/m-043-01 m043 +sketches/M2-043-01-sz1 m043 +photos/m-051-01 m051 +sketches/M2-051-01-sz1 m051 +photos/f-023-01 f023 +sketches/F2-023-01-sz1 f023 +photos/m1-019-01 m1019 +sketches/m1-019-01-sz1 m1019 +photos/m-063-01 m063 +sketches/m-063-01-sz1 m063 +photos/m-100-01 m100 +sketches/m-100-01-sz1 m100 +photos/f-026-01 f026 +sketches/F2-026-01-sz1 f026 +photos/m-024-01 m024 +sketches/M2-024-01-sz1 m024 +photos/m-075-01 m075 +sketches/m-075-01-sz1 m075 +photos/f1-011-01 f1011 +sketches/f1-011-01-sz1 f1011 +photos/f1-001-01 f1001 +sketches/f1-001-01-sz1 f1001 +photos/m-067-01 m067 +sketches/m-067-01-sz1 m067 +photos/m-061-01 m061 +sketches/M2-061-01-sz1 m061 +photos/m1-031-01 m1031 +sketches/m1-031-01-sz1 m1031 +photos/m-049-01 m049 +sketches/M2-049-01-sz1 m049 +photos/m-011-01 m011 +sketches/M2-011-01-sz1 m011 +photos/f-008-01 f008 +sketches/F2-008-01-sz1 f008 diff --git a/bob/db/cuhk/lists/generate_train_dev_eval.py b/bob/db/cuhk/lists/generate_train_dev_eval.py new file mode 100644 index 0000000000000000000000000000000000000000..2db7898cd37e508cc38e575f134ed1ee904c57bb --- /dev/null +++ b/bob/db/cuhk/lists/generate_train_dev_eval.py @@ -0,0 +1,69 @@ +""" +This script is not part of the package, it is just for organize it. + +This script generates the train set, dev set and evaluation set for a given input file. + +Since in all protocols of this database we have only one pair per identity, we will define the number of identies as #lines/2 + +photo first, sketch after + +""" + +import numpy + +input_file = "all-cuhk.lst" +files_train = 57 +files_dev = 56 +files_eval = 75 +files = open(input_file).readlines() + +N = len(files)/2 +assert N == files_train + files_dev + files_eval + +indexes = numpy.array(range(N)) +numpy.random.shuffle(indexes) + + +def get_lines_from_file(files, line_number): + + text = "" + text += files[line_number] + text += files[line_number+1] + + return text + +#train set +i = 0 +train_text = "" +for j in range(files_train): + train_text += get_lines_from_file(files, indexes[i]*2) + i+=1 +open("train_world.lst","w").write(train_text) + + +#dev set +dev_models_text = "" +dev_probes_text = "" +for j in range(files_dev): + text = get_lines_from_file(files, indexes[i]*2) + dev_models_text += text.split("\n")[0] + " " + text.split("\n")[0].split(" ")[1] + "\n" + dev_probes_text += text.split("\n")[1] + "\n" + + i+=1 +open("for_models.lst","w").write(dev_models_text) +open("for_probes.lst","w").write(dev_probes_text) + + +#eval set +eval_models_text = "" +eval_probes_text = "" +for j in range(files_eval): + text = get_lines_from_file(files, indexes[i]*2) + eval_models_text += text.split("\n")[0] + " " + text.split("\n")[0].split(" ")[1] + "\n" + eval_probes_text += text.split("\n")[1] + "\n" + + i+=1 +open("eval_for_models.lst","w").write(eval_models_text) +open("eval_for_probes.lst","w").write(eval_probes_text) + + diff --git a/bob/db/cuhk/lists/organize_cuhk-protocol.py b/bob/db/cuhk/lists/organize_cuhk-protocol.py new file mode 100644 index 0000000000000000000000000000000000000000..bbfdd8c35d86152e6f4126201b26eecbc1ea1a3b --- /dev/null +++ b/bob/db/cuhk/lists/organize_cuhk-protocol.py @@ -0,0 +1,79 @@ +""" +This script is not part of the package, it is just for organize it. +""" + +import os + +HTML_OUTPUT = False + + +def search_photo2sketch(photo_file_name, sketches): + + prefix = photo_file_name.split("-")[0] + id = photo_file_name.split("-")[1] + + for s in sketches: + + prefix_s = s.split("-")[0] + id_s = s.split("-")[1] + + #if id=="040" and id_s=="040" and id==id_s: + #import ipdb; ipdb.set_trace(); +# print prefix + " -- " + prefix_s + + if prefix=="f" and prefix_s=="F2" and id == id_s: + return s + elif prefix=="f" and prefix_s=="f" and id == id_s: + return s + elif prefix=="f1" and prefix_s=="f1" and id == id_s: + return s + elif prefix=="m" and (prefix_s=="m" or prefix_s=="M2") and id == id_s: + return s + elif prefix=="m1" and prefix_s=="m1"and id == id_s: + return s + return "" + + +input_dir = "/idiap/resource/database/CUHK-CUFS/CUHK-student-dataset/" +sketches_dir = os.path.join(input_dir,"sketches") +photos_dir = os.path.join(input_dir,"photos") + +sketches = open("sketches").readlines() +photos = open("photos").readlines() + + +if not HTML_OUTPUT: + + text = "" + + for p in photos: + sketch_file = search_photo2sketch(p, sketches) + + prefix = p.split("-")[0] + id = p.split("-")[1] + + text += os.path.join("photos",p.rstrip("*\n")) + " " + prefix + id + "\n" + text += os.path.join("sketches",sketch_file.rstrip("*\n")) + " " + prefix + id + "\n" + + open("all.lst",'w').write(text) + + +else: + + html = "<html><body>" + html += "<table>" + + for p in photos: + + html += "<tr>" + + html += "<td><img src='file://"+ os.path.join(photos_dir, p.rstrip("*\n")) +"'></td>" + sketch_file = search_photo2sketch(p, sketches) + html += "<td><img src='"+ os.path.join(sketches_dir, sketch_file.rstrip("*\n")) +"'></td>" + + html += "</tr>\n" + + html += "</table>" + html += "</body></html>" + + open("output.html",'w').write(html) diff --git a/bob/db/cuhk/query.py b/bob/db/cuhk/query.py new file mode 100644 index 0000000000000000000000000000000000000000..91cdbfc48145aa9a8001115cbab75d0a48a58d6f --- /dev/null +++ b/bob/db/cuhk/query.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : +# Tiago de Freitas Pereira <tiago.pereira@idiap.ch> +# Thu Oct 09 11:27:27 CEST 2014 +# +# Copyright (C) 2012-2014 Idiap Research Institute, Martigny, Switzerland +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3 of the License. +# +# This program 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. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +import bob.db.verification.filelist + +class Database(bob.db.verification.filelist.Database): + """Wrapper class for the CASIA NIR-VIS 2.0 database for face recognition recognition (http://www.cbsr.ia.ac.cn/english/NIR-VIS-2.0-Database.html). + this class defines a simple protocol for training, dev and and by splitting the audio files of the database in three main parts. + """ + + def __init__(self, original_directory = None, original_extension = None, annotation_directory=None): + # call base class constructor + from pkg_resources import resource_filename + lists = resource_filename(__name__, 'lists') + bob.db.verification.filelist.Database.__init__(self, lists, original_directory = original_directory, original_extension = original_extension, annotation_directory=annotation_directory) + + + def tobjects(self, protocol=None, model_ids=None, groups=None): + #No TObjects + return [] + + + def zobjects(self, protocol=None, groups=None): + #No TObjects + return [] + diff --git a/bob/db/cuhk/test.py b/bob/db/cuhk/test.py new file mode 100644 index 0000000000000000000000000000000000000000..7f7d1eedb4671addf93c86980d84872aff23326c --- /dev/null +++ b/bob/db/cuhk/test.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : +# Tiago de Freitas Pereira <tiago.pereira@idiap.ch> +# Thu Oct 09 11:27:27 CEST 2014 +# +# Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3 of the License. +# +# This program 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. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +"""A few checks on the protocols of a subset of the CUHK database +""" + +import bob.db.cuhk +possible_protocols = ["cuhk"] + + +def test_protocols(): + import os + + db = bob.db.cuhk.Database() + available_protocols = os.listdir(db.get_base_directory()) + + for p in possible_protocols: + assert p in available_protocols