Commit 5fbeece2 authored by André Anjos's avatar André Anjos 💬

[many] Fixed unit tests

parent c3a0e4b1
...@@ -47,7 +47,8 @@ To achieve this goal, interfaces to some publicly available vein image ...@@ -47,7 +47,8 @@ To achieve this goal, interfaces to some publicly available vein image
databases are contained, and default evaluation protocols are defined, e.g.: databases are contained, and default evaluation protocols are defined, e.g.:
- UTFVP - University of Twente Finger Vein Database [http://www.sas.ewi.utwente.nl/] - UTFVP - University of Twente Finger Vein Database [http://www.sas.ewi.utwente.nl/]
- VERA Finger vein Database [http://www.idiap.ch/scientific-research/resources] - VERA - Finger vein Database [http://www.idiap.ch/scientific-research/resources]
- PUT - The PUT biometric vein (palm and wrist) recognition dataset [http://biometrics.put.poznan.pl/vein-dataset/]
Algorithms Algorithms
...@@ -97,7 +98,8 @@ this package using the same installation mechanism. ...@@ -97,7 +98,8 @@ this package using the same installation mechanism.
Development Development
----------- -----------
In order to develop the latest version of this package:: In order to develop the latest version of this package, install Bob_ as
indicated above. Once that is done, do this::
$ git clone https://gitlab.idiap.ch/biometrc/bob.bio.vein.git $ git clone https://gitlab.idiap.ch/biometrc/bob.bio.vein.git
$ cd bob.bio.vein $ cd bob.bio.vein
......
...@@ -47,7 +47,6 @@ class MiuraMatch (Algorithm): ...@@ -47,7 +47,6 @@ class MiuraMatch (Algorithm):
"""Enrolls the model by computing an average graph for each model""" """Enrolls the model by computing an average graph for each model"""
# return the generated model # return the generated model
#import ipdb; ipdb.set_trace()
return numpy.array(enroll_features) return numpy.array(enroll_features)
......
...@@ -80,8 +80,6 @@ class LocalBinaryPatterns (Extractor): ...@@ -80,8 +80,6 @@ class LocalBinaryPatterns (Extractor):
"""Copies the given array into the given blocks""" """Copies the given array into the given blocks"""
# fill array in the desired shape # fill array in the desired shape
#For debugging
#import ipdb; ipdb.set_trace()
for b in range(self.m_n_blocks): for b in range(self.m_n_blocks):
lbphs_array[b * self.m_n_bins : (b+1) * self.m_n_bins] = lbphs_blocks[b][:] lbphs_array[b * self.m_n_bins : (b+1) * self.m_n_bins] = lbphs_blocks[b][:]
...@@ -90,9 +88,6 @@ class LocalBinaryPatterns (Extractor): ...@@ -90,9 +88,6 @@ class LocalBinaryPatterns (Extractor):
"""Computes and returns the LBP features for the given input fingervein """Computes and returns the LBP features for the given input fingervein
image""" image"""
# For debugging
#import ipdb; ipdb.set_trace()
finger_image = finger_image.astype(numpy.float64) finger_image = finger_image.astype(numpy.float64)
finger_mask = numpy.zeros(mask.shape) finger_mask = numpy.zeros(mask.shape)
...@@ -113,9 +108,6 @@ class LocalBinaryPatterns (Extractor): ...@@ -113,9 +108,6 @@ class LocalBinaryPatterns (Extractor):
# create new array # create new array
lbphs_array = numpy.zeros(shape, 'float64') lbphs_array = numpy.zeros(shape, 'float64')
#For debugging
#import ipdb; ipdb.set_trace()
# fill the array with the absolute values of the Gabor wavelet transform # fill the array with the absolute values of the Gabor wavelet transform
self.__fill__(lbphs_array, abs_blocks, 0) self.__fill__(lbphs_array, abs_blocks, 0)
......
#!/usr/bin/env python #!/usr/bin/env python
# vim: set fileencoding=utf-8 : # vim: set fileencoding=utf-8 :
import numpy
import math import math
import numpy
import scipy.ndimage
import bob.core import bob.core
import bob.io.base import bob.io.base
...@@ -198,14 +199,6 @@ class RepeatedLineTracking (Extractor): ...@@ -198,14 +199,6 @@ class RepeatedLineTracking (Extractor):
img_veins_bin = img_veins > md img_veins_bin = img_veins > md
img_veins_bin = scipy.ndimage.binary_closing(img_veins_bin, structure=numpy.ones((2,2))).astype(int) img_veins_bin = scipy.ndimage.binary_closing(img_veins_bin, structure=numpy.ones((2,2))).astype(int)
#import ipdb; ipdb.set_trace()
#img_veins_bin2 = scipy.ndimage.binary_closing(img_veins_bin, structure=numpy.ones((2,2))).astype(int)
#from PIL import Image
#Image.fromarray(bob.core.convert(img_veins_bin,numpy.uint8,(0,255),(0,1))).show()
#skel = self.skeletonize(img_veins_bin2)
#Image.fromarray(bob.core.convert(skel,numpy.uint8,(0,255),(0,1))).show()
return img_veins_bin.astype(numpy.float64) return img_veins_bin.astype(numpy.float64)
......
...@@ -329,7 +329,6 @@ class FingerCrop (Preprocessor): ...@@ -329,7 +329,6 @@ class FingerCrop (Preprocessor):
def __HE__(self, image): def __HE__(self, image):
#Umbralization based on the pixels non zero #Umbralization based on the pixels non zero
#import ipdb; ipdb.set_trace()
imageEnhance = numpy.zeros(image.shape) imageEnhance = numpy.zeros(image.shape)
imageEnhance = imageEnhance.astype(numpy.uint8) imageEnhance = imageEnhance.astype(numpy.uint8)
...@@ -372,7 +371,6 @@ class FingerCrop (Preprocessor): ...@@ -372,7 +371,6 @@ class FingerCrop (Preprocessor):
imageEnhance = utils.imfilter(image, gaborfilter, self.gpu, conv=False) imageEnhance = utils.imfilter(image, gaborfilter, self.gpu, conv=False)
imageEnhance = numpy.abs(imageEnhance) imageEnhance = numpy.abs(imageEnhance)
#import ipdb; ipdb.set_trace()
imageEnhance = bob.core.convert(imageEnhance,numpy.uint8,(0,255),(imageEnhance.min(),imageEnhance.max())) imageEnhance = bob.core.convert(imageEnhance,numpy.uint8,(0,255),(imageEnhance.min(),imageEnhance.max()))
return imageEnhance return imageEnhance
...@@ -388,8 +386,6 @@ class FingerCrop (Preprocessor): ...@@ -388,8 +386,6 @@ class FingerCrop (Preprocessor):
b = 1.2 b = 1.2
n = 2.0 n = 2.0
#import ipdb; ipdb.set_trace()
#Convert image to doubles #Convert image to doubles
image_new = bob.core.convert(image,numpy.float64,(0,1),(0,255)) image_new = bob.core.convert(image,numpy.float64,(0,1),(0,255))
img_h, img_w = image_new.shape img_h, img_w = image_new.shape
...@@ -459,7 +455,6 @@ class FingerCrop (Preprocessor): ...@@ -459,7 +455,6 @@ class FingerCrop (Preprocessor):
def crop_finger(self, image): def crop_finger(self, image):
spoofingValue = self.__spoofingdetector__(image) spoofingValue = self.__spoofingdetector__(image)
#import ipdb; ipdb.set_trace()
#Padding array #Padding array
image = self.__padding_finger__(image) image = self.__padding_finger__(image)
......
...@@ -13,6 +13,7 @@ import pkg_resources ...@@ -13,6 +13,7 @@ import pkg_resources
import bob.io.base import bob.io.base
import bob.io.matlab import bob.io.matlab
import bob.io.image
def F(parts): def F(parts):
...@@ -23,17 +24,17 @@ def F(parts): ...@@ -23,17 +24,17 @@ def F(parts):
def test_finger_crop(): def test_finger_crop():
#Test finger vein image preprocessing #Test finger vein image preprocessors
input_filename = F(('preprocessing', '0019_3_1_120509-160517.png')) input_filename = F(('preprocessors', '0019_3_1_120509-160517.png'))
output_img_filename = F(('preprocessing', output_img_filename = F(('preprocessors',
'0019_3_1_120509-160517_img_lee_huang.mat')) '0019_3_1_120509-160517_img_lee_huang.mat'))
output_fvr_filename = F(('preprocessing', output_fvr_filename = F(('preprocessors',
'0019_3_1_120509-160517_fvr_lee_huang.mat')) '0019_3_1_120509-160517_fvr_lee_huang.mat'))
img = bob.io.base.load(input_filename) img = bob.io.base.load(input_filename)
from bob.fingervein.preprocessing.FingerCrop import FingerCrop from bob.bio.vein.preprocessors.FingerCrop import FingerCrop
FC = FingerCrop(4, 40, False, False) FC = FingerCrop(4, 40, False, False)
#FC = FingerCrop(4, 40, False, 5, 0.2, False) #FC = FingerCrop(4, 40, False, 5, 0.2, False)
...@@ -52,16 +53,16 @@ def test_miuramax(): ...@@ -52,16 +53,16 @@ def test_miuramax():
#Maximum Curvature method against Matlab reference #Maximum Curvature method against Matlab reference
input_img_filename = F(('features', 'miuramax_input_img.mat')) input_img_filename = F(('extractors', 'miuramax_input_img.mat'))
input_fvr_filename = F(('features', 'miuramax_input_fvr.mat')) input_fvr_filename = F(('extractors', 'miuramax_input_fvr.mat'))
output_filename = F(('features', 'miuramax_output.mat')) output_filename = F(('extractors', 'miuramax_output.mat'))
# Load inputs # Load inputs
input_img = bob.io.base.load(input_img_filename) input_img = bob.io.base.load(input_img_filename)
input_fvr = bob.io.base.load(input_fvr_filename) input_fvr = bob.io.base.load(input_fvr_filename)
# Apply Python implementation # Apply Python implementation
from bob.fingervein.features.MaximumCurvature import MaximumCurvature from bob.bio.vein.extractors.MaximumCurvature import MaximumCurvature
MC = MaximumCurvature(5, False) MC = MaximumCurvature(5, False)
output_img = MC((input_img, input_fvr)) output_img = MC((input_img, input_fvr))
...@@ -77,16 +78,16 @@ def test_miurarlt(): ...@@ -77,16 +78,16 @@ def test_miurarlt():
#Repeated Line Tracking method against Matlab reference #Repeated Line Tracking method against Matlab reference
input_img_filename = F(('features', 'miurarlt_input_img.mat')) input_img_filename = F(('extractors', 'miurarlt_input_img.mat'))
input_fvr_filename = F(('features', 'miurarlt_input_fvr.mat')) input_fvr_filename = F(('extractors', 'miurarlt_input_fvr.mat'))
output_filename = F(('features', 'miurarlt_output.mat')) output_filename = F(('extractors', 'miurarlt_output.mat'))
# Load inputs # Load inputs
input_img = bob.io.base.load(input_img_filename) input_img = bob.io.base.load(input_img_filename)
input_fvr = bob.io.base.load(input_fvr_filename) input_fvr = bob.io.base.load(input_fvr_filename)
# Apply Python implementation # Apply Python implementation
from bob.fingervein.features.RepeatedLineTracking import RepeatedLineTracking from bob.bio.vein.extractors.RepeatedLineTracking import RepeatedLineTracking
RLT = RepeatedLineTracking(3000, 1, 21, False) RLT = RepeatedLineTracking(3000, 1, 21, False)
output_img = RLT((input_img, input_fvr)) output_img = RLT((input_img, input_fvr))
...@@ -102,16 +103,16 @@ def test_huangwl(): ...@@ -102,16 +103,16 @@ def test_huangwl():
#Wide Line Detector method against Matlab reference #Wide Line Detector method against Matlab reference
input_img_filename = F(('features', 'huangwl_input_img.mat')) input_img_filename = F(('extractors', 'huangwl_input_img.mat'))
input_fvr_filename = F(('features', 'huangwl_input_fvr.mat')) input_fvr_filename = F(('extractors', 'huangwl_input_fvr.mat'))
output_filename = F(('features', 'huangwl_output.mat')) output_filename = F(('extractors', 'huangwl_output.mat'))
# Load inputs # Load inputs
input_img = bob.io.base.load(input_img_filename) input_img = bob.io.base.load(input_img_filename)
input_fvr = bob.io.base.load(input_fvr_filename) input_fvr = bob.io.base.load(input_fvr_filename)
# Apply Python implementation # Apply Python implementation
from bob.fingervein.features.WideLineDetector import WideLineDetector from bob.bio.vein.extractors.WideLineDetector import WideLineDetector
WL = WideLineDetector(5, 1, 41, False) WL = WideLineDetector(5, 1, 41, False)
output_img = WL((input_img, input_fvr)) output_img = WL((input_img, input_fvr))
...@@ -123,17 +124,18 @@ def test_huangwl(): ...@@ -123,17 +124,18 @@ def test_huangwl():
def test_miura_match(): def test_miura_match():
"""Test matching: Match Ratio method against Matlab reference"""
template_filename = F(('matching', '0001_2_1_120509-135338.mat')) #Match Ratio method against Matlab reference
probe_gen_filename = F(('matching', '0001_2_2_120509-135558.mat'))
probe_imp_filename = F(('matching', '0003_2_1_120509-141255.mat')) template_filename = F(('algorithms', '0001_2_1_120509-135338.mat'))
probe_gen_filename = F(('algorithms', '0001_2_2_120509-135558.mat'))
probe_imp_filename = F(('algorithms', '0003_2_1_120509-141255.mat'))
template_vein = bob.io.base.load(template_filename) template_vein = bob.io.base.load(template_filename)
probe_gen_vein = bob.io.base.load(probe_gen_filename) probe_gen_vein = bob.io.base.load(probe_gen_filename)
probe_imp_vein = bob.io.base.load(probe_imp_filename) probe_imp_vein = bob.io.base.load(probe_imp_filename)
from bob.fingervein.tools.MiuraMatch import MiuraMatch from bob.bio.vein.algorithms.MiuraMatch import MiuraMatch
MM = MiuraMatch(ch=18, cw=28) MM = MiuraMatch(ch=18, cw=28)
score_gen = MM.score(template_vein, probe_gen_vein) score_gen = MM.score(template_vein, probe_gen_vein)
......
...@@ -10,12 +10,14 @@ eggs = bob.bio.vein ...@@ -10,12 +10,14 @@ eggs = bob.bio.vein
bob.extension bob.extension
gridtk gridtk
develop = src/bob.db.vera develop = src/bob.db.vera
src/bob.db.putvein
. .
auto-checkout = * auto-checkout = *
newest = false newest = false
[sources] [sources]
bob.db.vera = git git@github.com:bioidiap/bob.db.vera bob.db.vera = git git@github.com:bioidiap/bob.db.vera
bob.db.putvein = git git@gitlab.idiap.ch:biometric/bob.db.putvein
[scripts] [scripts]
recipe = bob.buildout:scripts recipe = bob.buildout:scripts
...@@ -5,18 +5,18 @@ ...@@ -5,18 +5,18 @@
References References
========== ==========
.. [LLP09]_ *E.C. Lee, H.C. Lee and K.R. Park. Finger vein recognition using minutia-based alignment and local binary pattern-based feature extraction. International Journal of Imaging Systems and Technology. Vol. 19, No. 3, pp. 175-178, September 2009. .. [KUU02]_ M. Kono, H. Ueki and S. Umemura. Near-infrared finger vein patterns for personal identification, Applied Optics, Vol. 41, Issue 35, pp. 7429-7436 (2002).
.. [KUU02]_ *M. Kono, H. Ueki and S. Umemura. Near-infrared finger vein patterns for personal identification, Applied Optics, Vol. 41, Issue 35, pp. 7429-7436 (2002). .. [MNM04]_ N. Miura, A. Nagasaka, and T. Miyatake. Feature extraction of finger vein patterns based on repeated line tracking and its application to personal identification. Machine Vision and Applications, Vol. 15, Num. 4, pp. 194--203, 2004.
.. [ZY09]_ *J. Zhang and J. Yang. Finger-vein image enhancement based on combination of gray-level grouping and circular gabor filter. In International Conference on Information Engineering and Computer Science (ICIECS), pp. 1-4, Dec 2009. .. [MNM05]_ N. Miura, A. Nagasaka, and T. Miyatake, Extraction of Finger-Vein Pattern Using Maximum Curvature Points in Image Profiles. Proceedings on IAPR conference on machine vision applications, Vol. 9 , pp. 347--350, 2005.
.. [ZTXL09]_ *Jianjun Zhao, Hogliang Tian, Weixing Xu, and Xin Li. A New Approach to Hand Vein Image Enhancement. In IEEE Second International Conference on Intelligent Computation Technology and Automation, ICICTA. Vol. 1, pp. 499-501. 2009. .. [LLP09]_ E.C. Lee, H.C. Lee and K.R. Park. Finger vein recognition using minutia-based alignment and local binary pattern-based feature extraction. International Journal of Imaging Systems and Technology. Vol. 19, No. 3, pp. 175-178, September 2009.
.. [MNM05]_ *N. Miura, A. Nagasaka, and T. Miyatake, Extraction of Finger-Vein Pattern Using Maximum Curvature Points in Image Profiles. Proceedings on IAPR conference on machine vision applications, Vol. 9 , pp. 347--350, 2005. .. [ZY09]_ J. Zhang and J. Yang. Finger-vein image enhancement based on combination of gray-level grouping and circular gabor filter. In International Conference on Information Engineering and Computer Science (ICIECS), pp. 1-4, Dec 2009.
.. [MNM04]_ *N. Miura, A. Nagasaka, and T. Miyatake. Feature extraction of finger vein patterns based on repeated line tracking and its application to personal identification. Machine Vision and Applications, Vol. 15, Num. 4, pp. 194--203, 2004. .. [ZTXL09]_ Jianjun Zhao, Hogliang Tian, Weixing Xu, and Xin Li. A New Approach to Hand Vein Image Enhancement. In IEEE Second International Conference on Intelligent Computation Technology and Automation, ICICTA. Vol. 1, pp. 499-501. 2009.
.. [HDLTL10]_ *B. Huang, Y. Dai, R. Li, D. Tang and W. Li. Finger-vein authentication based on wide line detector and pattern normalization, Proceedings on 20th International Conference on Pattern Recognition (ICPR), 2010. .. [HDLTL10]_ B. Huang, Y. Dai, R. Li, D. Tang and W. Li. Finger-vein authentication based on wide line detector and pattern normalization, Proceedings on 20th International Conference on Pattern Recognition (ICPR), 2010.
.. [MD13]_ *L. Mirmohamadsadeghi and A. Drygajlo. Palm vein recognition uisng local texture patterns, IET Biometrics, pp. 1-9, 2013. .. [MD13]_ L. Mirmohamadsadeghi and A. Drygajlo. Palm vein recognition using local texture patterns, IET Biometrics, pp. 1-9, 2013.
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