![e25e94037917adc3ef82b4e0fc70fe32.gif](https://i-blog.csdnimg.cn/blog_migrate/527b34389355a3167d2ca203126ad0e2.gif)
请注意,虹膜跟踪不会推断人们正在看的位置,也不能提供任何形式的身份识别。在模型的文档 和随附的模型卡中,我们详细描述了模型的预期用途,局限性和公平性(与Google的AI原则保持一致)。
MediaPipe虹膜模型能够使用单个RGB摄像机实时跟踪虹膜和瞳孔的界标,而无需专用硬件。该模型还返回眼睑和眉毛区域的界标,从而能够检测到轻微的眼球运动,例如眨眼。
引入@ tensorflow / face-landmarks-detection
![9b7a65a05d3164ee8ee5f00b7cd775f7.gif](https://i-blog.csdnimg.cn/blog_migrate/81a72a9a7aabc5453d35abf9687b720a.gif)
左上方是@ tensorflow-models / facemesh @ 0.0.4的预测,右上方是@ tensorflow-models / face-landmarks-detection @ 0.0.1的预测。虹膜界标为红色。
熟悉我们现有的 facemesh 模型的用户可以升级到新的 faceLandmarksDetection 模型,并只需进行少量代码更改,下面将对此进行详细说明。faceLandmarksDetection对facemesh进行了三项重大改进:
- 虹膜关键点检测
- 改善眼睑轮廓检测
- 改进了对旋转脸部的检测
安装
有两种安装faceLandmarksDetection软件包的方法:- 通过脚本标签:
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.6.0/dist/tf.js">script><script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/face-landmarks-detection">script>
通过NPM(通过yarn,网址:https://yarnpkg.com/):
$ yarn add @tensorflow-models/face-landmarks-detection@0.0.1
$ yarn add @tensorflow/tfjs@2.6.0
用法
安装软件包后,只需加载模型权重,然后传递图像即可开始检测面部标志:// If you are using NPM, first require the model. If you are using script tags, you can skip this step because `faceLandmarksDetection` will already be available in the global scope.const faceLandmarksDetection = require('@tensorflow-models/face-landmarks-detection');// Load the faceLandmarksDetection model assets.const model = await faceLandmarksDetection.load( faceLandmarksDetection.SupportedPackages.mediapipeFacemesh);// Pass in a video stream to the model to obtain an array of detected faces from the MediaPipe graph.// For Node users, the `estimateFaces` API also accepts a `tf.Tensor3D`, or an ImageData object.const video = document.querySelector("video");const faces = await model.estimateFaces({ input: video });
输入的内容estimateFaces可以是视频,静态图像,`tf.Tensor3D`,甚至是供Node.js管道中使用的ImageData对象。然后,FaceLandmarksDetection返回输入中面部的预测对象数组,其中包括有关每个面部的信息(例如,置信度得分以及该面部中478个界标的位置)。
这是一个样本预测对象:
{ faceInViewConfidence: 1, boundingBox: { topLeft: [232.28, 145.26], // [x, y] bottomRight: [449.75, 308.36], }, mesh: [ [92.07, 119.49, -17.54], // [x, y, z] [91.97, 102.52, -30.54], ... ], // x,y,z positions of each facial landmark within the input space. scaledMesh: [ [322.32, 297.58, -17.54], [322.18, 263.95, -30.54] ], // Semantic groupings of x,y,z positions. annotations: { silhouette: [ [326.19, 124.72, -3.82], [351.06, 126.30, -3.00], ... ], ... }}有关API的更多详细信息, 请参阅我们的自述文件。
性能
FaceLandmarksDetection是一种轻量级的程序包,只有大约3MB,因此非常适合在各种移动设备上进行实时推理。在测试时,请注意TensorFlow.js还提供了几种不同的后端供选择,包括带有 XNNPACK的 WebGL和WebAssembly(WASM),用于具有低端GPU的设备。下表显示了程序包如何在几种不同的设备和TensorFlow.js后端上执行。 桌面:![e82131f4d1a86103706087e0addacf7c.png](https://i-blog.csdnimg.cn/blog_migrate/bbfb9a0ec1d810944811cd903aea5aae.png)
![6ddb0a441b6c8df0b7171d416ab9f22e.png](https://i-blog.csdnimg.cn/blog_migrate/d60b92d1c8378df9eaf1db54eb5d4ae8.png)
展望未来
TensorFlow.js和MediaPipe团队都计划使用改进的虹膜界标将深度估计功能添加到我们的人脸界标检测解决方案中。我们坚信共享可实现可重复研究和快速实验的代码,并期待看到更广泛的社区如何利用MediaPipe虹膜模型。 作者提供了新软件包,可以在Web浏览器中通过此链接使用:https://storage.googleapis.com/tfjs-models/demos/face-landmarks-detection/index.html
详细解读,8000字线性代数知识点长文,带你入门深度学习/机器学习
2020-11-03
![52ab4d3c36e162cde14214793fc9087b.png](https://i-blog.csdnimg.cn/blog_migrate/74d38de87ce8414dbc6f13b8adaaa511.jpeg)
资料 | Python – 100天从新手到大师开放中,内附下载方式
2020-11-03
![a87cbf8ebf4aedaddfd4d57a25b01273.png](https://i-blog.csdnimg.cn/blog_migrate/5b1e59162e3698ea2479b69f4686a265.jpeg)
资源 | 《30天吃掉Tensorflow》开放下载
2020-10-23
![99aec0628057b806073e964084888a11.png](https://i-blog.csdnimg.cn/blog_migrate/5ebb850dd760ca58209d51288eab0dad.jpeg)
AI研习社是AI学术青年和开发者社区,为大家提供一个顶会资讯、论文解读、数据竞赛、求职内推等的技术交流阵地,欢迎登陆www.yanxishe.com加入我们吧~
投稿、转载、媒介合作联系微信号 | bajiaojiao-sz
商务合作联系微信号 | LJ18825253481