Skip to content
Snippets Groups Projects
Commit 84ab9119 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

rename Base to Annotator

parent 42f1d4f9
No related branches found
No related tags found
1 merge request!131Add annotator support
Pipeline #
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)
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)
......
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.
......
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,
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment