diff --git a/bob/bio/face/config/baseline/dummy.py b/bob/bio/face/config/baseline/dummy.py new file mode 100644 index 0000000000000000000000000000000000000000..7e0317a3f6a452a83efb5d2188f48081e71c386b --- /dev/null +++ b/bob/bio/face/config/baseline/dummy.py @@ -0,0 +1,50 @@ +from bob.pipelines import wrap +from sklearn.pipeline import make_pipeline +from bob.bio.base.pipelines.vanilla_biometrics import ( + Distance, + VanillaBiometricsPipeline, +) +from bob.pipelines.transformers import SampleLinearize + +if "database" in locals(): + annotation_type = database.annotation_type + fixed_positions = database.fixed_positions +else: + annotation_type = None + fixed_positions = None + + +import bob.ip.color +from sklearn.base import TransformerMixin, BaseEstimator +class ToGray(TransformerMixin, BaseEstimator): + + def transform(self, X, annotations=None): + return [bob.ip.color.rgb_to_gray(data)[0:10,0:10] for data in X] + + def _more_tags(self): + return {"stateless": True, "requires_fit": False} + + def fit(self, X, y=None): + return self + + +def load(annotation_type, fixed_positions=None): + + transform_extra_arguments = (("annotations", "annotations"),) + + transformer = make_pipeline( + wrap( + ["sample"], + ToGray(), + transform_extra_arguments=transform_extra_arguments, + ), + SampleLinearize(), + ) + + algorithm = Distance() + + return VanillaBiometricsPipeline(transformer, algorithm) + + +pipeline = load(annotation_type, fixed_positions) +transformer = pipeline.transformer diff --git a/setup.py b/setup.py index 9066286989f37a2ca4b0920d719ef2853fb2fa3d..d8e733b0aaccc39cf3dcb2feb4eac079454a0664 100644 --- a/setup.py +++ b/setup.py @@ -143,6 +143,7 @@ setup( 'arcface_insight_tf = bob.bio.face.config.baseline.arcface_insight_tf:transformer', 'gabor_graph = bob.bio.face.config.baseline.gabor_graph:transformer', 'lgbphs = bob.bio.face.config.baseline.lgbphs:transformer', + 'dummy = bob.bio.face.config.baseline.dummy:transformer', ], #baselines @@ -156,6 +157,7 @@ setup( 'arcface_insight_tf = bob.bio.face.config.baseline.arcface_insight_tf:pipeline', 'lgbphs = bob.bio.face.config.baseline.lgbphs:pipeline', 'lda = bob.bio.face.config.baseline.lda:pipeline', + 'dummy = bob.bio.face.config.baseline.dummy:pipeline', ],