# 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 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;"/>


<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.