logo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readme
Files and versions

69 lines
1.6 KiB

# Inception-ResNet v1 Face Embedding Operator
*author: David Wang*
## Desription
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).
## Code Example
Extract face image embedding from './img.png'.
*Write the pipeline in simplified style*:
```python
import towhee
towhee.glob('./img.png') \
.image_decode.cv2() \
.face_embedding.inceptionresnetv1() \
.tolist()
```
*Write a same pipeline with explicit inputs/outputs name specifications:*
```python
import towhee
towhee.glob['path']('./img.png') \
.image_decode.cv2['path', 'img']() \
.face_embedding.inceptionresnetv1['img', 'vec']() \
.select('img','vec') \
.show()
```
<img src="https://towhee.io/face-embedding/inceptionresnetv1/raw/branch/main/result.png" alt="result" style="height:60px;"/>
## Factory Constructor
Create the operator via the following factory method
***face_embedding.inceptionresnetv1(image_size = 160)***
**Parameters:**
***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.
supported types: `int`, default is 160.
## Interface
A face embedding operator takes a face image as input. It extracts the embedding back to ndarray.
**Parameters:**
***img***: *towhee.types.Image (a sub-class of numpy.ndarray)*
​ The input image.
**Returns**: *numpy.ndarray*
​ The extracted image embedding.
3 years ago