Skip to content
Snippets Groups Projects
Commit 34d6e15d authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Merge branch 'issue-8-remove-database-configuration' into 'master'

Issue 8 remove database configuration

Solving bob.bio.base#37

See merge request !15
parents 8352cb41 35614cee
No related branches found
No related tags found
1 merge request!15Issue 8 remove database configuration
Pipeline #
...@@ -3,19 +3,7 @@ ...@@ -3,19 +3,7 @@
from bob.bio.spear.database import MobioBioDatabase from bob.bio.spear.database import MobioBioDatabase
mobio_wav_directory = "[YOUR_MOBIO_WAV_DIRECTORY]" mobio_wav_directory = "[YOUR_MOBIO_WAV_DIRECTORY]"
mobio_audio_male = MobioBioDatabase( 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'}
)
mobio_audio_female = MobioBioDatabase(
original_directory=mobio_wav_directory, original_directory=mobio_wav_directory,
original_extension=".wav", original_extension=".wav",
protocol='female', protocol='female',
......
#!/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'}
)
...@@ -13,14 +13,13 @@ import numpy ...@@ -13,14 +13,13 @@ import numpy
class AudioBioFile(BioFile): class AudioBioFile(BioFile):
def __init__(self, f): def __init__(self, client_id, path, file_id):
""" """
Initializes this File object with an File equivalent for Initializes this File object with an File equivalent for
VoxForge database. 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'): def load(self, directory=None, extension='.wav'):
rate, audio = scipy.io.wavfile.read(self.make_path(directory, extension)) rate, audio = scipy.io.wavfile.read(self.make_path(directory, extension))
......
...@@ -38,12 +38,12 @@ class MobioBioDatabase(ZTBioDatabase): ...@@ -38,12 +38,12 @@ class MobioBioDatabase(ZTBioDatabase):
def objects(self, groups=None, protocol=None, purposes=None, model_ids=None, **kwargs): 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) 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): def tobjects(self, groups=None, protocol=None, model_ids=None, **kwargs):
retval = self.__db.tobjects(groups=groups, protocol=protocol, model_ids=model_ids, **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): def zobjects(self, groups=None, protocol=None, **kwargs):
retval = self.__db.zobjects(groups=groups, protocol=protocol, **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]
...@@ -75,4 +75,4 @@ class VoxforgeBioDatabase(BioDatabase): ...@@ -75,4 +75,4 @@ class VoxforgeBioDatabase(BioDatabase):
model_ids=model_ids, purposes=purposes) model_ids=model_ids, purposes=purposes)
# make sure to return BioFile representation of a file, not the database one # 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]
#!/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)
...@@ -47,9 +47,9 @@ bob.learn.linear = git https://gitlab.idiap.ch/bob/bob.learn.linear ...@@ -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.learn.em = git https://gitlab.idiap.ch/bob/bob.learn.em
bob.measure = git https://gitlab.idiap.ch/bob/bob.measure bob.measure = git https://gitlab.idiap.ch/bob/bob.measure
bob.db.base = git https://gitlab.idiap.ch/bob/bob.db.base 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.bio.base = git https://gitlab.idiap.ch/bob/bob.bio.base
bob.db.bio_filelist = git git@gitlab.idiap.ch:bob/bob.db.bio_filelist bob.db.bio_filelist = git https://gitlab.idiap.ch/bob/bob.db.bio_filelist
bob.db.voxforge = git git@gitlab.idiap.ch:bob/bob.db.voxforge bob.db.voxforge = git https://gitlab.idiap.ch/bob/bob.db.voxforge
[scripts] [scripts]
recipe = bob.buildout:scripts recipe = bob.buildout:scripts
......
...@@ -103,8 +103,8 @@ setup( ...@@ -103,8 +103,8 @@ setup(
'voxforge = bob.bio.spear.config.database.voxforge:database', 'voxforge = bob.bio.spear.config.database.voxforge:database',
'banca-audio = bob.bio.spear.config.database.banca_audio_G:database', 'banca-audio = bob.bio.spear.config.database.banca_audio_G:database',
'timit = bob.bio.spear.config.database.timit:database', 'timit = bob.bio.spear.config.database.timit:database',
'mobio-male = bob.bio.spear.config.database.mobio:mobio_audio_male', 'mobio-audio-male = bob.bio.spear.config.database.mobio_audio_male:database',
'mobio-female = bob.bio.spear.config.database.mobio:mobio_audio_female', 'mobio-audio-female = bob.bio.spear.config.database.mobio_audio_female:database',
], ],
'bob.bio.preprocessor': [ 'bob.bio.preprocessor': [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment