Commit 3e85cbc9 authored by Victor BROS's avatar Victor BROS

Porting of finger vein recognition baselines in the new bob.bio.base

parent 70507d21
Pipeline #44254 failed with stage
in 14 minutes
......@@ -2,7 +2,7 @@
# vim: set fileencoding=utf-8 :
# Tue 27 Sep 2016 16:48:32 CEST
'''Maximum Curvature and Miura Matching baseline
"""Maximum Curvature and Miura Matching baseline
References:
......@@ -10,41 +10,68 @@ References:
2. [TV13]_
3. [TVM14]_
'''
"""
sub_directory = 'mc'
"""Sub-directory where results will be placed.
from tempfile import TemporaryDirectory
from pathlib import Path
import os
You may change this setting using the ``--sub-directory`` command-line option
or the attribute ``sub_directory`` in a configuration file loaded **after**
this resource.
"""
from bob.bio.base.transformers import PreprocessorTransformer
from bob.bio.base.transformers import ExtractorTransformer
from bob.bio.base.pipelines.vanilla_biometrics import (
VanillaBiometricsPipeline,
BioAlgorithmLegacy,
)
from sklearn.pipeline import make_pipeline
from bob.pipelines import wrap
from ..preprocessor import NoCrop, TomesLeeMask, HuangNormalization, \
NoFilter, Preprocessor
from bob.bio.vein.preprocessor import (
NoCrop,
TomesLeeMask,
HuangNormalization,
NoFilter,
Preprocessor,
)
from bob.bio.vein.extractor import MaximumCurvature
from bob.bio.vein.algorithm import MiuraMatch
"""Baseline updated with the wrapper for the pipelines package"""
"""Sub-directory where temporary files are saved"""
sub_directory = 'rlt'
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
else:
# if /idiap/temp/<USER> does not exist, use /tmp/tmpxxxxxxxx
legacy_temp_dir = TemporaryDirectory().name
preprocessor = Preprocessor(
crop=NoCrop(),
mask=TomesLeeMask(),
normalize=HuangNormalization(),
filter=NoFilter(),
)
"""Preprocessing using gray-level based finger cropping and no post-processing
"""
preprocessor = PreprocessorTransformer(
Preprocessor(
crop=NoCrop(),
mask=TomesLeeMask(),
normalize=HuangNormalization(),
filter=NoFilter(),
)
)
from ..extractor import MaximumCurvature
extractor = MaximumCurvature()
"""Features are the output of the maximum curvature algorithm, as described on
[MNM05]_.
Defaults taken from [TV13]_.
"""
extractor = ExtractorTransformer(MaximumCurvature())
# Notice the values of ch and cw are different than those from the
# repeated-line tracking baseline.
from ..algorithm import MiuraMatch
algorithm = MiuraMatch()
"""Miura-matching algorithm with specific settings for search displacement
Defaults taken from [TV13]_.
"""
biometric_algorithm = BioAlgorithmLegacy(
MiuraMatch(), base_dir=legacy_temp_dir
)
transformer = make_pipeline(wrap(["sample"], preprocessor), wrap(["sample"], extractor))
pipeline = VanillaBiometricsPipeline(transformer, biometric_algorithm)
......@@ -2,7 +2,7 @@
# vim: set fileencoding=utf-8 :
# Tue 27 Sep 2016 16:48:08 CEST
'''Repeated-Line Tracking and Miura Matching baseline
"""Repeated-Line Tracking and Miura Matching baseline
References:
......@@ -10,39 +10,65 @@ References:
2. [TV13]_
3. [TVM14]_
'''
"""
from tempfile import TemporaryDirectory
from pathlib import Path
import os
sub_directory = 'rlt'
"""Sub-directory where results will be placed.
from bob.bio.base.transformers import PreprocessorTransformer
from bob.bio.base.transformers import ExtractorTransformer
from bob.bio.base.pipelines.vanilla_biometrics import (
VanillaBiometricsPipeline,
BioAlgorithmLegacy,
)
from sklearn.pipeline import make_pipeline
from bob.pipelines import wrap
You may change this setting using the ``--sub-directory`` command-line option
or the attribute ``sub_directory`` in a configuration file loaded **after**
this resource.
"""
from bob.bio.vein.preprocessor import (
NoCrop,
TomesLeeMask,
HuangNormalization,
NoFilter,
Preprocessor,
)
from bob.bio.vein.extractor import RepeatedLineTracking
from bob.bio.vein.algorithm import MiuraMatch
from ..preprocessor import NoCrop, TomesLeeMask, HuangNormalization, \
NoFilter, Preprocessor
"""Baseline updated with the wrapper for the pipelines package"""
"""Sub-directory where temporary files are saved"""
sub_directory = 'rlt'
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
else:
# if /idiap/temp/<USER> does not exist, use /tmp/tmpxxxxxxxx
legacy_temp_dir = TemporaryDirectory().name
preprocessor = Preprocessor(
crop=NoCrop(),
mask=TomesLeeMask(),
normalize=HuangNormalization(),
filter=NoFilter(),
)
"""Preprocessing using gray-level based finger cropping and no post-processing
"""
preprocessor = PreprocessorTransformer(
Preprocessor(
crop=NoCrop(),
mask=TomesLeeMask(),
normalize=HuangNormalization(),
filter=NoFilter(),
)
)
from ..extractor import RepeatedLineTracking
extractor = RepeatedLineTracking()
"""Features are the output of repeated-line tracking, as described on [MNM04]_.
Defaults taken from [TV13]_.
"""
extractor = ExtractorTransformer(RepeatedLineTracking())
from ..algorithm import MiuraMatch
algorithm = MiuraMatch(ch=65, cw=55)
"""Miura-matching algorithm with specific settings for search displacement
Defaults taken from [TV13]_.
"""
biometric_algorithm = BioAlgorithmLegacy(
MiuraMatch(ch=65, cw=55), base_dir=legacy_temp_dir
)
transformer = make_pipeline(wrap(["sample"], preprocessor), wrap(["sample"], extractor))
pipeline = VanillaBiometricsPipeline(transformer, biometric_algorithm)
......@@ -19,7 +19,6 @@ from bob.bio.base.pipelines.vanilla_biometrics import DatabaseConnector
_verafinger_directory = rc["bob.db.verafinger.directory"]
"""Value of ``~/.bobrc`` for this database"""
protocol = 'Nom'
"""The default protocol to use for tests
......@@ -34,14 +33,15 @@ 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(
original_directory = _verafinger_directory,
original_extension = '.png',
protocol = protocol),
original_directory=_verafinger_directory,
original_extension='.png',
protocol=protocol),
annotation_type = None,
fixed_positions = None
)
annotation_type=None,
fixed_positions=None
)
"""The :py:class:`bob.bio.base.database.BioDatabase` derivative with Verafinger
database settings
......@@ -57,5 +57,3 @@ You must make sure to create ``${HOME}/.bob_bio_databases.txt`` setting this
value to the place where you actually installed the Verafinger Database, as
explained in the section :ref:`bob.bio.vein.baselines`.
"""
......@@ -11,6 +11,9 @@ References:
3. [TVM14]_
"""
from tempfile import TemporaryDirectory
from pathlib import Path
import os
from bob.bio.base.transformers import PreprocessorTransformer
from bob.bio.base.transformers import ExtractorTransformer
......@@ -29,6 +32,23 @@ from bob.bio.vein.preprocessor import (
Preprocessor,
)
from bob.bio.vein.extractor import WideLineDetector
from bob.bio.vein.algorithm import MiuraMatch
"""Baseline updated with the wrapper for the pipelines package"""
"""Sub-directory where temporary files are saved"""
sub_directory = 'wld'
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
else:
# if /idiap/temp/<USER> does not exist, use /tmp/tmpxxxxxxxx
legacy_temp_dir = TemporaryDirectory().name
"""Preprocessing using gray-level based finger cropping and no post-processing
"""
preprocessor = PreprocessorTransformer(
Preprocessor(
crop=NoCrop(),
......@@ -38,30 +58,23 @@ preprocessor = PreprocessorTransformer(
)
)
"""Features are the output of the maximum curvature algorithm, as described on
[HDLTL10]_.
"""Preprocessing using gray-level based finger cropping and no post-processing
Defaults taken from [TV13]_.
"""
extractor = ExtractorTransformer(WideLineDetector())
from bob.bio.vein.extractor import WideLineDetector
extractor = ExtractorTransformer(WideLineDetector())
"""Features are the output of the maximum curvature algorithm, as described on
[HDLTL10]_.
"""Miura-matching algorithm with specific settings for search displacement
Defaults taken from [TV13]_.
"""
# Notice the values of ch and cw are different than those from the
# repeated-line tracking **and** maximum curvature baselines.
from bob.bio.vein.algorithm import MiuraMatch
biometric_algorithm = BioAlgorithmLegacy(
MiuraMatch(ch=18, cw=28), base_dir="/idiap/temp/vbros/pipeline_test/verafinger"
MiuraMatch(ch=18, cw=28), base_dir=legacy_temp_dir
)
"""Miura-matching algorithm with specific settings for search displacement
Defaults taken from [TV13]_.
"""
transformer = make_pipeline(wrap(["sample"], preprocessor), wrap(["sample"], extractor))
pipeline = VanillaBiometricsPipeline(transformer, biometric_algorithm)
......@@ -54,7 +54,9 @@ setup(
],
'bob.bio.pipeline': [
'wld = bob.bio.vein.configurations.wide_line_detector:pipeline'
'wld = bob.bio.vein.configurations.wide_line_detector:pipeline',
'mc = bob.bio.vein.configurations.maximum_curvature:pipeline',
'rlt = bob.bio.vein.configurations.repeated_line_tracking:pipeline',
],
'console_scripts': [
......
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