Coverage for src/bob/bio/vein/config/repeated_line_tracking.py: 0%

24 statements  

« prev     ^ index     » next       coverage.py v7.6.0, created at 2024-07-12 23:27 +0200

1#!/usr/bin/env python 

2# vim: set fileencoding=utf-8 : 

3# Tue 27 Sep 2016 16:48:08 CEST 

4 

5"""Repeated-Line Tracking and Miura Matching baseline 

6 

7References: 

8 

91. [MNM04]_ 

102. [TV13]_ 

113. [TVM14]_ 

12 

13""" 

14import os 

15import tempfile 

16 

17from sklearn.pipeline import make_pipeline 

18 

19from bob.bio.base.pipelines import PipelineSimple 

20from bob.bio.base.transformers import ( 

21 ExtractorTransformer, 

22 PreprocessorTransformer, 

23) 

24from bob.bio.vein.algorithm import MiuraMatch 

25from bob.bio.vein.extractor import RepeatedLineTracking 

26from bob.bio.vein.preprocessor import ( 

27 HuangNormalization, 

28 NoCrop, 

29 NoFilter, 

30 Preprocessor, 

31 TomesLeeMask, 

32) 

33from bob.pipelines import wrap 

34 

35"""Baseline updated with the wrapper for the pipelines package""" 

36 

37"""Sub-directory where temporary files are saved""" 

38sub_directory = "rlt" 

39default_temp = ( 

40 os.path.join("/idiap", "temp", os.environ["USER"]) 

41 if "USER" in os.environ 

42 else "~/temp" 

43) 

44 

45if os.path.exists(default_temp): 

46 legacy_temp_dir = os.path.join( 

47 default_temp, "bob_bio_base_tmp", sub_directory 

48 ) 

49else: 

50 # if /idiap/temp/<USER> does not exist, use /tmp/tmpxxxxxxxx 

51 legacy_temp_dir = tempfile.TemporaryDirectory().name 

52 

53"""Preprocessing using gray-level based finger cropping and no post-processing 

54""" 

55preprocessor = PreprocessorTransformer( 

56 Preprocessor( 

57 crop=NoCrop(), 

58 mask=TomesLeeMask(), 

59 normalize=HuangNormalization(), 

60 filter=NoFilter(), 

61 ) 

62) 

63 

64"""Features are the output of repeated-line tracking, as described on [MNM04]_. 

65 

66Defaults taken from [TV13]_. 

67""" 

68extractor = ExtractorTransformer(RepeatedLineTracking()) 

69 

70"""Miura-matching algorithm with specific settings for search displacement 

71 

72Defaults taken from [TV13]_. 

73""" 

74biometric_algorithm = MiuraMatch(ch=65, cw=55) 

75 

76transformer = make_pipeline( 

77 wrap(["sample"], preprocessor), wrap(["sample"], extractor) 

78) 

79pipeline = PipelineSimple(transformer, biometric_algorithm)