public class FaceUtils extends Object
| 构造器和说明 |
|---|
FaceUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static float |
convertScoreToSimilarity(String metricType,
float score)
将 Milvus 查询返回的得分转换为 0~1 范围的相似度
|
static DetectionResponse |
convertToDetectionResponse(ai.djl.modality.cv.output.DetectedObjects detection,
ai.djl.modality.cv.Image img)
转换为FaceDetectedResult
|
static DetectionResponse |
convertToDetectionResponse(com.seeta.sdk.SeetaRect[] seetaResult,
List<com.seeta.sdk.SeetaPointF[]> seetaPointFSList)
转换为FaceDetectedResult
|
static DetectionRectangle |
correctRect(DetectionRectangle rectangle,
int imageWidth,
int imageHeight)
修正检测框
|
static ai.djl.modality.cv.Image |
cropFace(ai.djl.modality.cv.Image image,
DetectionRectangle rectangle)
裁剪人脸
|
static void |
drawBoxesWithFaceAttribute(BufferedImage sourceImage,
DetectionResponse detectionResponse,
String savePath)
绘制人脸属性
|
static double[][] |
facePoints(List<Point> points)
子图中人脸关键点坐标 - Coordinates of key points in the image
|
static ai.djl.ndarray.NDArray |
faceTemplate112x112(ai.djl.ndarray.NDManager manager)
112x112的目标点 - Target point of 112x112
standard 5 landmarks for FFHQ faces with 112x112
|
static ai.djl.ndarray.NDArray |
faceTemplate512x512(ai.djl.ndarray.NDManager manager)
512x512的目标点 - Target point of 512x512
standard 5 landmarks for FFHQ faces with 512 x 512
|
static ai.djl.ndarray.NDArray |
faceTemplate96x112(ai.djl.ndarray.NDManager manager)
96x112的目标点 - Target point of 96x112
standard 5 landmarks for FFHQ faces with 96x112
|
static DetectionResponse |
featuresConvertToResponse(com.seeta.sdk.SeetaRect[] seetaResult,
List<com.seeta.sdk.SeetaPointF[]> seetaPointFSList,
List<float[]> featureList)
转换为FaceDetectedResult(人脸特征提取)
|
static DetectionResponse |
featuresConvertToResponse(com.seeta.sdk.SeetaRect rect,
com.seeta.sdk.SeetaPointF[] seetaPointFS,
float[] feature)
转换为FaceDetectedResult(人脸特征提取)
|
static ai.djl.modality.cv.output.DetectedObjects |
toDetectedObjects(MtcnnBatchResult mtcnnBatchResult,
int imageWidth,
int imageHeight)
将 Mtcnn 批量结果转换为 DJL 的 DetectedObjects
|
public static DetectionResponse convertToDetectionResponse(ai.djl.modality.cv.output.DetectedObjects detection, ai.djl.modality.cv.Image img)
detection - img - public static DetectionResponse convertToDetectionResponse(com.seeta.sdk.SeetaRect[] seetaResult, List<com.seeta.sdk.SeetaPointF[]> seetaPointFSList)
seetaResult - public static DetectionResponse featuresConvertToResponse(com.seeta.sdk.SeetaRect[] seetaResult, List<com.seeta.sdk.SeetaPointF[]> seetaPointFSList, List<float[]> featureList)
seetaResult - public static DetectionResponse featuresConvertToResponse(com.seeta.sdk.SeetaRect rect, com.seeta.sdk.SeetaPointF[] seetaPointFS, float[] feature)
rect - seetaPointFS - feature - public static DetectionRectangle correctRect(DetectionRectangle rectangle, int imageWidth, int imageHeight)
rectangle - imageWidth - imageHeight - public static double[][] facePoints(List<Point> points)
points - public static ai.djl.ndarray.NDArray faceTemplate512x512(ai.djl.ndarray.NDManager manager)
manager - public static ai.djl.ndarray.NDArray faceTemplate112x112(ai.djl.ndarray.NDManager manager)
manager - public static ai.djl.ndarray.NDArray faceTemplate96x112(ai.djl.ndarray.NDManager manager)
manager - public static void drawBoxesWithFaceAttribute(BufferedImage sourceImage, DetectionResponse detectionResponse, String savePath) throws IOException
sourceImage - detectionResponse - savePath - IOExceptionpublic static float convertScoreToSimilarity(String metricType, float score)
metricType - 向量度量方式:IP 或 L2score - 原始得分(L2 为距离,IP 为相似度)public static ai.djl.modality.cv.Image cropFace(ai.djl.modality.cv.Image image,
DetectionRectangle rectangle)
image - rectangle - public static ai.djl.modality.cv.output.DetectedObjects toDetectedObjects(MtcnnBatchResult mtcnnBatchResult, int imageWidth, int imageHeight)
mtcnnBatchResult - imageWidth - imageHeight - Copyright © 2025. All rights reserved.