关于加强公司网站建设的通知,logo素材网站有哪些,长治企业网站建设,上海网站推荐写在前面 工作中遇到#xff0c;简单整理人脸识别中#xff0c;对于模糊程度较高的图像数据#xff0c;识别率低#xff0c;错误率高。虽然使用 AdaFace 模型#xff0c;对低质量人脸表现尤为突出。但是还是需要对 模糊程度高的图像进行丢弃处理当前通过阈值分类#xff…写在前面 工作中遇到简单整理人脸识别中对于模糊程度较高的图像数据识别率低错误率高。虽然使用 AdaFace 模型对低质量人脸表现尤为突出。但是还是需要对 模糊程度高的图像进行丢弃处理当前通过阈值分类符合要求的进行特性提取实际应用中可以维护一个质量分数比如由 模糊程度图片字节大小人脸姿态评估(欧拉角)等 算出一个综合质量分用于人脸归类/聚类理解不足小伙伴帮忙指正 对每个人而言真正的职责只有一个找到自我。然后在心中坚守其一生全心全意永不停息。所有其它的路都是不完整的是人的逃避方式是对大众理想的懦弱回归是随波逐流是对内心的恐惧 ——赫尔曼·黑塞《德米安》 模糊度检测算法来自 https://pyimagesearch.com/2015/09/07/blur-detection-with-opencv/
具体实现方式小伙伴可直接看原文 这种方法起作用的原因是由于拉普拉斯算子本身的定义它用于测量图像的二阶导数。拉普拉斯突出显示包含快速强度变化的图像区域与 Sobel 和 Scharr 算子非常相似。而且就像这些运算符一样拉普拉斯通常用于边缘检测。这里的假设是如果图像包含高方差则存在广泛的响应包括边缘类和非边缘类代表正常的焦点图像。但是如果方差非常低则响应的分布很小表明图像中的边缘非常小。众所周知图像越模糊边缘就越少 下面为原文的 Demo
#!/usr/bin/env python
# -*- encoding: utf-8 -*-File : detect_blur.py
Time : 2023/07/24 22:57:51
Author : Li Ruilong
Version : 1.0
Contact : liruilongergmail.com
Desc : 图片模糊度检测
# here put the import lib# import the necessary packages
from imutils import paths
import cv2
import osdef variance_of_laplacian(image):gray cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)# compute the Laplacian of the image and then return the focus# measure, which is simply the variance of the Laplacianreturn cv2.Laplacian(gray, cv2.CV_64F).var()# loop over the input images
for imagePath in paths.list_images(./res/mh):# load the image, convert it to grayscale, and compute the# focus measure of the image using the Variance of Laplacian# methodimage cv2.imread(imagePath)fm variance_of_laplacian(image)text Not Blurryprint(fm)# if the focus measure is less than the supplied threshold,# then the image should be considered blurryif fm 100:text Blurry# show the imagefile_name os.path.basename(imagePath)cv2.imwrite(str(fm)__ file_name , image)
核心代码
cv2.Laplacian(gray, cv2.CV_64F).var()如果为 Image.image ,可以使用下的方式
def variance_of_laplacian(image):Time : 2023/07/25 01:57:44Author : liruilongergmail.comVersion : 1.0Desc : 模糊度检测Args:Returns:voidnumpy_image np.array(image)cv2_image cv2.cvtColor(numpy_image, cv2.COLOR_RGB2BGR)gray cv2.cvtColor(cv2_image, cv2.COLOR_BGR2GRAY)# compute the Laplacian of the image and then return the focus# measure, which is simply the variance of the Laplacianreturn cv2.Laplacian(gray, cv2.CV_64F).var()实际测试中发现阈值设置为 100 相对来说比较合适当然如何数据集很大可以考虑 提高阈值当模糊度大于 1000 时一般为较清晰图片低于 100 时图片模糊严重
下面为对一组较模糊数据进行检测 最后一个图像模糊度为 667 其他为 200 以内
(AdaFace) C:\Users\liruilong\Documents\GitHub\AdaFace_demopython detect_blur.py
130.99918569797578
97.54477372302556
70.30346984100659
95.56028915335366
77.70006004883219
107.2065965492792
93.43007114319839
75.44132565995248
127.50238903320515
98.11810838476116
69.49917570127641
132.46578324273048
99.2095025510204
92.97255942246558
93.33812691062155
667.4883318795927博文部分内容参考
© 文中涉及参考链接内容版权归原作者所有如有侵权请告知 https://pyimagesearch.com/2015/09/07/blur-detection-with-opencv/ © 2018-2023 liruilongergmail.com, All rights reserved. 保持署名-非商用-相同方式共享(CC BY-NC-SA 4.0)