class Face

Tencent AI 人脸相关能力.

Traits

Image

Constants

BASE_URL

DETECT

MULTI_DETECT

COMPARE

DETECT_CROSS_AGE

SHAPE

IDENTIFY

VERIFY

ADD

DELETE

GET_LIST

GET_INFO

CREATE_PERSON

DELETE_PERSON

SET_PERSON_INFO

GET_PERSON_INFO

GET_GROUP_LIST

GET_PERSON_LIST

Methods

mixed
detect(mixed $image, bool $big = true)

人脸分析:识别上传图像上面的人脸信息.

mixed
multiDetect(mixed $image)

多人脸检测:识别上传图像上面的人脸位置,支持多人脸识别.

mixed
compare(array $images)

人脸对比:对请求图片进行人脸对比.

array
detectCrossAge(mixed $source, mixed $target)

跨年龄人脸识别.

mixed
shape(mixed $image, bool $big = true)

五官检测:对请求图片进行五官定位.

mixed
identify(string $group_id, mixed $image, int $topn = 9)

人脸识别.

mixed
verify(string $person_id, mixed $image)

人脸验证

mixed
add(string $person_id, array $images, string $tag)

个体管理 => 增加人脸:将一个或一组人脸加入到一个个体中.

mixed
delete(string $person_id, array $face_ids)

个体管理 => 删除人脸:从一个个体中删除一个或一组人脸.

mixed
getList(string $person_id)

获取人脸列表.

mixed
getInfo(string $face_id)

获取人脸信息.

mixed
createPerson(array $group_ids, string $person_id, string $person_name, mixed $image, string $tag)

人体创建(属于一个组,或多个组).

mixed
deletePerson(string $person_id)

删除个体.

mixed
setPersonInfo(string $person_id, string $person_name, string $tag)

设置个体信息:设置个体的名字或备注.

mixed
getPersonInfo(string $person_id)

获取个体信息.

mixed
getGroupList()

获取组列表.

mixed
getPersonList(string $group_id)

获取人体列表.

Details

at line 68
mixed detect(mixed $image, bool $big = true)

人脸分析:识别上传图像上面的人脸信息.

检测给定图片中的所有人脸的位置 (x, y, w, h) 和相应的面部属性 包括性别 (gender),年龄, 表情 (expression), 魅力 (beauty), 眼镜 (glass) 和姿态 (pitch,roll,yaw).

Parameters

mixed $image 支持 JPG PNG BMP 格式
bool $big 检测模式,false-正常,true-大脸模式(默认)

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/detectface.shtml

at line 89
mixed multiDetect(mixed $image)

多人脸检测:识别上传图像上面的人脸位置,支持多人脸识别.

检测图片中的人脸位置,可以识别出一张图片上的多个人脸.

Parameters

mixed $image 支持 JPG PNG BMP 格式

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/detectmultiface.shtml

at line 107
mixed compare(array $images)

人脸对比:对请求图片进行人脸对比.

对请求图片的两个人脸进行对比,计算相似性以及五官相似度.

Parameters

array $images 支持 JPG PNG BMP 格式

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/facecompare.shtml

at line 133
array detectCrossAge(mixed $source, mixed $target)

跨年龄人脸识别.

对比两张图片,并找出相似度最高的两张人脸;支持多人合照、两张图片中的人处于不同年龄段的情况

Parameters

mixed $source
mixed $target

Return Value

array

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/detectcrossageface.shtml

at line 155
mixed shape(mixed $image, bool $big = true)

五官检测:对请求图片进行五官定位.

计算构成人脸轮廓的 88 个点,包括眉毛(左右各 8 点)、眼睛(左右各 8 点)、鼻子(13 点)、嘴巴(22 点)、脸型轮廓(21 点).

Parameters

mixed $image 支持 JPG PNG BMP 格式
bool $big 检测模式,false-正常,true-大脸模式(默认)

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/faceshape.shtml

at line 178
mixed identify(string $group_id, mixed $image, int $topn = 9)

人脸识别.

对于一个待识别的人脸图片,在一个组中识别出最相似的 N 个个体作为候选人返回,返回的 N 个个体按照相似度从大到小排列,N 由参数 topn 指定.

Parameters

string $group_id
mixed $image 支持 JPG PNG BMP 格式
int $topn 返回的候选人个数 默认 9

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/faceidentify.shtml

at line 199
mixed verify(string $person_id, mixed $image)

人脸验证

根据提供的图片和个体 ID,返回图片和个体是否是同一个人的判断以及置信度.

Parameters

string $person_id
mixed $image 支持 JPG PNG BMP 格式

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/faceverify.shtml

at line 228
mixed add(string $person_id, array $images, string $tag)

个体管理 => 增加人脸:将一个或一组人脸加入到一个个体中.

一个人脸只能被加入到一个个体中.一个个体最多允许包含 20 个人脸;加入几乎相同的人脸会返回错误.

Parameters

string $person_id
array $images 支持 JPG PNG BMP 格式
string $tag 备注信息

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/addface.shtml

at line 251
mixed delete(string $person_id, array $face_ids)

个体管理 => 删除人脸:从一个个体中删除一个或一组人脸.

Parameters

string $person_id
array $face_ids

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/delface.shtml

at line 271
mixed getList(string $person_id)

获取人脸列表.

获取一个个体下所有人脸 ID.

Parameters

string $person_id

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/getfaceids.shtml

at line 287
mixed getInfo(string $face_id)

获取人脸信息.

Parameters

string $face_id

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/getfaceinfo.shtml

at line 309
mixed createPerson(array $group_ids, string $person_id, string $person_name, mixed $image, string $tag)

人体创建(属于一个组,或多个组).

创建一个个体,并将个体放置到指定的组当中。一个组里面的个体总数上限为 20000 个。如果 ID 指定的组不存在,则会新建组并创建个体。

Parameters

array $group_ids
string $person_id
string $person_name
mixed $image 支持 JPG PNG BMP 格式
string $tag

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/newperson.shtml

at line 332
mixed deletePerson(string $person_id)

删除个体.

Parameters

string $person_id

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/delperson.shtml

at line 350
mixed setPersonInfo(string $person_id, string $person_name, string $tag)

设置个体信息:设置个体的名字或备注.

Parameters

string $person_id
string $person_name
string $tag

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/setinfo.shtml

at line 368
mixed getPersonInfo(string $person_id)

获取个体信息.

获取一个个体的信息,包括 ID,名字,备注,相关的人脸 ID 列表,以及所属组 ID 列表.

Parameters

string $person_id

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/getinfo.shtml

at line 384
mixed getGroupList()

获取组列表.

获取一个 AppId 下所有组 ID.

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/getgroupids.shtml

at line 402
mixed getPersonList(string $group_id)

获取人体列表.

获取一个组中的所有个体 ID.

Parameters

string $group_id

Return Value

mixed

Exceptions

TencentAIException

See also

https://ai.qq.com/doc/getpersonids.shtml