mirror of
https://github.com/geekwenjie/SmartJavaAI.git
synced 2026-09-14 22:18:42 +00:00
【底层优化】 支持自由选择 OpenCV 或 BufferedImage 作为图像引擎 【通用图像】 全部模型启用 Image 输入,支持各类图片格式与 Image 的互转 【模型管理】 优化模型生命周期,关闭后可重新创建 【人脸识别】 支持在人脸查询结果中绘制姓名标注 【人脸检测】 新增人脸裁剪功能 【修复】 修复若干已知问题,提升系统稳定性
81 lines
2.0 KiB
Java
81 lines
2.0 KiB
Java
package cn.smartjavaai.face.enums;
|
|
|
|
/**
|
|
* 人脸识别模型枚举
|
|
* @author dwj
|
|
*/
|
|
public enum FaceRecModelEnum {
|
|
|
|
FACENET_MODEL("PyTorch", 112, 112, 0.7f),
|
|
SEETA_FACE6_MODEL("c++", 0, 0, 0.62f),
|
|
SEETA_FACE6_LIGHT_MODEL("c++", 0, 0, 0.62f),
|
|
INSIGHT_FACE_IRSE50_MODEL("PyTorch", 112, 112, 0.62f),
|
|
INSIGHT_FACE_MOBILE_FACENET_MODEL("PyTorch", 112, 112, 0.64f),
|
|
ELASTIC_FACE_MODEL("PyTorch", 112, 112, 0.61f),
|
|
SPHERE_FACE_20A_ONNX("OnnxRuntime", 96, 112, 0.7f),
|
|
SPHERE_FACE_20A_PT("PyTorch", 96, 112, 0.7f),
|
|
DREAM_IJBA_RES18_NAIVE("OnnxRuntime", 224, 224, 0.74f),
|
|
EVOLVE_FACE_IR50("PyTorch", 112, 112, 0.62f),
|
|
EVOLVE_FACE_IR50_ASIA("PyTorch", 112, 112, 0.62f),
|
|
EVOLVE_FACE_IR152("PyTorch", 112, 112, 0.62f),
|
|
VGG_FACE("PyTorch", 224, 224, 0.75f);
|
|
|
|
/**
|
|
* 模型输入尺寸:宽
|
|
*/
|
|
private final int inputWidth;
|
|
|
|
/**
|
|
* 模型输入尺寸:高
|
|
*/
|
|
private final int inputHeight;
|
|
|
|
/**
|
|
* 模型引擎
|
|
*/
|
|
private final String engine;
|
|
|
|
/**
|
|
* 相似度阈值
|
|
*/
|
|
private final float threshold;
|
|
|
|
FaceRecModelEnum(String engine, int inputWidth, int inputHeight, float threshold) {
|
|
this.inputWidth = inputWidth;
|
|
this.inputHeight = inputHeight;
|
|
this.engine = engine;
|
|
this.threshold = threshold;
|
|
}
|
|
|
|
public int getInputWidth() {
|
|
return inputWidth;
|
|
}
|
|
|
|
public int getInputHeight() {
|
|
return inputHeight;
|
|
}
|
|
|
|
public String getEngine() {
|
|
return engine;
|
|
}
|
|
|
|
public float getThreshold() {
|
|
return threshold;
|
|
}
|
|
|
|
/**
|
|
* 根据名称获取枚举 (忽略大小写和下划线变体)
|
|
*/
|
|
public static FaceRecModelEnum fromName(String name) {
|
|
String formatted = name.trim().toUpperCase().replaceAll("[-_]", "");
|
|
for (FaceRecModelEnum model : values()) {
|
|
if (model.name().replaceAll("_", "").equals(formatted)) {
|
|
return model;
|
|
}
|
|
}
|
|
throw new IllegalArgumentException("未知模型名称: " + name);
|
|
}
|
|
|
|
|
|
}
|