diff --git a/bob/bio/spear/config/database/mobio.py b/bob/bio/spear/config/database/mobio_audio_female.py similarity index 53% rename from bob/bio/spear/config/database/mobio.py rename to bob/bio/spear/config/database/mobio_audio_female.py index e018fc38d10b601ebf4ef0498ba5a154acde6aa0..063798c3fb9d609603464d55e2d2cd146e2b43ac 100644 --- a/bob/bio/spear/config/database/mobio.py +++ b/bob/bio/spear/config/database/mobio_audio_female.py @@ -3,19 +3,7 @@ from bob.bio.spear.database import MobioBioDatabase mobio_wav_directory = "[YOUR_MOBIO_WAV_DIRECTORY]" -mobio_audio_male = MobioBioDatabase( - original_directory=mobio_wav_directory, - original_extension=".wav", - protocol='male', - models_depend_on_protocol=True, - all_files_options={'gender': 'male'}, - extractor_training_options={'gender': 'male'}, - projector_training_options={'gender': 'male'}, - enroller_training_options={'gender': 'male'}, - z_probe_options={'gender': 'male'} -) - -mobio_audio_female = MobioBioDatabase( +database = MobioBioDatabase( original_directory=mobio_wav_directory, original_extension=".wav", protocol='female', diff --git a/bob/bio/spear/config/database/mobio_audio_male.py b/bob/bio/spear/config/database/mobio_audio_male.py new file mode 100644 index 0000000000000000000000000000000000000000..8a7a6bd7df41066ef25619e5eccf36b5c4a9d5e6 --- /dev/null +++ b/bob/bio/spear/config/database/mobio_audio_male.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +from bob.bio.spear.database import MobioBioDatabase +mobio_wav_directory = "[YOUR_MOBIO_WAV_DIRECTORY]" + +database = MobioBioDatabase( + original_directory=mobio_wav_directory, + original_extension=".wav", + protocol='male', + models_depend_on_protocol=True, + all_files_options={'gender': 'male'}, + extractor_training_options={'gender': 'male'}, + projector_training_options={'gender': 'male'}, + enroller_training_options={'gender': 'male'}, + z_probe_options={'gender': 'male'} +) + diff --git a/bob/bio/spear/database/database.py b/bob/bio/spear/database/database.py index d366db482e8ff07918b8dfb12dc45c888d88b60c..a6b9fbe9a967b3c8de56a17074a0e5fb3762ffd0 100644 --- a/bob/bio/spear/database/database.py +++ b/bob/bio/spear/database/database.py @@ -13,14 +13,13 @@ import numpy class AudioBioFile(BioFile): - def __init__(self, f): + def __init__(self, client_id, path, file_id): """ Initializes this File object with an File equivalent for VoxForge database. """ - super(AudioBioFile, self).__init__(client_id=f.client_id, path=f.path, file_id=f.id) + super(AudioBioFile, self).__init__(client_id=client_id, path=path, file_id=file_id) - self.__f = f def load(self, directory=None, extension='.wav'): rate, audio = scipy.io.wavfile.read(self.make_path(directory, extension)) diff --git a/bob/bio/spear/database/mobio.py b/bob/bio/spear/database/mobio.py index a6469d1c8b3b83947c5e8a80d8fba9792b1bfc1a..81f4b1ee89d601abe107fa3daf15eabd9d8e49b6 100644 --- a/bob/bio/spear/database/mobio.py +++ b/bob/bio/spear/database/mobio.py @@ -38,12 +38,12 @@ class MobioBioDatabase(ZTBioDatabase): def objects(self, groups=None, protocol=None, purposes=None, model_ids=None, **kwargs): retval = self.__db.objects(groups=groups, protocol=protocol, purposes=purposes, model_ids=model_ids, **kwargs) - return [AudioBioFile(f) for f in retval] + return [AudioBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval] def tobjects(self, groups=None, protocol=None, model_ids=None, **kwargs): retval = self.__db.tobjects(groups=groups, protocol=protocol, model_ids=model_ids, **kwargs) - return [AudioBioFile(f) for f in retval] + return [AudioBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval] def zobjects(self, groups=None, protocol=None, **kwargs): retval = self.__db.zobjects(groups=groups, protocol=protocol, **kwargs) - return [AudioBioFile(f) for f in retval] + return [AudioBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval] diff --git a/bob/bio/spear/database/voxforge.py b/bob/bio/spear/database/voxforge.py index 4e2679834b7c772ca7fe68af32b3ccc6a492aade..26761e5fe23ff9085e28c03bf5f60e5c4dda7ce7 100644 --- a/bob/bio/spear/database/voxforge.py +++ b/bob/bio/spear/database/voxforge.py @@ -75,4 +75,4 @@ class VoxforgeBioDatabase(BioDatabase): model_ids=model_ids, purposes=purposes) # make sure to return BioFile representation of a file, not the database one - return [AudioBioFile(BioFile(client_id=f.client_id, path=f.path, file_id=f.id)) for f in objects] + return [AudioBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in objects] diff --git a/bob/bio/spear/test/test_databases.py b/bob/bio/spear/test/test_databases.py new file mode 100644 index 0000000000000000000000000000000000000000..de485e19ebc179c16b914566d01adf01b0175847 --- /dev/null +++ b/bob/bio/spear/test/test_databases.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : +# @author: Manuel Guenther <Manuel.Guenther@idiap.ch> +# @date: Thu May 24 10:41:42 CEST 2012 +# +# Copyright (C) 2011-2012 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/>. + + +from nose.plugins.skip import SkipTest + +import bob.bio.base +from bob.bio.base.test.utils import db_available +from bob.bio.base.test.test_database_implementations import check_database, check_database_zt + + +@db_available('voxforge') +def test_voxforge(): + database = bob.bio.base.load_resource('voxforge', 'database', preferred_package='bob.bio.spear') + try: + check_database(database, groups=('dev', 'eval')) + except IOError as e: + raise SkipTest( + "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + +@db_available('mobio') +def test_mobio(): + database = bob.bio.base.load_resource('mobio-audio-male', 'database', preferred_package='bob.bio.spear') + try: + check_database_zt(database, models_depend=True) + except IOError as e: + raise SkipTest( + "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) diff --git a/buildout-dev.cfg b/develop.cfg similarity index 86% rename from buildout-dev.cfg rename to develop.cfg index 2f6eb54bcc7361bd5da0ca5bee344699a79a6839..ffb07d990693e588dfdeee0c7e3b4e1db1d181af 100644 --- a/buildout-dev.cfg +++ b/develop.cfg @@ -47,9 +47,9 @@ bob.learn.linear = git https://gitlab.idiap.ch/bob/bob.learn.linear bob.learn.em = git https://gitlab.idiap.ch/bob/bob.learn.em bob.measure = git https://gitlab.idiap.ch/bob/bob.measure bob.db.base = git https://gitlab.idiap.ch/bob/bob.db.base -bob.bio.base = git https://gitlab.idiap.ch/bob/bob.bio.base branch=issue-8-remove-database-configuration -bob.db.bio_filelist = git git@gitlab.idiap.ch:bob/bob.db.bio_filelist -bob.db.voxforge = git git@gitlab.idiap.ch:bob/bob.db.voxforge +bob.bio.base = git https://gitlab.idiap.ch/bob/bob.bio.base +bob.db.bio_filelist = git https://gitlab.idiap.ch/bob/bob.db.bio_filelist +bob.db.voxforge = git https://gitlab.idiap.ch/bob/bob.db.voxforge [scripts] recipe = bob.buildout:scripts diff --git a/setup.py b/setup.py index f41c5b4009ab7726a8bca8a3070723989167f822..42c0cf4a37a9e6b2962c49db9f509f7cda9b36a1 100644 --- a/setup.py +++ b/setup.py @@ -103,8 +103,8 @@ setup( 'voxforge = bob.bio.spear.config.database.voxforge:database', 'banca-audio = bob.bio.spear.config.database.banca_audio_G:database', 'timit = bob.bio.spear.config.database.timit:database', - 'mobio-male = bob.bio.spear.config.database.mobio:mobio_audio_male', - 'mobio-female = bob.bio.spear.config.database.mobio:mobio_audio_female', + 'mobio-audio-male = bob.bio.spear.config.database.mobio_audio_male:database', + 'mobio-audio-female = bob.bio.spear.config.database.mobio_audio_female:database', ], 'bob.bio.preprocessor': [