mirror of
https://github.com/geekwenjie/SmartJavaAI.git
synced 2026-09-09 19:18:52 +00:00
- 新增机器翻译模块:支持 200+ 种语言之间的相互翻译
- 人脸识别模块:修复批量删除人脸数据时的异常问题 - 人脸识别模块:修复人脸检索 Top大于 1 时报异常问题
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<smartjavaai.version>1.0.16</smartjavaai.version>
|
||||
<smartjavaai.version>1.0.17</smartjavaai.version>
|
||||
<!--如果打包运行,需要替换成你的main-->
|
||||
<exec.mainClass>smartai.examples.face.facerec.RetinaFaceDemo</exec.mainClass>
|
||||
|
||||
@@ -109,6 +109,12 @@
|
||||
<artifactId>smartjavaai-ocr</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--翻译模块-->
|
||||
<dependency>
|
||||
<groupId>cn.smartjavaai</groupId>
|
||||
<artifactId>smartjavaai-translate</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>ai.djl.pytorch</groupId>
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 人脸属性检测demo
|
||||
* 模型下载地址:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234
|
||||
* @author dwj
|
||||
* @date 2025/5/1
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.util.List;
|
||||
* FaceNet人脸算法模型demo
|
||||
* 支持系统:windows 64位,linux 64位,macOS M系列芯片
|
||||
* 支持功能:人脸特征提取、人脸比对(1:1)、人脸比对(1:N)、人脸注册
|
||||
* 模型下载地址:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234
|
||||
* @author dwj
|
||||
* @date 2025/4/11
|
||||
*/
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.junit.Test;
|
||||
|
||||
/**
|
||||
* GPU 人脸检测
|
||||
* 模型下载地址:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234
|
||||
* @author dwj
|
||||
* @date 2025/4/14
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.nio.file.Paths;
|
||||
/**
|
||||
* UltraLightFastGenericFaceModel 轻量人脸算法模型demo
|
||||
* 支持功能:人脸检测(不支持人脸特征提取)
|
||||
* 模型下载地址:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234
|
||||
* @author dwj
|
||||
* @date 2025/4/11
|
||||
*/
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.nio.file.Paths;
|
||||
/**
|
||||
* RetinaFace人脸算法模型demo
|
||||
* 支持功能:人脸检测(不支持人脸特征提取)
|
||||
* 模型下载地址:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234
|
||||
* @author dwj
|
||||
* @date 2025/4/11
|
||||
*/
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.util.List;
|
||||
* SeetaFace6人脸算法模型demo
|
||||
* 支持系统:windows 64位,linux 64位
|
||||
* 支持功能:人脸检测、人脸特征提取、人脸比对(1:1)、人脸比对(1:N)、人脸注册
|
||||
* 模型下载地址:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234
|
||||
* @author dwj
|
||||
* @date 2025/4/11
|
||||
*/
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 静态活体检测demo
|
||||
* 模型下载地址:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234
|
||||
* @author dwj
|
||||
* @date 2025/5/1
|
||||
*/
|
||||
|
||||
@@ -40,6 +40,7 @@ import java.util.concurrent.Future;
|
||||
/**
|
||||
* 目标检测模型demo
|
||||
* 支持功能:目标检测
|
||||
* 模型下载地址:https://pan.baidu.com/s/1MeQ0oHGl8hneicUIUVJjbg?pwd=1234 提取码: 1234
|
||||
* @author dwj
|
||||
* @date 2025/4/11
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* OCR 文本检测 示例
|
||||
* 模型下载地址:https://pan.baidu.com/s/1MLfd73Vjdpnuls9-oqc9uw?pwd=1234 提取码: 1234
|
||||
* @author dwj
|
||||
* @date 2025/5/25
|
||||
*/
|
||||
@@ -38,7 +39,7 @@ public class OcrDetectionDemo {
|
||||
//指定检测模型
|
||||
config.setModelEnum(CommonDetModelEnum.PADDLEOCR_V5_DET_MODEL);
|
||||
//指定模型位置,需要更改为自己的模型路径(下载地址请查看文档)
|
||||
config.setDetModelPath("/Users/wenjie/Documents/develop/ocr模型/PP-OCRv5_server_det_infer/PP-OCRv5_server_det.onnx");
|
||||
config.setDetModelPath("/Users/xxx/Documents/develop/ocr模型/PP-OCRv5_server_det_infer/PP-OCRv5_server_det.onnx");
|
||||
OcrCommonDetModel model = OcrModelFactory.getInstance().getDetModel(config);
|
||||
List<OcrBox> boxes = model.detect("src/main/resources/ocr_1.jpg");
|
||||
log.info("OCR检测结果:{}", JSONObject.toJSONString(boxes));
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* OCR 文本方向检测 示例
|
||||
* 模型下载地址:https://pan.baidu.com/s/1MLfd73Vjdpnuls9-oqc9uw?pwd=1234 提取码: 1234
|
||||
* @author dwj
|
||||
* @date 2025/5/25
|
||||
*/
|
||||
@@ -37,11 +38,11 @@ public class OcrDirectionDetDemo {
|
||||
//指定检测模型
|
||||
directionModelConfig.setDetModelEnum(CommonDetModelEnum.PADDLEOCR_V5_DET_MODEL);
|
||||
//指定检测模型位置,需要更改为自己的模型路径(下载地址请查看文档)
|
||||
directionModelConfig.setDetModelPath("/Users/wenjie/Documents/develop/ocr模型/PP-OCRv5_server_det_infer/PP-OCRv5_server_det.onnx");
|
||||
directionModelConfig.setDetModelPath("/Users/xxx/Documents/develop/ocr模型/PP-OCRv5_server_det_infer/PP-OCRv5_server_det.onnx");
|
||||
//指定文本方向检测模型
|
||||
directionModelConfig.setModelEnum(DirectionModelEnum.CH_PPOCR_MOBILE_V2_CLS);
|
||||
//指定文本方向检测模型路径,需要更改为自己的模型路径(下载地址请查看文档)
|
||||
directionModelConfig.setModelPath("/Users/wenjie/Documents/develop/ocr模型/ch_ppocr_mobile_v2.0_cls.onnx");
|
||||
directionModelConfig.setModelPath("/Users/xxx/Documents/develop/ocr模型/ch_ppocr_mobile_v2.0_cls.onnx");
|
||||
OcrDirectionModel directionModel = OcrModelFactory.getInstance().getDirectionModel(directionModelConfig);
|
||||
List<OcrItem> itemList = directionModel.detect("src/main/resources/ocr_3.jpg");
|
||||
log.info("OCR方向检测结果:{}", JSONObject.toJSONString(itemList));
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* OCR 文本识别 示例
|
||||
* 模型下载地址:https://pan.baidu.com/s/1MLfd73Vjdpnuls9-oqc9uw?pwd=1234 提取码: 1234
|
||||
* @author dwj
|
||||
* @date 2025/5/25
|
||||
*/
|
||||
@@ -37,11 +38,11 @@ public class OcrRecognizeDemo {
|
||||
//指定检测模型
|
||||
recModelConfig.setDetModelEnum(CommonDetModelEnum.PADDLEOCR_V5_DET_MODEL);
|
||||
//指定检测模型位置,需要更改为自己的模型路径(下载地址请查看文档)
|
||||
recModelConfig.setDetModelPath("/Users/wenjie/Documents/develop/ocr模型/PP-OCRv5_server_det_infer/PP-OCRv5_server_det.onnx");
|
||||
recModelConfig.setDetModelPath("/Users/xxx/Documents/develop/ocr模型/PP-OCRv5_server_det_infer/PP-OCRv5_server_det.onnx");
|
||||
//指定识别模型
|
||||
recModelConfig.setRecModelEnum(CommonRecModelEnum.PADDLEOCR_V5_REC_MODEL);
|
||||
//指定识别模型位置,需要更改为自己的模型路径(下载地址请查看文档)
|
||||
recModelConfig.setRecModelPath("/Users/wenjie/Documents/develop/ocr模型/PP-OCRv5_server_rec_infer/PP-OCRv5_server_rec.onnx");
|
||||
recModelConfig.setRecModelPath("/Users/xxx/Documents/develop/ocr模型/PP-OCRv5_server_rec_infer/PP-OCRv5_server_rec.onnx");
|
||||
OcrCommonRecModel recModel = OcrModelFactory.getInstance().getRecModel(recModelConfig);
|
||||
OcrInfo ocrInfo = recModel.recognize("src/main/resources/ocr_1.jpg");
|
||||
log.info("OCR识别结果:{}", JSONObject.toJSONString(ocrInfo));
|
||||
@@ -111,16 +112,16 @@ public class OcrRecognizeDemo {
|
||||
//指定检测模型
|
||||
recModelConfig.setDetModelEnum(CommonDetModelEnum.PADDLEOCR_V5_DET_MODEL);
|
||||
//指定检测模型位置,需要更改为自己的模型路径(下载地址请查看文档)
|
||||
recModelConfig.setDetModelPath("/Users/wenjie/Documents/develop/ocr模型/PP-OCRv5_server_det_infer/PP-OCRv5_server_det.onnx");
|
||||
recModelConfig.setDetModelPath("/Users/xxx/Documents/develop/ocr模型/PP-OCRv5_server_det_infer/PP-OCRv5_server_det.onnx");
|
||||
//指定识别模型
|
||||
recModelConfig.setRecModelEnum(CommonRecModelEnum.PADDLEOCR_V5_REC_MODEL);
|
||||
//directionModelConfig.setDirectionModelEnum(DirectionModelEnum.CH_PPOCR_MOBILE_V2_CLS);
|
||||
//指定识别模型位置,需要更改为自己的模型路径(下载地址请查看文档)
|
||||
recModelConfig.setRecModelPath("/Users/wenjie/Documents/develop/ocr模型/PP-OCRv5_server_rec_infer/PP-OCRv5_server_rec.onnx");
|
||||
recModelConfig.setRecModelPath("/Users/xxx/Documents/develop/ocr模型/PP-OCRv5_server_rec_infer/PP-OCRv5_server_rec.onnx");
|
||||
//指定方向检测模型
|
||||
recModelConfig.setDirectionModelEnum(DirectionModelEnum.CH_PPOCR_MOBILE_V2_CLS);
|
||||
//指定方向模型位置,需要更改为自己的模型路径(下载地址请查看文档)
|
||||
recModelConfig.setDirectionModelPath("/Users/wenjie/Documents/develop/ocr模型/ch_ppocr_mobile_v2.0_cls.onnx");
|
||||
recModelConfig.setDirectionModelPath("/Users/xxx/Documents/develop/ocr模型/ch_ppocr_mobile_v2.0_cls.onnx");
|
||||
OcrCommonRecModel recModel = OcrModelFactory.getInstance().getRecModel(recModelConfig);
|
||||
int fontSize = 25;
|
||||
recModel.recognizeAndDraw("src/main/resources/ocr_4.jpg", "output/ocr_4_recognized.jpg", fontSize);
|
||||
|
||||
Reference in New Issue
Block a user