Py之face_alignment:face_alignment库的简介、安装、使用方法之详细攻略

简介: Py之face_alignment:face_alignment库的简介、安装、使用方法之详细攻略

face_alignment库的简介


      使用世界上最精确的面部定位网络,从Python中检测面部地标,该网络能够检测二维和三维坐标中的点。它使用了FAN最先进的基于深度学习的面部对齐方法。


Github地址:https://github.com/1adrianb/face-alignment



1、指定在CPU / GPU上运行


import face_alignment

# cuda for CUDA

fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, device='cpu')


2、使用特定的面部检测器检测地标。


默认情况下,该包将使用SFD面部检测器。但是,用户也可以选择使用dlib或预先存在的地面真实边界框。


import face_alignment

# sfd for SFD, dlib for Dlib and folder for existing bounding boxes.

fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, face_detector='sfd')


3、一次性处理整个目录


import face_alignment

from skimage import io

fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=False)

preds = fa.get_landmarks_from_directory('../test/assets/')



face_alignment库的安装


pip install face-alignment







face_alignment库的使用方法


1、检测图像中的二维、三维人脸标志




import face_alignment

from skimage import io

fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=False)

input = io.imread('../test/assets/aflw-test.jpg')

preds = fa.get_landmarks(input)

import face_alignment

from skimage import io

fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._3D, flip_input=False)

input = io.imread('../test/assets/aflw-test.jpg')

preds = fa.get_landmarks(input)

————————————————


相关文章
|
2月前
|
TensorFlow 算法框架/工具
【Tensorflow】图解tf.image.extract_patches的用法--提取图片特定区域
文章通过图解和示例详细解释了TensorFlow中tf.image.extract_patches函数的用法,展示了如何使用该函数从图像中提取特定区域或分割图像为多个子图像。
39 0
|
5月前
|
计算机视觉
这是一个关于face_recognition和dlib库的安装(亲测有用,毕竟我代码都写出来了)
这是一个关于face_recognition和dlib库的安装(亲测有用,毕竟我代码都写出来了)
|
Python 容器
Python Tkinter教程(三)——三种几何布局管理器Pack、Place和Grid的所有参数及相关方法及详细用法
Python Tkinter教程(三)——三种几何布局管理器Pack、Place和Grid的所有参数及相关方法及详细用法
338 0
|
计算机视觉 Python
|
Python
Python中,如何使用ImageDraw在Image上绘制粗线?
Python中,如何使用ImageDraw在Image上绘制粗线?
224 0
|
机器学习/深度学习 异构计算 Python
Py之face_alignment:face_alignment库的简介、安装、使用方法之详细攻略
Py之face_alignment:face_alignment库的简介、安装、使用方法之详细攻略
Py之face_alignment:face_alignment库的简介、安装、使用方法之详细攻略
|
存储 缓存 数据可视化
qml开发笔记(四):可视化元素Rectangle、Image
qml开发笔记(四):可视化元素Rectangle、Image
qml开发笔记(四):可视化元素Rectangle、Image
Dataset:White Wine Quality白葡萄酒品质数据集的简介、下载、使用方法之详细攻略
Dataset:White Wine Quality白葡萄酒品质数据集的简介、下载、使用方法之详细攻略
|
机器学习/深度学习 计算机视觉 Python
CV之face_recognition:Py之face_recognition库安装、介绍、使用方法详细攻略
CV之face_recognition:Py之face_recognition库安装、介绍、使用方法详细攻略
CV之face_recognition:Py之face_recognition库安装、介绍、使用方法详细攻略
|
编解码 自动驾驶 定位技术
Dataset之ApolloScape :ApolloScape Scene Parsing数据集的简介、下载、使用方法之详细攻略
Dataset之ApolloScape :ApolloScape Scene Parsing数据集的简介、下载、使用方法之详细攻略
Dataset之ApolloScape :ApolloScape Scene Parsing数据集的简介、下载、使用方法之详细攻略