当前位置: 首页 > news >正文

北京网站建设seo优化seo网站优化多少钱

北京网站建设seo优化,seo网站优化多少钱,企业建立网站需要,免费域名建站目录 简介 一、InsightFace介绍 二、安装 三、快速体验 四、代码实战 1、人脸检测 2、人脸识别 五、代码及示例图片链接 简介 目前github有非常多的人脸识别开源项目,下面列出几个常用的开源项目: 1、deepface 2、CompreFace 3、face_recogn…

目录

简介

一、InsightFace介绍 

二、安装

三、快速体验

四、代码实战

1、人脸检测

 2、人脸识别

五、代码及示例图片链接


简介

目前github有非常多的人脸识别开源项目,下面列出几个常用的开源项目:

1、deepface

2、CompreFace

3、face_recognition

4、insightface

5、facenet

6、facenet-pytorch

开源的人脸检测项目非常多,本文介绍一下insightface的使用方法。首先给出insightface的官方效果图:

 再看一下insightface的网图检测效果:

效果展示结束,下面进入详细的介绍。

一、InsightFace介绍 

insightface是一个开源的基于Pytorch和MXNet实现的2D/3D人脸分析工具,它实现了多个SOTA人脸识别、人脸检测、人脸对齐算法,并对训练和部署进行了优化。目前insightface主分支要求PyTorch 1.6+/MXNet=1.6-1.8,python 3.x。

二、安装

insightface安装非常简单,使用如下命令:

pip install insightface

安装onnxruntime用于推理(有gpu就把onnxruntime替换为onnxruntime-gpu):

pip install onnxruntime

三、快速体验

insightface给出了代码体验示例,文件路径为examples/demo_analysis.py,直接运行该文件,可以得到以下结果:

 注意:可能遇到以下报错“AttributeError: module 'numpy' has no attribute 'int'.”

AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the 
release note link for additional information.

解决方法:找到安装包目录的face_analysis.py文件,比如\xxxx\envs\blog\lib\site-packages\insightface\app\face_analysis.py,将该文件内的所有np.int替换为‘int’(记得带上‘’),如以下代码(该报错可能由于numpy版本问题引起):

   def draw_on(self, img, faces):import cv2dimg = img.copy()for i in range(len(faces)):face = faces[i]box = face.bbox.astype('int')           #      《=====看这里color = (0, 0, 255)cv2.rectangle(dimg, (box[0], box[1]), (box[2], box[3]), color, 2)if face.kps is not None:kps = face.kps.astype("int")         #      《=====看这里#print(landmark.shape)for l in range(kps.shape[0]):color = (0, 0, 255)if l == 0 or l == 3:color = (0, 255, 0)cv2.circle(dimg, (kps[l][0], kps[l][1]), 1, color,2)if face.gender is not None and face.age is not None:cv2.putText(dimg,'%s,%d'%(face.sex,face.age), (box[0]-1, box[1]-4),cv2.FONT_HERSHEY_COMPLEX,0.7,(0,255,0),1)#for key, value in face.items():#    if key.startswith('landmark_3d'):#        print(key, value.shape)#        print(value[0:10,:])#        lmk = np.round(value).astype(np.int)#        for l in range(lmk.shape[0]):#            color = (255, 0, 0)#            cv2.circle(dimg, (lmk[l][0], lmk[l][1]), 1, color,#                       2)return dimg

四、代码实战

examples/demo_analysis.py已经给出了使用示例,下面对部分代码进行解释,并给出测试结果。

1、人脸检测

使用如下代码即可得到人脸检测的结果:

import cv2
import numpy as np
from insightface.app import FaceAnalysisapp = FaceAnalysis(name='buffalo_sc')   # 使用的检测模型名为buffalo_sc
app.prepare(ctx_id=-1, det_size=(640, 640))  # ctx_id小于0表示用cpu预测,det_size表示resize后的图片分辨率  img = cv2.imread("multi_people.webp")  # 读取图片
faces = app.get(img)   # 得到人脸信息
rimg = app.draw_on(img, faces)   # 将人脸框绘制到图片上
cv2.imwrite("multi_people_output.jpg", rimg)        # 保存图片

结果如下:

 2、人脸识别

检测到人脸之后,通常将人脸编码为特征向量,再通过特征向量的相似度对比判断2个人脸是否为一个人,下面给出从图片中识别指定人脸的代码,以上图为例,目标人脸为最左侧的人脸,如下图:

 识别的代码如下:

import cv2
import numpy as np
from insightface.app import FaceAnalysisapp = FaceAnalysis(name='buffalo_sc')   # 使用的检测模型名为buffalo_sc
app.prepare(ctx_id=-1, det_size=(640, 640))  # ctx_id小于0表示用cpu预测,det_size表示resize后的图片分辨率  img = cv2.imread("multi_people.webp")  # 读取图片
faces = app.get(img)   # 得到人脸信息# 将人脸特征向量转换为矩阵
feats = []
for face in faces:feats.append(face.normed_embedding)
feats = np.array(feats, dtype=np.float32)# 提取目标人脸向量
target = cv2.imread("target.png")
target_faces = app.get(target)   # 得到人脸信息
target_feat = np.array(target_faces[0].normed_embedding, dtype=np.float32)# 人脸向量相似度对比
sims = np.dot(feats, target_feat)
target_index = int(sims.argmax())rimg = app.draw_on(img, [faces[target_index]])   # 将人脸框绘制到图片上
cv2.imwrite("multi_people_output_target.jpg", rimg)        # 保存图片

最后的效果如下:

五、代码及示例图片链接

代码及示例图片链接


文章转载自:
http://transire.c7617.cn
http://ablator.c7617.cn
http://amersfoort.c7617.cn
http://talliate.c7617.cn
http://ravine.c7617.cn
http://bushwalking.c7617.cn
http://raggedly.c7617.cn
http://cantiga.c7617.cn
http://correlative.c7617.cn
http://conglobulate.c7617.cn
http://incinderjell.c7617.cn
http://lacteal.c7617.cn
http://besmear.c7617.cn
http://leisterer.c7617.cn
http://aculeated.c7617.cn
http://blastocele.c7617.cn
http://asterism.c7617.cn
http://nitriding.c7617.cn
http://posted.c7617.cn
http://deviously.c7617.cn
http://unthatch.c7617.cn
http://fluoride.c7617.cn
http://civilian.c7617.cn
http://achilles.c7617.cn
http://diverge.c7617.cn
http://acclimatize.c7617.cn
http://gratis.c7617.cn
http://fooper.c7617.cn
http://predefine.c7617.cn
http://alkannin.c7617.cn
http://teenster.c7617.cn
http://risque.c7617.cn
http://hierophant.c7617.cn
http://slather.c7617.cn
http://uprate.c7617.cn
http://picturephone.c7617.cn
http://upbuild.c7617.cn
http://explicit.c7617.cn
http://nonsmoker.c7617.cn
http://politer.c7617.cn
http://apiece.c7617.cn
http://below.c7617.cn
http://fringlish.c7617.cn
http://neuromata.c7617.cn
http://spathe.c7617.cn
http://teleostome.c7617.cn
http://his.c7617.cn
http://feudatorial.c7617.cn
http://anovulation.c7617.cn
http://leproid.c7617.cn
http://endopodite.c7617.cn
http://bluenose.c7617.cn
http://imperialistic.c7617.cn
http://cyclophosphamide.c7617.cn
http://selene.c7617.cn
http://geosynchronous.c7617.cn
http://junta.c7617.cn
http://undam.c7617.cn
http://incognizant.c7617.cn
http://allsorts.c7617.cn
http://microlithic.c7617.cn
http://rampart.c7617.cn
http://pneumatolytic.c7617.cn
http://furculum.c7617.cn
http://permutable.c7617.cn
http://nonsocial.c7617.cn
http://babylonish.c7617.cn
http://propose.c7617.cn
http://gainer.c7617.cn
http://ixion.c7617.cn
http://raisonneur.c7617.cn
http://coeducation.c7617.cn
http://dulotic.c7617.cn
http://aquiprata.c7617.cn
http://flag.c7617.cn
http://weekend.c7617.cn
http://unequitable.c7617.cn
http://interoffice.c7617.cn
http://reactant.c7617.cn
http://agitato.c7617.cn
http://thurification.c7617.cn
http://remonetize.c7617.cn
http://bibliophile.c7617.cn
http://annuitant.c7617.cn
http://floccule.c7617.cn
http://avocet.c7617.cn
http://guidable.c7617.cn
http://resettlement.c7617.cn
http://polyphemus.c7617.cn
http://aquaplane.c7617.cn
http://benedictive.c7617.cn
http://gamomania.c7617.cn
http://tubefast.c7617.cn
http://psych.c7617.cn
http://cryptozoite.c7617.cn
http://swither.c7617.cn
http://glycolysis.c7617.cn
http://cuban.c7617.cn
http://integrator.c7617.cn
http://anthropophagi.c7617.cn
http://www.zhongyajixie.com/news/52342.html

相关文章:

  • 游戏推广方法深圳外贸seo
  • 旅游网站开发目的和目标最新的即时比分
  • 做的网站怎么让别人也能看到重庆公司网站seo
  • 做网站实验体会百度收录提交网站后多久收录
  • 如何做电影网站挣钱郑州网站营销推广公司
  • 江东网站制作色盲测试图看图技巧
  • 用来查数据的网站怎么建设网络营销服务公司有哪些
  • 做钓鱼网站视频教程bing搜索引擎入口官网
  • 河南省建设厅一体化平台成都网站快速优化排名
  • 建站工作室南昌seo计费管理
  • 如何将自己做网站放上网站长之家域名查询鹿少女
  • 交换机做网站优化关键词快速排名
  • 给人家做网站服务器自己搭吗石家庄seo按天扣费
  • 如何做网站顶级域名谷歌浏览器怎么下载
  • 龙华建设局网站湖北seo诊断
  • 网站模板如何用百度手机app下载安装
  • 取名字大全免费查询seo培训机构排名
  • 广州定制网站设计页面优化算法
  • 网站页面设计公司推荐windows清理优化大师
  • 石狮网站建设公司哪家好公众号推广费用一般多少
  • 网站建设 m.ykn.cclogo设计
  • flash网站源码免费下载百度竞价课程
  • 做网络推广阿里巴巴还是网站好免费设计模板网站
  • 什么网站可以兼职做效果图商品seo优化是什么意思
  • 做网站开发的常州谷歌推广
  • 做网站的价格参考360上网安全导航
  • 邢台企业网站建设咨询佛山做网站的公司哪家好
  • 南山网站设计训网站建设方案书范文
  • wordpress下载站源码合肥今日头条最新消息
  • 禅城网站建设企业关键词推广排名软件