"""Algorithm chain for computing Gabor jets, Gabor graphs, and Gabor graph comparisons"""
"""Computes a comparison of lists of Gabor jets using a similarity function of :py:class:`bob.ip.gabor.Similarity`.
The model enrollment simply stores all extracted Gabor jets for all enrollment features.
By default (i.e., ``multiple_feature_scoring = 'max_jet'``), the scoring uses an advanced local strategy.
For each node, the similarity between the given probe jet and all model jets is computed, and only the *highest* value is kept.
These values are finally averaged over all node positions.
Other strategies can be obtained using a different ``multiple_feature_scoring``.
**Parameters:**
gabor_jet_similarity_type : str:
The type of Gabor jet similarity to compute.
Please refer to the documentation of :py:class:`bob.ip.gabor.Similarity` for a list of possible values.
multiple_feature_scoring : str
How to fuse the local similarities into a single similarity value.
Possible values are:
* ``'average_model'`` : During enrollment, an average model is computed using functionality of :ref:`bob.ip.gabor <bob.ip.gabor>`.
* ``'average'`` : For each node, the average similarity is computed. Finally, the average of those similarities is returned.
* ``'min_jet', 'max_jet', 'med_jet'`` : For each node, the minimum, maximum or median similarity is computed. Finally, the average of those similarities is returned.
* ``'min_graph', 'max_graph', 'med_graph'`` : For each node, the average similarity is computed. Finally, the minimum, maximum or median of those similarities is returned.
These parameters are required by the disparity-based Gabor jet similarity functions, see :py:class:`bob.ip.gabor.Similarity`..
The default values are identical to the ones in the :py:class:`bob.bio.face.extractor.GridGraph`.
Please assure that this class and the :py:class:`bob.bio.face.extractor.GridGraph` class get the same configuration, otherwise unexpected things might happen.
"""Computes the score of the probe and the model"""
"""score(model, probe) -> score
Computes the score of the probe and the model using the desired Gabor jet similarity function and the desired score fusion strategy.
**Parameters:**
model : [[:py:class:`bob.ip.gabor.Jet`]]
The model enrolled by the :py:meth:`enroll` function.
probe : [:py:class:`bob.ip.gabor.Jet`]
The probe read by the :py:meth:`read_probe` function.
**Returns:**
score : float
The fused similarity score.
"""
self._check_feature(probe)
[self._check_feature(m)forminmodel]
assertlen(model)==len(probe)
...
...
@@ -148,7 +249,42 @@ class GaborJet (Algorithm):
defscore_for_multiple_probes(self,model,probes):
"""This function computes the score between the given model graph(s) and several given probe graphs."""
"""score(model, probes) -> score
This function computes the score between the given model graph(s) and several given probe graphs.
The same local scoring strategy as for several model jets is applied, but this time the local scoring strategy is applied between all graphs from the model and probes.
**Parameters:**
model : [[:py:class:`bob.ip.gabor.Jet`]]
The model enrolled by the :py:meth:`enroll` function.
"""Extractor for local Gabor binary pattern histogram sequences"""
"""Extracts *Local Gabor Binary Pattern Histogram Sequences* (LGBPHS) [ZSG+05]_ from the images, using functionality from :ref:`bob.ip.base <bob.ip.base>` and :ref:`bob.ip.gabor <bob.ip.gabor>`.
The block size and the overlap of the blocks can be varied, as well as the parameters of the Gabor wavelet (:py:class:`bob.ip.gabor.Transform`) and the LBP extractor (:py:class:`bob.ip.base.LBP`).
**Parameters:**
block_size : int or (int, int)
The size of the blocks that will be extracted.
This parameter might be either a single integral value, or a pair ``(block_height, block_width)`` of integral values.
block_overlap : int or (int, int)
The overlap of the blocks in vertical and horizontal direction.
This parameter might be either a single integral value, or a pair ``(block_overlap_y, block_overlap_x)`` of integral values.
Please see :py:class:`bob.ip.base.LBP` for the documentation of these values.
.. note::
The default values are as given in [ZSG+05]_ (the values of [ZSQ+09]_ might differ).
sparse_histogram : bool
If specified, the histograms will be handled in a sparse way.
This reduces the size of the extracted features, but the computation will take longer.
.. note::
Sparse histograms are only supported, when ``split_histogram = None``.
split_histogram : one of ``('blocks', 'wavelets', 'both')`` or ``None``
Defines, how the histogram sequence is split.
This could be interesting, if the histograms should be used in another way as simply concatenating them into a single histogram sequence (the default).
"""
def__init__(
self,
...
...
@@ -39,8 +79,6 @@ class LGBPHS (Extractor):
sparse_histogram=False,
split_histogram=None
):
"""Initializes the local Gabor binary pattern histogram sequence tool chain with the given file selector object"""
# call base class constructor
Extractor.__init__(
self,
...
...
@@ -137,7 +175,22 @@ class LGBPHS (Extractor):
def__call__(self,image):
"""Extracts the local Gabor binary pattern histogram sequence from the given image"""
"""__call__(image) -> feature
Extracts the local Gabor binary pattern histogram sequence from the given image.
**Parameters:**
image : 2D :py:class:`numpy.ndarray` (floats)
The image to extract the features from.
**Returns:**
feature : 2D or 3D :py:class:`numpy.ndarray` (floats)
The list of Gabor jets extracted from the image.
The 2D location of the jet's nodes is not returned.
"""
""""""
assertimage.ndim==2
assertisinstance(image,numpy.ndarray)
assertimage.dtype==numpy.float64
...
...
@@ -193,3 +246,7 @@ class LGBPHS (Extractor):
# return the concatenated list of all histograms
returnself._sparsify(lgbphs_array)
# re-define the train function to get it non-documented
deftrain(*args,**kwargs):raiseNotImplementedError("This function is not implemented and should not be called.")