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

78 lines
1.6 KiB

# MobileFaceNet Face Landmark Detector
3 years ago
*author: David Wang*
<br />
## Description
[MobileFaceNets](https://arxiv.org/pdf/1804.07573) is a class of extremely efficient CNN models to extract 68 landmarks from a facial image. It use less than 1 million parameters and is specifically tailored for high-accuracy real-time face verification on mobile and embedded devices. This repository is an adaptation from [cuijian/pytorch_face_landmark](https://github.com/cunjian/pytorch_face_landmark).
<br />
## Code Example
Extract facial landmarks from './img1.jpg'.
*Write a pipeline with explicit inputs/outputs name specifications:*
```python
from towhee import pipe, ops, DataCollection
p = (
pipe.input('path')
.map('path', 'img', ops.image_decode())
.map('img', 'landmark', ops.face_landmark_detection.mobilefacenet())
.output('img', 'landmark')
)
DataCollection(p('./img1.jpg')).show()
```
<img src="https://towhee.io/face-landmark-detection/mobilefacenet/raw/branch/main/result.png" alt="result1" style="height:20px;"/>
<br />
## Factory Constructor
Create the operator via the following factory method:
***face_landmark_detection.mobilefacenet(pretrained = True)***
**Parameters:**
***pretrained***
​ whether load the pre-trained weights.
​ supported types: `bool`, default is True, using pre-trained weights.
<br />
## Interface
An image embedding operator takes an image as input. it extracts the embedding as ndarray.
**Parameters:**
***img:*** *towhee.types.Image (a sub-class of numpy.ndarray)*
​ The input image.
**Returns:** *numpy.ndarray*
​ The extracted facial landmarks.