曾靖渝
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # 看OpenFace如何做到精准人脸识别 ###### tags:`學習紀錄` [toc] --- ## Before Meeting :::success ::: [refer](https://blog.csdn.net/dev_csdn/article/details/79176037) [refer]() [refer]() --- ## Recent Paper --- ### 看OpenFace如何做到精准人脸识别 :::success #### Abstracion - 人脸识别已经成为我们生活当中越来越普遍的一部分。 - 如今,智能手机使用人部识别来取得控制权,而像阿凡达这样的动画电影则用它来实现逼真的动作和表达。警方监控摄像头借助人脸识别软件鉴别通缉犯,同样的人脸识别也被零售商店用于进行有针对性的营销活动。并且我们都使用过类似于名人像 App和Facebook的自动标记工具,将我们、朋友和家人进行分类。 - 人脸识别可以在许多不同的场景中应用,但并不是所有的人脸识别库在准确性和性能上都是平等的,而且大多数最先进的系统都是专有的黑盒子。 - OpenFace是一个开源库,它具有专利模型的性能和精确性。该项目是在考虑移动性能的情况下创建的,因此让我们来看看一些使这个库快速而准确的内部结构,并通过一些用例来思考为什么可能想要在项目中实现它。 - ![](https://i.imgur.com/Sj2VXD2.png) ::: :::info #### Detail - 高层体系结构概述 - OpenFace是Brandon Amos、Bartosz Ludwiczuk和Mahadev Satyanarayanan开发的一种深度学习人部识别模型,模型基于文章:FaceNet:为人脸识别统一的嵌入和聚类,该文章由谷歌的James Philbin、James Philbin和Florian Schroff发表,并通过Python和Torch来实现,以便能在在CPU或GPU上运行。 - 尽管OpenFace只有几年的历史,但它已经被广泛采用,因为它提供的精确度与谷歌的FaceNet或facebook的DeepFace等私有的最先进的系统所包含的人脸识别模型类似。 - OpenFace的特别之处除了开源之外,还在它主要集中在移动设备上的实时人脸识别,所以可以用非常精确的数据来训练一个模型,尽管模型的数据非常少。 - ![](https://i.imgur.com/i4HNTny.png) - 从高层次的角度来看,OpenFace使用的Torch,是一个科学的计算框架能进行离线训练,这意味着它只在OpenFace完成一次,用户不必亲自动手训练成百上千的图片。然后把这些图像被扔进神经网络中用谷歌的FaceNet模型进行特征抽取。FaceNet依赖triplet loss方法来计算神经网络对人脸进行分类的准确性,并能够基于超球表面的测量结果进行人脸聚类。 - 在通过dlib的面部检测模型运行新图像之后,这个经过训练的神经网络在Python实现中被使用。一旦这些人脸被OpenCV的仿射变换规格化,所有的人脸都指向同一个方向,它们就会通过训练的神经网络单向传递。因此产生的128维度人脸嵌入(每张脸的128个测量值称为一个嵌入)可以对匹配分类,甚至可以用于相似检测的聚类算法中。 - ![](https://i.imgur.com/damLpLy.png) - 训练 - 在OpenFace pipeline的训练部分中,500k图像通过神经网络传递。这些图像来自两个公共数据集:CASIA-WebFace(由10575个独立的个体组成,总共有494,414张图像)和FaceScrub(由530个个体组成,共有106,863张图像,他们都是公众人物)。 - 在所有这些图像前面训练神经网络的目的是很明显的,在移动或者任何其他实时场景中都不可能训练50万张图片来获取所需的面部嵌入。但请记住,这部分pipeline只完成一次,因为OpenFace将这些图像用于生成128维度的人脸嵌入,它标识一个通用的面孔,用于Python训练的pipeline。然后使用低维度的数据(而不是在高维空间中)匹配图像,这有助于快速地创建模型。 - 正如前面提到的,OpenFace使用Google的FaceNet架构来进行特征提取,并使用triplet loss方法来测试神经网络对脸部的精确程度。它通过对三个不同的图像进行训练,其中一个是已知的人脸图像,叫做anchor图像,然后另一个图像是positive嵌入,而最后一个是不同的人的图像,被称为negative嵌入。 - 如果你想了解更多关于triplet loss的信息,请点击Andrew NG的卷积神经网络Coursera视频。 - 使用triplet嵌入的很重要的一点是,在一个单位超球面上,用欧氏空间距离能判断哪些图像更近,哪些更远。很明显,negative图像嵌入比positive和anchor测量的更深,而posivit与anchor空间距离更近。这一点很重要,因为决定集群算法可以用于相似性检测。如果想要在族谱网站上检测家庭成员,或者在社交媒体上寻找可能的营销活动(比如说团购),可能需要使用聚类算法。 - 脱离背景的人脸 - ![](https://i.imgur.com/4lsz3wF.png) - 上面已经介绍了OpenFace如何使用Torch来训练成千上万的来自公共数据集的图片,以获得低维度的面部嵌入,现在通过查看他们对流行的人脸检测库dlib的使用情况,来看看为什么要使用它,而不是OpenCV的面部检测库。 - 人脸识别软件的第一步是将人脸从图像的背景中分离出来,并将人脸从图像中分离出来。人脸检测算法还必须能够处理弱的和不一致的光线,以及不同的面部位置,比如倾斜或旋转的脸。幸运的是,dlib和OpenCV一起处理了所有这些问题。Dlib负责寻找脸部的基准点,而OpenCV则负责处理面部的标准化。 - 值得注意的是,在使用OpenFace时,可以实现dlib的面部检测,它组合使用了HOG向量的梯度)和支持向量机或OpenCV的Haar级联分类器。它们都接受过positive和negative图像训练,但是在实现上、检测速度和准确性方面都有很大的不同。 - 使用HOG分类器有几个好处。首先,在图像上使用一个滑动子窗口进行训练,因此不需要进行子采样和参数操作,就像在OpenCV中使用Haar分类器一样。这使得dlib的HOG和SVM的人脸检测更容易使用,而且可以更快地进行训练,同时所需要的数据更少,此外HOG的面部识别比OpenCV的Haar级联分类器更准确。所以使用dlib的HOG搭配SVM做人脸检测非常方便! - Pretraining - 除了在图像中找到每张脸,人脸识别过程的还包括预处理图像,以便解决一些如不一致和弱光线的问题,预处理将图像转换成灰度级以进行更快的训练,同时对面部位置标准化。 - 虽然一些面部识别模型可以通过大量的数据集训练来处理这些问题,但dlib使用了OpenCV的2D仿射变换,它可以旋转脸部,使眼睛、鼻子和嘴巴的位置保持一致。在仿射变换中,有68个面部特征点用于特征检测,并且将测量所得点之间的距离与普通人脸图像中的点进行比较,随后根据这些点将图像进行旋转和转换,通过比较将其裁剪为96 96个像素,用于被训练的神经网络。 - ![](https://i.imgur.com/ufXYRpl.png) - 将图像从背景中分离出来,并使用dlib和OpenCV进行预处理之后,再将图像传送到经过训练的神经网络中,这是在Torch的pipeline部分完成的。这个步骤中,神经网络上有一个单向传递来获得用于预测的128维度嵌入(面部特征)。这些低维度的面部嵌入在分类或聚类算法中会使用到。 - 测试中OpenFace使用一个线性支持向量器,它通常在现实世界中使用以匹配图像的特征。OpenFace令人印象最深刻的一点是对图像进行分类只需要几毫秒的时间。 - ![](https://i.imgur.com/ecH0Ysa.png) ::: :::warning #### Conclusion ::: [refer]() --- :::success #### Abstracion ::: :::info #### Detail ::: :::warning #### Conclusion ::: [refer]() ---

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully