SeetaFace2Demo
离线人脸识别升级版SeetaFace2
GitHub地址:
https://github.com/shuguoli68/LiSeetaFace2
效果截图
- 人脸检测识别
2. 人脸相似度:
使用
- 一、How to use ?
Step 1. Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.shuguoli68:LiSeetaFace2:1.0'
}
- 二、添加so文件、将模型文件复制到SD卡
-
so文件下载
:
https://pan.baidu.com/s/1lG56H7GXuQDfC6ybhrXbNA
armeabi-v7a: libSeetaFaceDetector2.so 、 libSeetaFaceLandmarker2.so 、 libSeetaFaceRecognizer2.so 、 libseetanet2.so
将SO文件放置在jniLibs下的armeabi-v7a的文件夹下,并且在主module下(一般为app):
defaultConfig {
...
ndk {
abiFilters 'armeabi-v7a'
}
}
-
模型文件下载
:
https://pan.baidu.com/s/1s4OWPnVFj3_xLNoQM1mdqA
dat模型文件seetaface :SeetaFaceDetector2.0.ats 、 SeetaFaceRecognizer2.0.ats 、 SeetaPointDetector2.0.pts5.ats
将三个ats文件放置在SD卡,根目录下的seetaface目录下,可以放在assets资源目录下,然后复制到SD卡,或者去服务器下载
- 二、初始化代码
Thread{
if (SeetaHelper.copyAts(this))//将assets目录中的模型文件拷贝到SD卡
SeetaHelper.getInstance().init()
}.start()
- 三、关键代码
val seetaImageData = SeetaUtil.ConvertToSeetaImageData(bitmap)//转化SeetaImageData
val seetaRects = SeetaHelper.getInstance().faceDetector2.Detect(seetaImageData)//人脸框的位置
val seetaPoints = SeetaHelper.getInstance().pointDetector2.Detect(seetaImageData, seetaRects[i])//脸部5个特征点
//得出两张人脸的相似度
val sim = SeetaHelper.getInstance().faceRecognizer2.Compare(
seetaImageData,
seetaPoints,
seetaImageData2,
seetaPoints2
)
GitHub地址:
https://github.com/shuguoli68/LiSeetaFace2
参考:
https://github.com/seetafaceengine/SeetaFace2
https://github.com/seetaface/SeetaFaceEngine2/blob/master/example/android/README.md
版权声明:本文为qq_36992688原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。