全部产品

人脸识别

更新时间:2019-12-05 15:08:27

该功能基于图片 AI 技术实现,能够检测图片中的人脸 矩形框 和 属性,如果图片有多张人脸,会把多张人脸的矩形框和属性检测出来。基于这些元数据,应用可以做年龄、性别的统计。

参数

操作名称:imm/detecface

结果字段意义参考 数据类型

返回内容示例:

  1. {
  2. "Faces":[
  3. {
  4. "Age":29,
  5. "Attractive":0.95,
  6. "Emotion":"HAPPY",
  7. "EmotionConfidence":0.9875330924987793,
  8. "EmotionDetails":{
  9. "ANGRY":0.000016857109585544094,
  10. "CALM":0.012278525158762932,
  11. "DISGUSTED":0.000012325451280048583,
  12. "HAPPY":0.9875330924987793,
  13. "SAD":0.0000388074986403808,
  14. "SCARED":0.000006888585176056949,
  15. "SURPRISED":0.000054363932576961815
  16. },
  17. "FaceAttributes":{
  18. "Beard":"NONE",
  19. "BeardConfidence":1,
  20. "FaceBoundary":{
  21. "Height":928,
  22. "Left":607,
  23. "Top":628,
  24. "Width":894
  25. },
  26. "Glasses":"NONE",
  27. "GlassesConfidence":1,
  28. "Mask":"NONE",
  29. "MaskConfidence":0.9999999403953552,
  30. "Race":"YELLOW",
  31. "RaceConfidence":0.598323404788971
  32. },
  33. "FaceConfidence":0.9704222083091736,
  34. "FaceId":"4199e1985b6d3bb075f0994c82e6d2fd82a274c11ce183e1fdb222dd3aa8c7ce",
  35. "Gender":"MALE",
  36. "GenderConfidence":1,
  37. }
  38. ],
  39. "ImageUri":"oss://image-demo/person.jpg",
  40. "RequestId":"5C3D854A3243A93A275E9C99",
  41. "httpStatusCode":200,
  42. "success":true
  43. }

使用示例

假如请求 Bucket 是 imm-demo,该 Bucket 区域在 华东1,对应的域名是 oss-cn-hangzhou.aliyuncs.com,请求预览照片是 person.jpg,未签名的请求结构如下:

  1. http://image-demo.oss-cn-hangzhou.aliyuncs.com/person.jpg?x-oss-process=imm/detecface

这里通过 Python SDK 实现接口调用如下:

  1. bucket = oss2.Bucket(oss2.Auth(access_key_id, access_key_secret), endpoint, bucket_name)
  2. key = 'person.jpg'
  3. process = "imm/detecface" //进行图片人脸检测
  4. bucket.get_object(key, process=process)