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

76 lines
1.5 KiB

# Inception-ResNet v1 Face Embedding Operator
*author: David Wang*
<br />
## 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).
<br />
## Code Example
Extract face image embedding from './img.png'.
*Write a pipeline with explicit inputs/outputs name specifications:*
```python
from towhee.dc2 import pipe, ops, DataCollection
p = (
pipe.input('path')
.map('path', 'img', ops.image_decode())
.map('img', 'vec', ops.face_embedding.inceptionresnetv1())
.output('img', 'vec')
)
DataCollection(p('img.png')).show()
```
<img src="https://towhee.io/face-embedding/inceptionresnetv1/raw/branch/main/result.png" alt="result" style="height:60px;"/>
<br />
## 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 discriminative feature but cost more time to calculate.
supported types: `int`, default is 160.
<br />
## 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.
3 years ago