copied
Readme
Files and versions
1.5 KiB
Inception-ResNet v1 Face Embedding Operator
author: David Wang
Description
This operator extracts embedding vector from facial image using Inception-ResNet. The implementation is an adaptation from timesler/facenet-pytorch.
Code Example
Extract face image embedding from './img.png'.
Write a pipeline with explicit inputs/outputs name specifications:
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()

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.
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.
1.5 KiB
Inception-ResNet v1 Face Embedding Operator
author: David Wang
Description
This operator extracts embedding vector from facial image using Inception-ResNet. The implementation is an adaptation from timesler/facenet-pytorch.
Code Example
Extract face image embedding from './img.png'.
Write a pipeline with explicit inputs/outputs name specifications:
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()

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