Commit 0229bcc4 authored by Xinyi ZHANG's avatar Xinyi ZHANG Committed by Tiago de Freitas Pereira
Browse files

”new_version”

parent 038e214b
......@@ -24,28 +24,38 @@ else:
fixed_positions = None
cropped_positions = {"leye": (49, 72), "reye": (49, 38)}
cropped_positions={'leye':(49,72), 'reye':(49,38)}
preprocessor_transformer = FaceCrop(cropped_image_size=(224,224), cropped_positions={'leye':(49,72), 'reye':(49,38)}, color_channel='rgb',fixed_positions=fixed_positions)
transform_extra_arguments = (None if (cropped_positions is None or fixed_positions is not None) else (("annotations", "annotations"),))
preprocessor_transformer = FaceCrop(
cropped_image_size=(224, 224),
cropped_positions={"leye": (49, 72), "reye": (49, 38)},
color_channel="rgb",
fixed_positions=fixed_positions,
)
transform_extra_arguments = (
None
if (cropped_positions is None or fixed_positions is not None)
else (("annotations", "annotations"),)
)
model = InceptionResnetV1(pretrained='vggface2').eval()
model = InceptionResnetV1(pretrained="vggface2").eval()
extractor_transformer = pytorch_library_model(model=model)
algorithm = Distance(distance_function = scipy.spatial.distance.cosine,is_distance_function = True)
algorithm = Distance(
distance_function=scipy.spatial.distance.cosine, is_distance_function=True
)
# Chain the Transformers together
transformer = make_pipeline(
wrap(["sample"], preprocessor_transformer,transform_extra_arguments=transform_extra_arguments),
wrap(
["sample"],
preprocessor_transformer,
transform_extra_arguments=transform_extra_arguments,
),
wrap(["sample"], extractor_transformer)
# Add more transformers here if needed
)
......@@ -54,63 +64,3 @@ transformer = make_pipeline(
# Assemble the Vanilla Biometric pipeline and execute
pipeline = VanillaBiometricsPipeline(transformer, algorithm)
transformer = pipeline.transformer
<<<<<<< HEAD
=======
>>>>>>> new
......@@ -84,6 +84,7 @@ class opencv_model(TransformerMixin, BaseEstimator):
"""
if self.model is None:
self._load_model()
img = np.array(X)
......@@ -100,4 +101,5 @@ class opencv_model(TransformerMixin, BaseEstimator):
return d
def _more_tags(self):
return {"stateless": True, "requires_fit": False}
......@@ -80,7 +80,7 @@ class pytorch_loaded_model(TransformerMixin, BaseEstimator):
"""
if self.model is None:
self.load_model()
self._load_model()
X = torch.Tensor(X)
......@@ -94,6 +94,7 @@ class pytorch_loaded_model(TransformerMixin, BaseEstimator):
return d
def _more_tags(self):
return {"stateless": True, "requires_fit": False}
......
......@@ -74,7 +74,7 @@ class tf_model(TransformerMixin, BaseEstimator):
"""
if self.model is None:
self.load_model()
self._load_model()
X = check_array(X, allow_nd=True)
X = tf.convert_to_tensor(X)
......
......@@ -17,4 +17,4 @@ References
.. [ZSQ09] *W. Zhang, S. Shan, L. Qing, X. Chen and W. Gao*. **Are Gabor phases really useless for face recognition?** Pattern Analysis & Applications, 12:301-307, 2009.
.. [TFP18] de Freitas Pereira, Tiago, André Anjos, and Sébastien Marcel. "Heterogeneous face recognition using domain specific units." IEEE Transactions on Information Forensics and Security 14.7 (2018): 1803-1816.
.. [HRM06] *G. Heusch, Y. Rodriguez, and S. Marcel*. **Local Binary Patterns as an Image Preprocessing for Face Authentication**. In IEEE International Conference on Automatic Face and Gesture Recognition (AFGR), 2006.
.. [LGB18] *C. Li, M. Gunther and T. E. Boult*. **ECLIPSE: Ensembles of Centroids Leveraging Iteratively Processed Spatial Eclipse Clustering**. 2018 IEEE Winter Conference on Applications of Computer Vision (WACV), Lake Tahoe, NV, USA, 2018, pp. 131-140, doi: 10.1109/WACV.2018.00021.
.. [LGB18] *C. Li, M. Gunther and T. E. Boult*. **ECLIPSE: Ensembles of Centroids Leveraging Iteratively Processed Spatial Eclipse Clustering**. 2018 IEEE Winter Conference on Applications of Computer Vision (WACV), Lake Tahoe, NV, USA, 2018, pp. 131-140, doi: 10.1109/WACV.2018.00021.
\ No newline at end of file
Supports Markdown
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