什么是 Azure 人脸服务?What is the Azure Face service?


现在,将对此服务的所有 HTTP 请求强制执行 TLS 1.2。TLS 1.2 is now enforced for all HTTP requests to this service.

Azure 人脸服务提供用于检测、识别和分析图像中人脸的 AI 算法。The Azure Face service provides AI algorithms that detect, recognize, and analyze human faces in images. 人脸识别软件在许多不同场景中都很重要,其中包括安全、自然用户界面、图像内容分析和管理、移动应用和机器人。Facial recognition software is important in many different scenarios, such as security, natural user interface, image content analysis and management, mobile apps, and robotics.

人脸服务提供多种不同的人脸分析功能,以下部分一一概述了这些功能。The Face service provides several different facial analysis functions which are each outlined in the following sections.

人脸检测Face detection

人脸服务可以检测图像中的人脸,并返回其位置的矩形坐标。The Face service detects human faces in an image and returns the rectangle coordinates of their locations. 人脸检测还可提取一系列人脸相关属性,例如身头部姿势、性别、年龄、情感、面部毛发和眼镜。Optionally, face detection can extract a series of face-related attributes, such as head pose, gender, age, emotion, facial hair, and glasses.


也可以通过计算机视觉服务使用人脸检测功能。The face detection feature is also available through the Computer Vision service. 但是,如果要对人脸数据执行进一步操作,则应改用此服务。However, if you want to do further operations with face data, you should use this service instead.


有关人脸检测的详细信息,请参阅人脸检测概念文章。For more information on face detection, see the Face detection concepts article. 另请参阅检测 API 参考文档。Also see the Detect API reference documentation.

人脸验证Face verification

验证 API 针对检测到的两个人脸执行身份验证,或从一个检测到的人脸对一个人员对象执行身份验证。The Verify API does an authentication against two detected faces or from one detected face to one person object. 实际上,它会评估两张脸是否属于同一个人。Practically, it evaluates whether two faces belong to the same person. 此功能可能适用于安全方案。This capability is potentially useful in security scenarios. 有关详细信息,请参阅人脸识别概念指南或验证 API 参考文档。For more information, see the Facial recognition concepts guide or the Verify API reference documentation.

查找相似人脸Find similar faces

查找相似人脸 API 会在目标人脸和一组候选人脸之间进行人脸匹配,找出与目标人脸相似的一小组人脸。The Find Similar API does face matching between target face and a set of candidate faces, finding a smaller set of faces that look similar to the target face. 这对于按图像进行人脸搜索很有用。This is useful for doing a face search by image.

该 API 支持两种工作模式:matchPerson 和 matchFace 。Two working modes, matchPerson and matchFace, are supported. 使用验证 API 针对同一人进行筛选后,matchPerson 模式会返回相似人脸。The matchPerson mode returns similar faces after filtering for the same person by using the Verify API. matchFace 模式会忽略同一人筛选器。The matchFace mode ignores the same-person filter. 它返回相似候选人脸的列表,这些人脸不一定属于同一人。It returns a list of similar candidate faces that may or may not belong to the same person.

以下示例显示了目标人脸:The following example shows the target face:


这些图像是候选人脸:And these images are the candidate faces:


为了查找四张相似人脸,matchPerson 模式会返回 a 和 b,它们与目标人脸显示的是同一个人。To find four similar faces, the matchPerson mode returns a and b, which show the same person as the target face. matchFace 模式返回 a、b、c 和 d—恰好四个候选项,即使某些选项与目标不是同一人或者相似度低,也是如此。The matchFace mode returns a, b, c, and d—exactly four candidates, even if some aren't the same person as the target or have low similarity. 有关详细信息,请参阅人脸识别概念指南或查找相似人脸 API 参考文档。For more information, see the Facial recognition concepts guide or the Find Similar API reference documentation.

人脸分组Face grouping

组 API 会基于相似性将未知人脸的集合分为几组。The Group API divides a set of unknown faces into several groups based on similarity. 每个组是原始人脸集合的互不相交真子集。Each group is a disjoint proper subset of the original set of faces. 一个组中的所有人脸可能属于同一人。All of the faces in a group are likely to belong to the same person. 一个人可能有多个不同的组。There can be several different groups for a single person. 组按其他因素(例如表情)区分。The groups are differentiated by another factor, such as expression, for example. 有关详细信息,请参阅人脸识别概念指南或分组 API 参考文档。For more information, see the Facial recognition concepts guide or the Group API reference documentation.

人员识别Person identification

识别 API 用于根据人员数据库识别检测到的人脸(人脸识别搜索)。The Identify API is used to identify a detected face against a database of people (facial recognition search). 此功能可用于照片管理软件中的自动图像标记。This feature might be useful for automatic image tagging in photo management software. 需提前创建数据库,以后可以不断地对其进行编辑。You create the database in advance, and you can edit it over time.

下图显示名为 "myfriends" 的数据库的示例。The following image shows an example of a database named "myfriends". 每个组最多可以包含 100 万个不同的 person 对象。Each group can contain up to 1 million different person objects. 每个人员对象可以注册最多 248 张人脸。Each person object can have up to 248 faces registered.


创建并训练数据库后,可以对组使用新检测到的人脸执行识别。After you create and train a database, you can do identification against the group with a new detected face. 如果人脸被标识为组中的某一人员,则返回该人员对象。If the face is identified as a person in the group, the person object is returned.

有关人员识别的详细信息,请参阅人脸识别概念指南或识别 API 参考文档。For more information about person identification, see the Facial recognition concepts guide or the Identify API reference documentation.

使用 Docker 容器进行本地部署Deploy on premises using Docker containers

使用人脸容器(预览版)在本地部署 API 功能。Use the Face container (preview) to deploy API features on-premises. 借助此 Docker 容器,你能够将服务进一步引入数据,以满足合规性、安全性或其他操作目的。This Docker container enables you to bring the service closer to your data for compliance, security or other operational reasons.

示例应用Sample apps

以下示例应用程序显示了人脸服务的多种用法:The following sample applications show a few ways to use the Face service:

数据隐私和安全性Data privacy and security

与所有认知服务资源一样,使用人脸服务的开发人员必须了解 Microsoft 针对客户数据的政策。As with all of the Cognitive Services resources, developers who use the Face service must be aware of Microsoft's policies on customer data. 有关详细信息,请参阅 Microsoft 信任中心内的“认知服务”页For more information, see the Cognitive Services page on the Microsoft Trust Center.

后续步骤Next steps

按照快速入门中的说明,使用所选语言对人脸识别应用的基本组件进行编码。Follow a quickstart to code the basic components of a face recognition app in the language of your choice.