Commit 6866c8b1 authored by Yannick DAYER's avatar Yannick DAYER

[py] Create protocol files for verafinger and fv3d

Rename the config file

Reorganize the config file
parent fb30cea2
Pipeline #44293 failed with stage
in 7 minutes and 27 seconds
......@@ -12,15 +12,25 @@ the link.
from bob.extension import rc
from ..database.fv3d import Database
from bob.bio.vein.database.fv3d import Database
from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector
import logging
logger = logging.getLogger("bob.bio.vein")
# Retrieve directory from config
_fv3d_directory = rc["bob.db.fv3d.directory"]
"""Value in ``~/.bobrc`` for this dataset directory"""
# Set default protocol if not given via a config file
if 'protocol' not in locals():
logger.info("protocol not specified, using default: 'central'")
protocol = 'central'
legacy_database = Database(
original_directory = _fv3d_directory,
original_extension = '.png',
protocol = protocol,
)
"""The :py:class:`bob.bio.base.database.BioDatabase` derivative with fv3d
database settings
......@@ -45,5 +55,5 @@ must make sure to set this value with ``bob config set bob.db.fv3d.directory``
to the place where you actually installed the `3D Fingervein`_ dataset, as
explained in the section :ref:`bob.bio.vein.baselines`.
"""
protocol = 'central' # TODO protocol implementation in bob pipelines?
print(f"protocol is '{protocol}'")
logger.debug(f"Loaded database fv3d config file, using protocol '{protocol}'.")
# author: Yannick Dayer <yannick.dayer@idiap.ch>
# Fri 16 Oct 2020 14:51:16 UTC+02
# This is a config file for bob.bio.vein
# It defines the database protocol to use with the Database Interface for the
# VeraFinger dataset, defined ar bob.db.verafinger.
# It is defined as a resource in the setup file of this package.
# Usage:
# $ bob bio pipelines vanilla-biometrics <pipeline> Nom verafinger
# or:
# $ bob bio pipelines vanilla-biometrics -p <pipeline> Nom verafinger
# The protocol resource must be specified before the database resource.
# This will be the default protocol if none is specified.
protocol = 'Nom'
# author: Yannick Dayer <yannick.dayer@idiap.ch>
# Fri 16 Oct 2020 14:50:47 UTC+02
# This is a config file for bob.bio.vein
# It defines the database protocol to use with the Database Interface for the
# VeraFinger dataset, defined ar bob.db.verafinger.
# It is defined as a resource in the setup file of this package.
# Usage:
# $ bob bio pipelines vanilla-biometrics <pipeline> B verafinger
# or:
# $ bob bio pipelines vanilla-biometrics -p <pipeline> B verafinger
# The protocol resource must be specified before the database resource.
protocol = 'B'
# author: Yannick Dayer <yannick.dayer@idiap.ch>
# Fri 16 Oct 2020 10:54:47 UTC+02
# This is a config file for bob.bio.vein
# It defines the database protocol to use with the Database Interface for the
# 3D Fingervein dataset, defined ar bob.db.fv3d.
# It is defined as a resource in the setup file of this package.
# Usage:
# $ bob bio pipelines vanilla-biometrics <pipeline> central fv3d
# or:
# $ bob bio pipelines vanilla-biometrics -p <pipeline> central fv3d
# The protocol resource must be specified before the database resource.
# This will be the default protocol if none is specified.
protocol = 'central'
# author: Yannick Dayer <yannick.dayer@idiap.ch>
# Fri 16 Oct 2020 14:51:02 UTC+02
# This is a config file for bob.bio.vein
# It defines the database protocol to use with the Database Interface for the
# VeraFinger dataset, defined ar bob.db.verafinger.
# It is defined as a resource in the setup file of this package.
# Usage:
# $ bob bio pipelines vanilla-biometrics <pipeline> Cropped-Nom verafinger
# or:
# $ bob bio pipelines vanilla-biometrics -p <pipeline> Cropped-Nom verafinger
# The protocol resource must be specified before the database resource.
protocol = 'cropped-Nom'
# author: Yannick Dayer <yannick.dayer@idiap.ch>
# Fri 16 Oct 2020 14:50:51 UTC+02
# This is a config file for bob.bio.vein
# It defines the database protocol to use with the Database Interface for the
# VeraFinger dataset, defined ar bob.db.verafinger.
# It is defined as a resource in the setup file of this package.
# Usage:
# $ bob bio pipelines vanilla-biometrics <pipeline> Cropped-B verafinger
# or:
# $ bob bio pipelines vanilla-biometrics -p <pipeline> Cropped-B verafinger
# The protocol resource must be specified before the database resource.
protocol = 'Cropped-B'
# author: Yannick Dayer <yannick.dayer@idiap.ch>
# Fri 16 Oct 2020 14:50:54 UTC+02
# This is a config file for bob.bio.vein
# It defines the database protocol to use with the Database Interface for the
# VeraFinger dataset, defined ar bob.db.verafinger.
# It is defined as a resource in the setup file of this package.
# Usage:
# $ bob bio pipelines vanilla-biometrics <pipeline> Cropped-Fifty verafinger
# or:
# $ bob bio pipelines vanilla-biometrics -p <pipeline> Cropped-Fifty verafinger
# The protocol resource must be specified before the database resource.
protocol = 'Cropped-Fifty'
# author: Yannick Dayer <yannick.dayer@idiap.ch>
# Fri 16 Oct 2020 14:50:58 UTC+02
# This is a config file for bob.bio.vein
# It defines the database protocol to use with the Database Interface for the
# VeraFinger dataset, defined ar bob.db.verafinger.
# It is defined as a resource in the setup file of this package.
# Usage:
# $ bob bio pipelines vanilla-biometrics <pipeline> Cropped-Full verafinger
# or:
# $ bob bio pipelines vanilla-biometrics -p <pipeline> Cropped-Full verafinger
# The protocol resource must be specified before the database resource.
protocol = 'Cropped-Fifty'
# author: Yannick Dayer <yannick.dayer@idiap.ch>
# Fri 16 Oct 2020 14:51:06 UTC+02
# This is a config file for bob.bio.vein
# It defines the database protocol to use with the Database Interface for the
# VeraFinger dataset, defined ar bob.db.verafinger.
# It is defined as a resource in the setup file of this package.
# Usage:
# $ bob bio pipelines vanilla-biometrics <pipeline> Fifty verafinger
# or:
# $ bob bio pipelines vanilla-biometrics -p <pipeline> Fifty verafinger
# The protocol resource must be specified before the database resource.
protocol = 'Fifty'
# author: Yannick Dayer <yannick.dayer@idiap.ch>
# Fri 16 Oct 2020 14:51:11 UTC+02
# This is a config file for bob.bio.vein
# It defines the database protocol to use with the Database Interface for the
# VeraFinger dataset, defined ar bob.db.verafinger.
# It is defined as a resource in the setup file of this package.
# Usage:
# $ bob bio pipelines vanilla-biometrics <pipeline> Full verafinger
# or:
# $ bob bio pipelines vanilla-biometrics -p <pipeline> Full verafinger
# The protocol resource must be specified before the database resource.
protocol = 'Full'
# author: Yannick Dayer <yannick.dayer@idiap.ch>
# Fri 16 Oct 2020 12:14:05 UTC+02
# This is a config file for bob.bio.vein
# It defines the database protocol to use with the Database Interface for the
# 3D Fingervein dataset, defined ar bob.db.fv3d.
# It is defined as a resource in the setup file of this package.
# Usage:
# $ bob bio pipelines vanilla-biometrics <pipeline> left fv3d
# or:
# $ bob bio pipelines vanilla-biometrics -p <pipeline> left fv3d
# The protocol resource must be specified before the database resource.
protocol = 'left'
# author: Yannick Dayer <yannick.dayer@idiap.ch>
# Fri 16 Oct 2020 12:14:56 UTC+02
# This is a config file for bob.bio.vein
# It defines the database protocol to use with the Database Interface for the
# 3D Fingervein dataset, defined ar bob.db.fv3d.
# It is defined as a resource in the setup file of this package.
# Usage:
# $ bob bio pipelines vanilla-biometrics <pipeline> right fv3d
# or:
# $ bob bio pipelines vanilla-biometrics -p <pipeline> right fv3d
# The protocol resource must be specified before the database resource.
protocol = 'right'
# author: Yannick Dayer <yannick.dayer@idiap.ch>
# Fri 16 Oct 2020 12:15:16 UTC+02
# This is a config file for bob.bio.vein
# It defines the database protocol to use with the Database Interface for the
# 3D Fingervein dataset, defined ar bob.db.fv3d.
# It is defined as a resource in the setup file of this package.
# Usage:
# $ bob bio pipelines vanilla-biometrics <pipeline> stitched fv3d
# or:
# $ bob bio pipelines vanilla-biometrics -p <pipeline> stitched fv3d
# The protocol resource must be specified before the database resource.
protocol = 'stitched'
......@@ -17,15 +17,24 @@ the link.
"""
from bob.extension import rc
from ..database.putvein import PutveinBioDatabase
from bob.bio.vein.database.putvein import PutveinBioDatabase
from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector
import logging
logger = logging.getLogger("bob.bio.vein")
_putvein_directory = rc["bob.db.putvein.directory"]
"""Value in ``~/.bobrc`` for this dataset directory"""
# Set default protocol if not given via a config file
if 'protocol' not in locals():
logger.info("protocol not specified, using default: 'central'")
protocol = 'central'
legacy_database = PutveinBioDatabase(
original_directory = _putvein_directory,
original_extension = '.bmp',
protocol = protocol,
)
"""The :py:class:`bob.bio.base.database.BioDatabase` derivative with PUT Vein
database settings
......@@ -61,9 +70,4 @@ command-line of ``verify.py`` or using the keyword ``protocol`` on a
configuration file that is loaded **after** this configuration resource.
"""
logger.debug(f"loaded database putvein config file, using protocol '{protocol}'.")
......@@ -18,15 +18,24 @@ You can download the raw data of the `UTFVP`_ database by following the link.
"""
from bob.extension import rc
from ..database.utfvp import Database
from bob.bio.vein.database.utfvp import Database
from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector
import logging
logger = logging.getLogger("bob.bio.vein")
_utfvp_directory = rc["bob.db.utfvp.directory"]
"""Value in ``~/.bobrc`` for this dataset directory"""
# Set default protocol if not given via a config file
if 'protocol' not in locals():
logger.info("protocol not specified, using default: 'central'")
protocol = 'central'
legacy_database = Database(
original_directory = _utfvp_directory,
original_extension = '.png',
protocol = protocol,
)
"""The :py:class:`bob.bio.base.database.BioDatabase` derivative with UTFVP settings
"""
......@@ -52,6 +61,4 @@ installed the `utfvp`_ dataset, as explained in the section
:ref:`bob.bio.vein.baselines`.
"""
protocol = 'nom' # TODO protocol implementation in bob pipelines?
logger.debug(f"Loaded database utfvp config file, using protocol '{protocol}'.")
......@@ -16,18 +16,17 @@ from bob.extension import rc
from bob.bio.vein.database.verafinger import Database
from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector
import logging
logger = logging.getLogger("bob.bio.vein")
_verafinger_directory = rc["bob.db.verafinger.directory"]
"""Value in ``~/.bobrc`` for this dataset directory"""
protocol = 'Nom' # TODO protocol implementation in bob pipelines?
"""The default protocol to use for tests
# Set default protocol if not given via a config file
if 'protocol' not in locals():
logger.info("protocol not specified, using default: 'central'")
protocol = 'central'
We accept any biometric recognition protocol implemented by bob.db.verafinger.
Variants of the biometric recognition protocol ending in ``-va`` can be used to
test for vulnerability analysis. For example, use the protocol ``Nom-va`` to
test the vulnerability of a biometric recognition pipeline using the ``Nom``
protocol for enrollment and probe samples from presentation attacks.
"""
"""Updated with the wrapper for the pipelines package"""
database = DatabaseConnector(Database(
......@@ -53,3 +52,6 @@ Notice that ``original_directory`` is set to
installed the `vera fingervein`_ dataset, as explained in the section
:ref:`bob.bio.vein.baselines`.
"""
print(f"VERAFINGER: protocol = '{protocol}'.")
logger.debug(f"Loaded database verafinger config file, using protocol '{protocol}'.")
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Tue 27 Sep 2016 16:48:16 CEST
"""Huang's Principal Curvature extractor and Miura Matching baseline
References:
1. [HDLTL10]_
2. [TV13]_
3. [TVM14]_
"""
from bob.bio.vein.preprocessor import (
NoCrop,
TomesLeeMask,
HuangNormalization,
NoFilter,
Preprocessor,
)
legacy_preprocessor = Preprocessor(
crop=NoCrop(),
mask=TomesLeeMask(),
normalize=HuangNormalization(),
filter=NoFilter(),
)
"""Preprocessing using gray-level based finger cropping and no post-processing
"""
from bob.bio.vein.extractor import PrincipalCurvature
legacy_extractor = PrincipalCurvature()
from bob.bio.base.transformers import (
PreprocessorTransformer,
ExtractorTransformer
)
from sklearn.pipeline import make_pipeline
from bob.pipelines import wrap
transformer = make_pipeline(
wrap(["sample"], PreprocessorTransformer(legacy_preprocessor)),
wrap(["sample"], ExtractorTransformer(legacy_extractor))
)
from bob.bio.vein.algorithm import MiuraMatch
# Notice the values of ch and cw are different than those from the
# repeated-line tracking **and** maximum curvature baselines.
legacy_algorithm = MiuraMatch(ch=18, cw=28)
"""Miura-matching algorithm with specific settings for search displacement
Defaults taken from [TV13]_.
"""
import os
from pathlib import Path
from tempfile import TemporaryDirectory
sub_directory = "pc"
user_temp = Path("/idiap/") / "temp" / os.environ["USER"]
if user_temp.exists():
# use /idiap/temp/<USER>/bob_bio_vein_tmp/<SUBDIRECTORY>/
legacy_temp_dir = user_temp / "bob_bio_vein_tmp" / sub_directory
print(f"Saving legacy temp in '{legacy_temp_dir}'")
else:
# if /idiap/temp/<USER> does not exist, use /tmp/tmpxxxxxxxx
legacy_temp_dir = TemporaryDirectory().name
from bob.bio.base.pipelines.vanilla_biometrics import (
VanillaBiometricsPipeline,
BioAlgorithmLegacy,
)
biometric_algorithm = BioAlgorithmLegacy(
legacy_algorithm,
base_dir=legacy_temp_dir,
)
pipeline = VanillaBiometricsPipeline(transformer, biometric_algorithm)
......@@ -32,11 +32,32 @@ setup(
entry_points={
'bob.bio.config': [
# protocols TODO: add all protocols
# verafinger
'Nom = bob.bio.vein.configurations.database.protocol.Nom',
'Cropped-Nom = bob.bio.vein.configurations.database.protocol.cropped_Nom',
'B = bob.bio.vein.configurations.database.protocol.b',
'Cropped-B = bob.bio.vein.configurations.database.protocol.cropped_b',
'Full = bob.bio.vein.configurations.database.protocol.full',
'Cropped-Full = bob.bio.vein.configurations.database.protocol.cropped_full',
'Fifty = bob.bio.vein.configurations.database.protocol.fifty',
'Cropped-Fifty = bob.bio.vein.configurations.database.protocol.cropped_fifty',
# utfvp
# 'nom = bob.bio.vein.configurations.database.protocol.nom',
# fv3d
'central = bob.bio.vein.configurations.database.protocol.central',
'left = bob.bio.vein.configurations.database.protocol.left',
'right = bob.bio.vein.configurations.database.protocol.right',
'stitched = bob.bio.vein.configurations.database.protocol.stitched',
# putvein
# 'wrist-LR_1 = bob.bio.vein.configurations.database.protocol.wristLR_1',
# TODO That will be a LOT of protocols, for putvein...
# legacy databases
'verafinger = bob.bio.vein.configurations.verafinger',
'utfvp = bob.bio.vein.configurations.utfvp',
'fv3d = bob.bio.vein.configurations.fv3d',
'putvein = bob.bio.vein.configurations.putvein',
'verafinger = bob.bio.vein.configurations.database.verafinger',
'utfvp = bob.bio.vein.configurations.database.utfvp',
'fv3d = bob.bio.vein.configurations.database.fv3d',
'putvein = bob.bio.vein.configurations.database.putvein',
# legacy baselines
'mc = bob.bio.vein.configurations.maximum_curvature',
......@@ -50,10 +71,10 @@ setup(
],
'bob.bio.database': [
'verafinger = bob.bio.vein.configurations.verafinger:database',
'utfvp = bob.bio.vein.configurations.utfvp:database',
'fv3d = bob.bio.vein.configurations.fv3d:database',
'putvein = bob.bio.vein.configurations.putvein:database',
'verafinger = bob.bio.vein.configurations.database.verafinger:database',
'utfvp = bob.bio.vein.configurations.database.utfvp:database',
'fv3d = bob.bio.vein.configurations.database.fv3d:database',
'putvein = bob.bio.vein.configurations.database.putvein:database',
],
'bob.bio.pipeline': [
......
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