@ -3,11 +3,18 @@
*author: David Wang*
*author: David Wang*
< br / >
## Desription
## Description
This operator extracts embedding vector from facial image using [Inception-ResNet ](https://arxiv.org/pdf/1602.07261.pdf ). The implementation is an adaptation from [timesler/facenet-pytorch ](https://github.com/timesler/facenet-pytorch ).
This operator extracts embedding vector from facial image using [Inception-ResNet ](https://arxiv.org/pdf/1602.07261.pdf ). The implementation is an adaptation from [timesler/facenet-pytorch ](https://github.com/timesler/facenet-pytorch ).
< br / >
## Code Example
## Code Example
Extract face image embedding from './img.png'.
Extract face image embedding from './img.png'.
@ -31,12 +38,16 @@ import towhee
towhee.glob['path']('./img.png') \
towhee.glob['path']('./img.png') \
.image_decode.cv2['path', 'img']() \
.image_decode.cv2['path', 'img']() \
.face_embedding.inceptionresnetv1['img', 'vec']() \
.face_embedding.inceptionresnetv1['img', 'vec']() \
.select('img','vec' ) \
.select['img','vec']( ) \
.show()
.show()
```
```
< img src = "https://towhee.io/face-embedding/inceptionresnetv1/raw/branch/main/result.png" alt = "result" style = "height:60px;" / >
< img src = "https://towhee.io/face-embedding/inceptionresnetv1/raw/branch/main/result.png" alt = "result" style = "height:60px;" / >
< br / >
## Factory Constructor
## Factory Constructor
Create the operator via the following factory method
Create the operator via the following factory method
@ -45,24 +56,27 @@ Create the operator via the following factory method
**Parameters:**
**Parameters:**
***image_size***: *int*
***image_size: *** *int*
Scaled input image size to extract embedding. The higher resolution would generate the more discriminateive feature but cost more time to calculate.
Scaled input image size to extract embedding. The higher resolution would generate the more discriminateive feature but cost more time to calculate.
supported types: `int` , default is 160.
supported types: `int` , default is 160.
< br / >
## Interface
## Interface
A face embedding operator takes a face image as input. It extracts the embedding back to ndarray.
A face embedding operator takes a face image as input. It extracts the embedding back to ndarray.
**Parameters:**
**Parameters:**
** *img***: *towhee.types.Image (a sub-class of numpy.ndarray)*
** *img: *** *towhee.types.Image (a sub-class of numpy.ndarray)*
The input image.
The input image.
**Returns**: *numpy.ndarray*
**Returns: ** *numpy.ndarray*
The extracted image embedding.
The extracted image embedding.