diff --git a/bob/bio/base/annotator/Base.py b/bob/bio/base/annotator/Annotator.py similarity index 84% rename from bob/bio/base/annotator/Base.py rename to bob/bio/base/annotator/Annotator.py index c40e028a6b76c9ca66893561e51e21fecbf15467..9a4cfb2b0bf55dd5aacf23423d1cae70f0f0088a 100644 --- a/bob/bio/base/annotator/Base.py +++ b/bob/bio/base/annotator/Annotator.py @@ -1,9 +1,8 @@ from bob.bio.base import read_original_data as base_read -import numpy # for documentation -class Base(object): - """Base class for all annotators. This class is meant to be used in +class Annotator(object): + """Annotator class for all annotators. This class is meant to be used in conjunction with the bob bio annotate script. Attributes @@ -14,7 +13,7 @@ class Base(object): """ def __init__(self, read_original_data=None, **kwargs): - super(Base, self).__init__(**kwargs) + super(Annotator, self).__init__(**kwargs) self.read_original_data = read_original_data or base_read def annotate(self, sample, **kwargs): @@ -36,6 +35,6 @@ class Base(object): """ raise NotImplementedError - # Alisa call to annotate + # Alias call to annotate def __call__(self, sample, **kwargs): return self.annotate(sample, **kwargs) diff --git a/bob/bio/base/annotator/Callable.py b/bob/bio/base/annotator/Callable.py index b4736d2c2684dc948e48c4e66b49e05b6e736580..0858a852dc7984d340c7b26c21c749b4ddbfe2f3 100644 --- a/bob/bio/base/annotator/Callable.py +++ b/bob/bio/base/annotator/Callable.py @@ -1,9 +1,18 @@ -from .Base import Base +from . import Annotator -class Callable(Base): +class Callable(Annotator): """A class that wraps a callable object that annotates a sample into a - bob.bio.annotator object.""" + bob.bio.annotator object. + + Attributes + ---------- + callable : callable + A callable with the following signature: + ``annotations = callable(sample, **kwargs)`` that takes numpy array and + returns annotations in dictionary format for that biometric sample. + Please see :any:`Annotator` for more information. + """ def __init__(self, callable, **kwargs): super(Callable, self).__init__(**kwargs) diff --git a/bob/bio/base/annotator/FailSafe.py b/bob/bio/base/annotator/FailSafe.py index 04a443a9327bde19cdb0c93d19ee46328e6a8c5e..ebeeb8ac69b61df5f3368785ce23d85d5129a4e9 100644 --- a/bob/bio/base/annotator/FailSafe.py +++ b/bob/bio/base/annotator/FailSafe.py @@ -1,10 +1,10 @@ import logging -from . import Base +from . import Annotator logger = logging.getLogger(__name__) -class FailSafe(Base): +class FailSafe(Annotator): """A fail-safe annotator. This annotator takes a list of annotator and tries them until you get your annotations. diff --git a/bob/bio/base/annotator/__init__.py b/bob/bio/base/annotator/__init__.py index e63b7dccf886b7122da3311ba3e84595b2b203c2..8e3546ea80ddd9dd5f474384eaf1a711e67fd2ec 100644 --- a/bob/bio/base/annotator/__init__.py +++ b/bob/bio/base/annotator/__init__.py @@ -1,4 +1,4 @@ -from .Base import Base +from .Annotator import Annotator from .FailSafe import FailSafe from .Callable import Callable @@ -23,7 +23,7 @@ def __appropriate__(*args): __appropriate__( - Base, + Annotator, FailSafe, Callable, )