diff --git a/.gitignore b/.gitignore index f7704e1e33b017dbcf5adfbfc0c70d16e5ce73a5..b33e012d38b866473a6e81cb3f3e6d370d6787cd 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,15 @@ Temp dataset.txt # Model +*.pdiparams +*.pdiparams.info +*.pdmodel *.onnx *.rknn # Picture -*.jpg \ No newline at end of file +*.jpg + +# Zip +*.tar +*.zip diff --git a/README.md b/README.md index 237e34b011da10ee1450dcad8eb7cca9382eeff9..47d502acbfb722b0487bb6eb4b2451ed375b2a94 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ Lockzhiner Vision Module 拥有丰富的 IO 接口,其接口图片如下图所 * [凌智视觉模块二维码检测与识别部署指南](./example/special/qr_code_recognition) * [凌智视觉模块条码检测与识别部署指南](./example/special/bar_code_recognition) * [凌智视觉模块人脸检测部署指南](example/vision/face_detection) +* [凌智视觉模块人脸识别部署指南](example/vision/face_recognition) ## 🐛 Bug反馈 diff --git a/configs/LZ-ArcFace.yaml b/configs/LZ-ArcFace.yaml new file mode 100644 index 0000000000000000000000000000000000000000..789cdb1a296a6966c9ecb6195cf9efbb463ef734 --- /dev/null +++ b/configs/LZ-ArcFace.yaml @@ -0,0 +1,27 @@ +config: + # RGB + mean: + - 0.485 + - 0.456 + - 0.406 + std: + - 0.229 + - 0.224 + - 0.225 + type: "fp32" + +load_onnx: + inputs: + - x + input_size_list: + - + - 1 + - 3 + - 112 + - 112 + outputs: + - save_infer_model/scale_0.tmp_1 + +build: + do_quantization: True + dataset: ./dataset.txt \ No newline at end of file diff --git a/configs/LZ-MobileNetV3.yaml b/configs/LZ-MobileNetV3.yaml index 6a42da07c574041ad33ce3d132b4930bd8dab2f5..3020477267defa7a24aaf04d9fdda63c41c3ac6e 100644 --- a/configs/LZ-MobileNetV3.yaml +++ b/configs/LZ-MobileNetV3.yaml @@ -1,4 +1,5 @@ config: + # BGR mean: - 0.406 - 0.456 diff --git a/configs/LZ-Picodet.yaml b/configs/LZ-Picodet.yaml index d69b926fa08dfad33a882f50e3709bd1f4ca9a22..ce39f0e08cd8525bcef3bd1af694ff78e2a37261 100644 --- a/configs/LZ-Picodet.yaml +++ b/configs/LZ-Picodet.yaml @@ -1,4 +1,5 @@ config: + # BGR mean: - 0.406 - 0.456 diff --git a/configs/LZ-Picodet_fp32.yaml b/configs/LZ-Picodet_fp32.yaml index 1ceb3941607a1db253f684f1e658ec347a97797e..8071fd36f468de700f4ff2c7cebc90e887ddc9b7 100644 --- a/configs/LZ-Picodet_fp32.yaml +++ b/configs/LZ-Picodet_fp32.yaml @@ -1,4 +1,5 @@ config: + # BGR mean: - 0.406 - 0.456 diff --git a/configs/LZ-RetinaFace.yaml b/configs/LZ-RetinaFace.yaml index 3eacb280d6e29077247c228225d1d03258e04c99..e51314cc0e35676f65f8b1635a1c2a0d3612a7bd 100644 --- a/configs/LZ-RetinaFace.yaml +++ b/configs/LZ-RetinaFace.yaml @@ -1,4 +1,5 @@ config: + # RGB mean: - -104 - -117 diff --git a/docs/models/arcface.md b/docs/models/arcface.md new file mode 100644 index 0000000000000000000000000000000000000000..c0018575ad629ff821b0a54168bda2711f8afdcf --- /dev/null +++ b/docs/models/arcface.md @@ -0,0 +1,34 @@ +```bash +cd /path/to/LockzhinerVisionModule + +rm -rf mobileface_v1.0_infer.tar +wget https://paddle-model-ecology.bj.bcebos.com/model/insight-face/mobileface_v1.0_infer.tar +tar -xvf mobileface_v1.0_infer.tar + +rm LZ-ArcFace.onnx +paddle2onnx --model_dir mobileface_v1.0_infer \ + --model_filename inference.pdmodel \ + --params_filename inference.pdiparams \ + --save_file LZ-ArcFace.onnx \ + --deploy_backend rknn + +rm face_demo.zip +rm face_0.jpg +rm face_1.jpg +rm face_2.jpg +wget https://bj.bcebos.com/paddlehub/fastdeploy/rknpu2/face_demo.zip +unzip face_demo.zip + +rm dataset.txt +touch dataset.txt +echo face_0.jpg > dataset.txt +echo face_1.jpg > dataset.txt +echo face_2.jpg > dataset.txt + +rm LZ-ArcFace.rknn +python utils/export.py \ + --config_path=./configs/LZ-ArcFace.yaml \ + --model_load_path=./LZ-ArcFace.onnx \ + --model_save_path=./LZ-ArcFace.rknn \ + --target_platform=RV1106 +``` \ No newline at end of file diff --git a/docs/models/retinaface.md b/docs/models/retinaface.md new file mode 100644 index 0000000000000000000000000000000000000000..89f77f5e9f30cc3e1582863bb0d5888e9409f46d --- /dev/null +++ b/docs/models/retinaface.md @@ -0,0 +1,24 @@ +```bash +cd /path/to/LockzhinerVisionModule + +rm RetinaFace_mobile320.onnx +wget https://ftrg.zbox.filez.com/v2/delivery/data/95f00b0fc900458ba134f8b180b3f7a1/examples/RetinaFace/RetinaFace_mobile320.onnx + +rm LZ-RetinaFace.onnx +mv RetinaFace_mobile320.onnx LZ-RetinaFace.onnx + +rm test.jpg +# 下载不了去 https://github.com/airockchip/rknn_model_zoo/blob/main/examples/RetinaFace/model/test.jpg 下载 +wget -O test.jpg https://s21.ax1x.com/2024/11/07/pAyN4VU.jpg + +rm dataset.txt +touch dataset.txt +echo test.jpg > dataset.txt + +rm LZ-RetinaFace.rknn +python utils/export.py \ + --config_path=./configs/LZ-RetinaFace.yaml \ + --model_load_path=./LZ-RetinaFace.onnx \ + --model_save_path=./LZ-RetinaFace.rknn \ + --target_platform=RV1106 +``` \ No newline at end of file diff --git a/example/vision/face_detection/README.md b/example/vision/face_detection/README.md index b634fedd5ed5028dbbfa5452c57dba29a3db180a..784ae33bd4fb8bb94b1cf924d092ce644e8cc0c1 100644 --- a/example/vision/face_detection/README.md +++ b/example/vision/face_detection/README.md @@ -2,7 +2,7 @@ 发布版本:V0.0.0 -日期:2024-09-11 +日期:2024-11-04 文件密级:□绝密 □秘密 □内部资料 ■公开 @@ -25,13 +25,17 @@ | **日期** | **版本** | **作者** | **修改说明** | | :--------- | -------- | -------- | ------------ | -| 2024/09/11 | 0.0.0 | 郑必城 | 初始版本 | +| 2024/11/04 | 0.0.0 | 郑必城 | 初始版本 | ## 1 简介 -在深度学习中,RetinaFace是一种高效的人脸检测模型,旨在准确识别图像中的人脸及其关键点。该模型结合了特征金字塔网络(FPN)和单阶段检测方法,能够在不同尺度下进行人脸检测,从而提高了对小型和远距离人脸的检测能力。RetinaFace不仅能够检测人脸位置,还能提供人脸的五个关键点(如眼睛、鼻子和嘴巴)的坐标,适用于多种人脸识别和分析应用。 +在深度学习中,RetinaFace 是一种高效的人脸检测模型,旨在准确识别图像中的人脸及其关键点。该模型结合了特征金字塔网络(FPN)和单阶段检测方法,能够在不同尺度下进行人脸检测,从而提高了对小型和远距离人脸的检测能力。RetinaFace 不仅能够检测人脸位置,还能提供人脸的五个关键点(如眼睛、鼻子和嘴巴)的坐标,适用于多种人脸识别和分析应用。 -## 2 在凌智视觉模块上部署模型 +## 2 运行前的准备 + +* 请确保你已经下载了 [凌智视觉模块人脸检测模型](https://gitee.com/LockzhinerAI/LockzhinerVisionModule/releases/download/v0.0.0/LZ-RetinaFace.rknn) + +## 3 在凌智视觉模块上部署模型 训练完模型后,请参考以下教程在凌智视觉模块上部署检测模型例程: @@ -42,6 +46,6 @@ 以下测试数据为模型执行 Predict 函数运行 1000 次耗时的平均时间 -| 检测模型 | FPS(帧/s) | 精度(%) | +| 人脸检测模型 | FPS(帧/s) | 精度(%) | |:-------:|:----:|:----:| |LZ-RetinaFace| 38 | - | \ No newline at end of file diff --git a/example/vision/face_detection/python/README.md b/example/vision/face_detection/python/README.md index 4eb920b6f3a5314a1669470d6c136779e5d1a9c9..fc693f3b17bb71369db512588ddd273127fa35d0 100644 --- a/example/vision/face_detection/python/README.md +++ b/example/vision/face_detection/python/README.md @@ -2,7 +2,7 @@ 发布版本:V0.0.0 -日期:2024-09-11 +日期:2024-11-04 文件密级:□绝密 □秘密 □内部资料 ■公开 @@ -25,13 +25,13 @@ | **日期** | **版本** | **作者** | **修改说明** | | :--------- | -------- | -------- | ------------ | -| 2024/09/11 | 0.0.0 | 郑必城 | 初始版本 | +| 2024/11/04 | 0.0.0 | 郑必城 | 初始版本 | ## 1 简介 接下来让我们基于 Python 来部署 RetinaFace 人脸检测模型。在开始本章节前: -- 请确保你已经参考 [凌智视觉模块检测模型部署指南](../README.md) 对模型进行了充分训练。 +- 请确保你已经参考 [凌智视觉模块人脸检测模型部署指南](../README.md) 正确下载了凌智视觉模块人脸检测模型。 - 请确保你已经按照 [开发环境搭建指南](../../../../docs/introductory_tutorial/python_development_environment.md) 正确配置了开发环境。 ## 2 Python API 文档 diff --git a/example/vision/face_recognition/README.md b/example/vision/face_recognition/README.md new file mode 100644 index 0000000000000000000000000000000000000000..801af0feb658bd8a94707fecfc3f1a881a874bd0 --- /dev/null +++ b/example/vision/face_recognition/README.md @@ -0,0 +1,55 @@ +