diff --git a/bob/pad/face/config/svm_frames.py b/bob/pad/face/config/svm_frames.py index 52d0caac2c01c926b717e67178376c06cc8186d1..8e17dbf5161d03b648c073aeb604ac5733dd4b9f 100644 --- a/bob/pad/face/config/svm_frames.py +++ b/bob/pad/face/config/svm_frames.py @@ -18,18 +18,21 @@ param_grid = [ }, ] + classifier = GridSearchCV(SVC(), param_grid=param_grid, cv=3) classifier = mario.wrap( - ["sample"], - classifier, - fit_extra_arguments=[("y", "is_bonafide")], + ["sample"], classifier, fit_extra_arguments=[("y", "is_bonafide")], ) # Pipeline # -frames_classifier = Pipeline([("frame_cont_to_array", frame_cont_to_array), ("classifier", classifier)]) -pipeline = Pipeline([ - ("preprocessor", preprocessor), - ("extractor", extractor), - ("svm", frames_classifier), -]) +frames_classifier = Pipeline( + [("frame_cont_to_array", frame_cont_to_array), ("classifier", classifier)] +) +pipeline = Pipeline( + [ + ("preprocessor", preprocessor), + ("extractor", extractor), + ("svm", frames_classifier), + ] +) diff --git a/setup.py b/setup.py index 39ab520a25b607ed36bb17cca39ef38ade4c6843..38c050a76834214836144e320372419597a54171 100644 --- a/setup.py +++ b/setup.py @@ -2,44 +2,40 @@ # vim: set fileencoding=utf-8 : from setuptools import setup, dist -dist.Distribution(dict(setup_requires=['bob.extension'])) + +dist.Distribution(dict(setup_requires=["bob.extension"])) # load the requirements.txt for additional requirements from bob.extension.utils import load_requirements, find_packages + install_requires = load_requirements() # The only thing we do in this file is to call the setup() function with all # parameters that define our package. setup( - # This is the basic information about your project. Modify all this # information before releasing code publicly. - name='bob.pad.face', + name="bob.pad.face", version=open("version.txt").read().rstrip(), - description= - 'Implements tools for spoofing or presentation attack detection in face biometrics', - url='https://gitlab.idiap.ch/bob/bob.pad.face', - license='GPLv3', - author='Olegs Nikisins', - author_email='olegs.nikisins@idiap.ch', - keywords='bob', - + description="Implements tools for spoofing or presentation attack detection in face biometrics", + url="https://gitlab.idiap.ch/bob/bob.pad.face", + license="GPLv3", + author="Olegs Nikisins", + author_email="olegs.nikisins@idiap.ch", + keywords="bob", # If you have a better, long description of your package, place it on the # 'doc' directory and then hook it here - long_description=open('README.rst').read(), - + long_description=open("README.rst").read(), # This line is required for any distutils based packaging. # It will find all package-data inside the 'bob' directory. - packages=find_packages('bob'), + packages=find_packages("bob"), include_package_data=True, - # This line defines which packages should be installed when you "install" # this package. All packages that are mentioned here, but are not installed # on the current system will be installed locally and only visible to the # scripts of this package. Don't worry - You won't need administrative # privileges when using buildout. install_requires=install_requires, - # This entry defines which scripts you will have inside the 'bin' directory # once you install the package (or run 'bin/buildout'). The order of each # entry under 'console_scripts' is like this: @@ -55,96 +51,52 @@ setup( # In this simple example we will create a single program that will print # the version of bob. entry_points={ - # scripts should be declared using this entry: - 'console_scripts': [ - 'quality-assessment.py = bob.pad.face.script.quality_assessment:main', + "console_scripts": [ + "quality-assessment.py = bob.pad.face.script.quality_assessment:main", ], - # registered databases: - 'bob.pad.database': [ - 'replay-attack = bob.pad.face.config.replay_attack:database', - 'replay-mobile = bob.pad.face.config.replay_mobile:database', - 'casiafasd = bob.pad.face.config.casiafasd:database', - 'mifs = bob.pad.face.config.mifs:database', - 'batl-db = bob.pad.face.config.database.batl.batl_db:database', - 'batl-db-infrared = bob.pad.face.config.database.batl.batl_db_infrared:database', - 'batl-db-depth = bob.pad.face.config.database.batl.batl_db_depth:database', - 'batl-db-thermal = bob.pad.face.config.database.batl.batl_db_thermal:database', - 'batl-db-rgb-ir-d-grandtest = bob.pad.face.config.database.batl.batl_db_rgb_ir_d_grandtest:database', - 'celeb-a = bob.pad.face.config.celeb_a:database', - 'maskattack = bob.pad.face.config.maskattack:database', - 'casiasurf-color = bob.pad.face.config.casiasurf_color:database', - 'casiasurf = bob.pad.face.config.casiasurf:database', + "bob.pad.database": [ + "replay-attack = bob.pad.face.config.replay_attack:database", + "replay-mobile = bob.pad.face.config.replay_mobile:database", + "casiafasd = bob.pad.face.config.casiafasd:database", + "mifs = bob.pad.face.config.mifs:database", + "celeb-a = bob.pad.face.config.celeb_a:database", + "maskattack = bob.pad.face.config.maskattack:database", + "casiasurf-color = bob.pad.face.config.casiasurf_color:database", + "casiasurf = bob.pad.face.config.casiasurf:database", ], - # registered configurations: - 'bob.bio.config': [ + "bob.pad.config": [ # databases - 'replay-attack = bob.pad.face.config.replay_attack', - 'replay-mobile = bob.pad.face.config.replay_mobile', - 'casiafasd = bob.pad.face.config.casiafasd', - 'mifs = bob.pad.face.config.mifs', - 'batl-db = bob.pad.face.config.database.batl.batl_db', - 'batl-db-infrared = bob.pad.face.config.database.batl.batl_db_infrared', - 'batl-db-depth = bob.pad.face.config.database.batl.batl_db_depth', - 'batl-db-thermal = bob.pad.face.config.database.batl.batl_db_thermal', - 'batl-db-rgb-ir-d-grandtest = bob.pad.face.config.database.batl.batl_db_rgb_ir_d_grandtest', - 'celeb-a = bob.pad.face.config.celeb_a', - 'maskattack = bob.pad.face.config.maskattack', - - # baselines using SVM: - 'lbp-svm = bob.pad.face.config.lbp_svm', - 'qm-svm = bob.pad.face.config.qm_svm', - - # baselines using LR: - 'qm-lr = bob.pad.face.config.qm_lr', - 'lbp-lr-batl-D-T-IR = bob.pad.face.config.lbp_lr_batl_D_T_IR', # this pipe-line can be used both for BATL databases, Depth, Thermal and Infrared channels. - - # baselines using GMM: - 'qm-one-class-gmm = bob.pad.face.config.qm_one_class_gmm', - ], - - # registered preprocessors: - 'bob.pad.preprocessor': [ - 'empty-preprocessor = bob.pad.face.config.preprocessor.filename:empty_preprocessor', # no preprocessing - 'rgb-face-detect-dlib = bob.pad.face.config.preprocessor.video_face_crop:rgb_face_detector_dlib', # detect faces locally replacing database annotations - 'rgb-face-detect-mtcnn = bob.pad.face.config.preprocessor.video_face_crop:rgb_face_detector_mtcnn', # detect faces locally replacing database annotations - 'bw-face-detect-mtcnn = bob.pad.face.config.preprocessor.video_face_crop:bw_face_detect_mtcnn', # detect faces locally, return BW image - 'rgb-face-detect-check-quality-128x128 = bob.pad.face.config.preprocessor.face_feature_crop_quality_check:face_feature_0_128x128_crop_rgb', # detect faces locally replacing database annotations, also check face quality by trying to detect the eyes in cropped face. - 'video-face-crop-align-bw-ir-d-channels-3x128x128 = bob.pad.face.config.preprocessor.video_face_crop_align_block_patch:video_face_crop_align_bw_ir_d_channels_3x128x128', # Extract a BW-NIR-D patch of size (3 x 128 x 128) containing aligned face - 'video-face-crop-align-bw-ir-d-channels-3x128x128-vect = bob.pad.face.config.preprocessor.video_face_crop_align_block_patch:video_face_crop_align_bw_ir_d_channels_3x128x128_vect', # Extract a BW-NIR-D **vectorized** patch of size containing aligned face - ], - - # registered extractors: - 'bob.pad.extractor': [ - 'video-lbp-histogram-extractor-n8r1-uniform = bob.pad.face.config.extractor.video_lbp_histogram:video_lbp_histogram_extractor_n8r1_uniform', - 'video-quality-measure-galbally-msu = bob.pad.face.config.extractor.video_quality_measure:video_quality_measure_galbally_msu', - ], - - # registered algorithms: - 'bob.pad.algorithm': [ - 'video-svm-pad-algorithm-10k-grid-mean-std = bob.pad.face.config.algorithm.video_svm_pad_algorithm:video_svm_pad_algorithm_10k_grid_mean_std', - 'video-svm-pad-algorithm-10k-grid-mean-std-frame-level = bob.pad.face.config.algorithm.video_svm_pad_algorithm:video_svm_pad_algorithm_10k_grid_mean_std_frame_level', - 'video-svm-pad-algorithm-default-svm-param-mean-std-frame-level = bob.pad.face.config.algorithm.video_svm_pad_algorithm:video_svm_pad_algorithm_default_svm_param_mean_std_frame_level', + "replay-attack = bob.pad.face.config.replay_attack", + "replay-mobile = bob.pad.face.config.replay_mobile", + "casiafasd = bob.pad.face.config.casiafasd", + "mifs = bob.pad.face.config.mifs", + "celeb-a = bob.pad.face.config.celeb_a", + "maskattack = bob.pad.face.config.maskattack", + # LBPs + "lbp = bob.pad.face.config.lbp_64", + # quality measure + "qm = bob.pad.face.config.qm_64", + # classifiers + "svm-frames = bob.pad.face.config.svm_frames", ], - # registered ``bob pad ...`` commands - 'bob.pad.cli': [ - 'statistics = bob.pad.face.script.statistics:statistics', + "bob.pad.cli": [ + "statistics = bob.pad.face.script.statistics:statistics", ], }, - # Classifiers are important if you plan to distribute this package through # PyPI. You can find the complete list of classifiers that are valid and # useful here (http://pypi.python.org/pypi?%3Aaction=list_classifiers). classifiers=[ - 'Framework :: Bob', - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', - 'Natural Language :: English', - 'Programming Language :: Python', - 'Topic :: Scientific/Engineering :: Artificial Intelligence', + "Framework :: Bob", + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Natural Language :: English", + "Programming Language :: Python", + "Topic :: Scientific/Engineering :: Artificial Intelligence", ], )