|
|
@ -5,23 +5,46 @@ |
|
|
|
|
|
|
|
## Desription |
|
|
|
|
|
|
|
A class of extremely efficient CNN models to extract 68 landmarks from a facial image[1]. |
|
|
|
A class of extremely efficient CNN models to extract 68 landmarks from a facial image[MobileFaceNets](https://arxiv.org/pdf/1804.07573.pdf). |
|
|
|
|
|
|
|
## Code Example |
|
|
|
|
|
|
|
extracted facial landmark from './img1.jpg'. |
|
|
|
|
|
|
|
*Write the pipeline in simplified style*: |
|
|
|
|
|
|
|
```python |
|
|
|
from towhee import dc |
|
|
|
|
|
|
|
dc.glob('./img1.jpg') \ |
|
|
|
.face_landmark_detection.mobilefacenet() \ |
|
|
|
.to_list() |
|
|
|
``` |
|
|
|
|
|
|
|
*Write a same pipeline with explicit inputs/outputs name specifications:* |
|
|
|
|
|
|
|
```python |
|
|
|
from towhee import ops |
|
|
|
from towhee import dc |
|
|
|
|
|
|
|
model = ops.face_landmark_detection.mobilefacenet() |
|
|
|
landmark = model(img) |
|
|
|
dc.glob['path']('./img1.jpg') \ |
|
|
|
.image_decode.cv2['path', 'img']() \ |
|
|
|
.face_landmark_detection.mobilefacenet() \ |
|
|
|
.to_list() |
|
|
|
``` |
|
|
|
|
|
|
|
## Factory Constructor |
|
|
|
|
|
|
|
Create the operator via the following factory method |
|
|
|
|
|
|
|
***ops.face_landmark_detection.mobilefacenet()*** |
|
|
|
***ops.face_landmark_detection.mobilefacenet(pretrained = True)*** |
|
|
|
|
|
|
|
**Parameters:** |
|
|
|
|
|
|
|
***pretrained*** |
|
|
|
|
|
|
|
whether load the pretrained weights.. |
|
|
|
|
|
|
|
supported types: `bool`, default is True, using pretrained weights |
|
|
|
|
|
|
|
## Interface |
|
|
|
|
|
|
@ -29,13 +52,6 @@ An image embedding operator takes an image as input. it extracts the embedding b |
|
|
|
|
|
|
|
**Args:** |
|
|
|
|
|
|
|
***framework*** |
|
|
|
|
|
|
|
the framework of the model |
|
|
|
|
|
|
|
supported types: `str`, default is 'pytorch' |
|
|
|
|
|
|
|
|
|
|
|
***pretrained*** |
|
|
|
|
|
|
|
whether load the pretrained weights.. |
|
|
@ -45,7 +61,7 @@ An image embedding operator takes an image as input. it extracts the embedding b |
|
|
|
|
|
|
|
**Parameters:** |
|
|
|
|
|
|
|
***image***: *towhee._types.Image* |
|
|
|
***image***: *np.ndarray* |
|
|
|
|
|
|
|
The input image. |
|
|
|
|
|
|
@ -54,32 +70,3 @@ An image embedding operator takes an image as input. it extracts the embedding b |
|
|
|
|
|
|
|
The extracted facial landmark. |
|
|
|
|
|
|
|
## Code Example |
|
|
|
|
|
|
|
extracted facial landmark from './img1.jpg'. |
|
|
|
|
|
|
|
*Write the pipeline in simplified style*: |
|
|
|
|
|
|
|
```python |
|
|
|
import towhee.DataCollection as dc |
|
|
|
|
|
|
|
dc.glob('./img1.jpg') |
|
|
|
.face_landmark_detection.mobilefacenet() |
|
|
|
.to_list() |
|
|
|
``` |
|
|
|
|
|
|
|
*Write a same pipeline with explicit inputs/outputs name specifications:* |
|
|
|
|
|
|
|
```python |
|
|
|
import towhee.DataCollection as dc |
|
|
|
|
|
|
|
dc.glob['path']('./img1.jpg') |
|
|
|
.image_decode.cv2['path', 'img']() |
|
|
|
.face_landmark_detection.mobilefacenet() |
|
|
|
.to_list() |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
## Reference |
|
|
|
|
|
|
|
[1].https://arxiv.org/pdf/1804.07573.pdf |
|
|
|