/ViewFaceCore

C# 超简单的人脸识别库。

Primary LanguageC#MIT LicenseMIT

ViewFaceCore

Nuget    GitHub license    GitHub stars    GitHub forks


—— 🪧 关于  | ⭐ 快速开始  | 🔧 构建  | 📄 文档  | ❓ 常见问题  | 📦 使用许可 ——

🪧 关于

  • 一个基于 SeetaFace6 的 .NET 人脸识别解决方案
  • 本项目受到了 SeetaFaceEngine.Net 的启发
  • 开源、免费、跨平台 (win/linux)

⭐ 快速开始

  • 受支持的 .NET 框架 和 操作系统

    目标框架 最低版本 操作系统
    .NET Framework 4.0 win ( x64/x86 )
    .NET Standard 2.0 win ( x64/x86 )
    .NET / .NET Core 3.1 win ( x64/x86 )、linux ( arm/arm64/x64 )
  • 简单的人脸信息检测

    • 以 Windows x64 为例
    1. 使用 nuget 安装依赖

      包名称 最小版本 生成文件夹 说明
      ViewFaceCore 0.3.5 —— ViewFaceCore .NET 核心库
      ViewFaceCore.model.face_detector 6.0.0 models 人脸检测的模型支持
      ViewFaceCore.runtime.win.x64 6.0.2 viewfacecore\win\x64 Windows-x64 的本机运行时
    2. 获取人脸信息

      using System;
      using System.Drawing;
      using ViewFaceCore.Sharp;
      
      namespace YourFaceProject
      {
          class Program
          {
              static void Main(string[] args)
              {
                  ViewFace face = new ViewFace();
                  string filename = @"[your face image file path]";
                  Bitmap bitmap = (Bitmap)Image.FromFile(filename);
                  var infos = face.FaceDetector(bitmap);
                  Console.WriteLine($"识别到的人脸数量:{infos.Length} 。人脸信息:\n");
                  Console.WriteLine($"No.\t人脸置信度\t位置信息");
                  for (int i = 0; i < infos.Length; i++)
                  {
                      Console.WriteLine($"{i}\t{infos[i].Score:f8}\t{infos[i].Location}");
                  }
                  Console.Read();
              }
          }
      }

🔧 构建

  • 项目结构

    Bridges
    Models
    SeetaFace/index
    Simples
    Tests
    ViewFaceCore

  • 开发环境

    • Visual Studio 2022 (17.0.2)
    • Windows 11 专业版 (21H2)
    • Ubuntu 20.04 (WSL)
  • 编译过程

    使用 SeetaFace6 开发包 编译

    描述 后缀名 放置路径
    头文件 *.h ViewFaceCore\SeetaFace\index\build\include\seeta\
    —— —— ——
    Windows 开发包 (x64) *.dll ViewFaceCore\SeetaFace\index\build\bin\x64\
    Windows 开发包 (x64) *.lib ViewFaceCore\SeetaFace\index\build\lib\x64\
    Windows 开发包 (x86) *.dll ViewFaceCore\SeetaFace\index\build\bin\x86\
    Windows 开发包 (x86) *.lib ViewFaceCore\SeetaFace\index\build\lib\x86\
    Ubuntu 开发包 (x64) *.so ViewFaceCore\SeetaFace\index\build\lib64\
    Ubuntu 开发包 (arm64) *.so ViewFaceCore\SeetaFace\index\build\lib\arm64\
    Ubuntu 开发包 (arm) *.so ViewFaceCore\SeetaFace\index\build\lib\arm\

    全部重新编译

    1. 配置 %VctPath% 环境变量 (即:vcvarsall.bat 脚本的路径)

      以 Visual Studio 2022 为例:
      C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build

    2. 按照 SeetaFace 编译依赖 配置好依赖工具
      • 本项目使用 MSVC (win) / GCC (linux on wsl) 编译完成
      1. 编译工具
      2. For linux
        GNU Make 工具
        GCC 或者 Clang 编译器
      3. For windows
        MSVC 或者 MinGW.
        jom
      4. CMake
      5. 依赖架构
        CPU 支持 AVX 和 FMA [可选](x86)或 NENO(ARM)支持
    3. 首先编译 OpenRoleZoo SeetaAuthorizeTenniS 三个项目
      • 在项目的 craft 文件夹下启动 shell

      powershell > ./build.win.vc14.all.cmd
      linux shell(wsl) > ./build.linux.all.sh

    4. 然后编译其他项目 SeetaMaskDetectorFaceAntiSpoofingX6FaceBoxesFaceRecognizer6FaceTracker6LandmarkerOpenRoleZooPoseEstimator6QualityAssessor3SeetaAgePredictorSeetaAuthorizeSeetaEyeStateDetectorSeetaGenderPredictor
      • 在项目的 craft 文件夹下启动 shell

      powershell > ./build.win.vc14.all.cmd
      linux shell(wsl) > ./build.linux.all.sh

📄 文档

❓ 常见问题

📦 使用许可

MIT © 2021 View