使用OpenCV部署SCRFD人脸检测,包含C++和Python两种版本的程序实现,本套程序只依赖opencv库就可以运行, 从而彻底摆脱对任何深度学习框架的依赖。
SCRFD是一个FCOS式的人脸检测器,2021年5月发出来的,SCRFD 是高效率高精度人脸检测算法,速度和精度相比其他算法都有提升。 你的机器里只要安装里OpenCV库,就能运行本套程序。C++版本的主程序是main.cpp,Python版本的主程序是main.py。 程序输出检测到的人脸矩形框和5个关键点
使用OpenCV部署SCRFD人脸检测,包含C++和Python两种版本的程序实现,本套程序只依赖opencv库就可以运行, 从而彻底摆脱对任何深度学习框架的依赖。
For the same input image, thresholds and setting, the generated confidence scores for all the detected faces are different in precision. How can we fix that?
main.py detects 123 faces in selfie.jpg
main.cpp detects 1334 faces in slelfie.jpg (ERROR)
Why?
How to solve it?
Traceback (most recent call last):
File "main.py", line 125, in
outimg = mynet.detect(srcimg)
File "main.py", line 107, in detect
i = i[0]
IndexError: invalid index to scalar variable.
File "d:\AI\Face\Face_detect\SCRFD\scrfd-opencv\main.py", line 12, in init
self.net = cv2.dnn.readNet(onnxmodel) #加载失败
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\dnn\include\opencv2/dnn/dnn.inl.hpp:349: error: (-204:Requested object was not found) Required argument "starts" not found into dictionary in function 'cv::dnn::dnn4_v20191202::Dict::get'
我试了其他scrfd的onnx模型,加载都是各种报错.不懂你有没有出现这种问题. onnxruntime 加载是正常的
C++版本报错:
1>------ 已启动生成: 项目: ConsoleApplication2, 配置: Release x64 ------
1>main.obj : error LNK2001: 无法解析的外部符号 "void __cdecl cv::imshow(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class cv::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@AEBV_InputArray@1@@z)
1>已完成生成项目“ConsoleApplication2.vcxproj”的操作 - 失败。
========== 生成: 0 成功,1 失败,0 最新,0 已跳过 ==========
有9个无法解析符号的报错
python版本的报错:
Traceback (most recent call last):
File "E:\karuizhi\scrfd-opencv-main\main.py", line 123, in
outimg = mynet.detect(srcimg)
File "E:\karuizhi\scrfd-opencv-main\main.py", line 78, in detect
bboxes = self.distance2bbox(anchor_centers, bbox_preds)
File "E:\karuizhi\scrfd-opencv-main\main.py", line 35, in distance2bbox
x1 = points[:, 0] - distance[:, 0]
ValueError: operands could not be broadcast together with shapes (12800,) (3200,)
这个相减维度不匹配x1 = points[:, 0] - distance[:, 0]
ValueError: operands could not be broadcast together with shapes (12800,) (3200,)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.