This commit is contained in:
linfso 2025-03-10 11:21:06 +08:00
parent 6779735e9b
commit 6c848f5319
11 changed files with 21 additions and 144 deletions

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: io.github.mymonstercat:rapidocr:0.0.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr/0.0.7/rapidocr-0.0.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr/0.0.7/rapidocr-0.0.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr/0.0.7/rapidocr-0.0.7-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: io.github.mymonstercat:rapidocr-common:0.0.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-common/0.0.7/rapidocr-common-0.0.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-common/0.0.7/rapidocr-common-0.0.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-common/0.0.7/rapidocr-common-0.0.7-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: io.github.mymonstercat:rapidocr-onnx-linux-x86_64:1.2.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-onnx-linux-x86_64/1.2.2/rapidocr-onnx-linux-x86_64-1.2.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-onnx-linux-x86_64/1.2.2/rapidocr-onnx-linux-x86_64-1.2.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-onnx-linux-x86_64/1.2.2/rapidocr-onnx-linux-x86_64-1.2.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: io.github.mymonstercat:rapidocr-onnx-macosx-x86_64:1.2.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-onnx-macosx-x86_64/1.2.2/rapidocr-onnx-macosx-x86_64-1.2.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-onnx-macosx-x86_64/1.2.2/rapidocr-onnx-macosx-x86_64-1.2.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-onnx-macosx-x86_64/1.2.2/rapidocr-onnx-macosx-x86_64-1.2.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: io.github.mymonstercat:rapidocr-onnx-models:1.2.2">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-onnx-models/1.2.2/rapidocr-onnx-models-1.2.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-onnx-models/1.2.2/rapidocr-onnx-models-1.2.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-onnx-models/1.2.2/rapidocr-onnx-models-1.2.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Maven: io.github.mymonstercat:rapidocr-onnx-platform:0.0.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-onnx-platform/0.0.7/rapidocr-onnx-platform-0.0.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-onnx-platform/0.0.7/rapidocr-onnx-platform-0.0.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/io/github/mymonstercat/rapidocr-onnx-platform/0.0.7/rapidocr-onnx-platform-0.0.7-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -57,7 +57,6 @@
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.1" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.0" level="project" />
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.2" level="project" />
<orderEntry type="library" name="Maven: com.github.jeffreyning:mybatisplus-plus:1.5.1-RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.5.10" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.58" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.2.Final" level="project" />
@ -272,11 +271,5 @@
<orderEntry type="library" name="Maven: com.aspose:aspose-words:19.1.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.10.0" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.7" level="project" />
<orderEntry type="library" name="Maven: io.github.mymonstercat:rapidocr:0.0.7" level="project" />
<orderEntry type="library" name="Maven: io.github.mymonstercat:rapidocr-common:0.0.7" level="project" />
<orderEntry type="library" name="Maven: io.github.mymonstercat:rapidocr-onnx-platform:0.0.7" level="project" />
<orderEntry type="library" name="Maven: io.github.mymonstercat:rapidocr-onnx-macosx-x86_64:1.2.2" level="project" />
<orderEntry type="library" name="Maven: io.github.mymonstercat:rapidocr-onnx-linux-x86_64:1.2.2" level="project" />
<orderEntry type="library" name="Maven: io.github.mymonstercat:rapidocr-onnx-models:1.2.2" level="project" />
</component>
</module>

View File

@ -1,7 +1,6 @@
package com.xdadan.erp.web.ai;
import com.benjaminwan.ocrlibrary.OcrResult;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xdadan.erp.ai.service.OCRService;
@ -135,8 +134,8 @@ public class AICommonController extends BaseController
String filePath = PayConfig.getUploadPath();
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
OcrResult rst=ocrService.recognize(fileName);
return AjaxResult.success("成功",rst);
AjaxResult rst=ocrService.recognize(fileName);
return rst;
}
catch (Exception e)
{
@ -164,8 +163,8 @@ public class AICommonController extends BaseController
// base64写入文件
String filePath="";
OcrResult rst=ocrService.recognize(filePath);
return AjaxResult.success("成功",rst);
AjaxResult rst=ocrService.recognize(filePath);
return rst;
}

View File

@ -57,7 +57,6 @@
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.4.1" level="project" />
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.3.0" level="project" />
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.2" level="project" />
<orderEntry type="library" name="Maven: com.github.jeffreyning:mybatisplus-plus:1.5.1-RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.5.10" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.58" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.2.Final" level="project" />
@ -272,11 +271,5 @@
<orderEntry type="library" name="Maven: com.aspose:aspose-words:19.1.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.10.0" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.7" level="project" />
<orderEntry type="library" name="Maven: io.github.mymonstercat:rapidocr:0.0.7" level="project" />
<orderEntry type="library" name="Maven: io.github.mymonstercat:rapidocr-common:0.0.7" level="project" />
<orderEntry type="library" name="Maven: io.github.mymonstercat:rapidocr-onnx-platform:0.0.7" level="project" />
<orderEntry type="library" name="Maven: io.github.mymonstercat:rapidocr-onnx-macosx-x86_64:1.2.2" level="project" />
<orderEntry type="library" name="Maven: io.github.mymonstercat:rapidocr-onnx-linux-x86_64:1.2.2" level="project" />
<orderEntry type="library" name="Maven: io.github.mymonstercat:rapidocr-onnx-models:1.2.2" level="project" />
</component>
</module>

View File

@ -163,33 +163,6 @@
<artifactId>aspectjweaver</artifactId>
</dependency>
<!--ocr识别-->
<dependency>
<groupId>io.github.mymonstercat</groupId>
<artifactId>rapidocr</artifactId>
<version>0.0.7</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- 一般只需要引入一个,CPU端建议使用onnx,移动端建议使用ncnn -->
<!-- 可前往maven中央仓库https://repo1.maven.org/maven2/io/github/mymonstercat/,查看版本 -->
<dependency>
<groupId>io.github.mymonstercat</groupId>
<artifactId>rapidocr-onnx-platform</artifactId>
<version>0.0.7</version>
</dependency>
<dependency>
<groupId>io.github.mymonstercat</groupId>
<artifactId>rapidocr-onnx-linux-x86_64</artifactId>
<version>1.2.2</version>
</dependency>
</dependencies>

View File

@ -1,9 +1,6 @@
package com.xdadan.erp.ai.service;
import com.benjaminwan.ocrlibrary.OcrResult;
import io.github.mymonstercat.Model;
import io.github.mymonstercat.ocr.InferenceEngine;
import io.github.mymonstercat.ocr.config.ParamConfig;
import com.xdadan.erp.common.core.domain.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -11,24 +8,24 @@ import org.springframework.stereotype.Service;
@Slf4j
public class OCRService {
public OcrResult recognize(String filePath){
ParamConfig paramConfig = ParamConfig.getDefaultConfig();
paramConfig.setDoAngle(true);
paramConfig.setMostAngle(true);
InferenceEngine engine = InferenceEngine.getInstance(Model.ONNX_PPOCR_V4);
// 开始识别
OcrResult ocrResult = engine.runOcr(filePath, paramConfig);
return ocrResult;
public AjaxResult recognize(String filePath){
// ParamConfig paramConfig = ParamConfig.getDefaultConfig();
// paramConfig.setDoAngle(true);
// paramConfig.setMostAngle(true);
// InferenceEngine engine = InferenceEngine.getInstance(Model.ONNX_PPOCR_V4);
// // 开始识别
// OcrResult ocrResult = engine.runOcr(filePath, paramConfig);
return AjaxResult.success("成功");
}
public static void main(String[] args) {
String temPath = "/Users/alan/Downloads/工作台1.png";
ParamConfig paramConfig = ParamConfig.getDefaultConfig();
paramConfig.setDoAngle(true);
paramConfig.setMostAngle(true);
InferenceEngine engine = InferenceEngine.getInstance(Model.ONNX_PPOCR_V4);
// 开始识别
OcrResult ocrResult = engine.runOcr(temPath, paramConfig);
System.out.println("识别内容"+ocrResult.getStrRes().replace("\n", " "));
// String temPath = "/Users/alan/Downloads/工作台1.png";
// ParamConfig paramConfig = ParamConfig.getDefaultConfig();
// paramConfig.setDoAngle(true);
// paramConfig.setMostAngle(true);
// InferenceEngine engine = InferenceEngine.getInstance(Model.ONNX_PPOCR_V4);
// // 开始识别
// OcrResult ocrResult = engine.runOcr(temPath, paramConfig);
// System.out.println("识别内容"+ocrResult.getStrRes().replace("\n", " "));
}
}