Skip to content
Snippets Groups Projects
Commit 3afbe77f 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 this issue on `bob.bio.base` bob.bio.base#37

See merge request !7
parents 273a10a2 d3859cf5
Branches
Tags
1 merge request!7Issue 8 remove database configuration
Pipeline #
...@@ -18,47 +18,11 @@ ...@@ -18,47 +18,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
import bob.bio.base import bob.bio.base
from bob.bio.base.test.utils import db_available from bob.bio.base.test.utils import db_available
from bob.bio.base.test.test_database_implementations import check_database, check_database_zt
def _check_database(database, groups=('dev',), protocol=None, training_depends=False, models_depend=False):
assert isinstance(database, bob.bio.base.database.BioDatabase)
# load the directories
if 'HOME' in os.environ:
database.replace_directories(os.path.join(os.environ['HOME'], '.bob_bio_databases.txt'))
if protocol: database.protocol = protocol
if protocol is None: protocol = database.protocol
assert len(database.all_files()) > 0
assert len(database.training_files('train_extractor')) > 0
assert len(database.arrange_by_client(database.training_files('train_enroller'))) > 0
for group in groups:
model_ids = database.model_ids_with_protocol(group, protocol=protocol)
assert len(model_ids) > 0
assert database.client_id_from_model_id(model_ids[0]) is not None
assert len(database.enroll_files(model_ids[0], group)) > 0
assert len(database.probe_files(model_ids[0], group)) > 0
assert database.training_depends_on_protocol == training_depends
assert database.models_depend_on_protocol == models_depend
def _check_database_zt(database, groups=('dev', 'eval'), protocol=None, training_depends=False, models_depend=False):
_check_database(database, groups, protocol, training_depends, models_depend)
assert isinstance(database, bob.bio.base.database.ZTBioDatabase)
for group in groups:
t_model_ids = database.t_model_ids(group)
assert len(t_model_ids) > 0
assert database.client_id_from_model_id(t_model_ids[0]) is not None
assert len(database.t_enroll_files(t_model_ids[0], group)) > 0
assert len(database.z_probe_files(group)) > 0
def _check_annotations(database): def _check_annotations(database):
...@@ -74,7 +38,18 @@ def _check_annotations(database): ...@@ -74,7 +38,18 @@ def _check_annotations(database):
def test_arface(): def test_arface():
database = bob.bio.base.load_resource('arface', 'database', preferred_package='bob.bio.face') database = bob.bio.base.load_resource('arface', 'database', preferred_package='bob.bio.face')
try: try:
_check_database(database, groups=('dev', 'eval')) check_database(database, groups=('dev', 'eval'))
_check_annotations(database)
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('atnt')
def test_atnt():
database = bob.bio.base.load_resource('atnt', 'database', preferred_package='bob.bio.face')
try:
check_database(database)
_check_annotations(database) _check_annotations(database)
except IOError as e: except IOError as e:
raise SkipTest( raise SkipTest(
...@@ -85,7 +60,7 @@ def test_arface(): ...@@ -85,7 +60,7 @@ def test_arface():
def test_banca(): def test_banca():
database = bob.bio.base.load_resource('banca', 'database', preferred_package='bob.bio.face') database = bob.bio.base.load_resource('banca', 'database', preferred_package='bob.bio.face')
try: try:
_check_database_zt(database) check_database_zt(database)
_check_annotations(database) _check_annotations(database)
except IOError as e: except IOError as e:
raise SkipTest( raise SkipTest(
...@@ -96,8 +71,8 @@ def test_banca(): ...@@ -96,8 +71,8 @@ def test_banca():
def test_caspeal(): def test_caspeal():
database = bob.bio.base.load_resource('caspeal', 'database', preferred_package='bob.bio.face') database = bob.bio.base.load_resource('caspeal', 'database', preferred_package='bob.bio.face')
try: try:
_check_database(database) check_database(database)
_check_database(database, protocol='aging') check_database(database, protocol='aging')
_check_annotations(database) _check_annotations(database)
except IOError as e: except IOError as e:
raise SkipTest( raise SkipTest(
...@@ -116,14 +91,35 @@ def test_caspeal(): ...@@ -116,14 +91,35 @@ def test_caspeal():
# raise SkipTest( # raise SkipTest(
# "The database could not be opened, probably the original directory is wrong. Here is the error: '%s'" % e) # "The database could not be opened, probably the original directory is wrong. Here is the error: '%s'" % e)
@db_available('cuhk_cufs')
def test_cuhk_cufs():
database = bob.bio.base.load_resource('cuhk_cufs', 'database', preferred_package='bob.bio.face')
try:
check_database(database)
_check_annotations(database)
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('gbu') @db_available('gbu')
def test_gbu(): def test_gbu():
database = bob.bio.base.load_resource('gbu', 'database', preferred_package='bob.bio.face') database = bob.bio.base.load_resource('gbu', 'database', preferred_package='bob.bio.face')
try: try:
_check_database(database, models_depend=True) check_database(database, models_depend=True)
_check_database(database, protocol='Bad', models_depend=True) check_database(database, protocol='Bad', models_depend=True)
_check_database(database, protocol = 'Ugly', models_depend=True) check_database(database, protocol = 'Ugly', models_depend=True)
_check_annotations(database)
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('ijba')
def test_ijba():
database = bob.bio.base.load_resource('ijba', 'database', preferred_package='bob.bio.face')
try:
check_database(database)
_check_annotations(database) _check_annotations(database)
except IOError as e: except IOError as e:
raise SkipTest( raise SkipTest(
...@@ -134,10 +130,10 @@ def test_gbu(): ...@@ -134,10 +130,10 @@ def test_gbu():
def test_lfw(): def test_lfw():
database = bob.bio.base.load_resource('lfw-restricted', 'database', preferred_package='bob.bio.face') database = bob.bio.base.load_resource('lfw-restricted', 'database', preferred_package='bob.bio.face')
try: try:
_check_database(database, training_depends=True, models_depend=True) check_database(database, training_depends=True, models_depend=True)
_check_database(database, groups=('dev', 'eval'), protocol='fold1', training_depends=True, models_depend=True) check_database(database, groups=('dev', 'eval'), protocol='fold1', training_depends=True, models_depend=True)
_check_database(bob.bio.base.load_resource('lfw-unrestricted', 'database', preferred_package='bob.bio.face'), check_database(bob.bio.base.load_resource('lfw-unrestricted', 'database', preferred_package='bob.bio.face'),
training_depends=True, models_depend=True) training_depends=True, models_depend=True)
_check_annotations(database) _check_annotations(database)
except IOError as e: except IOError as e:
raise SkipTest( raise SkipTest(
...@@ -148,12 +144,12 @@ def test_lfw(): ...@@ -148,12 +144,12 @@ def test_lfw():
def test_mobio(): def test_mobio():
database = bob.bio.base.load_resource('mobio-image', 'database', preferred_package='bob.bio.face') database = bob.bio.base.load_resource('mobio-image', 'database', preferred_package='bob.bio.face')
try: try:
_check_database_zt(database, models_depend=True) check_database_zt(database, models_depend=True)
_check_database_zt(database, protocol='female', models_depend=True) check_database_zt(database, protocol='female', models_depend=True)
_check_database_zt(bob.bio.base.load_resource('mobio-male', 'database', preferred_package='bob.bio.face'), check_database_zt(bob.bio.base.load_resource('mobio-male', 'database', preferred_package='bob.bio.face'),
models_depend=True) models_depend=True)
_check_database_zt(bob.bio.base.load_resource('mobio-female', 'database', preferred_package='bob.bio.face'), check_database_zt(bob.bio.base.load_resource('mobio-female', 'database', preferred_package='bob.bio.face'),
models_depend=True) models_depend=True)
except IOError as e: except IOError as e:
raise SkipTest( raise SkipTest(
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) "The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)
...@@ -169,9 +165,9 @@ def test_mobio(): ...@@ -169,9 +165,9 @@ def test_mobio():
def test_multipie(): def test_multipie():
database = bob.bio.base.load_resource('multipie', 'database', preferred_package='bob.bio.face') database = bob.bio.base.load_resource('multipie', 'database', preferred_package='bob.bio.face')
try: try:
_check_database_zt(database, training_depends=True) check_database_zt(database, training_depends=True)
_check_database_zt(bob.bio.base.load_resource('multipie-pose', 'database', preferred_package='bob.bio.face'), check_database_zt(bob.bio.base.load_resource('multipie-pose', 'database', preferred_package='bob.bio.face'),
training_depends=True) training_depends=True)
except IOError as e: except IOError as e:
raise SkipTest( raise SkipTest(
"The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) "The database could not queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)
...@@ -190,7 +186,7 @@ def test_multipie(): ...@@ -190,7 +186,7 @@ def test_multipie():
def test_scface(): def test_scface():
database = bob.bio.base.load_resource('scface', 'database', preferred_package='bob.bio.face') database = bob.bio.base.load_resource('scface', 'database', preferred_package='bob.bio.face')
try: try:
_check_database_zt(database) check_database_zt(database)
_check_annotations(database) _check_annotations(database)
except IOError as e: except IOError as e:
raise SkipTest( raise SkipTest(
...@@ -201,8 +197,19 @@ def test_scface(): ...@@ -201,8 +197,19 @@ def test_scface():
def test_xm2vts(): def test_xm2vts():
database = bob.bio.base.load_resource('xm2vts', 'database', preferred_package='bob.bio.face') database = bob.bio.base.load_resource('xm2vts', 'database', preferred_package='bob.bio.face')
try: try:
_check_database(database, groups=('dev', 'eval')) check_database(database, groups=('dev', 'eval'))
_check_database(database, groups=('dev', 'eval'), protocol='darkened-lp1') check_database(database, groups=('dev', 'eval'), protocol='darkened-lp1')
_check_annotations(database)
except IOError as e:
raise SkipTest(
"The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e)
@db_available('replay')
def test_replay():
database = bob.bio.base.load_resource('replay', 'database', preferred_package='bob.bio.face')
try:
check_database(database, groups=('dev', 'eval'))
_check_annotations(database) _check_annotations(database)
except IOError as e: except IOError as e:
raise SkipTest( raise SkipTest(
......
; vim: set fileencoding=utf-8 :
; Manuel Guenther <manuel.guenther@idiap.ch>
; Thu Oct 9 16:51:06 CEST 2014
[buildout]
parts = scripts
eggs = bob.bio.face
bob.db.base
bob.db.arface
bob.db.banca
bob.db.caspeal
bob.db.frgc
bob.db.gbu
bob.db.lfw
bob.db.mobio
bob.db.multipie
bob.db.scface
bob.db.xm2vts
gridtk
extensions = bob.buildout
mr.developer
auto-checkout = *
develop = src/bob.extension
src/bob.db.base
src/bob.db.atnt
src/bob.bio.base
src/bob.db.arface
src/bob.db.banca
src/bob.db.caspeal
src/bob.db.frgc
src/bob.db.gbu
src/bob.db.lfw
src/bob.db.mobio
src/bob.db.multipie
src/bob.db.scface
src/bob.db.xm2vts
.
; options for bob.buildout
debug = true
verbose = true
newest = false
[sources]
bob.extension = git https://gitlab.idiap.ch/bob/bob.extension
;bob.blitz = git https://gitlab.idiap.ch/bob/bob.blitz
;bob.core = git https://gitlab.idiap.ch/bob/bob.core
;bob.io.base = git https://gitlab.idiap.ch/bob/bob.io.base
;bob.io.image = git https://gitlab.idiap.ch/bob/bob.io.image
;bob.learn.activation = git https://gitlab.idiap.ch/bob/bob.learn.activation
;bob.math = git https://gitlab.idiap.ch/bob/bob.math
;bob.sp = git https://gitlab.idiap.ch/bob/bob.sp
;bob.ip.base = git https://gitlab.idiap.ch/bob/bob.ip.base
;bob.ip.color = git https://gitlab.idiap.ch/bob/bob.ip.color
;bob.ip.draw = git https://gitlab.idiap.ch/bob/bob.ip.draw
;bob.ip.gabor = git https://gitlab.idiap.ch/bob/bob.ip.gabor
;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.db.atnt = git https://gitlab.idiap.ch/bob/bob.db.atnt
bob.bio.base = git git@gitlab.idiap.ch:bob/bob.bio.base branch=issue-8-remove-database-configuration
;bob.learn.boosting = git https://gitlab.idiap.ch/bob/bob.learn.boosting
;bob.ip.facedetect = git https://gitlab.idiap.ch/bob/bob.ip.facedetect
;bob.ip.flandmark = git https://gitlab.idiap.ch/bob/bob.ip.flandmark
bob.db.arface = git https://gitlab.idiap.ch/bob/bob.db.arface
bob.db.banca = git https://gitlab.idiap.ch/bob/bob.db.banca
bob.db.caspeal = git https://gitlab.idiap.ch/bob/bob.db.caspeal
bob.db.frgc = git https://gitlab.idiap.ch/bob/bob.db.frgc
bob.db.gbu = git https://gitlab.idiap.ch/bob/bob.db.gbu
bob.db.lfw = git https://gitlab.idiap.ch/bob/bob.db.lfw
bob.db.mobio = git https://gitlab.idiap.ch/bob/bob.db.mobio
bob.db.multipie = git https://gitlab.idiap.ch/bob/bob.db.multipie
bob.db.scface = git https://gitlab.idiap.ch/bob/bob.db.scface
bob.db.xm2vts = git https://gitlab.idiap.ch/bob/bob.db.xm2vts
[scripts]
recipe = bob.buildout:scripts
dependent-scripts = true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment