# Face Embeddings using Deepface *Author: Krishna katyal*
## Description The pipeline is used to extract the feature vector of detected faces in images. It uses the for face embeddings [`Deepface`](https://github.com/serengil/deepface).
## Code Example Load an image from path './test_face.jpg'. *Write a pipeline with explicit inputs/outputs name specifications:* ```python from towhee import pipe, ops, DataCollection p = ( pipe.input('path') .map('path', 'img', ops.image_decode()) .map('img', 'vec', ops.face_embedding.deepface(model_name = 'DeepFace')) .output('img', 'vec') ) DataCollection(p('./test_face.jpg')).show() ```
## Factory Constructor Create the operator via the following factory method ***face_embedding.deepface(model_name = 'which model to use')*** Model options: - VGG-Face - FaceNet - OpenFace - DeepFace - ArcFace - Dlib - DeepID - Facenet512
## Interface A face embedding operator takes a face image as input. It extracts the embedding in ndarray. **Parameters:** ​ ***img:*** *towhee.types.Image (a sub-class of numpy.ndarray)* ​ The input image. **Returns:** *numpy.ndarray* ​ The extracted image embedding.
**Reference** https://github.com/serengil/deepface You can refer to [Getting Started with Towhee](https://towhee.io/) for more details. If you have any questions, you can [submit an issue to the towhee repository](https://github.com/towhee-io/towhee/issues). # More Resources - [Exploring Multimodal Embeddings with FiftyOne and Milvus - Zilliz blog](https://zilliz.com/blog/exploring-multimodal-embeddings-with-fiftyone-and-milvus): This post explored how multimodal embeddings work with Voxel51 and Milvus. - [How to Get the Right Vector Embeddings - Zilliz blog](https://zilliz.com/blog/how-to-get-the-right-vector-embeddings): A comprehensive introduction to vector embeddings and how to generate them with popular open-source models. - [The guide to clip-vit-base-patch32 | OpenAI](https://zilliz.com/ai-models/clip-vit-base-patch32): clip-vit-base-patch32: a CLIP multimodal model variant by OpenAI for image and text embedding. - [Using Vector Search to Better Understand Computer Vision Data - Zilliz blog](https://zilliz.com/blog/use-vector-search-to-better-understand-computer-vision-data): How Vector Search improves your understanding of Computer Vision Data - [Sparse and Dense Embeddings - Zilliz blog](https://zilliz.com/learn/sparse-and-dense-embeddings): Learn about sparse and dense embeddings, their use cases, and a text classification example using these embeddings. - [Understanding Neural Network Embeddings - Zilliz blog](https://zilliz.com/learn/understanding-neural-network-embeddings): This article is dedicated to going a bit more in-depth into embeddings/embedding vectors, along with how they are used in modern ML algorithms and pipelines. - [Enhancing Information Retrieval with Sparse Embeddings | Zilliz Learn - Zilliz blog](https://zilliz.com/learn/enhancing-information-retrieval-learned-sparse-embeddings): Explore the inner workings, advantages, and practical applications of learned sparse embeddings with the Milvus vector database - [An Introduction to Vector Embeddings: What They Are and How to Use Them - Zilliz blog](https://zilliz.com/learn/everything-you-should-know-about-vector-embeddings): In this blog post, we will understand the concept of vector embeddings and explore its applications, best practices, and tools for working with embeddings.