diff --git a/MANIFEST.in b/MANIFEST.in index ea6cbbd1da0a073c015e3e18cc33d746e2a4bc8a..bd9eaaa969e52ce0ec4fcc93bb51983faaf6c8a7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ -include README.rst bootstrap-buildout.py buildout.cfg develop.cfg COPYING version.txt requirements.txt databases.txt +include README.rst bootstrap-buildout.py buildout.cfg develop.cfg COPYING version.txt requirements.txt recursive-include doc *.py *.rst recursive-include bob/bio/spear/test/data *.hdf5 *.wav recursive-include bob/bio/spear/config/database *.py *.lst diff --git a/bob/bio/spear/config/database/banca_audio_G.py b/bob/bio/spear/config/database/banca_audio_G.py index 90766d0852fdc82c0db45917b27a78a2c8ebab9a..d8863f083739086879497607614d6f7688c4efb7 100644 --- a/bob/bio/spear/config/database/banca_audio_G.py +++ b/bob/bio/spear/config/database/banca_audio_G.py @@ -1,10 +1,14 @@ #!/usr/bin/env python import pkg_resources -import bob.db.bio_filelist +import bob.bio.base +from bob.bio.spear.database import AudioBioFile banca_wav_directory = "[YOUR_BANCA_WAV_DIRECTORY]" -database = bob.db.bio_filelist.Database(pkg_resources.resource_filename('bob.bio.spear', 'config/database/banca'), - original_directory=banca_wav_directory, - original_extension=".wav") +database = bob.bio.base.database.FileListBioDatabase(pkg_resources.resource_filename('bob.bio.spear', 'config/database/banca'), + 'banca', + bio_file_class=AudioBioFile, + protocol='G', + original_directory=banca_wav_directory, + original_extension=".wav") diff --git a/bob/bio/spear/config/database/timit.py b/bob/bio/spear/config/database/timit.py index 48ede1b9563bbe816ea142abe01a1883e6f8e239..3c27a07e745fc921ab879bbb193f950ca4a3c5a1 100644 --- a/bob/bio/spear/config/database/timit.py +++ b/bob/bio/spear/config/database/timit.py @@ -1,10 +1,14 @@ #!/usr/bin/env python import pkg_resources -import bob.db.bio_filelist +import bob.bio.base +from bob.bio.spear.database import AudioBioFile timit_wav_directory = "[YOUR_TIMIT_WAV_DIRECTORY]" -database = bob.db.bio_filelist.Database(pkg_resources.resource_filename('bob.bio.spear', 'config/database/timit'), - original_directory=timit_wav_directory, - original_extension=".wav") +database = bob.bio.base.database.FileListBioDatabase(pkg_resources.resource_filename('bob.bio.spear', 'config/database/timit'), + 'timit', + bio_file_class=AudioBioFile, + protocol='2', + original_directory=timit_wav_directory, + original_extension=".wav") diff --git a/bob/bio/spear/config/database/voxforge.py b/bob/bio/spear/config/database/voxforge.py deleted file mode 100644 index c51a0d2ef7803f5ca9d86fe824b05c09c916ff4e..0000000000000000000000000000000000000000 --- a/bob/bio/spear/config/database/voxforge.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python - -from bob.bio.spear.database import VoxforgeBioDatabase -voxforge_wav_directory = "[YOUR_VOXFORGE_DIRECTORY]" - -database = VoxforgeBioDatabase( - original_directory=voxforge_wav_directory, - original_extension=".wav", -) diff --git a/bob/bio/spear/database/__init__.py b/bob/bio/spear/database/__init__.py index a668dc781704a4cc9eefcb5fa801b0fbc321b3f8..b4ceac8002156cf715a90149fe066222d88a4f89 100644 --- a/bob/bio/spear/database/__init__.py +++ b/bob/bio/spear/database/__init__.py @@ -21,7 +21,6 @@ from .database import AudioBioFile from .mobio import MobioBioDatabase -from .voxforge import VoxforgeBioDatabase from .asvspoof import ASVspoofBioDatabase from .avspoof import AVspoofBioDatabase from .voicepa import VoicePABioDatabase @@ -43,7 +42,6 @@ def __appropriate__(*args): __appropriate__( AudioBioFile, MobioBioDatabase, - VoxforgeBioDatabase, ASVspoofBioDatabase, AVspoofBioDatabase, VoicePABioDatabase, diff --git a/bob/bio/spear/database/database.py b/bob/bio/spear/database/database.py index a6b9fbe9a967b3c8de56a17074a0e5fb3762ffd0..9b690634971c7ed116319883d23fcd30c92de2ba 100644 --- a/bob/bio/spear/database/database.py +++ b/bob/bio/spear/database/database.py @@ -3,10 +3,6 @@ # Tiago de Freitas Pereira <tiago.pereira@idiap.ch> # Wed 20 July 14:43:22 CEST 2016 -""" - Verification API for bob.db.voxforge -""" - from bob.bio.base.database.file import BioFile import scipy import numpy @@ -20,10 +16,8 @@ class AudioBioFile(BioFile): """ super(AudioBioFile, self).__init__(client_id=client_id, path=path, file_id=file_id) - - 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)) # We consider there is only 1 channel in the audio file => data[0] - data= numpy.cast['float'](audio) - return rate, data - + data = numpy.cast['float'](audio) + return rate, data diff --git a/bob/bio/spear/database/voxforge.py b/bob/bio/spear/database/voxforge.py deleted file mode 100644 index 26761e5fe23ff9085e28c03bf5f60e5c4dda7ce7..0000000000000000000000000000000000000000 --- a/bob/bio/spear/database/voxforge.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python -# vim: set fileencoding=utf-8 : -# Tiago de Freitas Pereira <tiago.pereira@idiap.ch> -# Wed 20 July 14:43:22 CEST 2016 - -""" - Verification API for bob.db.voxforge -""" - -from .database import AudioBioFile -from bob.bio.base.database import BioDatabase, BioFile - -class VoxforgeBioDatabase(BioDatabase): - """ - Implements verification API for querying Voxforge database. - """ - - def __init__(self, original_directory=None, original_extension=None, **kwargs): - # call base class constructors to open a session to the database - super(VoxforgeBioDatabase, self).__init__( - name='voxforge', protocol='', - original_directory=original_directory, - original_extension=original_extension, **kwargs) - - from bob.db.voxforge.query import Database as LowLevelDatabase - self.__db = LowLevelDatabase(original_directory=original_directory, original_extension=original_extension) - - def model_ids_with_protocol(self, groups=None, protocol=None, **kwargs): - """Returns a set of models ids for the specific query by the user. - - Keyword Parameters: - - protocol - Protocol is ignored in this context, since its choice has no influence on models. - - groups - The groups to which the subjects attached to the models belong ('dev', 'eval', 'world') - - Returns: A list containing the ids of all models belonging to the given groups. - """ - return [client.id for client in self.__db.clients(groups=groups, protocol=protocol)] - - def objects(self, protocol=None, purposes=None, model_ids=None, - groups=None, gender=None): - """Returns a set of Files for the specific query by the user. - - Keyword Parameters: - - protocol - Not applicable. VoxForge has only one protocol - - purposes - The purposes can be either 'enroll', 'probe', or their tuple. - If 'None' is given (this is the default), it is - considered the same as a tuple with both possible values. - - model_ids - Only retrieves the files for the provided list of model ids (claimed - client id). If 'None' is given (this is the default), no filter over - the model_ids is performed. - - groups - One of the groups ('dev', 'eval', 'world') or a tuple with several of them. - If 'None' is given (this is the default), it is considered the same as a - tuple with all possible values. - - gender - Not applicable - - Returns: A set of Files with the specified properties. - """ - - # now, query the actual Voxforge database - objects = self.__db.objects(groups=groups, - model_ids=model_ids, purposes=purposes) - - # make sure to return BioFile representation of a file, not the database one - 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 index 8e3589136da2a905b4fe99d7f804e47fe9c7266e..4c88dc31e0149a09fbdaaeff3b7208d16d001b41 100644 --- a/bob/bio/spear/test/test_databases.py +++ b/bob/bio/spear/test/test_databases.py @@ -26,15 +26,6 @@ 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') @@ -44,6 +35,7 @@ def test_mobio(): raise SkipTest( "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + @db_available('avspoof') def test_avspoof_licit(): database = bob.bio.base.load_resource('avspoof-licit', 'database', preferred_package='bob.bio.spear') @@ -53,6 +45,7 @@ def test_avspoof_licit(): raise SkipTest( "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + @db_available('asvspoof') def test_asvspoof_licit(): database = bob.bio.base.load_resource('asvspoof-licit', 'database', preferred_package='bob.bio.spear') @@ -62,6 +55,7 @@ def test_asvspoof_licit(): raise SkipTest( "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + @db_available('voicepa') def test_voicepa_licit(): database = bob.bio.base.load_resource('voicepa-licit', 'database', preferred_package='bob.bio.spear') @@ -81,6 +75,7 @@ def test_avspoof_spoof(): raise SkipTest( "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + @db_available('asvspoof') def test_asvspoof_spoof(): database = bob.bio.base.load_resource('asvspoof-spoof', 'database', preferred_package='bob.bio.spear') @@ -90,6 +85,7 @@ def test_asvspoof_spoof(): raise SkipTest( "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + @db_available('voicepa') def test_voicepa_spoof(): database = bob.bio.base.load_resource('voicepa-spoof', 'database', preferred_package='bob.bio.spear') @@ -98,3 +94,21 @@ def test_voicepa_spoof(): except IOError as e: raise SkipTest( "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + + +def test_timit(): + database = bob.bio.base.load_resource('timit', 'database', preferred_package='bob.bio.spear') + try: + check_database(database, groups=('dev',)) + except IOError as e: + raise SkipTest( + "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + + +def test_banca(): + database = bob.bio.base.load_resource('banca-audio', '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) diff --git a/databases.txt b/databases.txt deleted file mode 100644 index 4ea252f9adbb9280ecc08e1ef544d9705fb8582b..0000000000000000000000000000000000000000 --- a/databases.txt +++ /dev/null @@ -1 +0,0 @@ -bob.db.voxforge diff --git a/develop.cfg b/develop.cfg index 3318c29c26dacec5473c65b5e7a48931a8ac5af4..d77afeb14f273a0b612d1fbc7f28c7ba70f7202b 100644 --- a/develop.cfg +++ b/develop.cfg @@ -19,6 +19,7 @@ develop = src/bob.ap src/bob.db.asvspoof src/bob.db.avspoof src/bob.db.voicepa + src/bob.db.mobio . ; options for bob.buildout @@ -30,9 +31,10 @@ newest = false bob.ap = git https://gitlab.idiap.ch/bob/bob.ap bob.db.base = git https://gitlab.idiap.ch/bob/bob.db.base bob.bio.base = git https://gitlab.idiap.ch/bob/bob.bio.base -bob.db.avspoof = git git@gitlab.idiap.ch:bob/bob.db.avspoof.git -bob.db.asvspoof = git git@gitlab.idiap.ch:bob/bob.db.asvspoof.git -bob.db.voicepa = git git@gitlab.idiap.ch:bob/bob.db.voicepa.git +bob.db.avspoof = git https://gitlab.idiap.ch/bob/bob.db.avspoof +bob.db.asvspoof = git https://gitlab.idiap.ch/bob/bob.db.asvspoof +bob.db.voicepa = git https://gitlab.idiap.ch/bob/bob.db.voicepa +bob.db.mobio = git https://gitlab.idiap.ch/bob/bob.db.mobio [scripts] recipe = bob.buildout:scripts diff --git a/doc/links.rst b/doc/links.rst index 8769e1391b4a068f08f662d2c101b65631d05544..9da3a5c1234d21e7e100543b33581a57be0b4e0d 100644 --- a/doc/links.rst +++ b/doc/links.rst @@ -28,7 +28,6 @@ .. _Spro: https://gforge.inria.fr/projects/spro .. _HTK: http://htk.eng.cam.ac.uk/ .. _bob.db.mobio: https://pypi.python.org/pypi/bob.db.mobio -.. _bob.db.bio_filelist: https://pypi.python.org/pypi/bob.db.bio_filelist .. _NIST: http://www.nist.gov/itl/iad/ig/focs.cfm .. _bob.bio.gmm: https://pypi.python.org/pypi/bob.bio.gmm diff --git a/setup.py b/setup.py index 372e9c95f7625903c1b6b0c414b7410140b9e0f3..f819aa9409fe9acf269ff55dbdb35269c44130a5 100644 --- a/setup.py +++ b/setup.py @@ -100,7 +100,6 @@ setup( entry_points = { 'bob.bio.database': [ - '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-audio-male = bob.bio.spear.config.database.mobio_audio_male:database', diff --git a/test-requirements.txt b/test-requirements.txt index 73ed111ee7f3c40a0404a4c8cd953594c32b3b4a..9eb9b617d7a63a2c4fc6ccfd6a77883697e2d0d4 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,5 @@ gridtk -bob.db.voxforge bob.db.mobio -bob.db.bio_filelist bob.db.avspoof bob.db.asvspoof bob.db.voicepa