opensuse安装face_recognition全记录

vikeyfox@20210821@opensuse安装face_recognition全记录

安装所需的python-devel

首先确保安装了对应版本的python-devel, ubuntu可能叫python-dev,在这里我的系统里安装了python-devel,python38-devel,python39-devel这几个包,实际安装过程中需要的是python39-devel. opensuse的命令是sudo zypper install python39-devel

安装cmake boost

使用命令pip install cmake boost

这个可能不是必要的,不过装上也好

安装dlib和face_recognition

安装dlib,命令pip install dlib,等待时间有1到2分钟作用, 这一步有些教程有坑, 要先安装python-devel

vikey@suse:~> pip install dlib
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting dlib
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/f0/a2/ba6163c09fb427990180afd8d625bcecc5555af699c253193c35ffd48c4f/dlib-19.22.1.tar.gz (7.4 MB)
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) ... done
Created wheel for dlib: filename=dlib-19.22.1-cp39-cp39-linux_x86_64.whl size=4334494 sha256=53ad3ad557bff87d6b99d1e8fc429a1462ef65dd8c6b554641d2b2db0fd50278
Stored in directory: /home/vikey/.cache/pip/wheels/c1/47/3a/c8f63895e31161abcef997bf9dc743fb78fb7fa71aa1899213
Successfully built dlib
Installing collected packages: dlib
Successfully installed dlib-19.22.1

pip install face_recognition等待安装完成即可

vikey@suse:~> pip install face_recognition
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting face_recognition
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/1e/95/f6c9330f54ab07bfa032bf3715c12455a381083125d8880c43cbe76bb3d0/face_recognition-1.3.0-py2.py3-none-any.whl (15 kB)
Requirement already satisfied: Click>=6.0 in ./.local/lib/python3.9/site-packages (from face_recognition) (8.0.1)
Requirement already satisfied: face-recognition-models>=0.3.0 in ./.local/lib/python3.9/site-packages (from face_recognition) (0.3.0)
Requirement already satisfied: numpy in ./.local/lib/python3.9/site-packages (from face_recognition) (1.19.5)
Requirement already satisfied: dlib>=19.7 in ./.local/lib/python3.9/site-packages (from face_recognition) (19.22.1)
Collecting Pillow
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/42/25/59061f5848f509d3f50275c615fc620272d2bf2134d08232e4d79ad06cb0/Pillow-8.3.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (3.0 MB)
Installing collected packages: Pillow, face-recognition
Successfully installed Pillow-8.3.1 face-recognition-1.3.0

最后安装结束实验一下,由于安装的版本对应python3.9, 打开试一下:

vikey@suse:~> python3.9
Python 3.9.6 (default, Aug 09 2021, 11:37:16) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import face_recognition
>>>

模块导入ok

另外需要安装cv2,如果没有的话,执行pip install opencv-python或者pip3.9 install opencv-python,我的python默认版本是3.8所以要再装一次3.9的

下面抄段代码试验摄像头识别

记得把obama.jpg放在python脚本目录下

注意: video_capture = cv2.VideoCapture(2),参数为偶数,0,2,4,6,8是分别是第1,2,3,4,5个摄像头

# -*- coding: utf-8 -*-
import face_recognition
import cv2video_capture = cv2.VideoCapture(2)obama_img = face_recognition.load_image_file("obama.jpg")
obama_face_encoding = face_recognition.face_encodings(obama_img)[0]face_locations = []
face_encodings = []
face_names = []
process_this_frame = Truewhile True:ret, frame = video_capture.read()small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)if process_this_frame:face_locations = face_recognition.face_locations(small_frame)face_encodings = face_recognition.face_encodings(small_frame, face_locations)face_names = []for face_encoding in face_encodings:match = face_recognition.compare_faces([obama_face_encoding], face_encoding)if match[0]:name = "Barack"else:name = "unknown"face_names.append(name)process_this_frame = not process_this_framefor (top, right, bottom, left), name in zip(face_locations, face_names):top *= 4right *= 4bottom *= 4left *= 4cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255),  2)cv2.rectangle(frame, (left, bottom - 35), (right, bottom), (0, 0, 255), 2)font = cv2.FONT_HERSHEY_DUPLEXcv2.putText(frame, name, (left+6, bottom-6), font, 1.0, (255, 255, 255), 1)cv2.imshow('Video', frame)if cv2.waitKey(1) & 0xFF == ord('q'):breakvideo_capture.release()
cv2.destroyAllWindows()

运行后识别成功,实时标记人脸,速度还挺快.

脸不放了, 祝大家玩的愉快.

opensuse安装face_recognition全记录相关推荐

  1. ros2_object_analytics安装过程全记录

    ros2_object_analytics安装过程全记录 ros2_object_analytics安装过程全记录 问题总结 (1)OpenCV3.3依赖问题 (2)devel版本中librealse ...

  2. Ubuntu16.04LTS+CUDA8.0+cuDNN5.1+Anaconda3(python3.6)+tensorflow_gpu-1.2.1安装过程全记录

    Ubuntu16.04LTS+CUDA8.0+cuDNN5.1+Anaconda3(python3.6)+tensorflow_gpu-1.2.1安装过程全记录 最近搭建了一台用于深度学习的服务器,其 ...

  3. manjaro i3安装配置全记录

    manjaro i3安装配置全记录 安装 准备 安装踩坑记录 硬盘 安装过程 系统配置 准备 设置中文系统 安装必要配置 美化桌面 常用软件推荐 安装研发环境(java方向手动安装) 安装 准备 ma ...

  4. 在CentOS7上通过RPM安装实现LAMP+phpMyAdmin安装过程全记录

    在CentOS7上通过RPM安装实现LAMP+phpMyAdmin安装过程全记录 时间:2017年9月20日 一.软件环境: IP:192.168.1.71 Hostname:centos73-2.s ...

  5. 树莓派安装使用全记录

    树莓派安装使用全记录 昨天手残,把原来装好的树莓派3B+删除了一些不知道什么东西,刚好手上的4一直用的不爽,刚好一起重新搞一下. 安装系统 这个很简单,在官网https://www.raspberry ...

  6. amd64中Ubuntu安装使用全记录

    年终于过完了,按照计划将使用1个月的Ubuntu安装使用记录做一个完整的总结.前面已经有一篇帖子记录安装方面的东西,这里主要记录软件安装和系统的使用.把这个东西写出来主要是希望国内能有更多人安装和使用 ...

  7. Trimmomatic、bowtie2、samtools和bedtools安装过程全记录(已全部安装成功)

    目录 安装ubuntu 安装trimmomatic 安装bowtie 安装GCC 安装samtools 安装zlib2 继续安装samtools 安装liblzma-dev 继续安装samtools ...

  8. 在CentOS6上编译安装实现LAMP(php-modules)+phpMyAdmin安装过程全记录

    php与apache协作有三种模式:CGI.modules.FastCGI. 在CGI模式下,用户请求php文件时,apache会启动响应进程,调用php处理器处理请求,然后将结果返回给客户端.用户响 ...

  9. codeviz安装使用全记录

    安装过程 $ sudo apt-get install -y graphviz graphviz-dev graphviz-doc $ sudo apt-get install -y libgv-* ...

最新文章

  1. 几何画板论坛_伯中班主任论坛丨用爱守护生命的成长
  2. hbuilder能断点吗_知乎点赞破4万!这些PPT小秘密你知道吗?
  3. GNU make manual 翻译( 一百八十一)
  4. zabbix配置发送报警邮件
  5. iis php打开空白页,windows+IIS+php 访问显示空白页 php版本信息访问正常
  6. android 传感器ceshi,Android代码-传感器-测试手机支持那几种传感
  7. redis session java获取attribute_面试题:给我说说你能想到几种分布式session实现?...
  8. 配置 CentOS 7 的网络,及重命名网卡名
  9. 全球首例!机器人生娃
  10. Codeforces Round #219 (Div. 2) 解题报告
  11. html5怎么在index设置背景,index.html · huangliusong/HTML5Canvas知乎登录页面动态线条背景动画代码 - Gitee.com...
  12. 小区重选优先级_NR小区重选理论研究
  13. mac版本 sadptool_【Koala 工具】设备调试相关工具集锦
  14. kiban可视化入门
  15. jsp中的session和上下文
  16. PLSQL只导出表结构
  17. unity 接 steam,获取steamID ,username
  18. android标题栏尺寸,Android平台设计规范19条(轻松入门)
  19. 计算机软件对英语,计算机软件英语论文
  20. 内网使用 IPV6 之Teredo篇

热门文章

  1. Codeforces 814D An overnight dance in discotheque 贪心
  2. gittrack_什么时候使用git branch –track(开始“看上游”的意思)?
  3. 【科研杂记_3】测高卫星
  4. 如何使用MacBook更省电,Macbook电池应注意事项
  5. 掘金技术社区沸点指南(试行版)
  6. 如何将PDF删除水印?PDF删除水印的方法
  7. 厦门信托•震雷先行者集合资金信托计划
  8. win10计算机打开一直读进度条,win10开机读条后黑屏怎么办_win10开机读条之后黑屏修复方法-win7之家...
  9. 手写简易版链表及原理分析
  10. shtml 是什么?