"""Writes the OpenBR matrix and mask files (version 2), given the score file.
If gallery and probe names are provided, the matrices in both files will be sorted by gallery and probe names.
Otherwise, the order will be the same as given in the score file.
If ``search`` is given (as an integer), the resulting matrix files will be in the *search* format, keeping the given number of gallery scores with the highest values for each probe.
.. warning::
When provided with a 4-column score file, this function will work only, if there is only a single model id for each client.
...
...
@@ -30,32 +34,40 @@ def write_matrix(
matrix_file : str
The OpenBR matrix file that should be written.
Usually, the file name extension is .mtx
Usually, the file name extension is ``.mtx``
mask_file : str
The OpenBR mask file that should be written.
The mask file defines, which values are positives, negatives or to be ignored.
gallery_file_name : str
The name of the gallery file that will be written in the header of the OpenBR files.
probe_file_name : str
The name of the probe file that will be written in the header of the OpenBR files.
Usually, the file name extension is ``.mask``
model_names : [str] or ``None``
If given, the matrix will be written in the same order as the given model names.
The model names must be identical with the second column in the 5-column ``score_file``.
.. note::
If the score file is in four column format, the model_names must be the client ids stored in the first row.
If the score file is in four column format, the model_names must be the client ids stored in the first column.
In this case, there might be only a single model per client
Only the scores of the given models will be considered.
probe_names : [str] or ``None``
If given, the matrix will be written in the same order as the given probe names (the path of the probe).
The probe names are identical to the third line of the ``score_file``.
If given, the matrix will be written in the same order as the given probe names (the ``path`` of the probe).
The probe names are identical to the third column of the 4-column (or the fourth column of the 5-column) ``score_file``.
Only the scores of the given probe names will be considered in this case.
score_file_format : one of ``('4column', '5column')``
The format, in which the ``score_file`` is.
gallery_file_name : str
The name of the gallery file that will be written in the header of the OpenBR files.
probe_file_name : str
The name of the probe file that will be written in the header of the OpenBR files.
search : int or ``None``
If given, the scores will be sorted per probe, keeping the specified number of highest scores.
If the given number is higher than the models, ``NaN`` values will be added, and the mask will contain ``0x00`` values.
"""Plots the (cumulative) match characteristics curve and returns the maximum rank."""
"""Plots the (cumulative) match characteristics curve and returns the maximum rank.
This function plots a CMC curve using the given CMC scores, which can be read from the our score files using the :py:func:`bob.measure.load.cmc_four_column` or :py:func:`bob.measure.load.cmc_five_column` methods.
The structure of the ``cmc_scores`` parameter is relatively complex.
It contains a list of pairs of lists.
For each probe object, a pair of list negative and positive scores is required.
Keyword parameters:
cmc_scores : [([negative],[positive])]
The list of scores to be plotted.
logx : bool
Plot the rank axis in logarithmic scale? (Default: ``True``)
kwargs
Remaining keyword arguments passed directly to the :py:func:`matplotlib.pyplot.plot` function.
Sometimes,itisrequiredtoexportthescorefilesgeneratedbyBobtoadifferentformat,e.g.,tobeabletogenerateaplotcomparingBob's systems with other systems.
In this package, we provide source code to convert between different types of score files.
One of the supported formats is the matrix format that the National Institute of Standards and Technology (NIST) uses, and which is supported by OpenBR.
The scores are stored in two binary matrices, where the first matrix (usually with a ``.mtx`` filename extension) contains the raw scores, while a second mask matrix (extension ``.mask``) contains information, which scores are positives, and which are negatives.
To convert from Bob'sfourcolumnorfivecolumnscorefiletoapairofthesematrices,youcanusethe:py:func:`bob.measure.openbr.write_matrix`function.