Commit dc7401bf authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Remove entry points, fixes for refactoring

parent 0fc93b2c
Pipeline #3389 failed with stages
in 28 minutes and 8 seconds
include README.rst bootstrap-buildout.py buildout.cfg develop.cfg COPYING version.txt requirements.txt
include README.rst bootstrap-buildout.py buildout.cfg develop.cfg COPYING version.txt requirements.txt test-requirements.txt
recursive-include doc *.py *.rst
recursive-include bob/bio/video/test/data *.hdf5 *.avi
from . import mobio
from . import youtube
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
import bob.db.mobio
import bob.bio.base
mobio_video_directory = "[YOUR_MOBIO_VIDEO_DIRECTORY]"
database = bob.bio.base.database.DatabaseBobZT(
database = bob.db.mobio.Database(
original_directory = mobio_video_directory,
original_extension = '.mp4',
),
name = "mobio",
protocol = 'male',
models_depend_on_protocol = True,
all_files_options = {'subworld' : 'twothirds-subsampled'},
extractor_training_options = {'subworld' : 'twothirds-subsampled'},
projector_training_options = {'subworld' : 'twothirds-subsampled'},
enroller_training_options = {'subworld' : 'twothirds-subsampled'},
)
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
import bob.db.youtube
import bob.bio.base
youtube_directory = "[YOUR_YOUTUBE_DIRECTORY]"
database = bob.bio.base.database.DatabaseBob(
database = bob.db.youtube.Database(
original_directory = youtube_directory,
),
name = "youtube",
protocol = 'fold1',
models_depend_on_protocol = True,
training_depends_on_protocol = True,
all_files_options = {'subworld' : 'fivefolds'},
extractor_training_options = {'subworld' : 'fivefolds'},
projector_training_options = {'subworld' : 'fivefolds'},
enroller_training_options = {'subworld' : 'fivefolds'},
)
......@@ -104,8 +104,8 @@ class Wrapper (bob.bio.base.preprocessor.Preprocessor):
preprocessed : :py:class:`bob.bio.video.FrameContainer`
A frame container that contains the preprocessed frames.
"""
self._check_data(frames)
if not isinstance(frames, utils.FrameContainer):
frames = self.frame_selector(frames)
annots = None
fc = utils.FrameContainer()
......
import bob.db.atnt
import os
from bob.bio.base.database import DatabaseBob, DatabaseBobZT
from bob.bio.db import ZTBioDatabase, AtntBioDatabase
from bob.bio.base.test.utils import atnt_database_directory
class DummyDatabase (DatabaseBobZT):
def __init__(self):
# call base class constructor with useful parameters
DatabaseBobZT.__init__(
self,
database = bob.db.atnt.Database(
original_directory = atnt_database_directory()
),
name = 'test',
check_original_files_for_existence = True,
training_depends_on_protocol = False,
models_depend_on_protocol = False
)
class DummyDatabase(ZTBioDatabase):
def __init__(self):
# call base class constructor with useful parameters
super(DummyDatabase, self).__init__(
name='test',
original_directory=atnt_database_directory(),
original_extension='.pgm',
check_original_files_for_existence=True,
training_depends_on_protocol=False,
models_depend_on_protocol=False
)
self.__db = AtntBioDatabase()
def model_ids(self, group=None, protocol=None, gender=None):
return self.__db.model_ids(group, protocol, gender)
def objects(self, groups=None, protocol=None, purposes=None, model_ids=None, **kwargs):
return self.__db.objects(groups, protocol, purposes, model_ids, **kwargs)
def tobjects(self, groups=None, protocol=None, model_ids=None, **kwargs):
return []
def all_files(self, groups = ['dev']):
return DatabaseBob.all_files(self, groups)
def zobjects(self, groups=None, protocol=None, **kwargs):
return []
def t_model_ids(self, group = 'dev'):
return self.model_ids(group)
def tmodel_ids(self, protocol=None, groups=None, **kwargs):
return self.__db.model_ids(groups)
def t_enroll_files(self, t_model_id, group = 'dev'):
return self.enroll_files(t_model_id, group)
def t_enroll_files(self, t_model_id, group='dev'):
return self.__db.enroll_files(t_model_id, group)
def z_probe_files(self, group = 'dev'):
return self.probe_files(None, group)
def z_probe_files(self, group='dev'):
return self.__db.probe_files(None, group)
# override the original file names to return a one-element lists of file names
def original_file_names(self, files):
return [[n] for n in self.database.original_file_names(files, self.check_existence)]
# override all_files to return a one-element lists of files
def all_files(self, groups):
return [[n] for n in super(DummyDatabase, self).all_files(groups)]
def file_names(self, files, directory, extension):
if isinstance(files[0], list):
files = list(list(zip(*files))[0])
return super(DummyDatabase, self).file_names(files, directory, extension)
database = DummyDatabase()
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
from nose.plugins.skip import SkipTest
import bob.bio.base
def _check_database(database, groups = ('dev',), protocol = None, training_depends = False, models_depend = False):
assert isinstance(database, bob.bio.base.database.DatabaseBob)
if protocol: database.protocol = 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(group)
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.DatabaseBobZT)
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 test_mobio():
database = bob.bio.base.load_resource('mobio-video', 'database', preferred_package='bob.bio.video')
try:
_check_database_zt(database, models_depend=True)
_check_database_zt(database, protocol = 'female', models_depend=True)
except IOError as e:
raise SkipTest("The database could not be queried; probably the db.sql3 file is missing. Here is the import error: '%s'" % e)
def test_youtube():
database = bob.bio.base.load_resource('youtube', 'database', preferred_package='bob.bio.video')
try:
_check_database(database, training_depends=True, models_depend=True)
_check_database(database, protocol = 'fold7', training_depends=True, models_depend=True)
except IOError as e:
raise SkipTest("The database could not be queried; probably the db.sql3 file is missing. Here is the import error: '%s'" % e)
bob.db.mobio
bob.db.youtube
......@@ -6,8 +6,6 @@
parts = scripts
eggs = bob.bio.face
bob.bio.video
bob.db.mobio
bob.db.youtube
gridtk
extensions = bob.buildout
......@@ -37,8 +35,6 @@ develop = src/bob.extension
src/bob.ip.facedetect
src/bob.ip.flandmark
src/bob.bio.face
src/bob.db.mobio
src/bob.db.youtube
.
; options for bob.buildout
......@@ -72,9 +68,6 @@ 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.mobio = git https://gitlab.idiap.ch/bob/bob.db.mobio
bob.db.youtube = git https://gitlab.idiap.ch/bob/bob.db.youtube
[scripts]
recipe = bob.buildout:scripts
dependent-scripts = true
......@@ -53,7 +53,7 @@ Hence, when you want to run an experiment using the video wrapper classes, you m
Databases
~~~~~~~~~
All video databases defined here rely on the :py:class:`bob.bio.base.database.DatabaseBob` interface, which in turn uses the :ref:`verification_databases`.
All video databases defined here rely on the :py:class:`bob.bio.db.BioDatabase` interface, which in turn uses the :ref:`verification_databases`.
After downloading and extracting the original data of the data sets, it is necessary that the scripts know, where the data was installed.
For this purpose, the ``./bin/verify.py`` script can read a special file, where those directories are stored, see :ref:`bob.bio.base.installation`.
......
......@@ -68,8 +68,6 @@ setup(
entry_points = {
'bob.bio.database': [
'mobio-video = bob.bio.video.config.database.mobio:database',
'youtube = bob.bio.video.config.database.youtube:database',
'dummy-video = bob.bio.video.test.dummy.database:database', # for test purposes only
],
......
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