1、人脸模块:人脸查询支持 向量数据库Milvus 和 SQLite

2、人脸模块:FaceNet人脸模型也支持人脸注册,查询等功能
3、人脸模块:Seetaface6 自动下载人脸库
4、人脸模块:Seetaface6解决依赖库重复下载问题
5、人脸模块:支持手动加载人脸库
6、人脸模块:人脸识别相关功能支持更多参数
This commit is contained in:
dengwenjie
2025-06-09 12:12:10 +08:00
parent ad6706f559
commit bca9462331
67 changed files with 4170 additions and 1438 deletions

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>cn.smartjavaai</groupId>
<artifactId>smartjavaai-parent</artifactId>
<version>1.0.15</version>
<version>1.0.16</version>
</parent>
<artifactId>smartjavaai-ocr</artifactId>
@@ -20,7 +20,7 @@
</dependency>
</dependencies>
<version>1.0.15</version>
<version>1.0.16</version>
<name>smartjavaai-ocr</name>
<description>SmartJavaAI</description>
<url>https://github.com/geekwenjie/SmartJavaAI</url>

View File

@@ -205,7 +205,7 @@ public class OcrModelFactory {
registerCommonDetModel("PADDLEOCR_V5_DET_MODEL", PpOCRV5DetModel.class);
registerCommonRecModel("PADDLEOCR_V5_REC_MODEL", PpOCRV5RecModel.class);
registerDirectionModel("CH_PPOCR_MOBILE_V2_CLS", PPOCRMobileV2Model.class);
log.info("缓存目录:{}", Config.getCachePath());
log.debug("缓存目录:{}", Config.getCachePath());
}
}

View File

@@ -80,8 +80,8 @@ public class PpOCRV5DetModel implements OcrCommonDetModel {
ZooModel detectionModel = ModelZoo.loadModel(detCriteria);
// 创建池子:每个线程独享 Predictor
this.detPredictorPool = new GenericObjectPool<>(new PredictorFactory<>(detectionModel));
log.info("当前设备: " + detectionModel.getNDManager().getDevice());
log.info("当前引擎: " + Engine.getInstance().getEngineName());
log.debug("当前设备: " + detectionModel.getNDManager().getDevice());
log.debug("当前引擎: " + Engine.getInstance().getEngineName());
} catch (IOException | ModelNotFoundException | MalformedModelException e) {
throw new OcrException("检测模型加载失败", e);
}
@@ -142,7 +142,7 @@ public class PpOCRV5DetModel implements OcrCommonDetModel {
}
OcrUtils.drawRect((Mat)img.getWrappedImage(), boxList);
Path output = Paths.get(outputPath);
log.info("Saving to {}", output.toAbsolutePath().toString());
log.debug("Saving to {}", output.toAbsolutePath().toString());
img.save(Files.newOutputStream(output), "png");
((Mat) img.getWrappedImage()).release();
} catch (IOException e) {

View File

@@ -89,8 +89,8 @@ public class PPOCRMobileV2Model implements OcrDirectionModel {
ZooModel model = ModelZoo.loadModel(criteria);
// 创建池子:每个线程独享 Predictor
this.predictorPool = new GenericObjectPool<>(new PredictorFactory<>(model));
log.info("当前设备: " + model.getNDManager().getDevice());
log.info("当前引擎: " + Engine.getInstance().getEngineName());
log.debug("当前设备: " + model.getNDManager().getDevice());
log.debug("当前引擎: " + Engine.getInstance().getEngineName());
} catch (IOException | ModelNotFoundException | MalformedModelException e) {
throw new OcrException("模型加载失败", e);
}
@@ -232,7 +232,7 @@ public class PPOCRMobileV2Model implements OcrDirectionModel {
}
OcrUtils.drawRectWithText((Mat) img.getWrappedImage(), itemList);
Path output = Paths.get(outputPath);
log.info("Saving to {}", output.toAbsolutePath().toString());
log.debug("Saving to {}", output.toAbsolutePath().toString());
img.save(Files.newOutputStream(output), "png");
((Mat) img.getWrappedImage()).release();
} catch (IOException e) {

View File

@@ -90,8 +90,8 @@ public class PpOCRV5RecModel implements OcrCommonRecModel {
try{
ZooModel recognitionModel = ModelZoo.loadModel(recCriteria);
this.recPredictorPool = new GenericObjectPool<>(new PredictorFactory<>(recognitionModel));
log.info("当前设备: " + recognitionModel.getNDManager().getDevice());
log.info("当前引擎: " + Engine.getInstance().getEngineName());
log.debug("当前设备: " + recognitionModel.getNDManager().getDevice());
log.debug("当前引擎: " + Engine.getInstance().getEngineName());
} catch (IOException | ModelNotFoundException | MalformedModelException e) {
throw new OcrException("识别模型加载失败", e);
}

View File

@@ -52,7 +52,7 @@ public class OcrUtils {
List<OcrBox> boxList = new ArrayList<OcrBox>();
for(NDArray box : dt_boxes){
float[] pointsArr = box.toFloatArray();
//log.info("points: {}", pointsArr);
//log.debug("points: {}", pointsArr);
float[] lt = java.util.Arrays.copyOfRange(pointsArr, 0, 2);
float[] rt = java.util.Arrays.copyOfRange(pointsArr, 2, 4);
float[] rb = java.util.Arrays.copyOfRange(pointsArr, 4, 6);