百度飞桨OCR(PP-OCRv4_server_det|PP-OCRv4_server_rec_doc)文本识别-Java项目实践

什么是OCR?

OCR(Optical Character Recognition,光学字符识别)是一种通过技术手段将图像或扫描件中的文字内容转换为可编辑、可搜索的文本格式(如TXT、Word、PDF等)的技术。它广泛应用于文档数字化、信息提取、自动化处理等领域。


OCR的核心功能

  1. 图像转文本
    将纸质文档、照片、PDF扫描件等图像中的文字提取为计算机可识别的字符。

    • 例如:从一张发票中提取金额、日期等信息。
  2. 多语言支持
    支持多种语言的字符识别(如中文、英文、日文、阿拉伯语等),甚至能处理手写体、特殊符号。

  3. 格式保留
    部分高级OCR工具可保留原文档的排版、表格结构、字体样式等。


OCR的工作原理

  1. 图像预处理

    • 去噪、二值化、倾斜校正等,优化图像质量以提高识别准确率。
  2. 字符检测与分割

    • 定位图像中的文字区域,并将单个字符或单词分割出来。
  3. 特征提取与匹配

    • 通过算法(如深度学习模型)分析字符形状,与已知字符库比对,确定最可能的字符。
  4. 后处理与优化

    • 结合上下文语义修正识别结果(如将“0”修正为字母“O”),提升文本准确性。

常见应用场景

  1. 文档数字化

    • 将纸质书籍、合同、档案扫描为电子文本,便于存储和检索。
  2. 自动化办公

    • 提取发票、收据、表单中的数据,自动导入数据库或财务系统。
  3. 移动应用

    • 手机APP(如Google Keep、扫描全能王)通过拍照提取文字,支持翻译、复制粘贴。
  4. 车牌识别与安防

    • 监控摄像头捕捉车牌信息,用于交通管理或停车场系统。
  5. 残障人士辅助

    • 帮助视障用户通过图像识别文字,再转为语音朗读。

技术挑战与局限性

  • 复杂背景干扰:如花纹背景、低对比度文字可能导致识别失败。
  • 特殊字体或手写体:艺术字体、潦草手写体可能降低准确率。
  • 多语言混合:不同语言字符的混合场景需要更复杂的模型支持。
  • 图像质量依赖:模糊、倾斜、光照不均的图像会影响识别效果。

主流OCR工具/服务

  1. 商业工具

    • Adobe Acrobat(PDF文字提取)、Google Drive(在线OCR)、ABBYY FineReader。
  2. 开源项目

    • Tesseract OCR(Google开源,支持多种语言)。
    • PaddleOCR(基于深度学习的高精度识别)。
  3. 云服务API

    • Google Cloud Vision API、Amazon Textract、百度AI开放平台OCR。

未来趋势

  • 深度学习优化:通过Transformer、CNN等模型提升复杂场景的识别准确率。
  • 端侧部署:轻量化模型(如移动端OCR)实现实时处理。
  • 多模态融合:结合语音、图像、上下文信息提升语义理解能力。
    来源于qwen3

百度飞桨OCR(python)

开源地址:

https://github.com/PaddlePaddle/PaddleOCR
文档:
https://paddlepaddle.github.io/PaddleOCR/latest/index.html

文本检测+方向分类+文本识别

以cpu为例:
conda create -n py310 python=3.10 -y
conda activate py310
python -m pip install paddlepaddle==3.0.0rc1 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
pip install paddleocrfrom paddleocr import PaddleOCR, draw_ocr# Paddleocr supports Chinese, English, French, German, Korean and Japanese
# You can set the parameter `lang` as `ch`, `en`, `french`, `german`, `korean`, `japan`
# to switch the language model in order
ocr = PaddleOCR(use_angle_cls=True, lang='en') # need to run only once to download and load model into memory
img_path = 'PaddleOCR/doc/imgs_en/img_12.jpg'
result = ocr.ocr(img_path, cls=True)
for idx in range(len(result)):res = result[idx]for line in res:print(line)# draw result
from PIL import Image
result = result[0]
image = Image.open(img_path).convert('RGB')
boxes = [line[0] for line in result]
txts = [line[1][0] for line in result]
scores = [line[1][1] for line in result]
im_show = draw_ocr(image, boxes, txts, scores, font_path='/path/to/PaddleOCR/doc/fonts/simfang.ttf')
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')

低代码平台:
https://github.com/PaddlePaddle/PaddleX
文档:
https://paddlepaddle.github.io/PaddleX/latest/module_usage/tutorials/ocr_modules/text_detection.html
开箱即用:

PaddleX:

conda create -n py310 python=3.10 -y
conda activate py310from paddlex import create_model
## 文本检测 PP-OCRv4_server_det
## 文本识别 PP-OCRv4_server_rec_doc# 车牌检测 :    PP-YOLOE-L_vehicle
# 车辆属性检测:  PP-LCNet_x1_0_vehicle_attribute
model = create_model(model_name="PP-LCNet_x1_0_vehicle_attribute")
output = model.predict(input="img/cc.jpg", batch_size=1)
# print("----",str(output))for res in output:res.print()res.save_to_img(save_path="./output/")res.save_to_json(save_path="./output/res.json")

cnocr 开源项目(python)

https://github.com/breezedeus/cnocr

开箱即用:

conda create -n py310 python=3.10 -y
conda activate py310
## cpu版本
pip install cnocr[ort-cpu] -i https://mirrors.aliyun.com/pypi/simple## gpu版本
pip install cnocr[ort-gpu] -i https://mirrors.aliyun.com/pypi/simple# 简单使用
from cnocr import CnOcr
img_fp = './docs/examples/huochepiao.jpeg'
ocr = CnOcr()  # 所有参数都使用默认值
out = ocr.ocr(img_fp)
print(out)## 使用百度飞桨的版本
from cnocr import CnOcr
img_fp = './docs/examples/shupai.png'
ocr = CnOcr(rec_model_name='ch_PP-OCRv4')
out = ocr.ocr(img_fp)
print(out)

RapidOCR

用于PaddleOCR onnx的跨平台 (python|java|C++|C#)
在这里插入图片描述
开源地址:
https://github.com/RapidAI/RapidOCR
文档:
https://rapidai.github.io/RapidOCRDocs/main/

jvm:jni 方式调用 onnx
https://github.com/RapidAI/RapidOcrOnnxJvm
https://github.com/RapidAI/RapidOcrOnnx

开箱即用

conda create -n py310 python=3.10 -y
conda activate py310pip install onnxruntime
pip install rapidocrfrom rapidocr import RapidOCR
engine = RapidOCR(params={"Global.with_torch": True})
img_url = "https://img1.baidu.com/it/u=3619974146,1266987475&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=516"
result = engine(img_url)
print(result)
result.vis("vis_result.jpg")

RapidOCRJava

在这里插入图片描述

开源地址:
https://gitee.com/lc_monster/rapid-ocr-java

开箱即用:

<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-ncnn-platform</artifactId><version>0.0.7</version>
</dependency>public static void main(String[] args) {InferenceEngine engine = InferenceEngine.getInstance(Model.ONNX_PPOCR_V4);OcrResult ocrResult = engine.runOcr("/images/test.png");System.out.println(ocrResult.getStrRes().trim());}

场景

(标准的印刷体电子文档识别和数据抽取)

一般地OCR识别底层处理

1, 文字区域识别 (det)
2,方向分类(cls)
3,文字光学识别 (rec)

PaddleOCR to onnx

## det
paddle2onnx  --model_dir C:/Users/linpx/.paddlex/official_models/PP-OCRv4_server_det  --model_filename inference.pdmodel   --params_filename inference.pdiparams  --save_file ./ppocrv4_det.onnx  --opset_version 11# rec
paddle2onnx  --model_dir C:/Users/linpx/.paddlex/official_models/PP-OCRv4_server_rec_doc  --model_filename inference.pdmodel   --params_filename inference.pdiparams  --save_file ./ppocrv4_rec_doc.onnx  --opset_version 11

项目使用

  • 底层使用 PP-OCRv4_server_det + PP-OCRv4_server_rec_doc
  • onnxruntime(2onnx): ppocrv4_det.onnx + ppocrv4_rec_doc.onnx
  • 使用rapidOCR的跨平台的jni
  • rapidOCRJava pom依赖 快速的项目集成简单ocr能力

代码部分

主要有:pdf文件转图片》图片OCR》结果重画

package app;import com.alibaba.fastjson.JSON;
import com.benjaminwan.ocrlibrary.OcrResult;
import com.benjaminwan.ocrlibrary.Point;
import com.benjaminwan.ocrlibrary.TextBlock;
import com.visual.open.anpr.core.domain.DrawImage;
import io.github.mymonstercat.Model;
import io.github.mymonstercat.ocr.InferenceEngine;
import io.github.mymonstercat.ocr.config.ParamConfig;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import nu.pattern.OpenCV;
import org.apache.commons.collections4.list.TreeList;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.PDFRenderer;
import org.opencv.core.*;
import org.opencv.imgcodecs.Imgcodecs;import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.*;
import java.util.List;public class RapidOCRJavaDemo {static {OpenCV.loadShared();System.out.println("Loaded OpenCV version: " + Core.VERSION);}public static void main(String[] args) throws IOException {System.out.println("----------start-----------------");String parentPath = "D:\\work\\ocr-img\\pdf";pdfToPng(parentPath);File parent = new File(parentPath,"pdf2img");File[] files = parent.listFiles();for (File file : files){runOcr(file.getAbsolutePath());}System.out.println("----------end-----------------");}private static void runOcr(String filePath) {File file = new File(filePath);File parent = file.getParentFile();new File(parent.getAbsolutePath()+"/ocr").mkdirs();ParamConfig paramConfig = ParamConfig.getDefaultConfig();// 图像外接白框,用于提升识别率,文字框没有正确框住所有文字时,增加此值。默认50。paramConfig.setPadding(50);// 按图像长边进行总体缩放,放大增加识别耗时但精度更高,缩小减小耗时但精度降低,maxSideLen为0表示不缩放paramConfig.setMaxSideLen(0);// 文字框置信度门限,文字框没有正确框住所有文字时,减小此值paramConfig.setBoxScoreThresh(0.5f);// 同上,自行试验paramConfig.setBoxThresh(0.3f);// 单个文字框大小倍率,越大时单个文字框越大paramConfig.setUnClipRatio(1.6f);// 启用(true)/禁用(false) 文字方向检测,只有图片倒置的情况下(旋转90~270度的图片),才需要启用文字方向检测,默认关闭paramConfig.setDoAngle(false);// 启用(1)/禁用(0) 角度投票(整张图片以最大可能文字方向来识别),当禁用文字方向检测时,此项也不起作用,默认关闭paramConfig.setMostAngle(false);InferenceEngine engine = InferenceEngine.getInstance(Model.ONNX_PPOCR_V4);String outFileBox = parent.getAbsolutePath()+"/ocr/result_box_"+file.getName();String outFileFill = parent.getAbsolutePath()+"/ocr/result_fill_"+file.getName();OcrResult ocrResult = engine.runOcr(filePath, paramConfig);System.out.println(JSON.toJSONString(ocrResult));
//        System.out.println(ocrResult.getStrRes().trim());// 画框版本DrawImage drawBox = DrawImage.build(filePath);drawTextToImg(ocrResult.getTextBlocks(), drawBox);saveFileToDir(drawBox, outFileBox);createGrayBackgroundImage(filePath, outFileFill);// 填充文本版本DrawImage drawFill = DrawImage.build(outFileFill);drawFilledTextToImg(ocrResult.getTextBlocks(), drawFill);saveFileToDir(drawFill, outFileFill);}private static void pdfToPng(String parentPath) throws IOException {File parent = new File(parentPath);File[] files = parent.listFiles();new File(parent.getAbsolutePath()+"/pdf2img").mkdirs();for (int i = 0; i < files.length; i++) {File file = files[i];PDDocument document = PDDocument.load(file);PDFRenderer renderer = new PDFRenderer(document);String newFileName = UUID.randomUUID().toString().replace("-","");for (int j = 0; j < document.getNumberOfPages(); j++) {BufferedImage image = renderer.renderImageWithDPI(j, 300); // 300 DPIImageIO.write(image, "PNG", new File(parent.getAbsolutePath()+"/pdf2img",newFileName+"_page_" + (j + 1) + ".png"));}document.close();}}/*** 根据源图片生成一个灰色背景的新空白图片** @param sourceImagePath 源图片路径* @param outputImagePath 输出图片路径* @param grayValue       灰色值(0~255),推荐 128*/public static void createGrayBackgroundImage(String sourceImagePath, String outputImagePath) {int grayValue = 100;// 读取源图片Mat src = Imgcodecs.imread(sourceImagePath);if (src.empty()) {throw new RuntimeException("无法读取源图片: " + sourceImagePath);}// 获取源图尺寸int width = src.cols();int height = src.rows();// 创建一个与源图尺寸相同的新 Mat 对象,3 通道,8 位无符号整型Mat grayImage = new Mat(height, width, CvType.CV_8UC3, new Scalar(grayValue, grayValue, grayValue));// 释放源图资源(如果不需要后续使用)src.release();// 保存新图片boolean success = Imgcodecs.imwrite(outputImagePath, grayImage);if (!success) {throw new RuntimeException("无法保存新图片到: " + outputImagePath);}System.out.println("灰色背景图片已保存至: " + outputImagePath);// 释放新图片资源(如果不需要后续使用)grayImage.release();}private static void drawTextToImg(List<TextBlock> textBlocks, DrawImage drawImage) {for (TextBlock block : textBlocks) {List<Point> points = block.getBoxPoint();if (points == null || points.size() != 4) {continue; // 忽略无效数据}// 依次绘制四条线,形成闭合四边形for (int i = 0; i < 4; i++) {Point p1 = points.get(i);Point p2 = points.get((i + 1) % 4);drawImage.drawLine(new DrawImage.Point(p1.getX(), p1.getY()),new DrawImage.Point(p2.getX(), p2.getY()),2, Color.RED);}// 可选:绘制文本内容和置信度String displayText = String.format("%s", block.getText());// 文本位置设置在框的上方Point topLeft = points.get(0);int textX = topLeft.getX();int textY = topLeft.getY() - 25;drawImage.drawText(displayText,new DrawImage.Point(textX, textY),13,Color.GREEN);}}private static void saveFileToDir( DrawImage drawImage, String outputFilePath) {Mat outputMat = drawImage.toMat();Imgcodecs.imwrite(outputFilePath, outputMat);ByteArrayOutputStream plateStream = convertMatToStream(outputMat);saveStreamToFile(plateStream, outputFilePath);System.out.println("Saved to: " + outputFilePath);outputMat.release();}public static ByteArrayOutputStream convertMatToStream(Mat image) {MatOfByte matOfByte = new MatOfByte();Imgcodecs.imencode(".jpg", image, matOfByte); // 将 Mat 编码成 JPG 格式ByteArrayOutputStream outputStream = new ByteArrayOutputStream();try {outputStream.write(matOfByte.toArray()); // 写入字节流} catch (IOException e) {throw new RuntimeException("Error converting Mat to stream", e);}image.release();return outputStream;}public static void saveStreamToFile(ByteArrayOutputStream stream, String filePath) {try (FileOutputStream fileOutputStream = new FileOutputStream(filePath)) {stream.writeTo(fileOutputStream); // 将流写入文件} catch (IOException e) {throw new RuntimeException("Error writing stream to file", e);}}@Data@AllArgsConstructor@NoArgsConstructor@Builderstatic class  OcrTextDTO{private String text;private int x1;private int x2;private int y1;private int y2;}private static void drawFilledTextToImg(List<TextBlock> textBlocks, DrawImage drawImage) {//        System.out.println("textBlocks sort pre:"+JSON.toJSONString(textBlocks));Map<String,List<OcrTextDTO>> tableGroup = new LinkedHashMap<>();int currentY = 0;textBlocks.sort(Comparator.comparingInt(o ->o.getBoxPoint().stream().mapToInt(Point::getY).min().orElse(Integer.MAX_VALUE)));
//        System.out.println("textBlocks sort end:"+JSON.toJSONString(textBlocks));for (TextBlock block : textBlocks) {List<Point> points = block.getBoxPoint();if (points == null || points.size() != 4) {continue; // 忽略无效数据}int minY = Integer.MAX_VALUE;int maxY = Integer.MIN_VALUE;int minX = Integer.MAX_VALUE;int maxX = Integer.MIN_VALUE;System.out.println("points:"+JSON.toJSONString(points));// [{"x":1022,"y":971},{"x":1116,"y":971},{"x":1116,"y":1000},{"x":1022,"y":1000}]// 依次绘制四条线,形成闭合四边形for (int i = 0; i < 4; i++) {Point p1 = points.get(i);Point p2 = points.get((i + 1) % 4);drawImage.drawLine(new DrawImage.Point(p1.getX(), p1.getY()),new DrawImage.Point(p2.getX(), p2.getY()),2, Color.RED);minY = Math.min(minY, p1.getY());maxY = Math.max(maxY, p1.getY());minX = Math.min(minX, p1.getX());maxX = Math.max(maxX, p1.getX());}int height = maxY - minY;// 可选:绘制文本内容和置信度String displayText = String.format("%s", block.getText());// 文本位置设置在框的上方Point topLeft = points.get(0);int textX = topLeft.getX();int textY = topLeft.getY();
//            System.out.println("maxY:"+maxY+",minY:"+minY+",height:"+height);
//            System.out.println("currentY:"+currentY+",minY-currentY:"+(minY-currentY)+",minY:"+minY);if(currentY == 0){currentY = minY;}else {if(minY-currentY  > 18){currentY = minY;}}
//            System.out.println("----currentY:"+currentY+",minY:"+minY+",height:"+height);List<OcrTextDTO> orDefault = tableGroup.getOrDefault(currentY+"", new TreeList<>());orDefault.add(OcrTextDTO.builder().text(displayText).x1(minX).y1(minY).x2(maxX).y2(maxY).build());orDefault.sort(Comparator.comparingInt(OcrTextDTO::getX1));tableGroup.put(currentY+"",orDefault);
//            System.out.println("textY:"+textY+",height:"+height+",text:"+displayText);int fontSize;if (height > 40) {fontSize = (int) (height * 0.6);} else if (height > 25) {fontSize = (int) (height * 0.7);} else if (height > 15) {fontSize = (int) (height * 0.8);}else {fontSize = height;}drawImage.drawText(displayText,new DrawImage.Point(textX, textY),fontSize,Color.GREEN);}System.out.println(JSON.toJSONString(tableGroup));}
}

扩展

在java平台可以直接使用 onnxrunntime来进行解析,不使用 jni的方式

免责声明:样例仅供参考,如有错误还请纠正!谢谢

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.pswp.cn/pingmian/81778.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Pytorch实现常用代码笔记

Pytorch实现常用代码笔记 基础实现代码其他代码示例Networks or ProjectsNetwork ModulesLossUtils 基础实现代码 参考 深度学习手写代码 其他代码示例 Networks or Projects SENet学习笔记 SKNet——SENet孪生兄弟篇 GCNet&#xff1a;当Non-local遇见SENet YOLOv1到YOLO…

word通配符表

目录 一、word查找栏代码&通配符一览表二、word替换栏代码&通配符一览表三、参考文献 一、word查找栏代码&通配符一览表 序号清除使用通配符复选框勾选使用通配符复选框特殊字符代码特殊字符代码or通配符1任意单个字符^?一个任意字符?2任意数字^#任意数字&#…

TYUT-企业级开发教程-第6章

这一章 考点不多 什么是缓存&#xff1f;为什么要设计出缓存&#xff1f; 企业级应用为了避免读取数据时受限于数据库的访问效率而导致整体系统性能偏低&#xff0c;通 常会在应用程序与数据库之间建立一种临时的数据存储机制&#xff0c;该临时存储数据的区域称 为缓存。缓存…

双检锁(Double-Checked Locking)单例模式

在项目中使用双检锁&#xff08;Double-Checked Locking&#xff09;单例模式来管理 JSON 格式化处理对象&#xff08;如 ObjectMapper 在 Jackson 库中&#xff0c;或 JsonParser 在 Gson 库中&#xff09;是一种常见的做法。这种模式确保了对象只被创建一次&#xff0c;同时在…

华为网路设备学习-22(路由器OSPF-LSA及特殊详解)

一、基本概念 OSPF协议的基本概念 OSPF是一种内部网关协议&#xff08;IGP&#xff09;&#xff0c;主要用于在自治系统&#xff08;AS&#xff09;内部使路由器获得远端网络的路由信息。OSPF是一种链路状态路由协议&#xff0c;不直接传递路由表&#xff0c;而是通过交换链路…

数独求解器3.0 增加latex格式读取

首先说明两种读入格式 latex输入格式说明 \documentclass{article} \begin{document}This is some text before oku.\begin{array}{|l|l|l|l|l|l|l|l|l|} \hline & & & & 5 & & 2 & 9 \\ \hline& & 5 & 1 & & 7…

20250520在全志H3平台的Nano Pi NEO CORE开发板上运行Ubuntu Core16.04.3时跑通4G模块EC20

1、h3-sd-friendlycore-xenial-4.14-armhf-20210618.img.gz 在WIN10下使用7-ZIP解压缩/ubuntu20.04下使用tar 2、Win32DiskImager.exe 写如32GB的TF卡。【以管理员身份运行】 3、TF卡如果已经做过会有3个磁盘分区&#xff0c;可以使用SD Card Formatter/SDCardFormatterv5_WinE…

精益数据分析(74/126):从愿景到落地的精益开发路径——Rally的全流程管理实践

精益数据分析&#xff08;74/126&#xff09;&#xff1a;从愿景到落地的精益开发路径——Rally的全流程管理实践 在创业的黏性阶段&#xff0c;如何将抽象的愿景转化为可落地的产品功能&#xff1f;如何在快速迭代中保持战略聚焦&#xff1f;今天&#xff0c;我们通过Rally软…

Javascript 编程基础(4)函数 | 4.3、apply() 与 call() 方法

文章目录 一、apply() 与 call() 方法1、核心概念1.1、call() 方法1.2、apply() 方法 2、使用示例2.1、基本用法2.2、处理 this 指向问题 3、call() 与 apply() 的区别 一、apply() 与 call() 方法 apply() 和 call() 都是 JavaScript 函数对象的方法&#xff0c;用于显式设置函…

读一本书第一遍是快读还是细读?

在时间充足且计划对重要书籍进行多遍阅读的前提下&#xff0c;第一遍阅读的策略可以结合**「快读搭建框架」与「标记重点」**&#xff0c;为后续细读奠定基础。以下是具体建议及操作逻辑&#xff1a; 一、第一遍&#xff1a;快读为主&#xff0c;目标是「建立全局认知」 1. 快…

基于大模型的全面惊厥性癫痫持续状态技术方案

目录 一、数据收集与预处理系统1.1 多模态数据集成模块1.2 数据预处理流程二、大模型构建与训练系统2.1 模型架构设计2.2 训练流程三、术前评估系统3.1 癫痫发作风险预测3.2 手术可行性评估流程四、术中决策支持系统4.1 实时监测数据处理4.2 麻醉方案优化流程五、术后护理系统5…

React 19 中的useRef得到了进一步加强。

文章目录 前言一 useRef 的核心原理1.1 为什么需要 useRef&#xff1f;1.2 基本语法 二、React 19 中 useRef 的常见用法2.1 访问 DOM 元素2.2 保存跨渲染的数据 三、React 19 中的改进ref 作为一个属性案例演示(触发子组件焦点事件) 注意 总结 前言 在 React 的世界里&#x…

idea查看class文件源码

1、在idea中查看.class文件源码 在idea的一个工程里面将.class文件复制进去&#xff0c;会提示如下&#xff1a; 这时候&#xff0c;打开一个其他类&#xff0c;右键-》"show in explorer"&#xff0c;打开资源文件夹&#xff0c;这时候将class文件粘贴在此处&#…

基于 Vue + CEF3 的浏览器批量管理系统(附功能详解)

&#x1f310; 基于 Vue CEF3 的浏览器批量管理系统&#xff08;附功能详解&#xff09; 在当前多任务操作需求日益增长的背景下&#xff0c;如何高效管理多个浏览器实例成为了一个值得探讨的问题。今天给大家介绍一款基于 Vue 和 CEF3 构建的浏览器批量管理系统&#xff0c;…

JS实现古诗竖排从右至左

一个老题目&#xff0c;将下面古诗文由横排&#xff0c;变成古文竖排模式&#xff1a; 静夜思 李白 床前明月光&#xff0c; 疑似地上霜。 举头望明月&#xff0c; 低头思故乡。变成&#xff1a; 低|举|疑|床|静 头|头|似|前|夜 思|望|地|明|思 故|明|上|月| 乡|月|霜|光|李…

在 Android 中实现支持多手势交互的自定义 View(Kotlin 完整指南)

本文将手把手教你创建一个支持拖动、缩放、旋转等多种手势交互的自定义 View&#xff0c;并提供完整的代码实现和优化建议。 一、基础实现 1.1 创建自定义 View 骨架 import android.content.Context import android.graphics.* import android.util.AttributeSet import an…

Kotlin 协程 (一)

1. Kotlin 协程的核心概念 1.1 协程&#xff08;Coroutine&#xff09; 定义&#xff1a;协程是一种轻量级的执行上下文&#xff0c;可以在任何时候挂起和恢复&#xff0c;而不需要阻塞线程。特点&#xff1a; 比传统线程更轻量&#xff0c;开销更小。支持挂起和恢复&#xf…

机器学习 集成学习方法之随机森林

集成学习方法之随机森林 1 集成学习2 随机森林的算法原理2.1 Sklearn API2.2 示例 1 集成学习 机器学习中有一种大类叫集成学习&#xff08;Ensemble Learning&#xff09;&#xff0c;集成学习的基本思想就是将多个分类器组合&#xff0c;从而实现一个预测效果更好的集成分类…

thinkphp6实现统一监听并记录所有执行的sql语句除查询外

创建文件app/middleware/SqlLogger.php <?php namespace app\middleware;use think\facade\Db; use think\facade\Session;class SqlLogger {public function handle($request, \Closure $next){// 监听所有SQL $request->ip()Db::listen(function($sql, $time) {if (p…

pytorch训练可视化工具---TensorBoard

一、目的&#xff1a;为什么使用 TensorBoard 调控模型 使用 TensorBoard 可以帮我们&#xff1a; 实时查看 loss / acc 曲线 → 判断是否过拟合、欠拟合&#xff1b; 对比不同模型或超参数的效果&#xff1b; 可视化模型结构 → 帮助调试模型设计&#xff1b; 查看权重/梯…