Blazeface 人脸检测器

点击我爱计算机视觉标星,更快获取CVML新技术


文 /  Debidatta Dwibedi, 副研究员, Google Research

Blazeface 是一种可检测图像中人脸的轻量级模型。Blazeface 使用自定义编码器的 Single Shot Detector 架构,可以用在与面部相关的计算机视觉应用的第一个步骤里(如面部关键点识别)。

  • Blazeface
    https://arxiv.org/abs/1907.05047

  • Single Shot Detector 
    https://arxiv.org/abs/1512.02325

可以在下方网址中获取该模型更多的细节信息,包括其在不同数据集上的表现。

  • 下方
    https://drive.google.com/file/d/1f39lSzU5Oq-j_OXgS67KfN5wNsoeAZ4V/view

Blazeface 是为移动设备上的前置摄像头设计的,在这种情况下拍摄到的人脸通常占画面中占据较大部分。也就是说,Blazeface 可能难以检测出远距离的面孔。

请观看我们的 演示,我们使用此轻量级模型从实时视频流中预测面部边界框。

  • 演示
    https://storage.googleapis.com/tfjs-models/demos/blazeface/index.html

该模型还可以作为 MediaPipe 的一部分使用,MediaPipe 是用于构建多模型机器学习流水线的框架。

  • MediaPipe
    https://github.com/google/mediapipe/tree/master/mediapipe/models

安装

若使用yarn:

$ yarn add @tensorflow-models/blazeface

若使用 npm:

$ npm install @tensorflow-models/blazeface

请注意,此软件包将@tensorflow/tfjs-core 和 @tensorflow/tfjs-converter指定为同版本依赖项,因此也需要安装它们。

使用

导入到 npm:

import * as blazeface from '@tensorflow-models/blazeface';

或作为独立的脚本标签:

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-core"></script><script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-converter"></script><script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/blazeface"></script>

然后:

async function main() {  // Load the model.  const model = await blazeface.load();   // Pass in an image or video to the model. The model returns an array of  // bounding boxes, probabilities, and landmarks, one for each detected face.   const returnTensors = false; // Pass in `true` to get tensors back, rather than values.  const predictions = await model.estimateFaces(document.querySelector("img"), returnTensors);   if (predictions.length > 0) {    /*    `predictions` is an array of objects describing each detected face, for example:     [      {        topLeft: [232.28, 145.26],        bottomRight: [449.75, 308.36],        probability: [0.998],        landmarks: [          [295.13, 177.64], // right eye          [382.32, 175.56], // left eye          [341.18, 205.03], // nose          [345.12, 250.61], // mouth          [252.76, 211.37], // right ear          [431.20, 204.93] // left ear        ]      }    ]    */     for (let i = 0; i < predictions.length; i++) {      const start = predictions[i].topLeft;      const end = predictions[i].bottomRight;      const size = [end[0] - start[0], end[1] - start[1]];       // Render a rectangle over each detected face.      ctx.fillRect(start[0], start[1], size[0], size[1]);    }  }} main();

人脸技术交流群

关注最新最前沿的人脸检测、识别、对齐、重建、表情识别、表情迁移技术,扫码添加CV君拉你入群,(如已为CV君其他账号好友请直接私信)

(请务必注明:人脸):

喜欢在QQ交流的童鞋可以加52CV官方QQ群:805388940。

(不会时时在线,如果没能及时通过还请见谅)


长按关注我爱计算机视觉

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值