Commit 11d0d666 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

update config files

parent e793be09
from bob.pad.face.database import BRSUPadDatabase from bob.pad.face.database import BRSUPadDatabase
from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector
from bob.extension import rc
database = DatabaseConnector( database = DatabaseConnector(BRSUPadDatabase())
BRSUPadDatabase(
protocol="test",
original_directory=rc["bob.db.brsu.directory"],
)
)
#!/usr/bin/env python
# encoding: utf-8
from bob.pad.face.database import CasiaSurfPadDatabase from bob.pad.face.database import CasiaSurfPadDatabase
from bob.extension import rc from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector
database = CasiaSurfPadDatabase( database = DatabaseConnector(CasiaSurfPadDatabase())
protocol='all',
original_directory=rc['bob.db.casiasurf.directory'],
original_extension=".jpg",
)
from bob.pad.face.database import CasiaSurfPadDatabase from bob.pad.face.database import CasiaSurfPadDatabase
from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector
from bob.extension import rc
database = DatabaseConnector( database = DatabaseConnector(CasiaSurfPadDatabase())
CasiaSurfPadDatabase(
protocol="color",
original_directory=rc.get("bob.db.casiasurf.directory"),
original_extension=".jpg",
)
)
...@@ -8,15 +8,7 @@ the link. ...@@ -8,15 +8,7 @@ the link.
""" """
from bob.extension import rc
from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector
from bob.pad.face.database.celeb_a import CELEBAPadDatabase from bob.pad.face.database.celeb_a import CELEBAPadDatabase
database = DatabaseConnector( database = DatabaseConnector(CELEBAPadDatabase())
CELEBAPadDatabase(
protocol="grandtest",
original_directory=rc.get("bob.db.celeba.directory"),
original_extension="",
training_depends_on_protocol=True,
)
)
import bob.pipelines as mario import bob.pipelines as mario
from bob.bio.face.helpers import face_crop_solver from bob.bio.face.helpers import face_crop_solver
from bob.bio.video import VideoLikeContainer from bob.bio.video.transformer import VideoWrapper
from bob.bio.video.transformer import Wrapper as TransformerWrapper
from bob.pad.face.extractor import LBPHistogram from bob.pad.face.extractor import LBPHistogram
database = globals().get("database") database = globals().get("database")
...@@ -16,31 +15,22 @@ else: ...@@ -16,31 +15,22 @@ else:
cropper = face_crop_solver( cropper = face_crop_solver(
cropped_image_size=64, cropped_positions=annotation_type, color_channel="gray" cropped_image_size=64, cropped_positions=annotation_type, color_channel="gray"
) )
preprocessor = TransformerWrapper(cropper) preprocessor = VideoWrapper(cropper)
preprocessor = mario.wrap( preprocessor = mario.wrap(
["sample", "checkpoint"], ["sample"],
preprocessor, preprocessor,
transform_extra_arguments=(("annotations", "annotations"),), transform_extra_arguments=(("annotations", "annotations"),),
features_dir="temp/faces-64",
save_func=VideoLikeContainer.save,
load_func=VideoLikeContainer.load,
) )
# Extractor # # Extractor #
extractor = TransformerWrapper( extractor = VideoWrapper(
LBPHistogram( LBPHistogram(
lbptype="uniform", lbp_type="uniform",
elbptype="regular", elbp_type="regular",
rad=1, radius=1,
neighbors=8, neighbors=8,
circ=False, circular=False,
dtype=None, dtype=None,
) )
) )
extractor = mario.wrap( extractor = mario.wrap(["sample"], extractor)
["sample", "checkpoint"],
extractor,
features_dir="temp/iqm-features",
save_func=VideoLikeContainer.save,
load_func=VideoLikeContainer.load,
)
from bob.pad.face.database import MaskAttackPadDatabase from bob.pad.face.database import MaskAttackPadDatabase
from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector
from bob.extension import rc
database = DatabaseConnector( database = DatabaseConnector(MaskAttackPadDatabase())
MaskAttackPadDatabase(
protocol="classification",
original_directory=rc.get("bob.db.maskattack.directory"),
original_extension=".avi",
)
)
...@@ -17,12 +17,5 @@ the link. ...@@ -17,12 +17,5 @@ the link.
""" """
from bob.pad.face.database import MIFSPadDatabase from bob.pad.face.database import MIFSPadDatabase
from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector
from bob.extension import rc
database = DatabaseConnector( database = DatabaseConnector(MIFSPadDatabase())
MIFSPadDatabase(
protocol="grandtest",
original_directory=rc.get("bob.db.mifs.directory"),
original_extension="",
)
)
import bob.pipelines as mario import bob.pipelines as mario
from bob.bio.face.helpers import face_crop_solver from bob.bio.face.helpers import face_crop_solver
from bob.bio.video import VideoLikeContainer from bob.bio.video.transformer import VideoWrapper
from bob.bio.video.transformer import Wrapper as TransformerWrapper
from bob.pad.face.extractor import ImageQualityMeasure from bob.pad.face.extractor import ImageQualityMeasure
database = globals().get("database") database = globals().get("database")
...@@ -14,22 +13,13 @@ else: ...@@ -14,22 +13,13 @@ else:
# Preprocessor # # Preprocessor #
cropper = face_crop_solver(cropped_image_size=64, cropped_positions=annotation_type) cropper = face_crop_solver(cropped_image_size=64, cropped_positions=annotation_type)
preprocessor = TransformerWrapper(cropper) preprocessor = VideoWrapper(cropper)
preprocessor = mario.wrap( preprocessor = mario.wrap(
["sample", "checkpoint"], ["sample"],
preprocessor, preprocessor,
transform_extra_arguments=(("annotations", "annotations"),), transform_extra_arguments=(("annotations", "annotations"),),
features_dir="temp/faces-64",
save_func=VideoLikeContainer.save,
load_func=VideoLikeContainer.load,
) )
# Extractor # # Extractor #
extractor = TransformerWrapper(ImageQualityMeasure(galbally=True, msu=True, dtype=None)) extractor = VideoWrapper(ImageQualityMeasure(galbally=True, msu=True, dtype=None))
extractor = mario.wrap( extractor = mario.wrap(["sample"], extractor)
["sample", "checkpoint"],
extractor,
features_dir="temp/iqm-features",
save_func=VideoLikeContainer.save,
load_func=VideoLikeContainer.load,
)
...@@ -11,12 +11,5 @@ the link. ...@@ -11,12 +11,5 @@ the link.
""" """
from bob.pad.face.database import ReplayPadDatabase from bob.pad.face.database import ReplayPadDatabase
from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector
from bob.extension import rc
database = DatabaseConnector( database = DatabaseConnector(ReplayPadDatabase())
ReplayPadDatabase(
protocol="grandtest",
original_directory=rc.get("bob.db.replay.directory"),
original_extension=".mov",
)
)
...@@ -14,12 +14,5 @@ the link. ...@@ -14,12 +14,5 @@ the link.
""" """
from bob.pad.face.database import ReplayMobilePadDatabase from bob.pad.face.database import ReplayMobilePadDatabase
from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector from bob.pad.base.pipelines.vanilla_pad import DatabaseConnector
from bob.extension import rc
database = DatabaseConnector( database = DatabaseConnector(ReplayMobilePadDatabase())
ReplayMobilePadDatabase(
protocol="grandtest",
original_directory=rc.get("bob.db.replaymobile.directory"),
original_extension=".mov",
)
)
import bob.pipelines as mario import bob.pipelines as mario
from bob.pad.face.transformer import VideoToFrames from bob.pad.face.transformer import VideoToFrames
from sklearn.model_selection import GridSearchCV from sklearn.model_selection import GridSearchCV
from sklearn.pipeline import make_pipeline from sklearn.pipeline import Pipeline
from sklearn.svm import SVC from sklearn.svm import SVC
preprocessor = globals().get("preprocessor") preprocessor = globals().get("preprocessor")
...@@ -20,13 +20,16 @@ param_grid = [ ...@@ -20,13 +20,16 @@ param_grid = [
classifier = GridSearchCV(SVC(), param_grid=param_grid, cv=3) classifier = GridSearchCV(SVC(), param_grid=param_grid, cv=3)
classifier = mario.wrap( classifier = mario.wrap(
["sample", "checkpoint"], ["sample"],
classifier, classifier,
fit_extra_arguments=[("y", "is_bonafide")], fit_extra_arguments=[("y", "is_bonafide")],
model_path="temp/svm.pkl",
) )
# Pipeline # # Pipeline #
frames_classifier = make_pipeline(frame_cont_to_array, classifier) frames_classifier = Pipeline([("frame_cont_to_array", frame_cont_to_array), ("classifier", classifier)])
pipeline = make_pipeline(preprocessor, extractor, frames_classifier) pipeline = Pipeline([
("preprocessor", preprocessor),
("extractor", extractor),
("svm", frames_classifier),
])
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