类 FaceDetectorYN
- java.lang.Object
-
- org.opencv.objdetect.FaceDetectorYN
-
public class FaceDetectorYN extends java.lang.Object基于DNN的人脸检测模型下载链接:https://github.com/opencv/opencv_zoo/tree/master/models/face_detection_yunet
-
-
字段摘要
字段 修饰符和类型 字段 描述 protected longnativeObj
-
构造函数摘要
构造函数 修饰符 构造函数 描述 protectedFaceDetectorYN(long addr)
-
方法摘要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 描述 static FaceDetectorYN__fromPtr__(long addr)static FaceDetectorYNcreate(java.lang.String model, java.lang.String config, Size input_size)使用给定参数创建人脸检测器类的实例static FaceDetectorYNcreate(java.lang.String model, java.lang.String config, Size input_size, float score_threshold)使用给定参数创建人脸检测器类的实例static FaceDetectorYNcreate(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold)使用给定参数创建人脸检测器类的实例static FaceDetectorYNcreate(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold, int top_k)使用给定参数创建人脸检测器类的实例static FaceDetectorYNcreate(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id)使用给定参数创建人脸检测器类的实例static FaceDetectorYNcreate(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)使用给定参数创建人脸检测器类的实例static FaceDetectorYNcreate(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size)static FaceDetectorYNcreate(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold)static FaceDetectorYNcreate(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold, float nms_threshold)static FaceDetectorYNcreate(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold, float nms_threshold, int top_k)static FaceDetectorYNcreate(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id)static FaceDetectorYNcreate(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)intdetect(Mat image, Mat faces)检测输入图像中的人脸。protected voidfinalize()SizegetInputSize()longgetNativeObjAddr()floatgetNMSThreshold()floatgetScoreThreshold()intgetTopK()voidsetInputSize(Size input_size)设置网络输入的大小,这将覆盖创建模型时的输入大小。voidsetNMSThreshold(float nms_threshold)设置非最大抑制阈值,以抑制IoU大于给定值的边界框voidsetScoreThreshold(float score_threshold)设置分数阈值,以过滤掉分数小于给定值的边界框voidsetTopK(int top_k)设置在NMS之前保留的边界框数量
-
-
-
方法详情
-
getNativeObjAddr
public long getNativeObjAddr()
-
__fromPtr__
public static FaceDetectorYN __fromPtr__(long addr)
-
setInputSize
public void setInputSize(Size input_size)
设置网络输入的大小,这将覆盖创建模型时的输入大小。当输入图像的大小与创建模型时的输入大小不匹配时,请调用此方法。- 参数
input_size- 输入图像的大小
-
getInputSize
public Size getInputSize()
-
setScoreThreshold
public void setScoreThreshold(float score_threshold)
设置分数阈值,以过滤掉分数小于给定值的边界框- 参数
score_threshold- 用于过滤边界框的阈值
-
getScoreThreshold
public float getScoreThreshold()
-
setNMSThreshold
public void setNMSThreshold(float nms_threshold)
设置非最大抑制阈值,以抑制IoU大于给定值的边界框- 参数
nms_threshold- NMS操作的阈值
-
getNMSThreshold
public float getNMSThreshold()
-
setTopK
public void setTopK(int top_k)
设置在NMS之前保留的边界框数量- 参数
top_k- 基于分数从最高排名保留的边界框数量
-
getTopK
public int getTopK()
-
detect
public int detect(Mat image, Mat faces)
检测输入图像中的人脸。以下是一个示例输出。- 参数
image- 要检测的图像faces- 检测结果存储在形状为 [num_faces, 15] 的二维 cv::Mat 中 - 0-1:边界框左上角的 x, y - 2-3:边界框的宽度、高度 - 4-5:右眼的 x, y(示例图像中的蓝色点) - 6-7:左眼的 x, y(示例图像中的红色点) - 8-9:鼻尖的 x, y(示例图像中的绿色点) - 10-11:嘴巴右角的 x, y(示例图像中的粉色点) - 12-13:嘴巴左角的 x, y(示例图像中的黄色点) - 14:人脸分数- 返回
- 自动生成
-
create
public static FaceDetectorYN create(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)
使用给定参数创建人脸检测器类的实例- 参数
model- 请求模型的路径config- 用于兼容性的配置文件路径,ONNX模型不需要。input_size- 输入图像的大小score_threshold- 用于过滤掉分数小于给定值的边界框的阈值nms_threshold- 用于抑制 IoU 大于给定值的边界框的阈值top_k- 在 NMS 之前保留前 K 个边界框backend_id- 后端的 IDtarget_id- 目标设备的 ID- 返回
- 自动生成
-
create
public static FaceDetectorYN create(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id)
使用给定参数创建人脸检测器类的实例- 参数
model- 请求模型的路径config- 用于兼容性的配置文件路径,ONNX模型不需要。input_size- 输入图像的大小score_threshold- 用于过滤掉分数小于给定值的边界框的阈值nms_threshold- 用于抑制 IoU 大于给定值的边界框的阈值top_k- 在 NMS 之前保留前 K 个边界框backend_id- 后端的 ID- 返回
- 自动生成
-
create
public static FaceDetectorYN create(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold, int top_k)
使用给定参数创建人脸检测器类的实例- 参数
model- 请求模型的路径config- 用于兼容性的配置文件路径,ONNX模型不需要。input_size- 输入图像的大小score_threshold- 用于过滤掉分数小于给定值的边界框的阈值nms_threshold- 用于抑制 IoU 大于给定值的边界框的阈值top_k- 在 NMS 之前保留前 K 个边界框- 返回
- 自动生成
-
create
public static FaceDetectorYN create(java.lang.String model, java.lang.String config, Size input_size, float score_threshold, float nms_threshold)
使用给定参数创建人脸检测器类的实例- 参数
model- 请求模型的路径config- 用于兼容性的配置文件路径,ONNX模型不需要。input_size- 输入图像的大小score_threshold- 用于过滤掉分数小于给定值的边界框的阈值nms_threshold- 用于抑制 IoU 大于给定值的边界框的阈值- 返回
- 自动生成
-
create
public static FaceDetectorYN create(java.lang.String model, java.lang.String config, Size input_size, float score_threshold)
使用给定参数创建人脸检测器类的实例- 参数
model- 请求模型的路径config- 用于兼容性的配置文件路径,ONNX模型不需要。input_size- 输入图像的大小score_threshold- 用于过滤掉分数小于给定值的边界框的阈值- 返回
- 自动生成
-
create
public static FaceDetectorYN create(java.lang.String model, java.lang.String config, Size input_size)
使用给定参数创建人脸检测器类的实例- 参数
model- 请求模型的路径config- 用于兼容性的配置文件路径,ONNX模型不需要。input_size- 输入图像的大小- 返回
- 自动生成
-
create
public static FaceDetectorYN create(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id, int target_id)
- 参数
framework- 源框架名称bufferModel- 包含权重二进制文件的缓冲区bufferConfig- 包含网络配置文本文件的缓冲区input_size- 输入图像的大小score_threshold- 用于过滤掉分数小于给定值的边界框的阈值nms_threshold- 用于抑制 IoU 大于给定值的边界框的阈值top_k- 在 NMS 之前保留前 K 个边界框backend_id- 后端的 IDtarget_id- 目标设备的 ID- 返回
- 自动生成
-
create
public static FaceDetectorYN create(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold, float nms_threshold, int top_k, int backend_id)
- 参数
framework- 源框架名称bufferModel- 包含权重二进制文件的缓冲区bufferConfig- 包含网络配置文本文件的缓冲区input_size- 输入图像的大小score_threshold- 用于过滤掉分数小于给定值的边界框的阈值nms_threshold- 用于抑制 IoU 大于给定值的边界框的阈值top_k- 在 NMS 之前保留前 K 个边界框backend_id- 后端的 ID- 返回
- 自动生成
-
create
public static FaceDetectorYN create(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold, float nms_threshold, int top_k)
- 参数
framework- 源框架名称bufferModel- 包含权重二进制文件的缓冲区bufferConfig- 包含网络配置文本文件的缓冲区input_size- 输入图像的大小score_threshold- 用于过滤掉分数小于给定值的边界框的阈值nms_threshold- 用于抑制 IoU 大于给定值的边界框的阈值top_k- 在 NMS 之前保留前 K 个边界框- 返回
- 自动生成
-
create
public static FaceDetectorYN create(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold, float nms_threshold)
- 参数
framework- 源框架名称bufferModel- 包含权重二进制文件的缓冲区bufferConfig- 包含网络配置文本文件的缓冲区input_size- 输入图像的大小score_threshold- 用于过滤掉分数小于给定值的边界框的阈值nms_threshold- 用于抑制 IoU 大于给定值的边界框的阈值- 返回
- 自动生成
-
create
public static FaceDetectorYN create(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size, float score_threshold)
- 参数
framework- 源框架名称bufferModel- 包含权重二进制文件的缓冲区bufferConfig- 包含网络配置文本文件的缓冲区input_size- 输入图像的大小score_threshold- 用于过滤掉分数小于给定值的边界框的阈值- 返回
- 自动生成
-
create
public static FaceDetectorYN create(java.lang.String framework, MatOfByte bufferModel, MatOfByte bufferConfig, Size input_size)
- 参数
framework- 源框架名称bufferModel- 包含权重二进制文件的缓冲区bufferConfig- 包含网络配置文本文件的缓冲区input_size- 输入图像的大小- 返回
- 自动生成
-
finalize
protected void finalize() throws java.lang.Throwable- 覆盖方法
finalize方法,继承自java.lang.Object类- 抛出异常
java.lang.Throwable
-
-