Cloud Native应用交付

  • 首页
  • 关于本站
  • 个人介绍
  • Downloads
  • Repo
    • Github
    • Container
  • F5
    • F5 Python SDK
    • F5-container
    • F5-LBaaS
  • 社交
    • 联系我
    • 微信/微博
    • 公众号
    • 打赏赞助
行至水穷处 坐看云起时
Cloud Native Application Services: cnadn.net
  1. 首页
  2. AI
  3. 正文

Using Azure cognitive service to do face detection

2025年01月22日 1111点热度 0人点赞 0条评论

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from azure.cognitiveservices.vision.face import FaceClient
from msrest.authentication import CognitiveServicesCredentials
import os
 
class colors:
    green = '\033[92m'
    blue = '\033[94m'
    red = '\033[31m'
    yellow = '\033[33m'
    reset = '\033[0m'
 
# Paste your endpoint and key below
cog_endpoint = "https://westus.api.cognitive.microsoft.com/"
cog_key = "fdfsdfdsfsdfsdfsdfdsf"
face_client = FaceClient(cog_endpoint, CognitiveServicesCredentials(cog_key))
 
 
# Change the URL between the quotes below to run your own faces through the Azure Face Service!
#face_to_analyze = "https://raw.githubusercontent.com/pluralsight-cloud/AI-900-Artificial-Intelligence-Workloads-and-Considerations/main/images/image-analysis/2-azureface-couple.jpg"
face_to_analyze = "https://gd-hbimg.huaban.com/afdf6ae71a2aae825ed9ebb9d1157f3dee5fa6c9c2cea-YszQ1F_fw1200webp"
 
detected_faces = face_client.face.detect_with_url(url=face_to_analyze,
return_face_attributes=list(['headPose','glasses','accessories','blur','noise','occlusion']),
return_face_landmarks=True,
return_face_id=False)
if not detected_faces:
    print("No faces were found in the image! Please try another image!")
    input("Press Enter to exit")
    quit()
 
print("\n-----Facial Attributes-----")
for count, face in enumerate(detected_faces):
    print()
    print(f"{colors.green}\nPerson Number: {colors.reset}" + str(count))
    for acc in face.face_attributes.accessories:
        print(f"{colors.red}\nAccessories: {colors.reset}" + str(acc))
    print(f"{colors.yellow}\nGlasses: {colors.reset}" + str(face.face_attributes.glasses))
    print(f"{colors.blue}\nBlur: {colors.reset}" + str(face.face_attributes.blur.blur_level))
    print(f"{colors.green}\nOcclusion: {colors.reset}" + str(face.face_attributes.occlusion))
    print(f"{colors.red}\nNoise Level: {colors.reset}" + str(face.face_attributes.noise.noise_level))
    print("\n----------\n")
 
input("\nPress Enter to Exit...")
 

检测结果:

-----Facial Attributes-----

Person Number: 0

Glasses: GlassesType.no_glasses

Blur: BlurLevel.low

Occlusion: {'additional_properties': {}, 'forehead_occluded': False, 'eye_occluded': False, 'mouth_occluded': False}

Noise Level: NoiseLevel.low


Person Number: 1

Glasses: GlassesType.no_glasses

Blur: BlurLevel.low

Occlusion: {'additional_properties': {}, 'forehead_occluded': False, 'eye_occluded': False, 'mouth_occluded': False}

Noise Level: NoiseLevel.high


Person Number: 2

Glasses: GlassesType.no_glasses

Blur: BlurLevel.low

Occlusion: {'additional_properties': {}, 'forehead_occluded': False, 'eye_occluded': False, 'mouth_occluded': False}

Noise Level: NoiseLevel.low


Person Number: 3

Accessories: {'additional_properties': {}, 'type': <AccessoryType.glasses: 'glasses'>, 'confidence': 1.0}

Glasses: GlassesType.reading_glasses

Blur: BlurLevel.low

Occlusion: {'additional_properties': {}, 'forehead_occluded': False, 'eye_occluded': False, 'mouth_occluded': False}

Noise Level: NoiseLevel.low


Person Number: 4

Glasses: GlassesType.no_glasses

Blur: BlurLevel.low

Occlusion: {'additional_properties': {}, 'forehead_occluded': False, 'eye_occluded': False, 'mouth_occluded': False}

Noise Level: NoiseLevel.medium


Person Number: 5

Accessories: {'additional_properties': {}, 'type': <AccessoryType.head_wear: 'headWear'>, 'confidence': 0.98}

Glasses: GlassesType.no_glasses

Blur: BlurLevel.medium

Occlusion: {'additional_properties': {}, 'forehead_occluded': True, 'eye_occluded': False, 'mouth_occluded': False}

Noise Level: NoiseLevel.low


相关文章

  • Use Azure cognitive to analyze image
  • Small step in Data and AI- Azure Certificated
  • Use Azure custom vision to do object detection
  • 在Azure ML designer中进行聚类(clustering)模型分析
  • 在Azure ML designer中利用2-class logistic regression做Classification模型
本作品采用 知识共享署名-非商业性使用 4.0 国际许可协议 进行许可
标签: azure cognitive
最后更新:2025年01月22日

纳米

linjing.io

打赏 点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理。

页面AI聊天助手

纳米

linjing.io

☁️迈向Cloud Native ADC ☁️

认证获得:
TOGAF: ID 152743
Kubernetes: CKA #664
Microsoft: MCSE MCDBA
Cisco: CCNP
Juniper: JNCIS
F5:
F5 Certified Solution Expert, Security
F5 Certified Technology Specialist, LTM/GTM/APM/ASM
F5 Certified BIG-IP Administrator
  • 点击查看本博技术要素列表
  • 归档
    分类
    • AI
    • Automation
    • Avi Networks
    • Cisco ACI
    • CISCO资源
    • F5 with ELK
    • F5-Tech tips
    • F5技术
    • Juniper
    • Linux
    • NGINX
    • SDN
    • ServiceMesh
    • WEB编程
    • WINDOWS相关
    • 业界文章
    • 交换机技术
    • 化云为雨/Openstack
    • 协议原理
    • 容器/k8s
    • 我的工作
    • 我的生活
    • 网站技术
    • 路由器技术
    • 项目案例
    标签聚合
    envoy bigip docker neutron flannel gtm istio k8s openstack irule F5 DNS network nginx api
    最近评论
    汤姆 发布于 8 个月前(09月10日) 嗨,楼主,里面的json怎么下载啊,怎么收费啊?
    汤姆 发布于 8 个月前(09月09日) 大佬,kib的页面可以分享下吗?谢谢
    zhangsha 发布于 1 年前(05月12日) 资料发给我下,谢谢纳米同志!!!!lyx895@qq.com
    李成才 发布于 1 年前(01月02日) 麻烦了,谢谢大佬
    纳米 发布于 1 年前(01月02日) 你好。是的,因为以前下载系统插件在一次升级后将所有的下载生成信息全弄丢了。所以不少文件无法下载。DN...
    浏览次数
    • Downloads - 183,754 views
    • 联系我 - 118,966 views
    • 迄今为止最全最深入的BIGIP-DNS/GTM原理及培训资料 - 116,431 views
    • Github - 103,631 views
    • F5常见log日志解释 - 79,766 views
    • 从传统ADC迈向CLOUD NATIVE ADC - 下载 - 74,617 views
    • Sniffer Pro 4 70 530抓包软件 中文版+视频教程 - 74,320 views
    • 迄今为止最全最深入的BIGIP-DNS/GTM原理及培训资料 - 67,770 views
    • 关于本站 - 60,882 views
    • 这篇文档您是否感兴趣 - 55,491 views
    链接表
    • F5SE创新
    • Jimmy Song‘s Blog
    • SDNlab
    • Service Mesh社区
    • 三斗室
    • 个人profile
    • 云原生社区

    COPYRIGHT © 2023 Cloud Native 应用交付. ALL RIGHTS RESERVED.

    Theme Kratos Made By Seaton Jiang

    京ICP备14048088号-1

    京公网安备 11010502041506号