From 857fa37515341398dda6ad5436e6d536e507816a Mon Sep 17 00:00:00 2001 From: Yannick DAYER Date: Thu, 21 Jul 2022 16:41:31 +0200 Subject: [PATCH] [pipeline] prevent wrap of "passthrough" estimator --- bob/bio/face/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bob/bio/face/utils.py b/bob/bio/face/utils.py index 0f41cd4..15e3d69 100644 --- a/bob/bio/face/utils.py +++ b/bob/bio/face/utils.py @@ -343,7 +343,7 @@ def embedding_transformer( **kwargs, ): """ - Creates a pipeline composed by and FaceCropper and an Embedding extractor. + Creates a pipeline composed by a FaceCropper and an Embedding extractor. This transformer is suited for Facenet based architectures .. warning:: @@ -360,6 +360,10 @@ def embedding_transformer( **kwargs, ) + # Support None and "passthrough" Estimators + if embedding is not None and type(embedding) is not str: + embedding = wrap(["sample"], embedding) + transformer = Pipeline( [ ( @@ -370,7 +374,7 @@ def embedding_transformer( transform_extra_arguments=transform_extra_arguments, ), ), - ("embedding", wrap(["sample"], embedding)), + ("embedding", embedding), ] ) -- GitLab