first commit

This commit is contained in:
wzj 2025-04-25 14:48:24 +08:00
commit abe9ba3564
35 changed files with 5906 additions and 0 deletions

11
LICENSE Normal file
View File

@ -0,0 +1,11 @@
Copyright (c) 2019, SeetaTech,
Institute of Computing Technology, Chinese Academy of Sciences, Beijing, China
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

99
README.md Normal file
View File

@ -0,0 +1,99 @@
# SeetaFace6
[![License](https://img.shields.io/badge/license-BSD-blue.svg)](LICENSE)
[[中文]()] [English]
# 源码发布
该项目源码已经发布到 [SeetaFace6Open](https://github.com/SeetaFace6Open/index).
# 开放模块
`SeetaFace6`是中科视拓最新开放的商业正式级版本。突破了之前社区版和企业版版本不同步发布的情况这次发布的v6版本正式与商用版本同步。
<div align=center>
<img src="./asserts/fas.jpg" width="310" height="180" />
</div>
此次开放版包含了一直以来人脸识别的基本部分,如人脸检测、关键点定位、人脸识别。同时增加了活体检测、质量评估、年龄性别估计。并且响应时事,开放了口罩检测以及戴口罩的人脸识别模型。
<div align=center>
<img src="./asserts/fr_mask.png" width="560" height="240" />
</div>
对比于SeetaFace2我们开放版采用了商用版最新的推理引擎TenniSResNet50的推理速度从SeetaFace2在I7的8FPS提升到了20FPS。同时人脸识别训练集也大幅度提高SeetaFace6人脸识别数据量增加到了上亿张图片。
为了应对不同级别的应用需求SeetaFace6将开放三个版本模型
模型名称 | 网络结构 | 速度I7-6700 | 速度RK3399 | 特征长度
-|-|-|-|-
通用人脸识别 | ResNet-50 | 57ms | 300ms | 1024
带口罩人脸识别 | ResNet-50 | 34ms | 150ms | 512
通用人脸识别(小) | Mobile FaceNet | 9ms | 70ms | 512
作为能力兼容升级SeetaFace6仍然能够给众多人脸识别应用提供业务能力。
<div align=center>
<img src="./asserts/app_matrix.png" width="600" height="320" />
</div>
同时该套算法适用于高精度的服务器部署外,也可以终端设备上很好的适应运行。
<div align=center>
<img src="./asserts/endpoints.png" width="680" height="180" />
</div>
此次开放版将开放标准C++开发接口的包含x86和ARM架构支持逐步开放Ubuntu、CentOS、macOS、Android、IOS的支持。同时仍然保持了SeetaFace优良传统不依赖任何第三方库。
<div align=center>
<img src="./asserts/api_matrix.png" width="360" height="180" />
</div>
# 下载地址
### 百度网盘
开发包:
Windows: [Download](https://pan.baidu.com/s/1_rFID6k6Istmu8QJkHpbFw) code: `iqjk`. Patch: 1. x86 pentium support [Download](https://pan.baidu.com/s/1RsXdg2h4Yq-bILdyVSTXDA) code: `0vn3`.
Ubuntu1604: [Download](https://pan.baidu.com/s/1tOq12SdpUtuybe48cMuwag) code: `lc44`
CentOS7: [Download](https://pan.baidu.com/s/1-U02a--Xjt-Jvi2QWI-9vQ) code: `1i62`
Android: [Download](https://pan.baidu.com/s/1nGm5VB2D8OZOlZgcABGA7g) code: `7m2h`
macOS: [Comming soon]
IOS: [Download](https://pan.baidu.com/s/1-jKlCpVHoml9TmXq77SXxg) code: `t14x`, [Example](https://pan.baidu.com/s/159EVG8eqX2hPDeu1IrQaqg) code: `dund`.
ARM-Ubuntu1604(RK3399): [Download](https://pan.baidu.com/s/16fMkI5K02k0TEAOGvIsPuw) code: `wi4q`.
模型文件:
Part I: [Download](https://pan.baidu.com/s/1LlXe2-YsUxQMe-MLzhQ2Aw) code: `ngne`, including: `age_predictor.csta`, `face_landmarker_pts5.csta`, `fas_first.csta`, `pose_estimation.csta`, `eye_state.csta`, `face_landmarker_pts68.csta`, `fas_second.csta`, `quality_lbn.csta`, `face_detector.csta`, `face_recognizer.csta`, `gender_predictor.csta`, `face_landmarker_mask_pts5.csta`, `face_recognizer_mask.csta`, `mask_detector.csta`.
Part II: [Download](https://pan.baidu.com/s/1xjciq-lkzEBOZsTfVYAT9g) code: `t6j0`including: `face_recognizer_light.csta`.
### DropBox
[Comming soon]
# 使用入门
关于基本的接口使用,请参见教程:
[《SeetaFace 入门教程》](http://leanote.com/blog/post/5e7d6cecab64412ae60016ef)github上有同步[文档源码](https://github.com/seetafaceengine/SeetaFaceTutorial)。
人脸识别的完整示例Demo见 [example/qt](./example/qt)。
在每个压缩包的文档中都包含了对应平台上的调用示例,请解压对应平台压缩包后分别获取。
关于版本号的额外说明该开放版本立项的时候就是作为社区版v3发布而执行过程中调整至发布版本为商用版本v6。这个版本不统一是因为商用版迭代的版本管理和社区版不统一造成的。现在统一版本为v6。但是项目过程中还是存在`SeetaFace3`的表述大家不同担心v6和v3其实就是一个版本。
# 接口文档
各模块接口参见 [docs](./docs)
# 开发者社区
欢迎开发者加入 SeetaFace 开发者社区,请先加 SeetaFace 小助手微信,经过审核后邀请入群。
![QR](./asserts/QR.png)
# 联系我们
`SeetaFace` 开放版可以免费用于商业和个人用途。如果需要更多的商业支持,请联系商务邮件 bd@seetatech.com。

BIN
asserts/QR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

BIN
asserts/api_matrix.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB

BIN
asserts/app_matrix.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 KiB

BIN
asserts/endpoints.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 KiB

BIN
asserts/fas.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
asserts/fr_mask.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

110
docs/人脸检测.md Normal file
View File

@ -0,0 +1,110 @@
# 人脸检测器
## **1. 接口简介** <br>
人脸检测器会对输入的彩色图片或者灰度图像进行人脸检测,并返回所有检测到的人脸位置。<br>
## **2. 类型说明**<br>
### **2.1 struct SeetaImageData**<br>
|名称 | 类型 | 说明|
|---|---|---|
|data|unit8_t* |图像数据|
|width | int32_t | 图像的宽度|
|height | int32_t | 图像的高度|
|channels | int32_t | 图像的通道数|
说明:存储彩色(三通道)或灰度(单通道)图像,像素连续存储,行优先,采用 BGR888 格式存放彩色图像,单字节灰度值存放灰度图像。
### **2.2 struct SeetaRect**<br>
|名称 | 类型 | 说明|
|---|---|---|
|x|int32_t |人脸区域左上角横坐标|
|y| int32_t | 人脸区域左上角纵坐标|
|width| int32_t | 人脸区域宽度|
|height| int32_t | 人脸区域高度|
### **2.3 struct SeetaFaceInfo**<br>
|名称 | 类型 | 说明|
|---|---|---|
|pos|SeetaRect|人脸位置|
|score|float|人脸置信分数|
### **2.4 struct SeetaFaceInfoArray**<br>
|名称 | 类型 | 说明|
|---|---|---|
|data|const SeetaFaceInfo*|人脸信息数组|
|size|int|人脸信息数组长度|
## 3 class FaceDetector
人脸检测器。
### 3.1 Enum SeetaDevice
模型运行的计算设备。<br>
|名称 |说明|
|---|---|
|SEETA_DEVICE_AUTO|自动检测,会优先使用 GPU|
|SEETA_DEVICE_CPU|使用CPU计算|
|SEETA_DEVICE_GPU|使用GPU计算|
### 3.2 struct SeetaModelSetting
构造人脸检测器需要传入的结构体参数。<br>
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|model|const char**| |检测器模型|
|id|int| |GPU id|
|device|SeetaDevice|AUTO |计算设备(CPU 或者 GPU)|
### 3.3 构造函数
#### FaceDetector
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|setting|const SeetaModelSetting&| |检测器结构参数|
### 3.4 成员函数
#### detect
输入彩色图像,检测其中的人脸。<br>
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |输入的图像数据|
|返回值|SeetaFaceInfoArray| |人脸信息数组|
#### set
设置人脸检测器相关属性值。其中<br>
**PROPERTY_MIN_FACE_SIZE**: 表示人脸检测器可以检测到的最小人脸该值越小支持检测到的人脸尺寸越小检测速度越慢默认值为20<br>
**PROPERTY_THRESHOLD**:
表示人脸检测器过滤阈值,默认为 0.90<br>
**PROPERTY_MAX_IMAGE_WIDTH** 和 **PROPERTY_MAX_IMAGE_HEIGHT**:
分别表示支持输入的图像的最大宽度和高度;<br>
**PROPERTY_NUMBER_THREADS**:
表示人脸检测器计算线程数,默认为 4.
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||人脸检测器属性类别|
|value|double||设置的属性值|
|返回值|void| | | |
#### get
获取人脸检测器相关属性值。<br>
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||人脸检测器属性类别|
|返回值|double||对应的人脸属性值|

190
docs/人脸识别.md Normal file
View File

@ -0,0 +1,190 @@
# 人脸识别器
## **1. 接口简介** <br>
人脸识别器要求输入原始图像数据和人脸特征点(或者裁剪好的人脸数据),对输入的人脸提取特征值数组,根据提取的特征值数组对人脸进行相似度比较。<br>
## **2. 类型说明**<br>
### **2.1 struct SeetaImageData**<br>
|名称 | 类型 | 说明|
|---|---|---|
|data|unit8_t* |图像数据|
|width | int32_t | 图像的宽度|
|height | int32_t | 图像的高度|
|channels | int32_t | 图像的通道数|
说明:存储彩色(三通道)或灰度(单通道)图像,像素连续存储,行优先,采用 BGR888 格式存放彩色图像,单字节灰度值存放灰度图像。
### **2.2 struct SeetaPointF**<br>
|名称 | 类型 | 说明|
|---|---|---|
|x|double|人脸特征点横坐标|
|y|double|人脸特征点纵坐标|
## 3 class FaceRecognizer
人脸识别器。
### 3.1 Enum SeetaDevice
模型运行的计算设备。
|名称 |说明|
|---|---|
|SEETA_DEVICE_AUTO|自动检测,会优先使用 GPU|
|SEETA_DEVICE_CPU|使用CPU计算|
|SEETA_DEVICE_GPU|使用GPU计算|
### 3.2 struct SeetaModelSetting
构造人脸识别器需要传入的结构体参数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|model|const char**| |识别器模型|
|id|int| |GPU id|
|device|SeetaDevice|AUTO |计算设备(CPU 或者 GPU)|
### 3.3 构造函数
#### FaceRecognizer
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|setting|const SeetaModelSetting&| |识别器结构参数|
### 3.4 成员函数
#### GetCropFaceWidth
获取裁剪人脸的宽度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |返回的人脸宽度|
#### GetCropFaceHeight
获取裁剪的人脸高度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |返回的人脸高度|
#### GetCropFaceChannels
获取裁剪的人脸数据通道数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |返回的人脸数据通道数|
#### CropFace
裁剪人脸。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|points|const SeetaPointF*| |人脸特征点数组|
|face|SeetaImageData&| |返回的裁剪人脸|
|返回值|bool| |true表示人脸裁剪成功|
#### CropFace
裁剪人脸。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|points|const SeetaPointF*| |人脸特征点数组|
|返回值|seeta::ImageData| |返回的裁剪人脸|
#### GetCropFaceWidthV2
获取裁剪人脸的宽度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |返回的人脸宽度|
#### GetCropFaceHeightV2
获取裁剪的人脸高度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |返回的人脸高度|
#### GetCropFaceChannelsV2
获取裁剪的人脸数据通道数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |返回的人脸数据通道数|
#### CropFaceV2
裁剪人脸。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|points|const SeetaPointF*| |人脸特征点数组|
|face|SeetaImageData&| |返回的裁剪人脸|
|返回值|bool| |true表示人脸裁剪成功|
#### CropFaceV2
裁剪人脸。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|points|const SeetaPointF*| |人脸特征点数组|
|返回值|seeta::ImageData| |返回的裁剪人脸|
#### GetExtractFeatureSize
获取特征值数组的长度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |特征值数组的长度|
#### ExtractCroppedFace
输入裁剪后的人脸图像,提取人脸的特征值数组。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|face|const SeetaImageData&| |裁剪后的人脸图像数据|
|features|float*| |返回的人脸特征值数组|
|返回值|bool| |true表示提取特征成功|
#### Extract
输入原始图像数据和人脸特征点数组,提取人脸的特征值数组。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始的人脸图像数据|
|points|const SeetaPointF*| |人脸的特征点数组|
|features|float*| |返回的人脸特征值数组|
|返回值|bool| |true表示提取特征成功|
#### CalculateSimilarity
比较两人脸的特征值数据,获取人脸的相似度值。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|features1|const float*| |特征数组一|
|features2|const float*| |特征数组二|
|返回值|float| |相似度值|
#### set
设置相关属性值。其中<br>
**PROPERTY_NUMBER_THREADS**:
表示计算线程数,默认为 4.
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|value|double||设置的属性值|
|返回值|void| | | |
#### get
获取相关属性值。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|返回值|double||对应的属性值|

151
docs/人脸跟踪.md Normal file
View File

@ -0,0 +1,151 @@
# 人脸跟踪器
## **1. 接口简介** <br>
人脸跟踪器会对输入的彩色图像或者灰度图像中的人脸进行跟踪,并返回所有跟踪到的人脸信息。<br>
## **2. 类型说明**<br>
### **2.1 struct SeetaImageData**<br>
|名称 | 类型 | 说明|
|---|---|---|
|data|unit8_t* |图像数据|
|width | int32_t | 图像的宽度|
|height | int32_t | 图像的高度|
|channels | int32_t | 图像的通道数|
说明:存储彩色(三通道)或灰度(单通道)图像,像素连续存储,行优先,采用 BGR888 格式存放彩色图像,单字节灰度值存放灰度图像。
### **2.2 struct SeetaRect**<br>
|名称 | 类型 | 说明|
|---|---|---|
|x|int32_t |人脸区域左上角横坐标|
|y| int32_t | 人脸区域左上角纵坐标|
|width| int32_t | 人脸区域宽度|
|height| int32_t | 人脸区域高度|
### **2.3 struct SeetaTrackingFaceInfo**<br>
|名称 | 类型 | 说明|
|---|---|---|
|pos|SeetaRect|人脸位置|
|score|float|人脸置信分数|
|frame_no|int|视频帧的索引|
|PID|int|跟踪的人脸标识id|
### **2.4 struct SeetaTrackingFaceInfoArray**<br>
|名称 | 类型 | 说明|
|---|---|---|
|data|const SeetaTrackingFaceInfo*|人脸信息数组|
|size|int|人脸信息数组长度|
## 3 class FaceTracker
人脸跟踪器。
### 3.1 Enum SeetaDevice
模型运行的计算设备。
|名称 |说明|
|---|---|
|SEETA_DEVICE_AUTO|自动检测,会优先使用 GPU|
|SEETA_DEVICE_CPU|使用CPU计算|
|SEETA_DEVICE_GPU|使用GPU计算|
### 3.2 struct SeetaModelSetting
构造人脸跟踪器需要传入的结构体参数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|model|const char**| |跟踪器模型|
|id|int| |GPU id|
|device|SeetaDevice|AUTO |计算设备(CPU 或者 GPU)|
### 3.3 构造函数
#### FaceTrakcer
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|setting|const SeetaModelSetting&| |跟踪器结构参数|
|video_width|int| |视频的宽度|
|video_height|int| |视频的高度|
### 3.4 成员函数
#### SetSingleCalculationThreads
设置底层的计算线程数量。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|num|int| |线程数量|
|返回值|void| ||
#### Track
对视频帧中的人脸进行跟踪。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|返回值|SeetaTrackingFaceInfoArray| |跟踪到的人脸信息数组|
#### Track
对视频帧中的人脸进行跟踪。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|frame_no|int| |视频帧索引|
|返回值|SeetaTrackingFaceInfoArray| |跟踪到的人脸信息数组|
#### SetMinFaceSize
设置检测器的最小人脸大小。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|size|int32_t| |最小人脸大小|
|返回值|void| ||
说明size 的大小保证大于等于 20size的值越小能够检测到的人脸的尺寸越小
检测速度越慢。
#### GetMinFaceSize
获取最小人脸的大小。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int32_t| |最小人脸大小|
#### SetThreshold
设置检测器的检测阈值。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|thresh|float| |检测阈值|
|返回值|void| ||
#### GetScoreThreshold
获取检测器检测阈值。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|float| |检测阈值|
#### SetVideoStable
设置以稳定模式输出人脸跟踪结果。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|stable|bool| |是否是稳定模式|
|返回值|void| ||
说明:只有在视频中连续跟踪时,才使用此方法。
#### GetVideoStable
获取当前是否是稳定工作模式。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|bool| |是否是稳定模式|

70
docs/口罩检测.md Normal file
View File

@ -0,0 +1,70 @@
# 口罩检测器
## **1. 接口简介** <br>
口罩检测器根据输入的图像数据、人脸位置,返回是否佩戴口罩的检测结果。<br>
## **2. 类型说明**<br>
### **2.1 struct SeetaImageData**<br>
|名称 | 类型 | 说明|
|---|---|---|
|data|unit8_t* |图像数据|
|width | int32_t | 图像的宽度|
|height | int32_t | 图像的高度|
|channels | int32_t | 图像的通道数|
说明:存储彩色(三通道)或灰度(单通道)图像,像素连续存储,行优先,采用 BGR888 格式存放彩色图像,单字节灰度值存放灰度图像。
### **2.2 struct SeetaRect**<br>
|名称 | 类型 | 说明|
|---|---|---|
|x|int32_t |人脸区域左上角横坐标|
|y| int32_t | 人脸区域左上角纵坐标|
|width| int32_t | 人脸区域宽度|
|height| int32_t | 人脸区域高度|
## 3 class MaskDetector
口罩检测器。
### 3.1 Enum SeetaDevice
模型运行的计算设备。
|名称 |说明|
|---|---|
|SEETA_DEVICE_AUTO|自动检测,会优先使用 GPU|
|SEETA_DEVICE_CPU|使用CPU计算|
|SEETA_DEVICE_GPU|使用GPU计算|
### 3.2 struct SeetaModelSetting
口罩检测器需要传入的结构体参数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|model|const char**| |检测器模型|
|id|int| |GPU id|
|device|SeetaDevice|AUTO |计算设备(CPU 或者 GPU)|
### 3.3 构造函数
#### MaskDetector
构造检测器,需要在构造的时候传入检测器结构参数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|setting|const SeetaModelSetting&| |识别器接口参数|
### 3.4 成员函数
#### detect
输入图像数据、人脸位置,返回是否佩戴口罩的检测结果。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|face|const SeetaRect&| |人脸位置|
|score|float*|nullptr|戴口罩的置信度|
|返回值|bool| |true为佩戴了口罩|

125
docs/年龄估计.md Normal file
View File

@ -0,0 +1,125 @@
# 年龄估计器
## **1. 接口简介** <br>
年龄估计器要求输入原始图像数据和人脸特征点(或者裁剪好的人脸数据),对输入的人脸进行年龄估计。<br>
## **2. 类型说明**<br>
### **2.1 struct SeetaImageData**<br>
|名称 | 类型 | 说明|
|---|---|---|
|data|unit8_t* |图像数据|
|width | int32_t | 图像的宽度|
|height | int32_t | 图像的高度|
|channels | int32_t | 图像的通道数|
说明:存储彩色(三通道)或灰度(单通道)图像,像素连续存储,行优先,采用 BGR888 格式存放彩色图像,单字节灰度值存放灰度图像。
### **2.2 struct SeetaPointF**<br>
|名称 | 类型 | 说明|
|---|---|---|
|x|double|人脸特征点横坐标|
|y|double|人脸特征点纵坐标|
## 3 class AgePredictor
年龄估计器。
### 3.1 Enum SeetaDevice
模型运行的计算设备。
|名称 |说明|
|---|---|
|SEETA_DEVICE_AUTO|自动检测,会优先使用 GPU|
|SEETA_DEVICE_CPU|使用CPU计算|
|SEETA_DEVICE_GPU|使用GPU计算|
### 3.2 struct SeetaModelSetting
年龄估计器需要传入的结构体参数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|model|const char**| |模型文件|
|id|int| |GPU id|
|device|SeetaDevice|AUTO |计算设备(CPU 或者 GPU)|
### 3.3 构造函数
#### AgePredictor
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|setting|const SeetaModelSetting&| |结构参数|
### 3.4 成员函数
#### GetCropFaceWidth
获取裁剪人脸的宽度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |返回的人脸宽度|
#### GetCropFaceHeight
获取裁剪的人脸高度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |返回的人脸高度|
#### GetCropFaceChannels
获取裁剪的人脸数据通道数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |返回的人脸数据通道数|
#### CropFace
裁剪人脸。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|points|const SeetaPointF*| |人脸特征点数组|
|face|SeetaImageData&| |返回的裁剪人脸|
|返回值|bool| |true表示人脸裁剪成功|
#### PredictAge
输入裁剪好的人脸,返回估计的年龄。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|face|const SeetaImageData&| |裁剪好的人脸数据|
|age|int&| |估计的年龄|
|返回值|bool| |true表示估计成功|
#### PredictAgeWithCrop
输入原始图像数据和人脸特征点,返回估计的年龄。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始人脸数据|
|points|const SeetaPointF*| |人脸特征点|
|age|int&| |估计的年龄|
|返回值|bool| |true表示估计成功|
#### set
设置相关属性值。其中<br>
**PROPERTY_NUMBER_THREADS**:
表示计算线程数,默认为 4.
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|value|double||设置的属性值|
|返回值|void| | | |
#### get
获取相关属性值。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|返回值|double||对应的属性值|

128
docs/性别估计.md Normal file
View File

@ -0,0 +1,128 @@
# 性别估计器
## **1. 接口简介** <br>
性别估计器要求输入原始图像数据和人脸特征点(或者裁剪好的人脸数据),对输入的人脸进行性别估计。<br>
## **2. 类型说明**<br>
### **2.1 struct SeetaImageData**<br>
|名称 | 类型 | 说明|
|---|---|---|
|data|unit8_t* |图像数据|
|width | int32_t | 图像的宽度|
|height | int32_t | 图像的高度|
|channels | int32_t | 图像的通道数|
说明:存储彩色(三通道)或灰度(单通道)图像,像素连续存储,行优先,采用 BGR888 格式存放彩色图像,单字节灰度值存放灰度图像。
### **2.2 struct SeetaPointF**<br>
|名称 | 类型 | 说明|
|---|---|---|
|x|double|人脸特征点横坐标|
|y|double|人脸特征点纵坐标|
## 3 class GenderPredictor
性别估计器。
### 3.1 Enum SeetaDevice
模型运行的计算设备。
|名称 |说明|
|---|---|
|SEETA_DEVICE_AUTO|自动检测,会优先使用 GPU|
|SEETA_DEVICE_CPU|使用CPU计算|
|SEETA_DEVICE_GPU|使用GPU计算|
### 3.2 struct SeetaModelSetting
性别估计器需要传入的结构体参数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|model|const char**| |模型文件|
|id|int| |GPU id|
|device|SeetaDevice|AUTO |计算设备(CPU 或者 GPU)|
### 3.3 构造函数
#### GenderPredictor
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|setting|const SeetaModelSetting&| |结构参数|
### 3.4 成员函数
#### GetCropFaceWidth
获取裁剪人脸的宽度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |返回的人脸宽度|
#### GetCropFaceHeight
获取裁剪的人脸高度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |返回的人脸高度|
#### GetCropFaceChannels
获取裁剪的人脸数据通道数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |返回的人脸数据通道数|
#### CropFace
裁剪人脸。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|points|const SeetaPointF*| |人脸特征点数组|
|face|SeetaImageData&| |返回的裁剪人脸|
|返回值|bool| |true表示人脸裁剪成功|
#### PredictGender
输入裁剪好的人脸,返回估计的性别。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|face|const SeetaImageData&| |裁剪好的人脸数据|
|gender|GENDER&| |估计的性别|
|返回值|bool| |true表示估计成功|
说明GENDER可取值MALE男性和FEMALE女性
#### PredictGenderWithCrop
输入原始图像数据和人脸特征点,返回估计的性别。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始人脸数据|
|points|const SeetaPointF*| |人脸特征点|
|gender|GENDER&| |估计的性别|
|返回值|bool| |true表示估计成功|
说明GENDER可取值MALE男性和FEMALE女性
#### set
设置相关属性值。其中<br>
**PROPERTY_NUMBER_THREADS**:
表示计算线程数,默认为 4.
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|value|double||设置的属性值|
|返回值|void| | | |
#### get
获取相关属性值。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|返回值|double||对应的属性值|

113
docs/特征点检测.md Normal file
View File

@ -0,0 +1,113 @@
# 人脸特征点检测器
## **1. 接口简介** <br>
人脸特征点检测器要求输入原始图像数据和人脸位置,返回人脸 5 个或者其他数量的的特征点的坐标(特征点的数量和加载的模型有关)。<br>
## **2. 类型说明**<br>
### **2.1 struct SeetaImageData**<br>
|名称 | 类型 | 说明|
|---|---|---|
|data|unit8_t* |图像数据|
|width | int32_t | 图像的宽度|
|height | int32_t | 图像的高度|
|channels | int32_t | 图像的通道数|
说明:存储彩色(三通道)或灰度(单通道)图像,像素连续存储,行优先,采用 BGR888 格式存放彩色图像,单字节灰度值存放灰度图像。
### **2.2 struct SeetaRect**<br>
|名称 | 类型 | 说明|
|---|---|---|
|x|int32_t |人脸区域左上角横坐标|
|y| int32_t | 人脸区域左上角纵坐标|
|width| int32_t | 人脸区域宽度|
|height| int32_t | 人脸区域高度|
### **2.3 struct SeetaPointF**<br>
|名称 | 类型 | 说明|
|---|---|---|
|x|double|人脸特征点横坐标|
|y|double|人脸特征点纵坐标|
## 3 class FaceLandmarker
人脸特征点检测器。
### 3.1 Enum SeetaDevice
模型运行的计算设备。
|名称 |说明|
|---|---|
|SEETA_DEVICE_AUTO|自动检测,会优先使用 GPU|
|SEETA_DEVICE_CPU|使用CPU计算|
|SEETA_DEVICE_GPU|使用GPU计算|
### 3.2 struct SeetaModelSetting
构造人脸特征点检测器需要传入的结构体参数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|model|const char**| |检测器模型|
|id|int| |GPU id|
|device|SeetaDevice|AUTO |计算设备(CPU 或者 GPU)|
### 3.3 构造函数
#### FaceLandmarker
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|setting|const SeetaModelSetting&| |检测器结构参数|
### 3.4 成员函数
#### number
获取模型对应的特征点数组长度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| |模型特征点数组长度|
#### mark
获取人脸特征点。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |图像原始数据|
|face|const SeetaRect&| |人脸位置|
|points|SeetaPointF*| |获取的人脸特征点数组(需预分配好数组长度长度为number()返回的值)|
|返回值|void| | |
#### mark
获取人脸特征点和遮挡信息。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |图像原始数据|
|face|const SeetaRect&| |人脸位置|
|points|SeetaPointF*| |获取的人脸特征点数组(需预分配好数组长度长度为number()返回的值)|
|mask|int32_t*| |获取人脸特征点位置对应的遮挡信息数组(需预分配好数组长度长度为number()返回的值), 其中值为1表示被遮挡0表示未被遮挡|
|返回值|void| | |
#### mark
获取人脸特征点。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |图像原始数据|
|face|const SeetaRect&| |人脸位置|
|返回值|std::vector<SeetaPointF>| |获取的人脸特征点数组 |
#### mark_v2
获取人脸特征点和遮挡信息。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |图像原始数据|
|face|const SeetaRect&| |人脸位置|
|返回值|std::vector<PointWithMask>| |获取人脸特征点和是否遮挡数组|

View File

@ -0,0 +1,86 @@
# 眼睛状态检测器
## **1. 接口简介** <br>
眼睛检测器要求输入原始图像数据和人脸特征点,返回左眼和右眼的状态。<br>
## **2. 类型说明**<br>
### **2.1 struct SeetaImageData**<br>
|名称 | 类型 | 说明|
|---|---|---|
|data|unit8_t* |图像数据|
|width | int32_t | 图像的宽度|
|height | int32_t | 图像的高度|
|channels | int32_t | 图像的通道数|
说明:存储彩色(三通道)或灰度(单通道)图像,像素连续存储,行优先,采用 BGR888 格式存放彩色图像,单字节灰度值存放灰度图像。
### **2.2 struct SeetaPointF**<br>
|名称 | 类型 | 说明|
|---|---|---|
|x|double|人脸特征点横坐标|
|y|double|人脸特征点纵坐标|
## 3 class EyeStateDetector
眼睛状态检测器。
### 3.1 Enum SeetaDevice
模型运行的计算设备。
|名称 |说明|
|---|---|
|SEETA_DEVICE_AUTO|自动检测,会优先使用 GPU|
|SEETA_DEVICE_CPU|使用CPU计算|
|SEETA_DEVICE_GPU|使用GPU计算|
### 3.2 struct SeetaModelSetting
构造眼睛状态检测器需要传入的结构体参数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|model|const char**| |检测器模型|
|id|int| |GPU id|
|device|SeetaDevice|AUTO |计算设备(CPU 或者 GPU)|
### 3.3 构造函数
#### EyeStateDetector
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|setting|const SeetaModelSetting&| |检测器结构参数|
### 3.4 成员函数
#### Detect
输入原始图像数据和人脸特征点,返回左眼和右眼的状态。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|points|const SeetaPointF*| |人脸特征点数组|
|leftState|EYE_STATE| |返回的左眼状态|
|rightState|EYE_STATE| |返回的右眼状态|
说明EYE_STATE可取值为EYE_CLOSE闭眼、EYE_OPEN睁眼、EYE_RANDOM非眼部区域和EYE_UNKNOWN未知状态
#### set
设置相关属性值。其中<br>
**PROPERTY_NUMBER_THREADS**:
表示计算线程数,默认为 4.
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|value|double||设置的属性值|
|返回值|void| | | |
#### get
获取相关属性值。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|返回值|double||对应的属性值|

356
docs/质量评估器.md Normal file
View File

@ -0,0 +1,356 @@
# 质量评估器
## **1. 接口简介** <br>
质量评估器包含不同的质量评估模块,包括人脸亮度、人脸清晰度(非深度方法)、
人脸清晰度(深度方法)、人脸姿态(非深度方法)、人脸姿态(深度方法)、人脸分辨率和人脸完整度评估模块。<br>
## **2. 类型说明**<br>
### **2.1 struct SeetaImageData**<br>
|名称 | 类型 | 说明|
|---|---|---|
|data|unit8_t* |图像数据|
|width | int32_t | 图像的宽度|
|height | int32_t | 图像的高度|
|channels | int32_t | 图像的通道数|
说明:存储彩色(三通道)或灰度(单通道)图像,像素连续存储,行优先,采用 BGR888 格式存放彩色图像,单字节灰度值存放灰度图像。
### **2.2 struct SeetaRect**<br>
|名称 | 类型 | 说明|
|---|---|---|
|x|int32_t |人脸区域左上角横坐标|
|y| int32_t | 人脸区域左上角纵坐标|
|width| int32_t | 人脸区域宽度|
|height| int32_t | 人脸区域高度|
### **2.3 struct SeetaPointF**<br>
|名称 | 类型 | 说明|
|---|---|---|
|x|double|人脸特征点横坐标|
|y|double|人脸特征点纵坐标|
### 2.4 enum QualityLevel
|名称 | 类型 | 说明|
|---|---|---|
|LOW| |表示人脸质量为低|
|MEDIUM| |表示人脸质量为中|
|HIGH| |表示人脸质量为高|
### 2.5 class QualityResult
|名称 | 类型 | 说明|
|---|---|---|
|level|QualityLevel|人脸质量等级|
|score|float|人脸质量分数|
## 3 class QualityOfBrightness
非深度的人脸亮度评估器。
### 3.1 构造函数
#### QualityOfBrightness
人脸亮度评估器构造函数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|void|| ||
#### QualityOfBrightness
人脸亮度评估器构造函数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|v0|float| |分级参数一|
|v1|float| |分级参数二|
|v2|float| |分级参数三|
|v3|float| |分级参数四|
说明:说明:分类依据为[0, v0) and [v3, ~) => LOW[v0, v1) and [v2, v3) =>
MEDIUM[v1, v2) => HIGH。
### 3.2 成员函数
#### check
检测人脸亮度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|face|const SeetaRect&| |人脸位置|
|points|const SeetaPointF*| |人脸5个特征点数组|
|N|const int32_t| |人脸特征点数组长度|
|返回值|QualityResult| |人脸亮度检测结果|
## 4 class QualityOfClarity
非深度学习的人脸清晰度评估器。
### 4.1 构造函数
#### QualityOfClarity
人脸清晰度评估器构造函数
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|void|| ||
#### QualityOfClarity
人脸清晰度评估器构造函数
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|low|float| |分级参数一|
|high|float| |分级参数二|
说明:分类依据为[0, low)=> LOW; [low, high)=> MEDIUM; [high, ~)=> HIGH。
### 4.2 成员函数
#### check
检测人脸清晰度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|face|const SeetaRect&| |人脸位置|
|points|const SeetaPointF*| |人脸5个特征点数组|
|N|const int32_t| |人脸特征点数组长度|
|返回值|QualityResult| |人脸清晰度检测结果|
## 5 class QualityOfLBN
深度学习的人脸清晰度评估器。
### 5.1 Enum SeetaDevice
模型运行的计算设备。
|名称 |说明|
|---|---|
|SEETA_DEVICE_AUTO|自动检测,会优先使用 GPU|
|SEETA_DEVICE_CPU|使用CPU计算|
|SEETA_DEVICE_GPU|使用GPU计算|
### 5.2 struct SeetaModelSetting
构造评估器需要传入的结构体参数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|model|const char**| |评估器模型|
|id|int| |GPU id|
|device|SeetaDevice|AUTO |计算设备(CPU 或者 GPU)|
### 5.3 构造函数
人脸清晰度评估器构造函数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|setting|const SeetaModelSetting&| |对象构造结构体参数|
### 5.4 成员函数
#### Detect
检测人脸清晰度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|points|const SeetaPointF*| |人脸68个特征点数组|
|light|int*| |亮度返回结果,暂不推荐使用该返回结果|
|blur|int*| |模糊度返回结果|
|noise|int*| |是否有噪声返回结果,暂不推荐使用该返回结果|
|返回值|void| ||
说明blur 结果返回 0 说明人脸是清晰的blur 为 1 说明人脸是模糊的。
#### set
设置相关属性值。其中<br>
**PROPERTY_NUMBER_THREADS**:
表示计算线程数,默认为 4。<br>
**PROPERTY_ARM_CPU_MODE**:针对于移动端,表示设置的 cpu 计算模式。0 表示
大核计算模式1 表示小核计算模式2 表示平衡模式,为默认模式。<br>
**PROPERTY_BLUR_THRESH**:表示人脸模糊阈值,默认值大小为 0.80。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|value|double||设置的属性值|
|返回值|void| | | |
#### get
获取相关属性值。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|返回值|double||对应的属性值|
## 6 class QualityOfPose
非深度学习的人脸姿态评估器。
### 6.1 构造函数
#### QualityOfPose
人脸姿态评估器构造函数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|void|| ||
### 6.2 成员函数
#### check
检测人脸姿态。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|face|const SeetaRect&| |人脸位置|
|points|const SeetaPointF*| |人脸5个特征点数组|
|N|const int32_t| |人脸特征点数组长度|
|返回值|QualityResult| |人脸姿态检测结果|
## 7 class QualityOfPoseEx
深度学习的人脸姿态评估器。
### 7.1 Enum SeetaDevice
模型运行的计算设备。
|名称 |说明|
|---|---|
|SEETA_DEVICE_AUTO|自动检测,会优先使用 GPU|
|SEETA_DEVICE_CPU|使用CPU计算|
|SEETA_DEVICE_GPU|使用GPU计算|
### 7.2 struct SeetaModelSetting
构造评估器需要传入的结构体参数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|model|const char**| |评估器模型|
|id|int| |GPU id|
|device|SeetaDevice|AUTO |计算设备(CPU 或者 GPU)|
### 7.3 构造函数
#### QualityOfPoseEx
人脸姿态评估器构造函数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|setting|const SeetaModelSetting&| |对象结构体参数|
### 7.4 成员函数
#### check
检测人脸姿态。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|face|const SeetaRect&| |人脸位置|
|points|const SeetaPointF*| |人脸5个特征点数组|
|N|const int32_t| |人脸特征点数组长度|
|返回值|QualityResult| |人脸姿态检测结果|
#### set
设置相关属性值。其中<br>
**YAW_HIGH_THRESHOLD**:
yaw方向的分级参数一。<br>
**YAW_LOW_THRESHOLD**:
yaw方向的分级参数二。<br>
**PITCH_HIGH_THRESHOLD**
pitch方向的分级参数一。<br>
**PITCH_LOW_THRESHOLD**
pitch方向的分级参数二。<br>
**ROLL_HIGH_THRESHOLD**
roll方向的分级参数一。<br>
**ROLL_LOW_THRESHOLD**
roll方向的分级参数二。<br>
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|value|double||设置的属性值|
|返回值|void| | | |
#### get
获取相关属性值。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|返回值|double||对应的属性值|
## 8 class QualityOfResolution
非深度学习的人脸尺寸评估器。
### 8.1 构造函数
#### QualityOfResolution
人脸尺寸评估器构造函数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|void|| ||
#### QualityOfResolution
人脸尺寸评估器构造函数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|low|float| |分级参数一|
|high|float| |分级参数二|
### 8.2 成员函数
#### check
评估人脸尺寸。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|face|const SeetaRect&| |人脸位置|
|points|const SeetaPointF*| |人脸5个特征点数组|
|N|const int32_t| |人脸特征点数组长度|
|返回值|QualityResult| |人脸尺寸评估结果|
## 9 class QualityOfIntegrity
非深度学习的人脸完整度评估器,评估人脸靠近图像边缘的程度。
### 9.1 构造函数
#### QualityOfIntegrity
人脸完整评估器构造函数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|void|| ||
#### QualityOfIntegrity
人脸尺寸评估器构造函数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|low|float| |分级参数一|
|high|float| |分级参数二|
说明low和high主要来控制人脸位置靠近图像边缘的接受程度。
### 9.2 成员函数
#### check
评估人脸完整度。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|face|const SeetaRect&| |人脸位置|
|points|const SeetaPointF*| |人脸5个特征点数组|
|N|const int32_t| |人脸特征点数组长度|
|返回值|QualityResult| |人脸完整度评估结果|

159
docs/静默活体.md Normal file
View File

@ -0,0 +1,159 @@
# 静默活体识别器
## **1. 接口简介** <br>
静默活体识别根据输入的图像数据、人脸位置和人脸特征点,对输入人脸进行活体的判断,并返回人脸活体的状态。<br>
## **2. 类型说明**<br>
### **2.1 struct SeetaImageData**<br>
|名称 | 类型 | 说明|
|---|---|---|
|data|unit8_t* |图像数据|
|width | int32_t | 图像的宽度|
|height | int32_t | 图像的高度|
|channels | int32_t | 图像的通道数|
说明:存储彩色(三通道)或灰度(单通道)图像,像素连续存储,行优先,采用 BGR888 格式存放彩色图像,单字节灰度值存放灰度图像。
### **2.2 struct SeetaRect**<br>
|名称 | 类型 | 说明|
|---|---|---|
|x|int32_t |人脸区域左上角横坐标|
|y| int32_t | 人脸区域左上角纵坐标|
|width| int32_t | 人脸区域宽度|
|height| int32_t | 人脸区域高度|
### **2.3 struct SeetaPointF**<br>
|名称 | 类型 | 说明|
|---|---|---|
|x|double|人脸特征点横坐标|
|y|double|人脸特征点纵坐标|
## 3 class FaceAntiSpoofing
活体识别器。
### 3.1 Enum SeetaDevice
模型运行的计算设备。
|名称 |说明|
|---|---|
|SEETA_DEVICE_AUTO|自动检测,会优先使用 GPU|
|SEETA_DEVICE_CPU|使用CPU计算|
|SEETA_DEVICE_GPU|使用GPU计算|
### 3.2 struct SeetaModelSetting
构造活体识别器需要传入的结构体参数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|model|const char**| |识别器模型|
|id|int| |GPU id|
|device|SeetaDevice|AUTO |计算设备(CPU 或者 GPU)|
### 3.3 构造函数
#### FaceAntiSpoofing
构造活体识别器,需要在构造的时候传入识别器结构参数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|setting|const SeetaModelSetting&| |识别器接口参数|
说明:活体对象创建可以出入一个模型文件(局部活体模型)和两个模型文件(局部活体模型和全局活体模型,顺序不可颠倒),传入一个模型文件时活体识别速度快于传入两个模型文件的识别速度,传入一个模型文件时活体识别精度低于传入两个模型文件的识别精度。
### 3.4 成员函数
#### Predict
基于单帧图像对人脸是否为活体进行判断。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|face|const SeetaRect&| |人脸位置|
|points|const SeetaPointF*| |人脸特征点数组|
|返回值|Status| |人脸活体的状态|
说明Status 活体状态可取值为REAL(真人)、SPOOF(假体)、FUZZY由于图像质量问题造成的无法判断和 DETECTING正在检测DETECTING 状态针对于 PredicVideo 模式。
#### PredictVideo
基于连续视频序列对人脸是否为活体进行判断。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|image|const SeetaImageData&| |原始图像数据|
|face|const SeetaRect&| |人脸位置|
|points|const SeetaPointF*| |人脸特征点数组|
|返回值|Status| |人脸活体的状态|
说明Status 活体状态可取值为REAL(真人)、SPOOF(假体)、FUZZY由于图像质量问题造成的无法判断和 DETECTING正在检测DETECTING 状态针对于 PredicVideo 模式。
#### ResetVideo
重置活体识别结果,开始下一次 PredictVideo 识别过程。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|void| ||
#### GetPreFrameScore
获取活体检测内部分数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|clarity|float*| |人脸清晰度分数|
|reality|float*| |人脸活体分数|
|返回值|void| ||
#### SetVideoFrameCount
设置 Video 模式中识别视频帧数,当输入帧数为该值以后才会有活体的
真假结果。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|number|int32_t| |video模式下活体需求帧数|
|返回值|void| ||
#### GetVideoFrameCount
获取video模式下活体需求帧数。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|返回值|int| ||
#### SetThreshold
设置阈值。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|clarity|float| |人脸清晰度阈值|
|reality|float| |人脸活体阈值|
|返回值|void| ||
说明人脸清晰度阈值默认为0.3人脸活体阈值为0.8。
#### GetThreshold
获取阈值。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|clarity|float*| |人脸清晰度阈值|
|reality|float*| |人脸活体阈值|
#### set
设置相关属性值。其中<br>
**PROPERTY_NUMBER_THREADS**:
表示计算线程数,默认为 4.
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|value|double||设置的属性值|
|返回值|void| | | |
#### get
获取相关属性值。
|参数 | 类型 |缺省值|说明|
|---|---|---|---|
|property|Property||属性类别|
|返回值|double||对应的属性值|

66
example/qt/README.md Normal file
View File

@ -0,0 +1,66 @@
SeetaFaceDemo depend on opencv4 (or opencv3) and SeetaTech.com SF3.0 lib
open seetaface_demo.pro, modify INCLUDEPATH parameter and LIBS parameter.
INCLUDEPATH add opencv header files path and SF3.0 header files path.
LIBS add opencv libs and SF3.0 libs.
you modify and save seetaface_demo.pro, then must run qmake
example:
LINUX:
```
INCLUDEPATH += /wqy/tools/opencv4_home/include/opencv4 \
/wqy/seeta_sdk/SF3/libs/SF3.0_v1/include
LIBS += -L/wqy/tools/opencv4_home/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs \
-L/wqy/seeta_sdk/SF3/libs/SF3.0_v1/lib64 -lSeetaFaceDetector600 -lSeetaFaceLandmarker600 \
-lSeetaFaceAntiSpoofingX600 -lSeetaFaceTracking600 -lSeetaFaceRecognizer610 \
-lSeetaQualityAssessor300 -lSeetaPoseEstimation600 -lSeetaAuthorize -ltennis
```
WINDOWS:
1¡¢install vs2015
2¡¢install qt5.9.
note:when select install components, checked msvc2015 64-bit
after installed, confirm compile tool and build kits is msvc2015 64bit
3¡¢configure parameters:
SF3.0_ROOT = C:/study/SF3.0/sf3.0_windows/sf3.0_windows
OPENCV_ROOT = C:/thirdparty/opencv4.2/build
```
INCLUDEPATH += C:/thirdparty/opencv4.2/build/include \
C:/study/SF3.0/sf3.0_windows/sf3.0_windows/include
CONFIG(debug, debug|release) {
LIBS += -LC:/thirdparty/opencv4.2/build/x64/vc14/lib -lopencv_world420d \
-LC:/study/SF3.0/sf3.0_windows/sf3.0_windows/lib/x64 -lSeetaFaceDetector600d -lSeetaFaceLandmarker600d \
-lSeetaFaceAntiSpoofingX600d -lSeetaFaceTracking600d -lSeetaFaceRecognizer610d \
-lSeetaQualityAssessor300d -lSeetaPoseEstimation600d
} else {
LIBS += -LC:/thirdparty/opencv4.2/build/x64/vc14/lib -lopencv_world420 \
-LC:/study/SF3.0/sf3.0_windows/sf3.0_windows/lib/x64 -lSeetaFaceDetector600 -lSeetaFaceLandmarker600 \
-lSeetaFaceAntiSpoofingX600 -lSeetaFaceTracking600 -lSeetaFaceRecognizer610 \
-lSeetaQualityAssessor300 -lSeetaPoseEstimation600
}
```
Note:
Before running seetaface_demo, please download and save SF3.0 models into seetaface_demo's directory models.
Then copy opencv_world420d.dll and all of SF3.0 lib directory's dll files and paste them into seetaface_demo directory

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,7 @@
<RCC>
<qresource prefix="/new/prefix1">
<file>default.png</file>
<file>white.png</file>
<file>seetatech_logo.png</file>
</qresource>
</RCC>

View File

@ -0,0 +1,101 @@
#include<QtGui>
#include<QLabel>
#include<QProgressBar>
#include<QPushButton>
#include<QHBoxLayout>
#include "inputfilesprocessdialog.h"
#include "videocapturethread.h"
InputFilesProcessDlg::InputFilesProcessDlg(QWidget *parent, InputFilesThread * thread)
: QDialog(parent)
{
m_exited = false;
workthread = thread;
qDebug() << "------------dlg input----------------";
//初始化控件对象
//tr是把当前字符串翻译成为其他语言的标记
//&后面的字母是用快捷键来激活控件的标记例如可以用Alt+w激活Find &what这个控件
label = new QLabel("", this);
progressbar = new QProgressBar(this);
progressbar->setOrientation(Qt::Horizontal);
progressbar->setMinimum(0);
progressbar->setMaximum(100);
progressbar->setValue(5);
progressbar->setFormat(tr("current progress:%1%").arg(QString::number(5, 'f',1)));
progressbar->setAlignment(Qt::AlignLeft| Qt::AlignVCenter);
cancelButton = new QPushButton(tr("&Cancel"));
cancelButton->setEnabled(true);
//closeButton = new QPushButton(tr("&Close"));
//连接信号和槽
//connect(edit1, SIGNAL(textChanged()), this, SLOT(enableOkButton()));
//connect(okButton, SIGNAL(clicked()), this, SLOT(okClicked()));
//connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
connect(workthread, SIGNAL(sigprogress(float)), this, SLOT(setprogressvalue(float)));
connect(workthread, SIGNAL(sigInputFilesEnd()), this, SLOT(setinputfileend()));
QHBoxLayout *bottomLayout = new QHBoxLayout;
bottomLayout->addStretch();
bottomLayout->addWidget(cancelButton);
//bottomLayout->addWidget(closeButton);
bottomLayout->addStretch();
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(label);
mainLayout->addWidget(progressbar);
mainLayout->addStretch();
mainLayout->addLayout(bottomLayout);
this->setLayout(mainLayout);
setWindowTitle(tr("Input Files Progress"));
//cancelButton->setEnabled(true);
setFixedSize(400,160);
}
void InputFilesProcessDlg::closeEvent(QCloseEvent *event)
{
if(!m_exited)
{
workthread->m_exited = true;
event->ignore();
}else
{
event->accept();
}
}
void InputFilesProcessDlg::cancelClicked()
{
workthread->m_exited = true;
}
InputFilesProcessDlg::~InputFilesProcessDlg()
{
}
void InputFilesProcessDlg::setinputfileend()
{
hide();
m_exited = true;
close();
}
void InputFilesProcessDlg::setprogressvalue(float value)
{
QString str = QString("%1%").arg(QString::number(value, 'f',1));
progressbar->setValue(value);
progressbar->setFormat(str);
}

View File

@ -0,0 +1,48 @@
#ifndef INPUTFILESPROCESSDIALOG_H
#define INPUTFILESPROCESSDIALOG_H
#include<QDialog>
class QLabel;
class QProgressBar;
class QPushButton;
class InputFilesThread;
class InputFilesProcessDlg :public QDialog{
//如果需要在对话框类中自定义信号和槽则需要在类内添加Q_OBJECT
Q_OBJECT
public:
//构造函数,析构函数
InputFilesProcessDlg(QWidget *parent, InputFilesThread * thread);
~InputFilesProcessDlg();
protected:
void closeEvent(QCloseEvent *event);
//在signal和slots中定义这个对话框所需要的信号。
signals:
//signals修饰的函数不需要本类实现。他描述了本类对象可以发送那些求助信号
//slots必须用private修饰
private slots:
void cancelClicked();
void setprogressvalue(float value);
void setinputfileend();
//申明这个对话框需要哪些组件
private:
QLabel *label;
QProgressBar *progressbar;
//QLabel *label2;
QPushButton *cancelButton;//, *closeButton;
InputFilesThread * workthread;
bool m_exited;
};
#endif // INPUTFILESPROCESSDIALOG_H

View File

@ -0,0 +1,22 @@
#include "mainwindow.h"
#include <QApplication>
#include <QDebug>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GBK"));
//QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"))
MainWindow w;
w.setWindowTitle("SeetaFace Demo");
w.setWindowIcon(QIcon(":/new/prefix1/seetatech_logo.png"));
w.show();
QString str("乱码");
qDebug() << str;
return a.exec();
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,134 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
//#include<QTimer>
/*
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "seeta/FaceLandmarker.h"
#include "seeta/FaceDetector.h"
#include "seeta/FaceAntiSpoofing.h"
#include "seeta/Common/Struct.h"
*/
#include "videocapturethread.h"
#include "qsqldatabase.h"
#include "qsqltablemodel.h"
#include "qstandarditemmodel.h"
#include <map>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void getdatas();
void cleardata();
protected:
void closeEvent(QCloseEvent *event);
private slots:
//void on_pushButton_clicked();
void editrecord();
void deleterecord();
void onupdateui(const QImage & image);
void onrecognize(int pid, const QString & name, const QString & imagepath, float score, const QImage &image, const QRect &rc);
void onvideothreadend(int value);
void on_dbsavebtn_clicked();
void on_previewrunbtn_clicked();
void on_previewstopbtn_clicked();
void on_settingsavebtn_clicked();
void on_rotatebtn_clicked();
void showfaceinfo();
void on_tabWidget_currentChanged(int index);
void on_addimagebtn_clicked();
void on_menufacedbbtn_clicked();
//void on_pushButton_8_clicked();
void on_menusettingbtn_clicked();
void on_previewclearbtn_clicked();
void on_menuopenvideofile_clicked();
void on_menuopenpicturefile_clicked();
void on_menuopencamera_clicked();
void on_addfilesbtn_clicked();
void oninputfilesupdateui(std::vector<DataInfo *> *);
void on_settingselectmodelbtn_clicked();
private:
Ui::MainWindow *ui;
/*
QTimer *m_timer;
cv::VideoCapture * m_capture;
seeta::FaceDetector * m_fd;
seeta::FaceLandmarker * m_pd;
seeta::FaceAntiSpoofing * m_spoof;
*/
VideoCaptureThread * m_videothread;
QSqlDatabase m_database;
// QSqlTableModel * m_model;
QString m_table;
QString m_config_table;
QStandardItemModel * m_model;
QPixmap m_default_image;
//QString m_currentimagefile;
QString m_image_path;
QString m_image_tmp_path;
//QString m_model_path;
std::map<int, DataInfo *> m_datalst;
int m_currenttab;
QStandardItemModel * m_videomodel;
RecognizeType m_type;
InputFilesThread *m_inputfilesthread;
ResetModelThread *m_resetmodelthread;
};
#endif // MAINWINDOW_H

View File

@ -0,0 +1,774 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1230</width>
<height>718</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="QTabWidget" name="tabWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1221</width>
<height>751</height>
</rect>
</property>
<property name="currentIndex">
<number>3</number>
</property>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>Menu</string>
</attribute>
<widget class="QPushButton" name="menufacedbbtn">
<property name="geometry">
<rect>
<x>190</x>
<y>220</y>
<width>171</width>
<height>81</height>
</rect>
</property>
<property name="text">
<string>&amp;Face Database</string>
</property>
</widget>
<widget class="QPushButton" name="menuopencamera">
<property name="geometry">
<rect>
<x>190</x>
<y>380</y>
<width>171</width>
<height>81</height>
</rect>
</property>
<property name="text">
<string>Open &amp;Camera</string>
</property>
</widget>
<widget class="QPushButton" name="menusettingbtn">
<property name="geometry">
<rect>
<x>701</x>
<y>220</y>
<width>171</width>
<height>81</height>
</rect>
</property>
<property name="text">
<string>&amp;Setting</string>
</property>
</widget>
<widget class="QPushButton" name="menuopenvideofile">
<property name="geometry">
<rect>
<x>440</x>
<y>383</y>
<width>171</width>
<height>81</height>
</rect>
</property>
<property name="text">
<string>Open &amp;Video</string>
</property>
</widget>
<widget class="QPushButton" name="menuopenpicturefile">
<property name="geometry">
<rect>
<x>706</x>
<y>383</y>
<width>171</width>
<height>81</height>
</rect>
</property>
<property name="text">
<string>Open &amp;Image</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Face Database</string>
</attribute>
<widget class="QTableView" name="dbtableview">
<property name="geometry">
<rect>
<x>0</x>
<y>10</y>
<width>641</width>
<height>631</height>
</rect>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>660</x>
<y>10</y>
<width>521</width>
<height>121</height>
</rect>
</property>
<property name="title">
<string>Register</string>
</property>
<widget class="QPushButton" name="addimagebtn">
<property name="geometry">
<rect>
<x>61</x>
<y>60</y>
<width>131</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>&amp;Image</string>
</property>
</widget>
<widget class="QPushButton" name="addfilesbtn">
<property name="geometry">
<rect>
<x>309</x>
<y>60</y>
<width>151</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>&amp;Directory</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>660</x>
<y>230</y>
<width>521</width>
<height>391</height>
</rect>
</property>
<property name="title">
<string>Edit</string>
</property>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>45</x>
<y>40</y>
<width>21</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>ID:</string>
</property>
</widget>
<widget class="QLineEdit" name="db_editid">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>70</x>
<y>40</y>
<width>171</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>274</x>
<y>40</y>
<width>53</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Name:</string>
</property>
</widget>
<widget class="QLineEdit" name="db_editname">
<property name="geometry">
<rect>
<x>320</x>
<y>40</y>
<width>171</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>53</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Picture:</string>
</property>
</widget>
<widget class="QLabel" name="db_editpicture">
<property name="geometry">
<rect>
<x>70</x>
<y>90</y>
<width>171</width>
<height>161</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>283</x>
<y>90</y>
<width>41</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Face:</string>
</property>
</widget>
<widget class="QLabel" name="db_editcrop">
<property name="geometry">
<rect>
<x>320</x>
<y>90</y>
<width>111</width>
<height>101</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="rotatebtn">
<property name="geometry">
<rect>
<x>130</x>
<y>260</y>
<width>71</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>&amp;Rotate</string>
</property>
</widget>
<widget class="QPushButton" name="dbsavebtn">
<property name="geometry">
<rect>
<x>170</x>
<y>340</y>
<width>161</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>&amp;Save</string>
</property>
</widget>
</widget>
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Preview</string>
</attribute>
<widget class="QLabel" name="previewlabel">
<property name="geometry">
<rect>
<x>6</x>
<y>26</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="sizeIncrement">
<size>
<width>800</width>
<height>600</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="previewrunbtn">
<property name="geometry">
<rect>
<x>831</x>
<y>603</y>
<width>101</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>&amp;Run</string>
</property>
</widget>
<widget class="QPushButton" name="previewstopbtn">
<property name="geometry">
<rect>
<x>955</x>
<y>603</y>
<width>101</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>&amp;Stop</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>816</x>
<y>25</y>
<width>71</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Record:</string>
</property>
</widget>
<widget class="QLabel" name="recognize_label">
<property name="geometry">
<rect>
<x>9</x>
<y>4</y>
<width>761</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>open camera: 0</string>
</property>
</widget>
<widget class="QTableView" name="previewtableview">
<property name="geometry">
<rect>
<x>814</x>
<y>46</y>
<width>391</width>
<height>551</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="previewclearbtn">
<property name="geometry">
<rect>
<x>1076</x>
<y>603</y>
<width>101</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>&amp;Clear </string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Setting</string>
</attribute>
<widget class="QPushButton" name="settingsavebtn">
<property name="geometry">
<rect>
<x>880</x>
<y>470</y>
<width>121</width>
<height>51</height>
</rect>
</property>
<property name="text">
<string>&amp;Save</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox_3">
<property name="geometry">
<rect>
<x>110</x>
<y>40</y>
<width>661</width>
<height>80</height>
</rect>
</property>
<property name="title">
<string>Face Detector</string>
</property>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>81</x>
<y>40</y>
<width>91</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Min Face Size:</string>
</property>
</widget>
<widget class="QLineEdit" name="fdminfacesize">
<property name="geometry">
<rect>
<x>180</x>
<y>40</y>
<width>113</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>381</x>
<y>40</y>
<width>121</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Score Threshold:</string>
</property>
</widget>
<widget class="QLineEdit" name="fdthreshold">
<property name="geometry">
<rect>
<x>500</x>
<y>40</y>
<width>113</width>
<height>25</height>
</rect>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_4">
<property name="geometry">
<rect>
<x>110</x>
<y>140</y>
<width>661</width>
<height>80</height>
</rect>
</property>
<property name="title">
<string>Anti-Spoofing</string>
</property>
<widget class="QLineEdit" name="antispoofreality">
<property name="geometry">
<rect>
<x>500</x>
<y>40</y>
<width>113</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_12">
<property name="geometry">
<rect>
<x>49</x>
<y>40</y>
<width>131</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Clarity Threshold:</string>
</property>
</widget>
<widget class="QLabel" name="label_13">
<property name="geometry">
<rect>
<x>370</x>
<y>40</y>
<width>131</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Reality Threshold:</string>
</property>
</widget>
<widget class="QLineEdit" name="antispoofclarity">
<property name="geometry">
<rect>
<x>180</x>
<y>40</y>
<width>113</width>
<height>25</height>
</rect>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_5">
<property name="geometry">
<rect>
<x>110</x>
<y>250</y>
<width>661</width>
<height>151</height>
</rect>
</property>
<property name="title">
<string>Quality Assessor</string>
</property>
<widget class="QLineEdit" name="yawhighthreshold">
<property name="geometry">
<rect>
<x>180</x>
<y>40</y>
<width>61</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_15">
<property name="geometry">
<rect>
<x>37</x>
<y>39</y>
<width>141</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Yaw Score Between:</string>
</property>
</widget>
<widget class="QLineEdit" name="yawlowthreshold">
<property name="geometry">
<rect>
<x>297</x>
<y>40</y>
<width>61</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="pitchhighthreshold">
<property name="geometry">
<rect>
<x>180</x>
<y>90</y>
<width>61</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_16">
<property name="geometry">
<rect>
<x>31</x>
<y>90</y>
<width>151</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Pitch Score Between:</string>
</property>
</widget>
<widget class="QLineEdit" name="pitchlowthreshold">
<property name="geometry">
<rect>
<x>298</x>
<y>90</y>
<width>61</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_20">
<property name="geometry">
<rect>
<x>362</x>
<y>40</y>
<width>51</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>°</string>
</property>
</widget>
<widget class="QLabel" name="label_21">
<property name="geometry">
<rect>
<x>363</x>
<y>89</y>
<width>51</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>°</string>
</property>
</widget>
<widget class="QLabel" name="label_22">
<property name="geometry">
<rect>
<x>245</x>
<y>40</y>
<width>51</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>° And</string>
</property>
</widget>
<widget class="QLabel" name="label_23">
<property name="geometry">
<rect>
<x>244</x>
<y>90</y>
<width>51</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>° And</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_6">
<property name="geometry">
<rect>
<x>110</x>
<y>430</y>
<width>661</width>
<height>91</height>
</rect>
</property>
<property name="title">
<string>Face Recognizer</string>
</property>
<widget class="QLineEdit" name="fr_threshold">
<property name="geometry">
<rect>
<x>140</x>
<y>30</y>
<width>113</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>56</x>
<y>60</y>
<width>81</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Model File:</string>
</property>
</widget>
<widget class="QLineEdit" name="fr_modelpath">
<property name="geometry">
<rect>
<x>140</x>
<y>60</y>
<width>471</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_14">
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>121</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Score Threshold:</string>
</property>
</widget>
<widget class="QPushButton" name="settingselectmodelbtn">
<property name="geometry">
<rect>
<x>620</x>
<y>60</y>
<width>21</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</widget>
</widget>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1230</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,109 @@
#include<QtGui>
#include<QLabel>
#include<QProgressBar>
#include<QPushButton>
#include<QHBoxLayout>
#include "resetmodelprocessdialog.h"
#include "videocapturethread.h"
ResetModelProcessDlg::ResetModelProcessDlg(QWidget *parent, ResetModelThread * thread)
: QDialog(parent)
{
m_exited = false;
workthread = thread;
qDebug() << "------------dlg input----------------";
//初始化控件对象
//tr是把当前字符串翻译成为其他语言的标记
//&后面的字母是用快捷键来激活控件的标记例如可以用Alt+w激活Find &what这个控件
label = new QLabel("", this);
progressbar = new QProgressBar(this);
progressbar->setOrientation(Qt::Horizontal);
progressbar->setMinimum(0);
progressbar->setMaximum(100);
progressbar->setValue(5);
progressbar->setFormat(tr("current progress:%1%").arg(QString::number(5, 'f',1)));
progressbar->setAlignment(Qt::AlignLeft| Qt::AlignVCenter);
cancelButton = new QPushButton(tr("&Cancel"));
//cancelButton->setEnabled(true);
//closeButton = new QPushButton(tr("&Close"));
//连接信号和槽
connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked()));
//connect(okButton, SIGNAL(clicked()), this, SLOT(okClicked()));
//connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
connect(workthread, SIGNAL(sigprogress(float)), this, SLOT(setProgressValue(float)));
connect(workthread, SIGNAL(sigResetModelEnd(int)), this, SLOT(setResetModelEnd(int)));
QHBoxLayout *bottomLayout = new QHBoxLayout;
bottomLayout->addStretch();
bottomLayout->addWidget(cancelButton);
//bottomLayout->addWidget(closeButton);
bottomLayout->addStretch();
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(label);
mainLayout->addWidget(progressbar);
mainLayout->addStretch();
mainLayout->addLayout(bottomLayout);
this->setLayout(mainLayout);
setWindowTitle(tr("Reset Face Recognizer Model Progress"));
//cancelButton->setEnabled(true);
setFixedSize(400,160);
}
void ResetModelProcessDlg::closeEvent(QCloseEvent *event)
{
if(!m_exited)
{
workthread->m_exited = true;
event->ignore();
}else
{
event->accept();
}
}
void ResetModelProcessDlg::cancelClicked()
{
qDebug() << "ResetModelProcessDlg cancelclicked";
workthread->m_exited = true;
}
ResetModelProcessDlg::~ResetModelProcessDlg()
{
qDebug() << "ResetModelProcessDlg ~ResetModelProcessDlg";
}
void ResetModelProcessDlg::setResetModelEnd(int value)
{
m_exited = true;
this->hide();
qDebug() << "setResetModelEnd:" << value;
if(value == 0)
{
accept();
}else
{
reject();
}
}
void ResetModelProcessDlg::setProgressValue(float value)
{
QString str = QString("%1%").arg(QString::number(value, 'f',1));
progressbar->setValue(value);
progressbar->setFormat(str);
}

View File

@ -0,0 +1,50 @@
#ifndef RESETMODELPROCESSDIALOG_H
#define RESETMODELPROCESSDIALOG_H
#include<QDialog>
class QLabel;
class QProgressBar;
class QPushButton;
class ResetModelThread;
class ResetModelProcessDlg :public QDialog{
//如果需要在对话框类中自定义信号和槽则需要在类内添加Q_OBJECT
Q_OBJECT
public:
//构造函数,析构函数
ResetModelProcessDlg(QWidget *parent, ResetModelThread * thread);
~ResetModelProcessDlg();
protected:
void closeEvent(QCloseEvent *event);
//在signal和slots中定义这个对话框所需要的信号。
signals:
//signals修饰的函数不需要本类实现。他描述了本类对象可以发送那些求助信号
//slots必须用private修饰
private slots:
void cancelClicked();
void setProgressValue(float value);
void setResetModelEnd(int);
//申明这个对话框需要哪些组件
private:
QLabel *label;
QProgressBar *progressbar;
//QLabel *label2;
QPushButton *cancelButton;//, *closeButton;
ResetModelThread * workthread;
bool m_exited;
};
#endif // RESETMODELPROCESSDIALOG_H

View File

@ -0,0 +1,71 @@
#-------------------------------------------------
#
# Project created by QtCreator 2020-03-16T14:40:38
#
#-------------------------------------------------
QT += core gui sql
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = seetaface_demo
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp \
videocapturethread.cpp \
inputfilesprocessdialog.cpp \
resetmodelprocessdialog.cpp
HEADERS += \
mainwindow.h \
videocapturethread.h \
inputfilesprocessdialog.h \
resetmodelprocessdialog.h
FORMS += \
mainwindow.ui
#windows adm64:
#INCLUDEPATH += C:/thirdparty/opencv4.2/build/include \
# C:/study/SF3.0/sf3.0_windows/sf3.0_windows/include
#CONFIG(debug, debug|release) {
#LIBS += -LC:/thirdparty/opencv4.2/build/x64/vc14/lib -lopencv_world420d \
# -LC:/study/SF3.0/sf3.0_windows/sf3.0_windows/lib/x64 -lSeetaFaceDetector600d -lSeetaFaceLandmarker600d \
# -lSeetaFaceAntiSpoofingX600d -lSeetaFaceTracking600d -lSeetaFaceRecognizer610d \
# -lSeetaQualityAssessor300d -lSeetaPoseEstimation600d
#} else {
#LIBS += -LC:/thirdparty/opencv4.2/build/x64/vc14/lib -lopencv_world420 \
# -LC:/study/SF3.0/sf3.0_windows/sf3.0_windows/lib/x64 -lSeetaFaceDetector600 -lSeetaFaceLandmarker600 \
# -lSeetaFaceAntiSpoofingX600 -lSeetaFaceTracking600 -lSeetaFaceRecognizer610 \
# -lSeetaQualityAssessor300 -lSeetaPoseEstimation600
#}
#linux:
INCLUDEPATH += /wqy/tools/opencv4_home/include/opencv4 \
/wqy/seeta_sdk/SF3/libs/SF3.0_v1/include
LIBS += -L/wqy/tools/opencv4_home/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs \
-L/wqy/seeta_sdk/SF3/libs/SF3.0_v1/lib64 -lSeetaFaceDetector600 -lSeetaFaceLandmarker600 \
-lSeetaFaceAntiSpoofingX600 -lSeetaFaceTracking600 -lSeetaFaceRecognizer610 \
-lSeetaQualityAssessor300 -lSeetaPoseEstimation600 -lSeetaAuthorize -ltennis
RESOURCES += \
face_resource.qrc

View File

@ -0,0 +1,336 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.4.1, 2020-03-17T18:13:17. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{1a9b2863-cf78-4bf8-bcd9-520cf75bdafe}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.9.2 GCC 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.9.2 GCC 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.592.gcc_64_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/wqy/test/qtproject/build-seetaface_demo-Desktop_Qt_5_9_2_GCC_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/wqy/test/qtproject/build-seetaface_demo-Desktop_Qt_5_9_2_GCC_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/wqy/test/qtproject/build-seetaface_demo-Desktop_Qt_5_9_2_GCC_64bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
<value type="QString">-w</value>
<value type="QString">-r</value>
</valuelist>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">seetaface_demo</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/wqy/test/qtproject/seetaface_demo/seetaface_demo.pro</value>
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">seetaface_demo.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">/wqy/test/qtproject/build-seetaface_demo-Desktop_Qt_5_9_2_GCC_64bit-Debug</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">18</value>
</data>
<data>
<variable>Version</variable>
<value type="int">18</value>
</data>
</qtcreator>

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,222 @@
#ifndef VIDEOCAPTURETHREAD_H
#define VIDEOCAPTURETHREAD_H
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "seeta/FaceLandmarker.h"
#include "seeta/FaceDetector.h"
#include "seeta/FaceAntiSpoofing.h"
#include "seeta/Common/Struct.h"
#include "seeta/CTrackingFaceInfo.h"
#include "seeta/FaceTracker.h"
#include "seeta/FaceRecognizer.h"
#include "seeta/QualityAssessor.h"
#include "seeta/QualityOfPoseEx.h"
#include "seeta/QualityOfLBN.h"
#include <QThread>
#include <QImage>
#include <QMutex>
#include <chrono>
#include <map>
typedef struct RecognizeType
{
int type; //0: open camera, 1:open video file, 2:open image file
QString filename; //when type is 1 or 2, video file name or image file name
QString title; //windows title
}RecognizeType;
typedef struct DataInfo
{
int id;
int x;
int y;
int width;
int height;
QString name;
QString image_path;
float features[1024];
}DataInfo;
typedef struct Config_Paramter
{
int MinFaceSize;
float Fd_Threshold;
int VideoWidth;
int VideoHeight;
float YawLowThreshold;
float YawHighThreshold;
float PitchLowThreshold;
float PitchHighThreshold;
float AntiSpoofClarity;
float AntiSpoofReality;
float Fr_Threshold;
QString Fr_ModelPath;
} Config_Paramter;
typedef struct Fr_DataInfo
{
int pid;
int state;
}Fr_DataInfo;
class VideoCaptureThread;
class WorkThread : public QThread
{
Q_OBJECT
public:
WorkThread(VideoCaptureThread * main);
~WorkThread();
protected:
void run();
signals:
void sigRecognize(int, const QString &, const QString &, float, const QImage &, const QRect &);
private:
int recognize(const SeetaTrackingFaceInfo & faceinfo);//, std::vector<unsigned int> & datas);
public:
VideoCaptureThread * m_mainthread;
std::vector<unsigned int> m_lastpids;
std::vector<Fr_DataInfo> m_lasterrorpids;
};
class ResetModelThread : public QThread
{
Q_OBJECT
public:
ResetModelThread( const QString &imagepath, const QString & tmpimagepath);
~ResetModelThread();
void start(std::map<int, DataInfo *> *datalst, const QString & table, seeta::FaceRecognizer * fr);
protected:
void run();
signals:
//void sigResetModelUpdateUI(std::vector<DataInfo *> *);
void sigResetModelEnd(int);
void sigprogress(float);
public:
seeta::FaceRecognizer * m_fr;
//VideoCaptureThread * m_mainthread;
std::map<int, DataInfo *> * m_datalst;
QString m_table;
QString m_image_path;
QString m_image_tmp_path;
bool m_exited;
};
class InputFilesThread : public QThread
{
Q_OBJECT
public:
InputFilesThread(VideoCaptureThread * main, const QString &imagepath, const QString & tmpimagepath);
~InputFilesThread();
void start(const QStringList * files, unsigned int id, const QString & table);
protected:
void run();
signals:
void sigInputFilesUpdateUI(std::vector<DataInfo *> *);
void sigInputFilesEnd();
void sigprogress(float);
public:
VideoCaptureThread * m_mainthread;
const QStringList * m_files;
unsigned int m_id;
QString m_table;
QString m_image_path;
QString m_image_tmp_path;
bool m_exited;
};
class VideoCaptureThread : public QThread
{
Q_OBJECT
public:
VideoCaptureThread(std::map<int, DataInfo *> * datalst, int videowidth, int videoheight);
~VideoCaptureThread();
//void setMinFaceSize(int size);
void setparamter();
int checkimage(const QString & image, const QString & crop, float * features, SeetaRect &rect);
void start(const RecognizeType &type);
seeta::FaceRecognizer * CreateFaceRecognizer(const QString & modelfile);
void set_fr(seeta::FaceRecognizer * fr);
protected:
void run();
signals:
void sigUpdateUI(const QImage & image);
void sigEnd(int);
private:
cv::VideoCapture * m_capture;
public:
seeta::FaceDetector * m_fd;
seeta::FaceLandmarker * m_pd;
seeta::FaceLandmarker * m_pd68;
seeta::FaceAntiSpoofing * m_spoof;
seeta::FaceRecognizer * m_fr;
seeta::FaceTracker * m_tracker;
seeta::QualityAssessor * m_qa;
seeta::QualityOfLBN * m_lbn;
seeta::QualityOfPoseEx * m_poseex;
public:
bool m_isrun;
bool m_exited;
std::map<int, DataInfo *> *m_datalst;
bool m_readimage;
SeetaImageData *m_mainImage;
cv::Mat m_mainmat;
std::vector<SeetaTrackingFaceInfo> m_mainfaceinfos;
WorkThread * m_workthread;
QMutex m_mutex;
RecognizeType m_type;
};
#endif // VIDEOCAPTURETHREAD_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B