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

医院内外网站建设做网站用属于前端

医院内外网站建设,做网站用属于前端,定制网站建设公司策划书,七牛 百度云加速 wordpress本篇文章的代码块的实现主要是为了能够快速的通过python第三方非标准库对比出两张人脸是否一样。 实现过程比较简单,但是第三方python依赖的安装过程较为曲折,下面是通过实践对比总结出来的能够支持的几个版本,避免大家踩坑。 python版本&a…

本篇文章的代码块的实现主要是为了能够快速的通过python第三方非标准库对比出两张人脸是否一样。

实现过程比较简单,但是第三方python依赖的安装过程较为曲折,下面是通过实践对比总结出来的能够支持的几个版本,避免大家踩坑。

python版本:3.6.8
dlib版本:19.7.0
face-recognition版本:0.1.10

开始之前,我们选择使用pip的方式对第三方的非标准库进行安装。

pip install cmakepip install dlib==19.7.0pip install face-recognition==0.1.10pip install opencv-python

然后,将使用到的模块cv2/face-recognition两个模块导入到代码块中即可。

# OpenCV is a library of programming functions mainly aimed at real-time computer vision.
import cv2# It's loading a pre-trained model that can detect faces in images.
import face_recognition

新建一个python函数get_face_encodings,用来获取人脸部分的编码,后面可以根据这个编码来进行人脸比对。

def get_face_encodings(image_path):"""It takes an image path, loads the image, finds the faces in the image, and returns the 128-d face encodings for eachface:param image_path: The path to the image to be processed"""# It's loading a pre-trained model that can detect faces in images.image = cv2.imread(image_path)# It's converting the image from BGR to RGB.image_RGB = image[:, :, ::-1]image_face = face_recognition.face_locations(image_RGB)# It's taking the image and the face locations and returning the face encodings.face_env = face_recognition.face_encodings(image_RGB, image_face)# It's returning the first face encoding in the list.return face_env[0]

上述函数中注释都是通过Pycharm插件自动生成的,接下来我们直接调用get_face_encodings函数分别获取两个人脸的编码。

# It's taking the image and the face locations and returning the face encodings.
ima1 = get_face_encodings('03.jpg')# It's taking the image and the face locations and returning the face encodings.
ima2 = get_face_encodings('05.jpg')

上面我们选择了两张附有人脸的图片,并且已经获取到了对应的人脸编码。接着使用compare_faces函数进行人脸比对。

# It's comparing the two face encodings and returning True if they match.
is_same = face_recognition.compare_faces([ima1], ima2, tolerance=0.3)[0]print('人脸比对结果:{}'.format(is_same))

人脸比对结果:False

这个时候人脸比对结果已经出来了,False代表不一样。这里compare_faces有一个比较重要的参数就是tolerance=0.3,默认情况下是0.6。

tolerance参数的值越小的时候代表比对要求更加严格,因此这个参数的大小需要根据实际情况设置,它会直接影响整个比对过程的结果。

往期精彩

python自制PDF转换.PNG格式图片(按每页生成图片完整源码)小工具!

python如何使用最简单的方式将PDF转换成Word?

python项目环境迁移时如何生成第三方库文件requirements.txt并安装?

http://www.yayakq.cn/news/434525/

相关文章:

  • 佛山网站建设哪家专业做网站与不做网站的区别
  • 做网站是要云空间吗城市建设服务中心网站
  • 衡阳购物网站开发案例专业商城网站制作公司
  • 如何自行建设网站电脑免费安装wordpress
  • 网站怎么做需要花钱吗网络优化岗位详细介绍
  • 老牌网站建设中兴通讯的网站建设分析
  • 电子商务网站建设规划淘宝网站怎么做链接地址
  • 欧美网站模板srm采购管理系统
  • 网站不想备案销售型网站有哪些
  • html网站地图生成器项目管理软件有哪些
  • 天津中小企业网站制作开网店哪些平台不收费
  • php图片网站源码文学网站开发设计报告
  • 宜城网站定制住房城乡建设局网站
  • 河南建设通网站建设网站必须用dns
  • 菏泽做网站设计贵金属企业网站源码
  • 最新网站建设软件广东省住房城乡建设厅门户网站
  • cms网站开发实验报告免费网站推广2023
  • 中小企业服务中心网站建设淘宝客 网站无备案
  • 制作网站页面怎么做做网站为什么很复杂
  • 构建网站需要什么意思网站里的字体大小
  • 黑龙江省建设集团网站云南省城乡建设培训中心网站
  • 网站关键词之间广东新闻联播2019
  • 网站兼容ie代码做电影网站用的云盘
  • 最便宜的网站网站优化百度
  • 网站大气是什么意思专业建站公司的业务内容
  • 开网店需要自己做网站吗浙江省建设厅证书查询
  • 做搜狗网站关键词排名关于内网站建设的请示
  • 中国山东建设监理协会官方网站站长工具果冻传媒
  • 连云港市赣榆区建设局网站怎么用自己的电脑做网站
  • 临沂网站制作定制网络编程技术及应用