Commit fa929dc3 authored by Amir Mohammadi's avatar Amir Mohammadi

The new database is a high-level only database.

You still can use it as a low-level though.
parent 07525fb5
Pipeline #5445 failed with stages
in 27 seconds
......@@ -24,7 +24,7 @@ http://www.voxforge.org/
from .query import Database
import bob.io.audio
from bob.db.bio_filelist.models import File, Client
from bob.bio.base.database.filelist.models import FileListFile, Client
def get_config():
"""Returns a string containing the configuration information.
......
#!/usr/bin/env python
from bob.db.voxforge import Database
voxforge_wav_directory = "[YOUR_VOXFORGE_DIRECTORY]"
database = Database(
original_directory=voxforge_wav_directory,
original_extension=".wav",
)
......@@ -17,16 +17,19 @@
# 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.bio_filelist
import bob.bio.base
from bob.bio.spear.database import AudioBioFile
class Database(bob.db.bio_filelist.Database):
class Database(bob.bio.base.database.FileListBioDatabase):
"""Wrapper class for the subVoxforge database for speaker recognition (http://www.voxforge.org/).
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):
def __init__(self, original_directory=None, original_extension=None):
# call base class constructor
from pkg_resources import resource_filename
lists = resource_filename(__name__, 'lists')
bob.db.bio_filelist.Database.__init__(self, lists, original_directory = original_directory, original_extension = original_extension)
folder = resource_filename(__name__, 'lists')
super(Database, self).__init__(folder, 'voxforge', biofilecls=AudioBioFile,
original_directory=original_directory,
original_extension=original_extension)
......@@ -21,33 +21,35 @@
"""
import bob.db.voxforge
def test_query():
db = bob.db.voxforge.Database()
assert len(db.client_ids()) == 30 # 10 client ids for world, dev and eval
assert len(db.client_ids(groups='world')) == 10 # 10 client ids for world
assert len(db.client_ids(groups='optional_world_1')) == 10 # 10 client ids for optional world 1
assert len(db.client_ids(groups='optional_world_2')) == 10 # 10 client ids for optional world 2
assert len(db.client_ids(groups='dev')) == 10 # 10 client ids for dev
assert len(db.client_ids(groups='eval')) == 10 # 10 client ids for eval
assert len(db.model_ids()) == 30 # 30 model ids for world, dev and eval
assert len(db.model_ids(groups='world')) == 10 # 10 model ids for world
assert len(db.model_ids(groups='optional_world_1')) == 10 # 10 model ids for optional world 1
assert len(db.model_ids(groups='optional_world_2')) == 10 # 10 model ids for optional world 2
assert len(db.model_ids(groups='dev')) == 10 # 10 model ids for dev
assert len(db.model_ids(groups='eval')) == 10 # 10 model ids for eval
assert len(db.objects(groups='world')) == 3148 # 3148 samples in the world set
assert len(db.objects(groups='dev', purposes='enroll')) == 1304 # 1304 samples for enrollment in the dev set
assert len(db.objects(groups='dev', purposes='enroll', model_ids='Dcoetzee')) == 240 # 240 samples to enroll model 'Dcoetzee' in the dev set
assert len(db.objects(groups='dev', purposes='enroll', model_ids='rortiz')) == 0 # 0 samples to enroll model 'rortiz' (it is an eval model)
assert len(db.objects(groups='dev', purposes='probe')) == 300 # 300 samples as probes in the dev set
assert len(db.objects(groups='eval', purposes='enroll')) == 1509 # 1509 samples for enrollment in the eval set
assert len(db.objects(groups='eval', purposes='enroll', model_ids='rortiz')) == 120 # 120 samples to enroll model 'rortiz' in the eval set
assert len(db.objects(groups='eval', purposes='enroll', model_ids='Dcoetzee')) == 0 # 0 samples to enroll model 'Dcoetzee' (it is a dev model)
assert len(db.objects(groups='eval', purposes='probe')) == 300 # 300 samples as probes in the eval set
from bob.bio.base.test.test_database_implementations import check_database
def test_voxforge():
db = bob.bio.base.load_resource('voxforge', 'database', preferred_package='bob.db.voxforge')
check_database(db, groups=('dev', 'eval'))
assert len(db.client_ids()) == 30 # 10 client ids for world, dev and eval
assert len(db.client_ids(groups='world')) == 10 # 10 client ids for world
assert len(db.client_ids(groups='optional_world_1')) == 10 # 10 client ids for optional world 1
assert len(db.client_ids(groups='optional_world_2')) == 10 # 10 client ids for optional world 2
assert len(db.client_ids(groups='dev')) == 10 # 10 client ids for dev
assert len(db.client_ids(groups='eval')) == 10 # 10 client ids for eval
assert len(db.model_ids(groups=None)) == 30 # 30 model ids for world, dev and eval
assert len(db.model_ids(groups='world')) == 10 # 10 model ids for world
assert len(db.model_ids(groups='optional_world_1')) == 10 # 10 model ids for optional world 1
assert len(db.model_ids(groups='optional_world_2')) == 10 # 10 model ids for optional world 2
assert len(db.model_ids(groups='dev')) == 10 # 10 model ids for dev
assert len(db.model_ids(groups='eval')) == 10 # 10 model ids for eval
assert len(db.objects(groups='world')) == 3148 # 3148 samples in the world set
assert len(db.objects(groups='dev', purposes='enroll')) == 1304 # 1304 samples for enrollment in the dev set
assert len(db.objects(groups='dev', purposes='enroll', model_ids='Dcoetzee')) == 240 # 240 samples to enroll model 'Dcoetzee' in the dev set
assert len(db.objects(groups='dev', purposes='enroll', model_ids='rortiz')) == 0 # 0 samples to enroll model 'rortiz' (it is an eval model)
assert len(db.objects(groups='dev', purposes='probe')) == 300 # 300 samples as probes in the dev set
assert len(db.objects(groups='eval', purposes='enroll')) == 1509 # 1509 samples for enrollment in the eval set
assert len(db.objects(groups='eval', purposes='enroll', model_ids='rortiz')) == 120 # 120 samples to enroll model 'rortiz' in the eval set
assert len(db.objects(groups='eval', purposes='enroll', model_ids='Dcoetzee')) == 0 # 0 samples to enroll model 'Dcoetzee' (it is a dev model)
assert len(db.objects(groups='eval', purposes='probe')) == 300 # 300 samples as probes in the eval set
......@@ -15,7 +15,8 @@ develop = src/bob.extension
src/bob.io.base
src/bob.io.audio
src/bob.db.base
src/bob.db.bio_filelist
src/bob.bio.base
src/bob.bio.spear
.
......@@ -32,7 +33,8 @@ bob.core = git https://gitlab.idiap.ch/bob/bob.core
bob.io.base = git https://gitlab.idiap.ch/bob/bob.io.base
bob.io.audio = git https://gitlab.idiap.ch/bob/bob.io.audio
bob.db.base = git https://gitlab.idiap.ch/bob/bob.db.base
bob.db.bio_filelist = git git@gitlab.idiap.ch:tiago.pereira/bob.db.bio_filelist
bob.bio.base = git https://gitlab.idiap.ch/bob/bob.bio.base
bob.bio.spear = git https://gitlab.idiap.ch/bob/bob.bio.spear
[scripts]
recipe = bob.buildout:scripts
......
py:class bob.db.base.file.File
py:class bob.db.base.database.SQLiteDatabase
py:class sqlalchemy.ext.declarative.api.Base
py:class bob.db.bio_filelist.query.Database
......@@ -33,22 +33,22 @@ setup(
description='Speaker verification protocol on a subset of the VoxForge database',
url='http://gitlab.idiap.ch/bob/bob.db.voxforge',
license='BSD',
keywords = "Speaker Recognition, Speaker verification, Audio processing, Database, Voxforge",
keywords="Speaker Recognition, Speaker verification, Audio processing, Database, Voxforge",
author='Elie Khoury',
author_email='Elie.Khoury@idiap.ch',
long_description=open('README.rst').read(),
packages=find_packages(),
include_package_data=True,
zip_safe = False,
zip_safe=False,
install_requires = install_requires,
install_requires=install_requires,
entry_points = {
entry_points={
# scripts to download the database
'console_scripts' : [
'console_scripts': [
'download_and_untar_voxforge.py = bob.db.voxforge.download_and_untar:main'
],
......@@ -56,9 +56,14 @@ setup(
'bob.db': [
'voxforge = bob.db.voxforge.driver:Interface',
],
'bob.bio.database': [
'voxforge = bob.db.voxforge.config:database',
],
},
classifiers = [
classifiers=[
'Framework :: Bob',
'Development Status :: 4 - Beta',
'Intended Audience :: Education',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment