63
docs/FAQ.en.md
Normal file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
comments: true
|
||||
hide:
|
||||
- navigation
|
||||
- toc
|
||||
---
|
||||
|
||||
1. **Prediction error: got an unexpected keyword argument 'gradient_clip'**
|
||||
The installed version of paddle is incorrect. Currently, this project only supports Paddle 1.7, which will be adapted to 1.8 in the near future.
|
||||
|
||||
2. **Error when converting attention recognition model: KeyError: 'predict'**
|
||||
Solved. Please update to the latest version of the code.
|
||||
|
||||
3. **About inference speed**
|
||||
When there are many words in the picture, the prediction time will increase. You can use `--rec_batch_num` to set a smaller prediction batch num. The default value is 30, which can be changed to 10 or other values.
|
||||
|
||||
4. **Service deployment and mobile deployment**
|
||||
It is expected that the service deployment based on Serving and the mobile deployment based on Paddle Lite will be released successively in mid-to-late June. Stay tuned for more updates.
|
||||
|
||||
5. **Release time of self-developed algorithm**
|
||||
Baidu Self-developed algorithms such as SAST, SRN and end2end PSL will be released in June or July. Please be patient.
|
||||
|
||||
6. **How to run on Windows or Mac?**
|
||||
PaddleOCR has completed the adaptation to Windows and MAC systems. Two points should be noted during operation:
|
||||
1. In [Quick installation](./installation_en.md), if you do not want to install docker, you can skip the first step and start with the second step.
|
||||
2. When downloading the inference model, if wget is not installed, you can directly click the model link or copy the link address to the browser to download, then extract and place it in the corresponding directory.
|
||||
|
||||
7. **The difference between ultra-lightweight model and General OCR model**
|
||||
At present, PaddleOCR has opensourced two Chinese models, namely 8.6M ultra-lightweight Chinese model and general Chinese OCR model. The comparison information between the two is as follows:
|
||||
- Similarities: Both use the same **algorithm** and **training data**;
|
||||
- Differences: The difference lies in **backbone network** and **channel parameters**, the ultra-lightweight model uses MobileNetV3 as the backbone network, the general model uses Resnet50_vd as the detection model backbone, and Resnet34_vd as the recognition model backbone. You can compare the two model training configuration files to see the differences in parameters.
|
||||
|
||||
|Model|Backbone|Detection configuration file|Recognition configuration file|
|
||||
|-|-|-|-|
|
||||
|8.6M ultra-lightweight Chinese OCR model|MobileNetV3+MobileNetV3|det_mv3_db.yml|rec_chinese_lite_train.yml|
|
||||
|General Chinese OCR model|Resnet50_vd+Resnet34_vd|det_r50_vd_db.yml|rec_chinese_common_train.yml|
|
||||
|
||||
8. **Is there a plan to opensource a model that only recognizes numbers or only English + numbers?**
|
||||
It is not planned to opensource numbers only, numbers + English only, or other vertical text models. PaddleOCR has opensourced a variety of detection and recognition algorithms for customized training. The two Chinese models are also based on the training output of the open-source algorithm library. You can prepare the data according to the tutorial, choose the appropriate configuration file, train yourselves, and we believe that you can get good result. If you have any questions during the training, you are welcome to open issues or ask in the communication group. We will answer them in time.
|
||||
|
||||
9. **What is the training data used by the open-source model? Can it be opensourced?**
|
||||
At present, the open source model, dataset and magnitude are as follows:
|
||||
- Detection:
|
||||
English dataset: ICDAR2015
|
||||
Chinese dataset: LSVT street view dataset with 3w pictures
|
||||
- Recognition:
|
||||
English dataset: MJSynth and SynthText synthetic dataset, the amount of data is tens of millions.
|
||||
Chinese dataset: LSVT street view dataset with cropped text area, a total of 30w images. In addition, the synthesized data based on LSVT corpus is 500w.
|
||||
|
||||
Among them, the public datasets are opensourced, users can search and download by themselves, or refer to [Chinese data set](dataset/datasets_en.md), synthetic data is not opensourced, users can use open-source synthesis tools to synthesize data themselves. Current available synthesis tools include [text_renderer](https://github.com/Sanster/text_renderer), [SynthText](https://github.com/ankush-me/SynthText), [TextRecognitionDataGenerator](https://github.com/Belval/TextRecognitionDataGenerator), etc.
|
||||
|
||||
10. **Error in using the model with TPS module for prediction**
|
||||
Error message: Input(X) dims[3] and Input(Grid) dims[2] should be equal, but received X dimension[3]\(108) != Grid dimension[2]\(100)
|
||||
Solution: TPS does not support variable shape. Please set --rec_image_shape='3,32,100' and --rec_char_type='en'
|
||||
|
||||
11. **Custom dictionary used during training, the recognition results show that words do not appear in the dictionary**
|
||||
The used custom dictionary path is not set when making prediction. The solution is setting parameter `rec_char_dict_path` to the corresponding dictionary file.
|
||||
|
||||
12. **Results of cpp_infer and python_inference are very different**
|
||||
Versions of exported inference model and inference library should be same. For example, on Windows platform, version of the inference library that PaddlePaddle provides is 1.8, but version of the inference model that PaddleOCR provides is 1.7, you should export model yourself(`tools/export_model.py`) on PaddlePaddle 1.8 and then use the exported model for inference.
|
||||
|
||||
13. **How to identify artistic fonts in signs or advertising images**
|
||||
Recognizing artistic fonts in signs or advertising images is a very challenging task because the variation in individual characters is much greater compared to standard fonts. If the artistic font to be identified is within a dictionary list, each word in the dictionary can be treated as a template for recognition using a general image retrieval system. You can try using PaddleClas image recognition system.
|
||||
778
docs/FAQ.md
Normal file
@@ -0,0 +1,778 @@
|
||||
---
|
||||
comments: true
|
||||
hide:
|
||||
- navigation
|
||||
- toc
|
||||
---
|
||||
|
||||
> 恭喜你发现宝藏!
|
||||
|
||||
PaddleOCR收集整理了自从开源以来在issues和用户群中的常见问题并且给出了简要解答,旨在为OCR的开发者提供一些参考,也希望帮助大家少走一些弯路。
|
||||
|
||||
其中[通用问题](#1)一般是初次接触OCR相关算法时用户会提出的问题,在[1.5 垂类场景实现思路](#15)中总结了如何在一些具体的场景中确定技术路线进行优化。[PaddleOCR常见问题](#2-paddleocr)是开发者在使用PaddleOCR之后可能会遇到的问题也是PaddleOCR实践过程中的避坑指南。
|
||||
|
||||
同时PaddleOCR也会在review issue的过程中添加 `good issue`、 `good first issue` 标签,但这些问题可能不会被立刻补充在FAQ文档里,开发者也可对应查看。我们也非常希望开发者能够帮助我们将这些内容补充在FAQ中。
|
||||
|
||||
OCR领域大佬众多,本文档回答主要依赖有限的项目实践,难免挂一漏万,如有遗漏和不足,也**希望有识之士帮忙补充和修正**,万分感谢。
|
||||
|
||||
## 1. 通用问题
|
||||
|
||||
### 1.1 检测
|
||||
|
||||
#### Q: 基于深度学习的文字检测方法有哪几种?各有什么优缺点?
|
||||
|
||||
**A**:常用的基于深度学习的文字检测方法一般可以分为基于回归的、基于分割的两大类,当然还有一些将两者进行结合的方法。
|
||||
|
||||
(1)基于回归的方法分为box回归和像素值回归。a. 采用box回归的方法主要有CTPN、Textbox系列和EAST,这类算法对规则形状文本检测效果较好,但无法准确检测不规则形状文本。 b. 像素值回归的方法主要有CRAFT和SA-Text,这类算法能够检测弯曲文本且对小文本效果优秀但是实时性能不够。
|
||||
|
||||
(2)基于分割的算法,如PSENet,这类算法不受文本形状的限制,对各种形状的文本都能取得较好的效果,但是往往后处理比较复杂,导致耗时严重。目前也有一些算法专门针对这个问题进行改进,如DB,将二值化进行近似,使其可导,融入训练,从而获取更准确的边界,大大降低了后处理的耗时。
|
||||
|
||||
### 1.2 识别
|
||||
|
||||
#### Q: PaddleOCR提供的文本识别算法包括哪些?
|
||||
|
||||
**A**:PaddleOCR主要提供五种文本识别算法,包括CRNN\StarNet\RARE\Rosetta和SRN, 其中CRNN\StarNet和Rosetta是基于ctc的文字识别算法,RARE是基于attention的文字识别算法;SRN为百度自研的文本识别算法,引入了语义信息,显著提升了准确率。 详情可参照如下页面: 文本识别算法
|
||||
|
||||
#### Q: 文本识别方法CRNN关键技术有哪些?
|
||||
|
||||
**A**:CRNN 关键技术包括三部分。(1)CNN提取图像卷积特征。(2)深层双向LSTM网络,在卷积特征的基础上继续提取文字序列特征。(3)Connectionist Temporal Classification(CTC),解决训练时字符无法对齐的问题。
|
||||
|
||||
#### Q: 对于中文行文本识别,CTC和Attention哪种更优?
|
||||
|
||||
**A**:(1)从效果上来看,通用OCR场景CTC的识别效果优于Attention,因为带识别的字典中的字符比较多,常用中文汉字三千字以上,如果训练样本不足的情况下,对于这些字符的序列关系挖掘比较困难。中文场景下Attention模型的优势无法体现。而且Attention适合短语句识别,对长句子识别比较差。
|
||||
|
||||
(2)从训练和预测速度上,Attention的串行解码结构限制了预测速度,而CTC网络结构更高效,预测速度上更有优势。
|
||||
|
||||
#### Q: 弯曲形变的文字识别需要怎么处理?TPS应用场景是什么,是否好用?
|
||||
|
||||
**A**:(1)在大多数情况下,如果遇到的场景弯曲形变不是太严重,检测4个顶点,然后直接通过仿射变换转正识别就足够了。
|
||||
|
||||
(2)如果不能满足需求,可以尝试使用TPS(Thin Plate Spline),即薄板样条插值。TPS是一种插值算法,经常用于图像变形等,通过少量的控制点就可以驱动图像进行变化。一般用在有弯曲形变的文本识别中,当检测到不规则的/弯曲的(如,使用基于分割的方法检测算法)文本区域,往往先使用TPS算法对文本区域矫正成矩形再进行识别,如,STAR-Net、RARE等识别算法中引入了TPS模块。
|
||||
|
||||
> **Warning**:TPS看起来美好,在实际应用时经常发现并不够鲁棒,并且会增加耗时,需要谨慎使用。
|
||||
|
||||
### 1.3 端到端
|
||||
|
||||
#### Q: 请问端到端的pgnet相比于DB+CRNN在准确率上有优势吗?或者是pgnet最擅长的场景是什么场景呢?
|
||||
|
||||
**A**:pgnet是端到端算法,检测识别一步到位,不用分开训练2个模型,也支持弯曲文本的识别,但是在中文上的效果还没有充分验证;db+crnn的验证更充分,应用相对成熟,常规非弯曲的文本都能解的不错。
|
||||
|
||||
#### Q: 目前OCR普遍是二阶段,端到端的方案在业界落地情况如何?
|
||||
|
||||
**A**:端到端在文字分布密集的业务场景,效率会比较有保证,精度的话看自己业务数据积累情况,如果行级别的识别数据积累比较多的话two-stage会比较好。百度的落地场景,比如工业仪表识别、车牌识别都用到端到端解决方案。
|
||||
|
||||
#### Q: 二阶段的端到端的场景文本识别方法的不足有哪些?
|
||||
|
||||
**A**:这类方法一般需要设计针对ROI提取特征的方法,而ROI操作一般比较耗时。
|
||||
|
||||
#### Q: AAAI 2021最新的端到端场景文本识别PGNet算法有什么特点?
|
||||
|
||||
**A**:PGNet不需要字符级别的标注,NMS操作以及ROI操作。同时提出预测文本行内的阅读顺序模块和基于图的修正模块来提升文本识别效果。该算法是百度自研,近期会在PaddleOCR开源。
|
||||
|
||||
### 1.4 评估方法
|
||||
|
||||
#### Q: OCR领域常用的评估指标是什么?
|
||||
|
||||
**A**:对于两阶段的可以分开来看,分别是检测和识别阶段
|
||||
|
||||
(1)检测阶段:先按照检测框和标注框的IOU评估,IOU大于某个阈值判断为检测准确。这里检测框和标注框不同于一般的通用目标检测框,是采用多边形进行表示。检测准确率:正确的检测框个数在全部检测框的占比,主要是判断检测指标。检测召回率:正确的检测框个数在全部标注框的占比,主要是判断漏检的指标。
|
||||
|
||||
(2)识别阶段:
|
||||
字符识别准确率,即正确识别的文本行占标注的文本行数量的比例,只有整行文本识别对才算正确识别。
|
||||
|
||||
(3)端到端统计:
|
||||
端对端召回率:准确检测并正确识别文本行在全部标注文本行的占比;
|
||||
端到端准确率:准确检测并正确识别文本行在 检测到的文本行数量 的占比;
|
||||
准确检测的标准是检测框与标注框的IOU大于某个阈值,正确识别的检测框中的文本与标注的文本相同。
|
||||
|
||||
### 1.5 垂类场景实现思路
|
||||
|
||||
#### Q:背景干扰的文字(如印章盖到落款上,需要识别落款或者印章中的文字),如何识别?
|
||||
|
||||
**A**:(1)在人眼确认可识别的条件下,对于背景有干扰的文字,首先要保证检测框足够准确,如果检测框不准确,需要考虑是否可以通过过滤颜色等方式对图像预处理并且增加更多相关的训练数据;在识别的部分,注意在训练数据中加入背景干扰类的扩增图像。
|
||||
|
||||
(2)如果MobileNet模型不能满足需求,可以尝试ResNet系列大模型来获得更好的效果。
|
||||
|
||||
#### Q:请问对于图片中的密集文字,有什么好的处理办法吗?
|
||||
|
||||
**A**:可以先试用预训练模型测试一下,例如DB+CRNN,判断下密集文字图片中是检测还是识别的问题,然后针对性的改善。还有一种是如果图象中密集文字较小,可以尝试增大图像分辨率,对图像进行一定范围内的拉伸,将文字稀疏化,提高识别效果。
|
||||
|
||||
#### Q: 文本行较紧密的情况下如何准确检测?
|
||||
|
||||
**A**:使用基于分割的方法,如DB,检测密集文本行时,最好收集一批数据进行训练,并且在训练时,并将生成二值图像的shrink_ratio参数调小一些。
|
||||
|
||||
#### Q:对于一些在识别时稍微模糊的文本,有没有一些图像增强的方式?
|
||||
|
||||
**A**:在人类肉眼可以识别的前提下,可以考虑图像处理中的均值滤波、中值滤波或者高斯滤波等模糊算子尝试。也可以尝试从数据扩增扰动来强化模型鲁棒性,另外新的思路有对抗性训练和超分SR思路,可以尝试借鉴。但目前业界尚无普遍认可的最优方案,建议优先在数据采集阶段增加一些限制提升图片质量。
|
||||
|
||||
#### Q:低像素文字或者字号比较小的文字有什么超分辨率方法吗
|
||||
|
||||
**A**:超分辨率方法分为传统方法和基于深度学习的方法。基于深度学习的方法中,比较经典的有SRCNN,另外CVPR2020也有一篇超分辨率的工作可以参考文章:Unpaired Image Super-Resolution using Pseudo-Supervision,但是没有充分的实践验证过,需要看实际场景下的效果。
|
||||
|
||||
#### Q:对于一些尺寸较大的文档类图片,在检测时会有较多的漏检,怎么避免这种漏检的问题呢?
|
||||
|
||||
**A**:PaddleOCR中在图像最长边大于960时,将图像等比例缩放为长边960的图像再进行预测,对于这种图像,可以通过修改det_limit_side_len,增大检测的最长边:tools/infer/utility.py#L42
|
||||
|
||||
#### Q:文档场景中,使用DB模型会出现整行漏检的情况应该怎么解决?
|
||||
|
||||
**A**:可以在预测时调小 det_db_box_thresh 阈值,默认为0.5, 可调小至0.3观察效果。
|
||||
|
||||
#### Q: 弯曲文本(如略微形变的文档图像)漏检问题
|
||||
|
||||
**A**: db后处理中计算文本框平均得分时,是求rectangle区域的平均分数,容易造成弯曲文本漏检,已新增求polygon区域的平均分数,会更准确,但速度有所降低,可按需选择,在相关pr中可查看[可视化对比效果](https://github.com/PaddlePaddle/PaddleOCR/pull/2604)。该功能通过参数 [det_db_score_mode](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.1/tools/infer/utility.py#L51)进行选择,参数值可选[`fast`(默认)、`slow`],`fast`对应原始的rectangle方式,`slow`对应polygon方式。感谢用户[buptlihang](https://github.com/buptlihang)提[pr](https://github.com/PaddlePaddle/PaddleOCR/pull/2574)帮助解决该问题🌹。
|
||||
|
||||
#### Q:如何识别文字比较长的文本?
|
||||
|
||||
**A**:在中文识别模型训练时,并不是采用直接将训练样本缩放到[3,32,320]进行训练,而是先等比例缩放图像,保证图像高度为32,宽度不足320的部分补0,宽高比大于10的样本直接丢弃。预测时,如果是单张图像预测,则按上述操作直接对图像缩放,不做宽度320的限制。如果是多张图预测,则采用batch方式预测,每个batch的宽度动态变换,采用这个batch中最长宽度。
|
||||
|
||||
#### Q:如何识别带空格的英文行文本图像?
|
||||
|
||||
**A**:空格识别可以考虑以下两种方案:
|
||||
|
||||
(1)优化文本检测算法。检测结果在空格处将文本断开。这种方案在检测数据标注时,需要将含有空格的文本行分成好多段。
|
||||
|
||||
(2)优化文本识别算法。在识别字典里面引入空格字符,然后在识别的训练数据中,如果用空行,进行标注。此外,合成数据时,通过拼接训练数据,生成含有空格的文本。
|
||||
|
||||
#### Q:弯曲文本有试过opencv的TPS进行弯曲校正吗?
|
||||
|
||||
**A**:opencv的tps需要标出上下边界对应的点,这个点很难通过传统方法或者深度学习方法获取。PaddleOCR里StarNet网络中的tps模块实现了自动学点,自动校正,可以直接尝试这个。
|
||||
|
||||
#### Q: 如何识别招牌或者广告图中的艺术字?
|
||||
|
||||
**A**: 招牌或者广告图中的艺术字是文本识别一个非常有挑战性的难题,因为艺术字中的单字和印刷体相比,变化非常大。如果需要识别的艺术字是在一个词典列表内,可以将改每个词典认为是一个待识别图像模板,通过通用图像检索识别系统解决识别问题。可以尝试使用PaddleClas的图像识别系统。
|
||||
|
||||
#### Q: 印章如何识别
|
||||
|
||||
**A**:1. 使用带tps的识别网络或abcnet,2.使用极坐标变换将图片拉平之后使用crnn
|
||||
|
||||
#### Q: 使用预训练模型进行预测,对于特定字符识别识别效果较差,怎么解决?
|
||||
|
||||
**A**: 由于我们所提供的识别模型是基于通用大规模数据集进行训练的,部分字符可能在训练集中包含较少,因此您可以构建特定场景的数据集,基于我们提供的预训练模型进行微调。建议用于微调的数据集中,每个字符出现的样本数量不低于300,但同时需要注意不同字符的数量均衡。具体可以参考:微调。
|
||||
|
||||
#### Q: 在使用训练好的识别模型进行预测的时候,发现有很多重复的字,这个怎么解决呢?
|
||||
|
||||
**A**:可以看下训练的尺度和预测的尺度是否相同,如果训练的尺度为[3, 32, 320],预测的尺度为[3, 64, 640],则会有比较多的重复识别现象。
|
||||
|
||||
#### Q: 图像正常识别出来的文字是OK的,旋转90度后识别出来的结果就比较差,有什么方法可以优化?
|
||||
|
||||
**A**: 整图旋转90之后效果变差是有可能的,因为目前PPOCR默认输入的图片是正向的; 可以自己训练一个整图的方向分类器,放在预测的最前端(可以参照现有方向分类器的方式),或者可以基于规则做一些预处理,比如判断长宽等等。
|
||||
|
||||
#### Q: 如何识别竹简上的古文?
|
||||
|
||||
**A**:对于字符都是普通的汉字字符的情况,只要标注足够的数据,finetune模型就可以了。如果数据量不足,您可以尝试[StyleText](https://github.com/PFCCLab/StyleText)工具。
|
||||
而如果使用的字符是特殊的古文字、甲骨文、象形文字等,那么首先需要构建一个古文字的字典,之后再进行训练。
|
||||
|
||||
#### Q: 只想要识别票据中的部分片段,重新训练它的话,只需要训练文本检测模型就可以了吗?问文本识别,方向分类还是用原来的模型这样可以吗?
|
||||
|
||||
**A**:可以的。PaddleOCR的检测、识别、方向分类器三个模型是独立的,在实际使用中可以优化和替换其中任何一个模型。
|
||||
|
||||
#### Q: 如何用PaddleOCR识别视频中的文字?
|
||||
|
||||
**A**: 目前PaddleOCR主要针对图像做处理,如果需要视频识别,可以先对视频抽帧,然后用PPOCR识别。
|
||||
|
||||
#### Q: 相机采集的图像为四通道,应该如何处理?
|
||||
|
||||
**A**: 有两种方式处理:
|
||||
|
||||
- 如果没有其他需要,可以在解码数据的时候指定模式为三通道,例如如果使用opencv,可以使用cv::imread(img_path, cv::IMREAD_COLOR)。
|
||||
- 如果其他模块需要处理四通道的图像,那也可以在输入PaddleOCR模块之前进行转换,例如使用cvCvtColor(&img,img3chan,CV_RGBA2RGB)。
|
||||
|
||||
#### Q: 遇到中英文识别模型不支持的字符,该如何对模型做微调?
|
||||
|
||||
**A**:如果希望识别中英文识别模型中不支持的字符,需要更新识别的字典,并完成微调过程。比如说如果希望模型能够进一步识别罗马数字,可以按照以下步骤完成模型微调过程。
|
||||
|
||||
1. 准备中英文识别数据以及罗马数字的识别数据,用于训练,同时保证罗马数字和中英文识别数字的效果;
|
||||
2. 修改默认的字典文件,在后面添加罗马数字的字符;
|
||||
3. 下载PaddleOCR提供的预训练模型,配置预训练模型和数据的路径,开始训练。
|
||||
|
||||
#### Q:特殊字符(例如一些标点符号)识别效果不好怎么办?
|
||||
|
||||
**A**:首先请您确认要识别的特殊字符是否在字典中。
|
||||
如果字符在已经字典中但效果依然不好,可能是由于识别数据较少导致的,您可以增加相应数据finetune模型。
|
||||
|
||||
---
|
||||
|
||||
#### Q:单张图上多语种并存识别(如单张图印刷体和手写文字并存),应该如何处理?
|
||||
|
||||
**A**:单张图像中存在多种类型文本的情况很常见,典型的以学生的试卷为代表,一张图像同时存在手写体和印刷体两种文本,这类情况下,可以尝试”1个检测模型+1个N分类模型+N个识别模型”的解决方案。
|
||||
其中不同类型文本共用同一个检测模型,N分类模型指额外训练一个分类器,将检测到的文本进行分类,如手写+印刷的情况就是二分类,N种语言就是N分类,在识别的部分,针对每个类型的文本单独训练一个识别模型,如手写+印刷的场景,就需要训练一个手写体识别模型,一个印刷体识别模型,如果一个文本框的分类结果是手写体,那么就传给手写体识别模型进行识别,其他情况同理。
|
||||
|
||||
#### Q: 多语言的字典里是混合了不同的语种,这个是有什么讲究吗?统一到一个字典里会对精度造成多大的损失?
|
||||
|
||||
**A**:统一到一个字典里,会造成最后一层FC过大,增加模型大小。如果有特殊需求的话,可以把需要的几种语言合并字典训练模型,合并字典之后如果引入过多的形近字,可能会造成精度损失,字符平衡的问题可能也需要考虑一下。在PaddleOCR里暂时将语言字典分开。
|
||||
|
||||
#### Q:类似泰语这样的小语种,部分字会占用两个字符甚至三个字符,请问如何制作字典
|
||||
|
||||
**A**:处理字符的时候,把多字符的当作一个字就行,字典中每行是一个字。
|
||||
|
||||
---
|
||||
|
||||
#### Q: 想把简历上的文字识别出来后,能够把关系一一对应起来,比如姓名和它后面的名字组成一对,籍贯、邮箱、学历等等都和各自的内容关联起来,这个应该如何处理,PPOCR目前支持吗?
|
||||
|
||||
**A**: 这样的需求在企业应用中确实比较常见,但往往都是个性化的需求,没有非常规整统一的处理方式。常见的处理方式有如下两种:
|
||||
|
||||
1. 对于单一版式、或者版式差异不大的应用场景,可以基于识别场景的一些先验信息,将识别内容进行配对; 比如运用表单结构信息:常见表单"姓名"关键字的后面,往往紧跟的就是名字信息
|
||||
2. 对于版式多样,或者无固定版式的场景, 需要借助于NLP中的NER技术,给识别内容中的某些字段,赋予key值
|
||||
|
||||
由于这部分需求和业务场景强相关,难以用一个统一的模型去处理,目前PPOCR暂不支持。 如果需要用到NER技术,可以参照Paddle团队的另一个开源套件: [PaddlePaddle/ERNIE](https://github.com/PaddlePaddle/ERNIE), 其提供的预训练模型ERNIE, 可以帮助提升NER任务的准确率。
|
||||
|
||||
### 1.6 训练过程与模型调优
|
||||
|
||||
#### Q: 增大batch_size模型训练速度没有明显提升
|
||||
|
||||
**A**:如果batch_size打得太大,加速效果不明显的话,可以试一下增大初始化内存的值,运行代码前设置环境变量:
|
||||
export FLAGS_initial_cpu_memory_in_mb=2000 # 设置初始化内存约2G左右
|
||||
|
||||
#### Q: 预测时提示图像过大,显存、内存溢出了,应该如何处理?
|
||||
|
||||
**A**:可以按照这个PR的修改来缓解显存、内存占用 #2230
|
||||
|
||||
#### Q: 识别训练时,训练集精度已经到达90了,但验证集精度一直在70,涨不上去怎么办?
|
||||
|
||||
**A**:训练集精度90,测试集70多的话,应该是过拟合了,有两个可尝试的方法:(1)加入更多的增广方式或者调大增广prob的概率,默认为0.4。(2)调大系统的l2 decay值
|
||||
|
||||
### 1.7 补充资料
|
||||
|
||||
#### Q: 对于小白如何快速入门中文OCR项目实践?
|
||||
|
||||
**A**:建议可以先了解OCR方向的基础知识,大概了解基础的检测和识别模型算法。然后在Github上可以查看OCR方向相关的repo。目前来看,从内容的完备性来看,PaddleOCR的中英文双语教程文档是有明显优势的,在数据集、模型训练、预测部署文档详实,可以快速入手。而且还有微信用户群答疑,非常适合学习实践。项目地址:PaddleOCR AI 快车道课程:<https://aistudio.baidu.com/aistudio/course/introduce/1519>
|
||||
|
||||
## 2. PaddleOCR实战问题
|
||||
|
||||
### 2.1 PaddleOCR repo
|
||||
|
||||
#### Q: PaddleOCR develop分支和dygraph分支的区别?
|
||||
|
||||
**A**:目前PaddleOCR有四个分支,分别是:
|
||||
|
||||
- develop:基于Paddle静态图开发的分支,推荐使用paddle1.8 或者2.0版本,该分支具备完善的模型训练、预测、推理部署、量化裁剪等功能,领先于release/1.1分支。
|
||||
- release/1.1:PaddleOCR 发布的第一个稳定版本,基于静态图开发,具备完善的训练、预测、推理部署、量化裁剪等功能。
|
||||
- dygraph:基于Paddle动态图开发的分支,目前仍在开发中,未来将作为主要开发分支,运行要求使用Paddle2.0.0版本。
|
||||
- release/2.0-rc1-0:PaddleOCR发布的第二个稳定版本,基于动态图和paddle2.0版本开发,动态图开发的工程更易于调试,目前支,支持模型训练、预测,暂不支持移动端部署。
|
||||
|
||||
如果您已经上手过PaddleOCR,并且希望在各种环境上部署PaddleOCR,目前建议使用静态图分支,develop或者release/1.1分支。如果您是初学者,想快速训练,调试PaddleOCR中的算法,建议尝鲜PaddleOCR dygraph分支。
|
||||
|
||||
**注意**:develop和dygraph分支要求的Paddle版本、本地环境有差别,请注意不同分支环境安装部分的差异。
|
||||
|
||||
#### Q:PaddleOCR与百度的其他OCR产品有什么区别?
|
||||
|
||||
**A**:PaddleOCR主要聚焦通用ocr,如果有垂类需求,您可以用PaddleOCR+垂类数据自己训练;
|
||||
如果缺少带标注的数据,或者不想投入研发成本,建议直接调用开放的API,开放的API覆盖了目前比较常见的一些垂类。
|
||||
|
||||
### 2.2 安装环境
|
||||
|
||||
#### Q:OSError: [WinError 126] 找不到指定的模块。mac pro python 3.4 shapely import 问题
|
||||
|
||||
**A**:这个问题是因为shapely库安装有误,可以参考 #212 这个issue重新安装一下
|
||||
|
||||
#### Q:PaddlePaddle怎么指定GPU运行 os.environ["CUDA_VISIBLE_DEVICES"]这种不生效
|
||||
|
||||
**A**:通过设置 export CUDA_VISIBLE_DEVICES='0'环境变量
|
||||
|
||||
#### Q:PaddleOCR是否支持在Windows或Mac系统上运行?
|
||||
|
||||
**A**:PaddleOCR已完成Windows和Mac系统适配,运行时注意两点:
|
||||
(1)在快速安装时,如果不想安装docker,可跳过第一步,直接从第二步安装paddle开始。
|
||||
(2)inference模型下载时,如果没有安装wget,可直接点击模型链接或将链接地址复制到浏览器进行下载,并解压放置到相应目录。
|
||||
|
||||
### 2.3 数据量说明
|
||||
|
||||
#### Q:简单的对于精度要求不高的OCR任务,数据集需要准备多少张呢?
|
||||
|
||||
**A**:(1)训练数据的数量和需要解决问题的复杂度有关系。难度越大,精度要求越高,则数据集需求越大,而且一般情况实际中的训练数据越多效果越好。
|
||||
|
||||
(2)对于精度要求不高的场景,检测任务和识别任务需要的数据量是不一样的。对于检测任务,500张图像可以保证基本的检测效果。对于识别任务,需要保证识别字典中每个字符出现在不同场景的行文本图像数目需要大于200张(举例,如果有字典中有5个字,每个字都需要出现在200张图片以上,那么最少要求的图像数量应该在200-1000张之间),这样可以保证基本的识别效果。
|
||||
|
||||
#### Q:请问PaddleOCR项目中的中文超轻量和通用模型用了哪些数据集?训练多少样本,gpu什么配置,跑了多少个epoch,大概跑了多久?
|
||||
|
||||
**A**:
|
||||
(1)检测的话,LSVT街景数据集共3W张图像,超轻量模型,150epoch左右,2卡V100 跑了不到2天;通用模型:2卡V100 150epoch 不到4天。
|
||||
(2)识别的话,520W左右的数据集(真实数据26W+合成数据500W)训练,超轻量模型:4卡V100,总共训练了5天左右。通用模型:4卡V100,共训练6天。
|
||||
|
||||
超轻量模型训练分为2个阶段:
|
||||
(1)全量数据训练50epoch,耗时3天
|
||||
(2)合成数据+真实数据按照1:1数据采样,进行finetune训练200epoch,耗时2天
|
||||
|
||||
通用模型训练:
|
||||
真实数据+合成数据,动态采样(1:1)训练,200epoch,耗时 6天左右。
|
||||
|
||||
#### Q:训练文字识别模型,真实数据有30w,合成数据有500w,需要做样本均衡吗?
|
||||
|
||||
**A**:需要,一般需要保证一个batch中真实数据样本和合成数据样本的比例是5:1~10:1左右效果比较理想。如果合成数据过大,会过拟合到合成数据,预测效果往往不佳。还有一种启发性的尝试是可以先用大量合成数据训练一个base模型,然后再用真实数据微调,在一些简单场景效果也是会有提升的。
|
||||
|
||||
#### Q: 当训练数据量少时,如何获取更多的数据?
|
||||
|
||||
**A**:当训练数据量少时,可以尝试以下三种方式获取更多的数据:(1)人工采集更多的训练数据,最直接也是最有效的方式。(2)基于PIL和opencv基本图像处理或者变换。例如PIL中ImageFont, Image, ImageDraw三个模块将文字写到背景中,opencv的旋转仿射变换,高斯滤波等。(3)利用数据生成算法合成数据,例如pix2pix等算法。
|
||||
|
||||
### 2.4 数据标注与生成
|
||||
|
||||
> [!NOTE]
|
||||
> StyleText 已经移动到 [PFCCLab/StyleText](https://github.com/PFCCLab/StyleText)
|
||||
|
||||
#### Q: Style-Text 如何不文字风格迁移,就像普通文本生成程序一样默认字体直接输出到分割的背景图?
|
||||
|
||||
**A**:使用image_synth模式会输出fake_bg.jpg,即为背景图。如果想要批量提取背景,可以稍微修改一下代码,将fake_bg保存下来即可。要修改的位置:
|
||||
<https://github.com/PaddlePaddle/PaddleOCR/blob/de3e2e7cd3b8b65ee02d7a41e570fa5b511a3c1d/StyleText/engine/synthesisers.py#L68>
|
||||
|
||||
#### Q: 能否修改StyleText配置文件中的分辨率?
|
||||
|
||||
**A**:StyleText目前的训练数据主要是高度32的图片,建议不要改变高度。未来我们会支持更丰富的分辨率。
|
||||
|
||||
#### Q: StyleText是否可以更换字体文件?
|
||||
|
||||
**A**:StyleText项目中的字体文件为标准字体,主要用作模型的输入部分,不能够修改。
|
||||
StyleText的用途主要是:提取style_image中的字体、背景等style信息,根据语料生成同样style的图片。
|
||||
|
||||
#### Q: StyleText批量生成图片为什么没有输出?
|
||||
|
||||
**A**:需要检查以下您配置文件中的路径是否都存在。尤其要注意的是[label_file配置](https://github.com/PFCCLab/StyleText/blob/main/README_ch.md#%E4%B8%89%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B)。
|
||||
如果您使用的style_image输入没有label信息,您依然需要提供一个图片文件列表。
|
||||
|
||||
#### Q:使用StyleText进行数据合成时,文本(TextInput)的长度远超StyleInput的长度,该怎么处理与合成呢?
|
||||
|
||||
**A**:在使用StyleText进行数据合成的时候,建议StyleInput的长度长于TextInput的长度。有2种方法可以处理上述问题:
|
||||
|
||||
1. 将StyleInput按列的方向进行复制与扩充,直到其超过TextInput的长度。
|
||||
2. 将TextInput进行裁剪,保证每段TextInput都稍短于StyleInput,分别合成之后,再拼接在一起。
|
||||
|
||||
实际使用中发现,使用第2种方法的效果在长文本合成的场景中的合成效果更好,StyleText中提供的也是第2种数据合成的逻辑。
|
||||
|
||||
#### Q: StyleText 合成数据效果不好?
|
||||
|
||||
**A**:StyleText模型生成的数据主要用于OCR识别模型的训练。PaddleOCR目前识别模型的输入为32 x N,因此当前版本模型主要适用高度为32的数据。
|
||||
建议要合成的数据尺寸设置为32 x N。尺寸相差不多的数据也可以生成,尺寸很大或很小的数据效果确实不佳。
|
||||
|
||||
### 2.5 预训练模型与微调
|
||||
|
||||
#### Q:如何更换文本检测/识别的backbone?
|
||||
|
||||
**A**:无论是文字检测,还是文字识别,骨干网络的选择是预测效果和预测效率的权衡。一般,选择更大规模的骨干网络,例如ResNet101_vd,则检测或识别更准确,但预测耗时相应也会增加。而选择更小规模的骨干网络,例如MobileNetV3_small_x0_35,则预测更快,但检测或识别的准确率会大打折扣。幸运的是不同骨干网络的检测或识别效果与在ImageNet数据集图像1000分类任务效果正相关。飞桨图像分类套件PaddleClas汇总了ResNet_vd、Res2Net、HRNet、MobileNetV3、GhostNet等23种系列的分类网络结构,在上述图像分类任务的top1识别准确率,GPU(V100和T4)和CPU(骁龙855)的预测耗时以及相应的117个预训练模型下载地址。
|
||||
|
||||
(1)文字检测骨干网络的替换,主要是确定类似于ResNet的4个stages,以方便集成后续的类似FPN的检测头。此外,对于文字检测问题,使用ImageNet训练的分类预训练模型,可以加速收敛和效果提升。
|
||||
|
||||
(2)文字识别的骨干网络的替换,需要注意网络宽高stride的下降位置。由于文本识别一般宽高比例很大,因此高度下降频率少一些,宽度下降频率多一些。可以参考PaddleOCR中MobileNetV3骨干网络的改动。
|
||||
|
||||
#### Q: 参照文档做实际项目时,是重新训练还是在官方训练的基础上进行训练?具体如何操作?
|
||||
|
||||
**A**: 基于官方提供的模型,进行finetune的话,收敛会更快一些。 具体操作上,以识别模型训练为例:如果修改了字符文件,可以设置pretraind_model为官方提供的预训练模型
|
||||
|
||||
#### Q: 下载的识别模型解压后缺失文件,没有期望的inference.pdiparams, inference.pdmodel等文件
|
||||
|
||||
**A**:用解压软件解压可能会出现这个问题,建议二次解压下或者用命令行解压tar xf
|
||||
|
||||
#### Q: 为什么在checkpoints中load下载的预训练模型会报错?
|
||||
|
||||
**A**:这里有两个不同的概念:
|
||||
|
||||
pretrained_model:指预训练模型,是已经训练完成的模型。这时会load预训练模型的参数,但并不会load学习率、优化器以及训练状态等。如果需要finetune,应该使用pretrained。
|
||||
checkpoints:指之前训练的中间结果,例如前一次训练到了100个epoch,想接着训练。这时会load尝试所有信息,包括模型的参数,之前的状态等。
|
||||
|
||||
#### Q: 如何对检测模型finetune,比如冻结前面的层或某些层使用小的学习率学习?
|
||||
|
||||
**A**:如果是冻结某些层,可以将变量的stop_gradient属性设置为True,这样计算这个变量之前的所有参数都不会更新了,参考:<https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/faq/train_cn.html#id4>
|
||||
|
||||
如果对某些层使用更小的学习率学习,静态图里还不是很方便,一个方法是在参数初始化的时候,给权重的属性设置固定的学习率,参考:<https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/fluid/param_attr/ParamAttr_cn.html#paramattr>
|
||||
|
||||
实际上我们实验发现,直接加载模型去fine-tune,不设置某些层不同学习率,效果也都不错
|
||||
|
||||
### 2.6 模型超参调整
|
||||
|
||||
#### Q: DB检测训练输入尺寸640,可以改大一些吗?
|
||||
|
||||
**A**:不建议改大。检测模型训练输入尺寸是预处理中random crop后的尺寸,并非直接将原图进行resize,多数场景下这个尺寸并不小了,改大后可能反而并不合适,而且训练会变慢。另外,代码里可能有的地方参数按照预设输入尺寸适配的,改大后可能有隐藏风险。
|
||||
|
||||
#### Q: 预处理部分,图片的长和宽为什么要处理成32的倍数?
|
||||
|
||||
**A**:以检测中的resnet骨干网络为例,图像输入网络之后,需要经过5次2倍降采样,共32倍,因此建议输入的图像尺寸为32的倍数。
|
||||
|
||||
#### Q: 在识别模型中,为什么降采样残差结构的stride为(2, 1)?
|
||||
|
||||
**A**: stride为(2, 1),表示在图像y方向(高度方向)上stride为2,x方向(宽度方向)上为1。由于待识别的文本图像通常为长方形,这样只在高度方向做下采样,尽量保留宽度方向的序列信息,避免宽度方向下采样后丢失过多的文字信息。
|
||||
|
||||
#### Q:训练识别时,如何选择合适的网络输入shape?
|
||||
|
||||
**A**:一般高度采用32,最长宽度的选择,有两种方法:
|
||||
|
||||
(1)统计训练样本图像的宽高比分布。最大宽高比的选取考虑满足80%的训练样本。
|
||||
|
||||
(2)统计训练样本文字数目。最长字符数目的选取考虑满足80%的训练样本。然后中文字符长宽比近似认为是1,英文认为3:1,预估一个最长宽度。
|
||||
|
||||
#### Q:识别模型框出来的位置太紧凑,会丢失边缘的文字信息,导致识别错误
|
||||
|
||||
**A**:可以在命令中加入 --det_db_unclip_ratio ,参数定义位置,这个参数是检测后处理时控制文本框大小的,默认1.6,可以尝试改成2.5或者更大,反之,如果觉得文本框不够紧凑,也可以把该参数调小。
|
||||
|
||||
### 2.7 模型结构
|
||||
|
||||
#### Q:文本识别训练不加LSTM是否可以收敛?
|
||||
|
||||
**A**:理论上是可以收敛的,加上LSTM模块主要是为了挖掘文字之间的序列关系,提升识别效果。对于有明显上下文语义的场景效果会比较明显。
|
||||
|
||||
#### Q:文本识别中LSTM和GRU如何选择?
|
||||
|
||||
**A**:从项目实践经验来看,序列模块采用LSTM的识别效果优于GRU,但是LSTM的计算量比GRU大一些,可以根据自己实际情况选择。
|
||||
|
||||
#### Q:对于CRNN模型,backbone采用DenseNet和ResNet_vd,哪种网络结构更好?
|
||||
|
||||
**A**:Backbone的识别效果在CRNN模型上的效果,与Imagenet 1000 图像分类任务上识别效果和效率一致。在图像分类任务上ResnNet_vd(79%+)的识别精度明显优于DenseNet(77%+),此外对于GPU,Nvidia针对ResNet系列模型做了优化,预测效率更高,所以相对而言,resnet_vd是较好选择。如果是移动端,可以优先考虑MobileNetV3系列。
|
||||
|
||||
#### Q: 如何根据不同的硬件平台选用不同的backbone?
|
||||
|
||||
**A**:在不同的硬件上,不同的backbone的速度优势不同,可以根据不同平台的速度-精度图来确定backbone,这里可以参考[PaddleClas模型速度-精度图](https://github.com/PaddlePaddle/PaddleClas/tree/release/2.0/docs/zh_CN/models)。
|
||||
|
||||
### 2.8 PP-OCR系统
|
||||
|
||||
#### Q: 在PP-OCR系统中,文本检测的骨干网络为什么没有使用SE模块?
|
||||
|
||||
**A**:SE模块是MobileNetV3网络一个重要模块,目的是估计特征图每个特征通道重要性,给特征图每个特征分配权重,提高网络的表达能力。但是,对于文本检测,输入网络的分辨率比较大,一般是640\*640,利用SE模块估计特征图每个特征通道重要性比较困难,网络提升能力有限,但是该模块又比较耗时,因此在PP-OCR系统中,文本检测的骨干网络没有使用SE模块。实验也表明,当去掉SE模块,超轻量模型大小可以减小40%,文本检测效果基本不受影响。详细可以参考PP-OCR技术文章,<https://arxiv.org/abs/2009.09941>.
|
||||
|
||||
#### Q: PP-OCR系统中,文本检测的结果有置信度吗?
|
||||
|
||||
**A**:文本检测的结果有置信度,由于推理过程中没有使用,所以没有显示的返回到最终结果中。如果需要文本检测结果的置信度,可以在[文本检测DB的后处理代码](../ppocr/postprocess/db_postprocess.py)的155行,添加scores信息。这样,在[检测预测代码](../tools/infer/predict_det.py)的197行,就可以拿到文本检测的scores信息。
|
||||
|
||||
#### Q: DB文本检测,特征提取网络金字塔构建的部分代码在哪儿?
|
||||
|
||||
**A**:特征提取网络金字塔构建的部分:[代码位置](../ppocr/modeling/necks/db_fpn.py)。ppocr/modeling文件夹里面是组网相关的代码,其中architectures是文本检测或者文本识别整体流程代码;backbones是骨干网络相关代码;necks是类似与FPN的颈函数代码;heads是提取文本检测或者文本识别预测结果相关的头函数;transforms是类似于TPS特征预处理模块。更多的信息可以参考[代码组织结构](./tree.md)。
|
||||
|
||||
#### Q:PaddleOCR如何做到横排和竖排同时支持的?
|
||||
|
||||
**A**:合成了一批竖排文字,逆时针旋转90度后加入训练集与横排一起训练。预测时根据图片长宽比判断是否为竖排,若为竖排则将crop出的文本逆时针旋转90度后送入识别网络。
|
||||
|
||||
#### Q: 目前知识蒸馏有哪些主要的实践思路?
|
||||
|
||||
**A**:知识蒸馏即利用教师模型指导学生模型的训练,目前有3种主要的蒸馏思路:
|
||||
|
||||
1. 基于输出结果的蒸馏,即让学生模型学习教师模型的软标签(分类或者OCR识别等任务中)或者概率热度图(分割等任务中)。
|
||||
2. 基于特征图的蒸馏,即让学生模型学习教师模型中间层的特征图,拟合中间层的一些特征。
|
||||
3. 基于关系的蒸馏,针对不同的样本(假设个数为N),教师模型会有不同的输出,那么可以基于不同样本的输出,计算一个NxN的相关性矩阵,可以让学生模型去学习教师模型关于不同样本的相关性矩阵。
|
||||
|
||||
当然,知识蒸馏方法日新月异,也欢迎大家提出更多的总结与建议。
|
||||
|
||||
#### Q: 文字识别模型模型的输出矩阵需要进行解码才能得到识别的文本。代码中实现为preds_idx = preds.argmax(axis=2),也就是最佳路径解码法。这是一种贪心算法,是每一个时间步只将最大概率的字符作为当前时间步的预测输出,但得到的结果不一定是最好的。为什么不使用beam search这种方式进行解码呢?
|
||||
|
||||
**A**:实验发现,使用贪心的方法去做解码,识别精度影响不大,但是速度方面的优势比较明显,因此PaddleOCR中使用贪心算法去做识别的解码。
|
||||
|
||||
### 2.9 端到端
|
||||
|
||||
#### Q: 端到端算法PGNet是否支持中文识别,速度会很慢嘛?
|
||||
|
||||
**A**:目前开源的PGNet算法模型主要是用于检测英文数字,对于中文的识别需要自己训练,大家可以使用开源的端到端中文数据集,而对于复杂文本(弯曲文本)的识别,也可以自己构造一批数据集针对进行训练,对于推理速度,可以先将模型转换为inference再进行预测,速度应该会相当可观。
|
||||
|
||||
#### Q: 端到端算法PGNet提供了两种后处理方式,两者之间有什么区别呢?
|
||||
|
||||
**A**: 两种后处理的区别主要在于速度的推理,config中PostProcess有fast/slow两种模式,slow模式的后处理速度慢,精度相对较高,fast模式的后处理速度快,精度也在可接受的范围之内。建议使用速度快的后处理方式。
|
||||
|
||||
#### Q: 使用PGNet进行eval报错?
|
||||
|
||||
**A**: 需要注意,我们目前在release/2.1更新了评测代码,目前支持A,B两种评测模式:
|
||||
|
||||
- A模式:该模式主要为了方便用户使用,与训练集一样的标注文件就可以正常进行eval操作, 代码中默认是A模式。
|
||||
- B模式:该模式主要为了保证我们的评测代码可以和Total Text官方的评测方式对齐,该模式下直接加载官方提供的mat文件进行eval。
|
||||
|
||||
#### Q: PGNet有中文预训练模型吗?
|
||||
|
||||
**A**: 目前我们尚未提供针对中文的预训练模型,如有需要,可以尝试自己训练。具体需要修改的地方有:
|
||||
|
||||
1. [config文件中](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.1/configs/e2e/e2e_r50_vd_pg.yml#L23-L24),字典文件路径及语种设置;
|
||||
1. [网络结构中](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.1/ppocr/modeling/heads/e2e_pg_head.py#L181),`out_channels`修改为字典中的字符数目+1(考虑到空格);
|
||||
1. [loss中](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.1/ppocr/losses/e2e_pg_loss.py#L93),修改`37`为字典中的字符数目+1(考虑到空格);
|
||||
|
||||
#### Q: 用于PGNet的训练集,文本框的标注有要求吗?
|
||||
|
||||
**A**: PGNet支持多点标注,比如4点、8点、14点等。但需要注意的是,标注点尽可能分布均匀(相邻标注点间隔距离均匀一致),且label文件中的标注点需要从标注框的左上角开始,按标注点顺时针顺序依次编写,以上问题都可能对训练精度造成影响。
|
||||
我们提供的,基于Total Text数据集的PGNet预训练模型使用了14点标注方式。
|
||||
|
||||
#### Q: 用PGNet做进行端到端训练时,数据集标注的点的个数必须都是统一一样的吗? 能不能随意标点数,只要能够按顺时针从左上角开始标这样?
|
||||
|
||||
**A**: 目前代码要求标注为统一的点数。
|
||||
|
||||
### 2.10 模型效果与效果不一致
|
||||
|
||||
#### Q: PP-OCR检测效果不好,该如何优化?
|
||||
|
||||
**A**: 具体问题具体分析:
|
||||
如果在你的场景上检测效果不可用,首选是在你的数据上做finetune训练;
|
||||
如果图像过大,文字过于密集,建议不要过度压缩图像,可以尝试修改检测预处理的resize逻辑,防止图像被过度压缩;
|
||||
检测框大小过于紧贴文字或检测框过大,可以调整db_unclip_ratio这个参数,加大参数可以扩大检测框,减小参数可以减小检测框大小;
|
||||
检测框存在很多漏检问题,可以减小DB检测后处理的阈值参数det_db_box_thresh,防止一些检测框被过滤掉,也可以尝试设置det_db_score_mode为'slow';
|
||||
其他方法可以选择use_dilation为True,对检测输出的feature map做膨胀处理,一般情况下,会有效果改善;
|
||||
|
||||
#### Q:同一张图通用检测出21个条目,轻量级检测出26个 ,难道不是轻量级的好吗?
|
||||
|
||||
**A**:可以主要参考可视化效果,通用模型更倾向于检测一整行文字,轻量级可能会有一行文字被分成两段检测的情况,不是数量越多,效果就越好。
|
||||
|
||||
#### Q: DB有些框太贴文本了反而去掉了一些文本的边角影响识别,这个问题有什么办法可以缓解吗?
|
||||
|
||||
**A**:可以把后处理的参数unclip_ratio适当调大一点。
|
||||
|
||||
#### Q: 使用合成数据精调小模型后,效果可以,但是还没开源的小infer模型效果好,这是为什么呢?
|
||||
|
||||
**A**:(1)要保证使用的配置文件和pretrain weights是对应的;
|
||||
|
||||
(2)在微调时,一般都需要真实数据,如果使用合成数据,效果反而可能会有下降,PaddleOCR中放出的识别inference模型也是基于预训练模型在真实数据上微调得到的,效果提升比较明显;
|
||||
|
||||
(3)在训练的时候,文本长度超过25的训练图像都会被丢弃,因此需要看下真正参与训练的图像有多少,太少的话也容易过拟合。
|
||||
|
||||
#### Q: 表格识别中,如何提高单字的识别结果?
|
||||
|
||||
**A**: 首先需要确认一下检测模型有没有有效的检测出单个字符,如果没有的话,需要在训练集当中添加相应的单字数据集。
|
||||
|
||||
#### Q: 动态图分支(dygraph,release/2.0),训练模型和推理模型效果不一致
|
||||
|
||||
**A**:当前问题表现为:使用训练完的模型直接测试结果较好,但是转换为inference model后,预测结果不一致;出现这个问题一般是两个原因:
|
||||
|
||||
1. 预处理函数设置的不一致
|
||||
2. 后处理参数不一致 repo中config.yml文件的前后处理参数和inference预测默认的超参数有不一致的地方,建议排查下训练模型预测和inference预测的前后处理, 参考issue。
|
||||
|
||||
#### Q: 自己训练的det模型,在同一张图片上,inference模型与eval模型结果差别很大,为什么?
|
||||
|
||||
**A**:这是由于图片预处理不同造成的。如果训练的det模型图片输入并不是默认的shape[600, 600],eval的程序中图片预处理方式与train时一致 (由xxx_reader.yml中的test_image_shape参数决定缩放大小,但predict_eval.py中的图片预处理方式由程序里的preprocess_params决定, 最好不要传入max_side_len,而是传入和训练时一样大小的test_image_shape。
|
||||
|
||||
#### Q: 训练模型和测试模型的检测结果差距较大
|
||||
|
||||
**A**:1. 检查两个模型使用的后处理参数是否是一样的,训练的后处理参数在配置文件中的PostProcess部分,测试模型的后处理参数在tools/infer/utility.py中,最新代码中两个后处理参数已保持一致。
|
||||
|
||||
#### Q: PaddleOCR模型Python端预测和C++预测结果不一致?
|
||||
|
||||
**A**:正常来说,python端预测和C++预测文本是一致的,如果预测结果差异较大, 建议首先排查diff出现在检测模型还是识别模型,或者尝试换其他模型是否有类似的问题。 其次,检查python端和C++端数据处理部分是否存在差异,建议保存环境,更新PaddleOCR代码再试下。 如果更新代码或者更新代码都没能解决,建议在PaddleOCR微信群里或者issue中抛出您的问题。
|
||||
|
||||
用户总结的排查步骤:<https://github.com/PaddlePaddle/PaddleOCR/issues/2470>
|
||||
|
||||
### 2.11 训练调试与配置文件
|
||||
|
||||
#### Q: 某个类别的样本比较少,通过增加训练的迭代次数或者是epoch,变相增加小样本的数目,这样能缓解这个问题么?
|
||||
|
||||
**A**: 尽量保证类别均衡, 某些类别样本少,可以通过补充合成数据的方式处理;实验证明训练集中出现频次较少的字符,识别效果会比较差,增加迭代次数不能改变样本量少的问题。
|
||||
|
||||
#### Q:文本检测换成自己的数据没法训练,有一些”###”是什么意思?
|
||||
|
||||
**A**:数据格式有问题,”###” 表示要被忽略的文本区域,所以你的数据都被跳过了,可以换成其他任意字符或者就写个空的。
|
||||
|
||||
#### Q:如何调试数据读取程序?
|
||||
|
||||
**A**:tools/train.py中有一个test_reader()函数用于调试数据读取。
|
||||
|
||||
#### Q:中文文本检测、文本识别构建训练集的话,大概需要多少数据量
|
||||
|
||||
**A**:检测需要的数据相对较少,在PaddleOCR模型的基础上进行Fine-tune,一般需要500张可达到不错的效果。 识别分英文和中文,一般英文场景需要几十万数据可达到不错的效果,中文则需要几百万甚至更多。
|
||||
|
||||
#### Q: config yml文件中的ratio_list参数的作用是什么?
|
||||
|
||||
**A**: 在动态图中,ratio_list在有多个数据源的情况下使用,ratio_list中的每个值是每个epoch从对应数据源采样数据的比例。如ratio_list=[0.3,0.2],label_file_list=['data1','data2'],代表每个epoch的训练数据包含data1 30%的数据,和data2里 20%的数据,ratio_list中数值的和不需要等于1。ratio_list和label_file_list的长度必须一致。
|
||||
|
||||
静态图检测数据采样的逻辑与动态图不同,但基本不影响训练精度。
|
||||
|
||||
在静态图中,使用 检测 dataloader读取数据时,会先设置每个epoch的数据量,比如这里设置为1000,ratio_list中的值表示在1000中的占比,比如ratio_list是[0.3, 0.7],则表示使用两个数据源,每个epoch从第一个数据源采样1000*0.3=300张图,从第二个数据源采样700张图。ratio_list的值的和也不需要等于1。
|
||||
|
||||
#### Q: iaa里面添加的数据增强方式,是每张图像训练都会做增强还是随机的?如何添加一个数据增强方法?
|
||||
|
||||
**A**:iaa增强的训练配置参考:[这里](https://github.com/PaddlePaddle/PaddleOCR/blob/0ccc1720c252beb277b9e522a1b228eb6abffb8a/configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml#L82)。其中{ 'type': Fliplr, 'args': { 'p': 0.5 } } p是概率。新增数据增强,可以参考[这个方法](https://github.com/PaddlePaddle/PaddleOCR/blob/release%2F2.1/doc/doc_ch/add_new_algorithm.md#%E6%95%B0%E6%8D%AE%E5%8A%A0%E8%BD%BD%E5%92%8C%E5%A4%84%E7%90%86)
|
||||
|
||||
#### Q: 怎么加速训练过程呢?
|
||||
|
||||
**A**:OCR模型训练过程中一般包含大量的数据增广,这些数据增广是比较耗时的,因此可以离线生成大量增广后的图像,直接送入网络进行训练,机器资源充足的情况下,也可以使用分布式训练的方法,可以参考[分布式训练教程文档](https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/doc/doc_ch/distributed_training.md)。
|
||||
|
||||
#### Q: 一些特殊场景的数据识别效果差,但是数据量很少,不够用来finetune怎么办?
|
||||
|
||||
**A**:您可以合成一些接近使用场景的数据用于训练。
|
||||
我们计划推出基于特定场景的文本数据合成工具,请您持续关注PaddleOCR的近期更新。
|
||||
|
||||
#### Q: PaddleOCR可以识别灰度图吗?
|
||||
|
||||
**A**:PaddleOCR的模型均为三通道输入。如果您想使用灰度图作为输入,建议直接用3通道的模式读入灰度图,
|
||||
或者将单通道图像转换为三通道图像再识别。例如,opencv的cvtColor函数就可以将灰度图转换为RGB三通道模式。
|
||||
|
||||
#### Q: 如何合成手写中文数据集?
|
||||
|
||||
**A**: 手写数据集可以通过手写单字数据集合成得到。随机选取一定数量的单字图片和对应的label,将图片高度resize为随机的统一高度后拼接在一起,即可得到合成数据集。对于需要添加文字背景的情况,建议使用阈值化将单字图片的白色背景处理为透明背景,再与真实背景图进行合成。具体可以参考文档[手写数据集](https://github.com/PaddlePaddle/PaddleOCR/blob/a72d6f23be9979e0c103d911a9dca3e4613e8ccf/doc/doc_ch/handwritten_datasets.md)。
|
||||
|
||||
#### Q:PaddleOCR默认不是200个step保存一次模型吗?为啥文件夹下面都没有生成
|
||||
|
||||
**A**:因为默认保存的起始点不是0,而是4000,将eval_batch_step [4000, 5000]改为[0, 2000] 就是从第0次迭代开始,每2000迭代保存一次模型
|
||||
|
||||
#### Q: PaddleOCR在训练的时候一直使用cosine_decay的学习率下降策略,这是为什么呢?
|
||||
|
||||
**A**:cosine_decay表示在训练的过程中,学习率按照cosine的变化趋势逐渐下降至0,在迭代轮数更长的情况下,比常量的学习率变化策略会有更好的收敛效果,因此在实际训练的时候,均采用了cosine_decay,来获得精度更高的模型。
|
||||
|
||||
#### Q: Cosine学习率的更新策略是怎样的?训练过程中为什么会在一个值上停很久?
|
||||
|
||||
**A**: Cosine学习率的说明可以参考[这里](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/optimizer/lr/CosineAnnealingDecay_cn.html#cosineannealingdecay)
|
||||
|
||||
在PaddleOCR中,为了让学习率更加平缓,我们将其中的epoch调整成了iter。
|
||||
学习率的更新会和总的iter数量有关。当iter比较大时,会经过较多iter才能看出学习率的值有变化。
|
||||
|
||||
#### Q: 之前的CosineWarmup方法为什么不见了?
|
||||
|
||||
**A**: 我们对代码结构进行了调整,目前的Cosine可以覆盖原有的CosineWarmup的功能,只需要在配置文件中增加相应配置即可。
|
||||
例如下面的代码,可以设置warmup为2个epoch:
|
||||
|
||||
```
|
||||
lr:
|
||||
name: Cosine
|
||||
learning_rate: 0.001
|
||||
warmup_epoch: 2
|
||||
```
|
||||
|
||||
#### Q: 训练识别和检测时学习率要加上warmup,目的是什么?
|
||||
|
||||
**A**: Warmup机制先使学习率从一个较小的值逐步升到一个较大的值,而不是直接就使用较大的学习率,这样有助于模型的稳定收敛。在OCR检测和OCR识别中,一般会带来精度~0.5%的提升。
|
||||
|
||||
#### Q: 关于dygraph分支中,文本识别模型训练,要使用数据增强应该如何设置?
|
||||
|
||||
**A**:可以参考[配置文件](../configs/rec/ch_ppocr_v2.0/rec_chinese_lite_train_v2.0.yml)在`Train['dataset']['transforms']`添加RecAug字段,使数据增强生效。可以通过添加对aug_prob设置,表示每种数据增强采用的概率。aug_prob默认是0.4。详细设置可以参考[ISSUE 1744](https://github.com/PaddlePaddle/PaddleOCR/issues/1744)。
|
||||
|
||||
#### Q: 训练过程中,训练程序意外退出/挂起,应该如何解决?
|
||||
|
||||
**A**: 考虑内存,显存(使用GPU训练的话)是否不足,可在配置文件中,将训练和评估的batch size调小一些。需要注意,训练batch size调小时,学习率learning rate也要调小,一般可按等比例调整。
|
||||
|
||||
#### Q: 训练程序启动后直到结束,看不到训练过程log?
|
||||
|
||||
**A**: 可以从以下三方面考虑:
|
||||
1. 检查训练进程是否正常退出、显存占用是否释放、是否有残留进程,如果确定是训练程序卡死,可以检查环境配置,遇到环境问题建议使用docker,可以参考说明文档[安装](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.1/doc/doc_ch/installation.md)。
|
||||
2. 检查数据集的数据量是否太小,可调小batch size从而增加一个epoch中的训练step数量,或在训练config文件中,将参数print_batch_step改为1,即每一个step打印一次log信息。
|
||||
3. 如果使用私有数据集训练,可先用PaddleOCR提供/推荐的数据集进行训练,排查私有数据集是否存在问题。
|
||||
|
||||
#### Q: 配置文件中的参数num workers是什么意思,应该如何设置?
|
||||
|
||||
**A**: 训练数据的读取需要硬盘IO,而硬盘IO速度远小于GPU运算速度,为了避免数据读取成为训练速度瓶颈,可以使用多进程读取数据,num workers表示数据读取的进程数量,0表示不使用多进程读取。在Linux系统下,多进程读取数据时,进程间通信需要基于共享内存,因此使用多进程读取数据时,建议设置共享内存不低于2GB,最好可以达到8GB,此时,num workers可以设置为CPU核心数。如果机器硬件配置较低,或训练进程卡死、dataloader报错,可以将num workers设置为0,即不使用多进程读取数据。
|
||||
|
||||
### 2.12 预测
|
||||
|
||||
#### Q: 为什么PaddleOCR检测预测是只支持一张图片测试?即test_batch_size_per_card=1
|
||||
|
||||
**A**:测试的时候,对图像等比例缩放,最长边960,不同图像等比例缩放后长宽不一致,无法组成batch,所以设置为test_batch_size为1。
|
||||
|
||||
#### Q: PaddleOCR支持tensorrt推理吗?
|
||||
|
||||
**A**:支持的,需要在编译的时候将CMakeLists.txt文件当中,将相关代码option(WITH_TENSORRT "Compile demo with TensorRT." OFF)的OFF改成ON。关于服务器端部署的更多设置,可以参考飞桨官网
|
||||
|
||||
#### Q: 如何使用TensorRT加速PaddleOCR预测?
|
||||
|
||||
**A**: 目前paddle的dygraph分支已经支持了python和C++ TensorRT预测的代码,python端inference预测时把参数[--use_tensorrt=True](https://github.com/PaddlePaddle/PaddleOCR/blob/3ec57e8df9263de6fa897e33d2d91bc5d0849ef3/tools/infer/utility.py#L37)即可,
|
||||
C++TensorRT预测需要使用支持TRT的预测库并在编译时打开[-DWITH_TENSORRT=ON](https://github.com/PaddlePaddle/PaddleOCR/blob/3ec57e8df9263de6fa897e33d2d91bc5d0849ef3/deploy/cpp_infer/tools/build.sh#L15)。
|
||||
如果想修改其他分支代码支持TensorRT预测,可以参考[PR](https://github.com/PaddlePaddle/PaddleOCR/pull/2921)。
|
||||
|
||||
注:建议使用TensorRT大于等于6.1.0.5以上的版本。
|
||||
|
||||
#### Q: 为什么识别模型做预测的时候,预测图片的数量数量还会影响预测的精度
|
||||
|
||||
**A**: 推理时识别模型默认的batch_size=6, 如预测图片长度变化大,可能影响预测效果。如果出现上述问题可在推理的时候设置识别bs=1,命令如下:
|
||||
|
||||
```bash linenums="1"
|
||||
python3 tools/infer/predict_rec.py --image_dir="./doc/imgs_words/ch/word_4.jpg" --rec_model_dir="./PP-OCRv3_mobile_rec_infer/" --rec_batch_num=1
|
||||
```
|
||||
|
||||
### 2.13 推理部署
|
||||
|
||||
#### Q:PaddleOCR模型推理方式有几种?各自的优缺点是什么
|
||||
|
||||
**A**:目前推理方式支持基于训练引擎推理和基于预测引擎推理。
|
||||
|
||||
(1)基于训练引擎推理不需要转换模型,但是需要先组网再load参数,语言只支持python,不适合系统集成。
|
||||
|
||||
(2)基于预测引擎的推理需要先转换模型为inference格式,然后可以进行不需要组网的推理,语言支持c++和python,适合系统集成。
|
||||
|
||||
#### Q:PaddleOCR中,对于模型预测加速,CPU加速的途径有哪些?基于TenorRT加速GPU对输入有什么要求?
|
||||
|
||||
**A**:(1)CPU可以使用mkldnn进行加速;对于python inference的话,可以把enable_mkldnn改为true,[参考代码](https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/tools/infer/utility.py#L99),对于cpp inference的话,可参考[文档](https://github.com/PaddlePaddle/PaddleOCR/tree/dygraph/deploy/cpp_infer)
|
||||
|
||||
(2)GPU需要注意变长输入问题等,TRT6 之后才支持变长输入
|
||||
|
||||
#### Q:hubserving、pdserving这两种部署方式区别是什么?
|
||||
|
||||
**A**:hubserving原本是paddlehub的配套服务部署工具,可以很方便的将paddlehub内置的模型部署为服务,paddleocr使用了这个功能,并将模型路径等参数暴露出来方便用户自定义修改。paddle serving是面向所有paddle模型的部署工具,文档中可以看到我们提供了快速版和标准版,其中快速版和hubserving的本质是一样的,而标准版基于rpc,更稳定,更适合分布式部署。
|
||||
|
||||
#### Q: 目前paddle hub serving 只支持 imgpath,如果我想用imgurl 去哪里改呢?
|
||||
|
||||
**A**:图片是在[这里](https://github.com/PaddlePaddle/PaddleOCR/blob/67ef25d593c4eabfaaceb22daade4577f53bed81/deploy/hubserving/ocr_system/module.py#L55)读取的, 可以参考下面的写法,将url path转化为np array
|
||||
|
||||
```
|
||||
response = request.urlopen('http://i1.whymtj.com/uploads/tu/201902/9999/52491ae4ba.jpg')
|
||||
img_array = np.array(bytearray(response.read()), dtype=np.uint8)
|
||||
img = cv.imdecode(img_array, -1)
|
||||
```
|
||||
|
||||
#### Q: C++ 端侧部署可以只对OCR的检测部署吗?
|
||||
|
||||
**A**:可以的,识别和检测模块是解耦的。如果想对检测部署,需要自己修改一下main函数, 只保留检测相关就可以: [参考](https://github.com/PaddlePaddle/PaddleOCR/blob/de3e2e7cd3b8b65ee02d7a41e570fa5b511a3c1d/deploy/cpp_infer/src/main.cpp#L72)
|
||||
|
||||
#### Q:服务部署可以只发布文本识别,而不带文本检测模型么?
|
||||
|
||||
**A**:可以的。默认的服务部署是检测和识别串联预测的。也支持单独发布文本检测或文本识别模型,比如使用PaddleHUBPaddleOCR 模型时,deploy下有三个文件夹,分别是
|
||||
ocr_det:检测预测
|
||||
ocr_rec: 识别预测
|
||||
ocr_system: 检测识别串联预测
|
||||
|
||||
#### Q: lite预测库和nb模型版本不匹配,该如何解决?
|
||||
|
||||
**A**: 如果可以正常预测就不用管,如果这个问题导致无法正常预测,可以尝试使用同一个commit的Paddle Lite代码编译预测库和opt文件,可以参考[移动端部署教程](https://github.com/PaddlePaddle/PaddleOCR/blob/release%2F2.1/deploy/lite/readme.md)。
|
||||
|
||||
#### Q:如何将PaddleOCR预测模型封装成SDK
|
||||
|
||||
**A**:如果是Python的话,可以使用tools/infer/predict_system.py中的TextSystem进行sdk封装,如果是c++的话,可以使用deploy/cpp_infer/src下面的DBDetector和CRNNRecognizer完成封装
|
||||
|
||||
#### Q:为什么PaddleOCR检测预测是只支持一张图片测试?即test_batch_size_per_card=1
|
||||
|
||||
**A**:测试的时候,对图像等比例缩放,最长边960,不同图像等比例缩放后长宽不一致,无法组成batch,所以设置为test_batch_size为1。
|
||||
|
||||
#### Q:为什么第一张张图预测时间很长,第二张之后预测时间会降低?
|
||||
|
||||
**A**:第一张图需要显存资源初始化,耗时较多。完成模型加载后,之后的预测时间会明显缩短。
|
||||
|
||||
#### Q: 采用Paddle-Lite进行端侧部署,出现问题,环境没问题
|
||||
|
||||
**A**:如果你的预测库是自己编译的,那么你的nb文件也要自己编译,用同一个lite版本。不能直接用下载的nb文件,因为版本不同。
|
||||
|
||||
#### Q: 如何多进程运行paddleocr?
|
||||
|
||||
**A**:实例化多个paddleocr服务,然后将服务注册到注册中心,之后通过注册中心统一调度即可,关于注册中心,可以搜索eureka了解一下具体使用,其他的注册中心也行。
|
||||
|
||||
#### Q: 如何多进程预测?
|
||||
|
||||
**A**: 近期PaddleOCR新增了[多进程预测控制参数](https://github.com/PaddlePaddle/PaddleOCR/blob/a312647be716776c1aac33ff939ae358a39e8188/tools/infer/utility.py#L103),`use_mp`表示是否使用多进程,`total_process_num`表示在使用多进程时的进程数。具体使用方式请参考[文档](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.1/doc/doc_ch/inference.md#1-%E8%B6%85%E8%BD%BB%E9%87%8F%E4%B8%AD%E6%96%87ocr%E6%A8%A1%E5%9E%8B%E6%8E%A8%E7%90%86)。
|
||||
|
||||
#### Q: 怎么解决paddleOCR在T4卡上有越预测越慢的情况?
|
||||
|
||||
**A**:
|
||||
|
||||
1. T4 GPU没有主动散热,因此在测试的时候需要在每次infer之后需要sleep 30ms,否则机器容易因为过热而降频(inference速度会变慢),温度过高也有可能会导致宕机。
|
||||
2. T4在不使用的时候,也有可能会降频,因此在做benchmark的时候需要锁频,下面这两条命令可以进行锁频。
|
||||
|
||||
```
|
||||
nvidia-smi -i 0 -pm ENABLED
|
||||
nvidia-smi --lock-gpu-clocks=1590 -i 0
|
||||
```
|
||||
|
||||
#### Q: 在windows上进行cpp inference的部署时,总是提示找不到`paddle_fluid.dll`和`opencv_world346.dll`
|
||||
|
||||
**A**:有2种方法可以解决这个问题:
|
||||
|
||||
1. 将paddle预测库和opencv库的地址添加到系统环境变量中。
|
||||
2. 将提示缺失的dll文件拷贝到编译产出的`ocr_system.exe`文件夹中。
|
||||
|
||||
#### Q: win下C++部署中文识别乱码的解决方法
|
||||
|
||||
**A**: win下编码格式不是utf8,而ppocr_keys_v1.txt的编码格式的utf8,将ppocr_keys_v1.txt 的编码从utf-8修改为 Ansi 编码格式就行了。
|
||||
|
||||
#### Q: windows 3060显卡GPU模式启动 加载模型慢
|
||||
|
||||
**A**: 30系列的显卡需要使用cuda11。
|
||||
|
||||
#### Q:想在Mac上部署,从哪里下载预测库呢?
|
||||
|
||||
**A**:Mac上的Paddle预测库可以从这里下载:[https://paddle-inference-lib.bj.bcebos.com/mac/2.0.0/cpu_avx_openblas/paddle_inference.tgz](https://paddle-inference-lib.bj.bcebos.com/mac/2.0.0/cpu_avx_openblas/paddle_inference.tgz)
|
||||
|
||||
#### Q:内网环境如何进行服务化部署呢?
|
||||
|
||||
**A**:仍然可以使用PaddleServing或者HubServing进行服务化部署,保证内网地址可以访问即可。
|
||||
|
||||
#### Q: 使用hub_serving部署,延时较高,可能的原因是什么呀?
|
||||
|
||||
**A**: 首先,测试的时候第一张图延时较高,可以多测试几张然后观察后几张图的速度;其次,如果是在cpu端部署serving端模型(如backbone为ResNet34),耗时较慢,建议在cpu端部署mobile(如backbone为MobileNetV3)模型。
|
||||
|
||||
#### Q: 在使用PaddleLite进行预测部署时,启动预测后卡死/手机死机?
|
||||
|
||||
**A**: 请检查模型转换时所用PaddleLite的版本,和预测库的版本是否对齐。即PaddleLite版本为2.8,则预测库版本也要为2.8。
|
||||
|
||||
#### Q: 预测时显存爆炸、内存泄漏问题?
|
||||
|
||||
**A**: 打开显存/内存优化开关`enable_memory_optim`可以解决该问题,相关代码已合入,[查看详情](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.1/tools/infer/utility.py#L153)。
|
||||
336
docs/community/code_and_doc.en.md
Normal file
@@ -0,0 +1,336 @@
|
||||
---
|
||||
comments: true
|
||||
typora-copy-images-to: images
|
||||
---
|
||||
|
||||
# Appendix
|
||||
|
||||
This appendix contains python, document specifications and Pull Request process.
|
||||
|
||||
## Appendix 1:Python Code Specification
|
||||
|
||||
The Python code of PaddleOCR follows [PEP8 Specification]( https://www.python.org/dev/peps/pep-0008/ ), some of the key concerns include the following
|
||||
|
||||
- Space
|
||||
|
||||
- Spaces should be added after commas, semicolons, colons, not before them
|
||||
|
||||
```python linenums="1"
|
||||
# true:
|
||||
print(x, y)
|
||||
|
||||
# false:
|
||||
print(x , y)
|
||||
```
|
||||
|
||||
- When specifying a keyword parameter or default parameter value in a function, do not use spaces on both sides of it
|
||||
|
||||
```python linenums="1"
|
||||
# true:
|
||||
def complex(real, imag=0.0)
|
||||
# false:
|
||||
def complex(real, imag = 0.0)
|
||||
```
|
||||
|
||||
- comment
|
||||
|
||||
- Inline comments: inline comments are indicated by the` # `sign. Two spaces should be left between code and` # `, and one space should be left between` # `and comments, for example
|
||||
|
||||
```python linenums="1"
|
||||
x = x + 1 # Compensate for border
|
||||
```
|
||||
|
||||
- Functions and methods: The definition of each function should include the following:
|
||||
|
||||
- Function description: Utility, input and output of function
|
||||
- Args: Name and description of each parameter
|
||||
- Returns: The meaning and type of the return value
|
||||
|
||||
```python linenums="1"
|
||||
def fetch_bigtable_rows(big_table, keys, other_silly_variable=None):
|
||||
"""Fetches rows from a Bigtable.
|
||||
|
||||
Retrieves rows pertaining to the given keys from the Table instance
|
||||
represented by big_table. Silly things may happen if
|
||||
other_silly_variable is not None.
|
||||
|
||||
Args:
|
||||
big_table: An open Bigtable Table instance.
|
||||
keys: A sequence of strings representing the key of each table row
|
||||
to fetch.
|
||||
other_silly_variable: Another optional variable, that has a much
|
||||
longer name than the other args, and which does nothing.
|
||||
|
||||
Returns:
|
||||
A dict mapping keys to the corresponding table row data
|
||||
fetched. Each row is represented as a tuple of strings. For
|
||||
example:
|
||||
|
||||
{'Serak': ('Rigel VII', 'Preparer'),
|
||||
'Zim': ('Irk', 'Invader'),
|
||||
'Lrrr': ('Omicron Persei 8', 'Emperor')}
|
||||
|
||||
If a key from the keys argument is missing from the dictionary,
|
||||
then that row was not found in the table.
|
||||
"""
|
||||
pass
|
||||
```
|
||||
|
||||
## Appendix 2: Document Specification
|
||||
|
||||
### 2.1 Overall Description
|
||||
|
||||
- Document Location: If you add new features to your original Markdown file, please **Do not re-create** a new file. If you don't know where to add it, you can first PR the code and then ask the official in commit.
|
||||
|
||||
- New Markdown Document Name: Describe the content of the document in English, typically a combination of lowercase letters and underscores, such as `add_New_Algorithm.md`
|
||||
|
||||
- New Markdown Document Format: Catalog - Body - FAQ
|
||||
|
||||
> The directory generation method can use [this site](https://ecotrust-canada.github.io/markdown-toc/ ) Automatically extract directories after copying MD contents, and then add `
|
||||
|
||||
- English and Chinese: Any changes or additions to the document need to be made in both Chinese and English documents.
|
||||
|
||||
### 2.2 Format Specification
|
||||
|
||||
- Title format: The document title format follows the format of: Arabic decimal point combination-space-title (for example, `2.1 XXXX`, `2.XXXX`)
|
||||
|
||||
- Code block: Displays code in code block format that needs to be run, describing the meaning of command parameters before the code block. for example:
|
||||
|
||||
> Pipeline of detection + direction Classify + recognition: Vertical text can be recognized after set direction classifier parameters`--use_angle_cls true`.
|
||||
>
|
||||
> ```bash linenums="1"
|
||||
> paddleocr --image_dir ./imgs/11.jpg --use_angle_cls true
|
||||
> ```
|
||||
|
||||
- Variable References: If code variables or command parameters are referenced in line, they need to be represented in line code, for example, above `--use_angle_cls true` with one space in front and one space in back
|
||||
|
||||
- Uniform naming: e.g. PP-OCRv2, PP-OCR mobile, `paddleocr` whl package, PPOCRLabel, Paddle Lite, etc.
|
||||
|
||||
- Supplementary notes: Supplementary notes by reference format `>`.
|
||||
|
||||
- Picture: If a picture is added to the description document, specify the naming of the picture (describing its content) and add the picture under `doc/`.
|
||||
|
||||
- Title: Capitalize the first letter of each word in the title.
|
||||
|
||||
## Appendix 3: Pull Request Description
|
||||
|
||||
### 3.1 PaddleOCR Branch Description
|
||||
|
||||
PaddleOCR will maintain two branches in the future, one for each:
|
||||
|
||||
- release/x.x family branch: stable release version branch, also the default branch. PaddleOCR releases a new release branch based on feature updates and adapts to the release version of Paddle. As versions iterate, more and more release/x.x family branches are maintained by default with the latest version of the release branch.
|
||||
- dygraph branch: For the development branch, adapts the dygraph version of the Paddle dynamic graph to primarily develop new functionality. If you need to redevelop, choose the dygraph branch. To ensure that the dygraph branch pulls out the release/x.x branch when needed, the code for the dygraph branch can only use the valid API in the latest release branch of Paddle. That is, if a new API has been developed in the Paddle dygraph branch but has not yet appeared in the release branch code, do not use it in Paddle OCR. In addition, performance optimization, parameter tuning, policy updates that do not involve API can be developed normally.
|
||||
|
||||
The historical branch of PaddleOCR will no longer be maintained in the future. These branches will continue to be maintained, considering that some of you may still be using them:
|
||||
|
||||
Develop branch: This branch was used for the development and testing of static diagrams and is currently compatible with version >=1.7. If you have special needs, you can also use this branch to accommodate older versions of Paddle, but you won't update your code until you fix the bug.
|
||||
|
||||
PaddleOCR welcomes you to actively contribute code to repo. Here are some basic processes for contributing code.
|
||||
|
||||
### 3.2 PaddleOCR Code Submission Process And Specification
|
||||
|
||||
If you are familiar with Git use, you can jump directly to [Some Conventions For Submitting Code in 3.2.10](#Some_conventions_for_submitting_code)
|
||||
|
||||
#### 3.2.1 Create Your `Remote Repo`
|
||||
|
||||
In PaddleOCR [GitHub Home]( https://github.com/PaddlePaddle/PaddleOCR ) Click the `Fork` button in the upper left corner to create a `remote repo`in your personal directory, such as `https://github.com/ {your_name}/PaddleOCR`.
|
||||
|
||||

|
||||
|
||||
Clone `Remote repo`
|
||||
|
||||
```bash linenums="1"
|
||||
# pull code of develop branch
|
||||
git clone https://github.com/{your_name}/PaddleOCR.git -b dygraph
|
||||
cd PaddleOCR
|
||||
```
|
||||
|
||||
Clone failures are mostly due to network reasons, try again later or configure the proxy
|
||||
|
||||
#### 3.2.2 Login And Connect Using Token
|
||||
|
||||
Start by viewing the information for the current `remote repo`.
|
||||
|
||||
```bash linenums="1"
|
||||
git remote -v
|
||||
# origin https://github.com/{your_name}/PaddleOCR.git (fetch)
|
||||
# origin https://github.com/{your_name}/PaddleOCR.git (push)
|
||||
```
|
||||
|
||||
Only the information of the clone `remote repo`, i.e. the PaddleOCR under your username, is available. Due to the change in Github's login method, you need to reconfigure the `remote repo` address by means of a Token. The token is generated as follows:
|
||||
|
||||
1. Find Personal Access Tokens: Click on your avatar in the upper right corner of the Github page and choose Settings --> Developer settings --> Personal access tokens,
|
||||
|
||||
2. Click Generate new token: Fill in the token name in Note, such as 'paddle'. In Select scopes, select repo (required), admin:repo_hook, delete_repo, etc. You can check them according to your needs. Then click Generate token to generate the token, and finally copy the generated token.
|
||||
|
||||
Delete the original origin configuration
|
||||
|
||||
```bash linenums="1"
|
||||
git remote rm origin
|
||||
```
|
||||
|
||||
Change the remote branch to `https://oauth2:{token}@github.com/{your_name}/PaddleOCR.git`. For example, if the token value is 12345 and your user name is PPOCR, run the following command
|
||||
|
||||
```bash linenums="1"
|
||||
git remote add origin https://oauth2:12345@github.com/PPOCR/PaddleOCR.git
|
||||
```
|
||||
|
||||
This establishes a connection to our own `remote repo`. Next we create a remote host of the original PaddleOCR repo, named upstream.
|
||||
|
||||
```bash linenums="1"
|
||||
git remote add upstream https://github.com/PaddlePaddle/PaddleOCR.git
|
||||
```
|
||||
|
||||
Use `git remote -v` to view current `remote warehouse` information, output as follows, found to include two origin and two upstream of `remote repo` .
|
||||
|
||||
```bash linenums="1"
|
||||
origin https://github.com/{your_name}/PaddleOCR.git (fetch)
|
||||
origin https://github.com/{your_name}/PaddleOCR.git (push)
|
||||
upstream https://github.com/PaddlePaddle/PaddleOCR.git (fetch)
|
||||
upstream https://github.com/PaddlePaddle/PaddleOCR.git (push)
|
||||
```
|
||||
|
||||
This is mainly to keep the local repository up to date when subsequent pull request (PR) submissions are made.
|
||||
|
||||
#### 3.2.3 Create Local Branch
|
||||
|
||||
First get the latest code of upstream, then create a new_branch branch based on the dygraph of the upstream repo (upstream).
|
||||
|
||||
```bash linenums="1"
|
||||
git fetch upstream
|
||||
git checkout -b new_branch upstream/dygraph
|
||||
```
|
||||
|
||||
> If for a newly forked PaddleOCR project, the user's remote repo (origin) has the same branch updates as the upstream repository (upstream), you can also create a new local branch based on the default branch of the origin repo or a specified branch with the following command
|
||||
>
|
||||
> ```bash linenums="1"
|
||||
> # Create new_branch branch on user remote repo (origin) based on develop branch
|
||||
> git checkout -b new_branch origin/develop
|
||||
> # Create new_branch branch based on upstream remote repo develop branch
|
||||
> # If you need to create a new branch from upstream,
|
||||
> # you need to first use git fetch upstream to get upstream code
|
||||
> git checkout -b new_branch upstream/develop
|
||||
> ```
|
||||
|
||||
The final switch to the new branch is displayed with the following output information.
|
||||
|
||||
Branch new_branch set up to track remote branch develop from upstream.
|
||||
Switched to a new branch 'new_branch'
|
||||
|
||||
After switching branches, file changes can be made on this branch
|
||||
|
||||
#### 3.2.4 Use Pre-Commit Hook
|
||||
|
||||
Paddle developers use the pre-commit tool to manage Git pre-submit hooks. It helps us format the source code (C++, Python) and automatically check for basic things (such as having only one EOL per file, not adding large files to Git) before committing it.
|
||||
|
||||
The pre-commit test is part of the unit test in Travis-CI. PR that does not satisfy the hook cannot be submitted to PaddleOCR. Install it first and run it in the current directory:
|
||||
|
||||
```bash linenums="1"
|
||||
pip install pre-commit
|
||||
pre-commit install
|
||||
```
|
||||
|
||||
> 1. Paddle uses clang-format to adjust the C/C++ source code format. Make sure the `clang-format` version is above 3.8.
|
||||
>
|
||||
> 2. Yapf installed through pip install pre-commit is slightly different from conda install-c conda-forge pre-commit, and PaddleOCR developers use `pip install pre-commit`.
|
||||
|
||||
#### 3.2.5 Modify And Submit Code
|
||||
|
||||
If you make some changes on `README.Md` on PaddleOCR, you can view the changed file through `git status`, and then add the changed file using `git add`。
|
||||
|
||||
```bash linenums="1"
|
||||
git status # View change files
|
||||
git add README.md
|
||||
pre-commit
|
||||
```
|
||||
|
||||
Repeat these steps until the pre-comit format check does not error. As shown below.
|
||||
|
||||

|
||||
|
||||
Use the following command to complete the submission.
|
||||
|
||||
```bash linenums="1"
|
||||
git commit -m "your commit info"
|
||||
```
|
||||
|
||||
#### 3.2.6 Keep Local Repo Up To Date
|
||||
|
||||
Get the latest code for upstream and update the current branch. Here the upstream comes from section 2.2, `Connecting to a remote repo`.
|
||||
|
||||
```bash linenums="1"
|
||||
git fetch upstream
|
||||
# If you want to commit to another branch, you need to pull code from another branch of upstream, here is develop
|
||||
git pull upstream develop
|
||||
```
|
||||
|
||||
#### 3.2.7 Push To Remote Repo
|
||||
|
||||
```bash linenums="1"
|
||||
git push origin new_branch
|
||||
```
|
||||
|
||||
#### 3.2.7 Submit Pull Request
|
||||
|
||||
Click the new pull request to select the local branch and the target branch, as shown in the following figure. In the description of PR, fill in the functions completed by the PR. Next, wait for review, and if you need to modify something, update the corresponding branch in origin with the steps above.
|
||||
|
||||

|
||||
|
||||
#### 3.2.8 Sign CLA Agreement And Pass Unit Tests
|
||||
|
||||
Signing the CLA When submitting a Pull Request to PaddlePaddle for the first time, you need to sign a CLA (Contributor License Agreement) agreement to ensure that your code can be incorporated as follows:
|
||||
|
||||
1. Please check the Check section in PR, find the license/cla, and click on the right detail to enter the CLA website
|
||||
|
||||
2. Click Sign in with GitHub to agree on the CLA website and when clicked, it will jump back to your Pull Request page
|
||||
|
||||
#### 3.2.9 Delete Branch
|
||||
|
||||
- Remove remote branch
|
||||
|
||||
After PR is merged into the main repo, we can delete the branch of the remote repofrom the PR page.
|
||||
You can also use `git push origin:branch name` to delete remote branches, such as:
|
||||
|
||||
```bash linenums="1"
|
||||
git push origin :new_branch
|
||||
```
|
||||
|
||||
- Delete local branch
|
||||
|
||||
```bash linenums="1"
|
||||
# Switch to the development branch, otherwise the current branch cannot be deleted
|
||||
git checkout develop
|
||||
|
||||
# Delete new_ Branch Branch
|
||||
git branch -D new_branch
|
||||
```
|
||||
|
||||
#### 3.2.10 Some Conventions For Submitting Code
|
||||
|
||||
In order for official maintainers to better focus on the code itself when reviewing it, please follow the following conventions each time you submit your code:
|
||||
|
||||
1)Please ensure that the unit tests in Travis-CI pass smoothly. If not, indicate that there is a problem with the submitted code, and the official maintainer generally does not review it.
|
||||
|
||||
2)Before submitting a Pull Request.
|
||||
|
||||
- Note the number of commits.
|
||||
|
||||
Reason: If you only modify one file and submit more than a dozen commits, each commit will only make a few modifications, which can be very confusing to the reviewer. The reviewer needs to look at each commit individually to see what changes have been made, and does not exclude the fact that changes between commits overlap each other.
|
||||
|
||||
Suggestion: Keep as few commits as possible each time you submit, and supplement your last commit with git commit --amend. For multiple commits that have been Push to a remote warehouse, you can refer to [squash commits after push](https://stackoverflow.com/questions/5667884/how-to-squash-commits-in-git-after-they-have-been-pushed ).
|
||||
|
||||
- Note the name of each commit: it should reflect the content of the current commit, not be too arbitrary.
|
||||
|
||||
3) If you have solved a problem, add in the first comment box of the Pull Request:fix #issue_number,This will automatically close the corresponding Issue when the Pull Request is merged. Key words include:close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved,please choose the right vocabulary. Detailed reference [Closing issues via commit messages](https://help.github.com/articles/closing-issues-via-commit-messages).
|
||||
|
||||
In addition, in response to the reviewer's comments, you are requested to abide by the following conventions:
|
||||
|
||||
1) Each review comment from an official maintainer would like a response, which would better enhance the contribution of the open source community.
|
||||
|
||||
- If you agree to the review opinion and modify it accordingly, give a simple Done.
|
||||
- If you disagree with the review, please give your own reasons for refuting.
|
||||
|
||||
2)If there are many reviews:
|
||||
|
||||
- Please give an overview of the changes.
|
||||
- Please reply with `start a review', not directly. The reason is that each reply sends an e-mail message, which can cause a mail disaster.
|
||||
327
docs/community/code_and_doc.md
Normal file
@@ -0,0 +1,327 @@
|
||||
---
|
||||
comments: true
|
||||
typora-copy-images-to: images
|
||||
---
|
||||
|
||||
# 附录
|
||||
|
||||
本附录包含了Python、文档规范以及Pull Request流程,请各位开发者遵循相关内容
|
||||
|
||||
## 附录1:Python代码规范
|
||||
|
||||
PaddleOCR的Python代码遵循 [PEP8规范](https://www.python.org/dev/peps/pep-0008/),其中一些关注的重点包括如下内容
|
||||
|
||||
- 空格
|
||||
|
||||
- 空格应该加在逗号、分号、冒号后,而非他们的前面
|
||||
|
||||
```python linenums="1"
|
||||
# 正确:
|
||||
print(x, y)
|
||||
|
||||
# 错误:
|
||||
print(x , y)
|
||||
```
|
||||
|
||||
- 在函数中指定关键字参数或默认参数值时, 不要在其两侧使用空格
|
||||
|
||||
```python linenums="1"
|
||||
# 正确:
|
||||
def complex(real, imag=0.0)
|
||||
# 错误:
|
||||
def complex(real, imag = 0.0)
|
||||
```
|
||||
|
||||
- 注释
|
||||
|
||||
- 行内注释:行内注释使用 `#` 号表示,在代码与 `#` 之间需要空两个空格, `#` 与注释之间应当空一个空格,例如
|
||||
|
||||
```python linenums="1"
|
||||
x = x + 1 # Compensate for border
|
||||
```
|
||||
|
||||
- 函数和方法:每个函数的定义后的描述应该包括以下内容:
|
||||
|
||||
- 函数描述:函数的作用,输入输出的
|
||||
- Args:每个参数的名字以及对该参数的描述
|
||||
- Returns:返回值的含义和类型
|
||||
|
||||
```python linenums="1"
|
||||
def fetch_bigtable_rows(big_table, keys, other_silly_variable=None):
|
||||
"""Fetches rows from a Bigtable.
|
||||
|
||||
Retrieves rows pertaining to the given keys from the Table instance
|
||||
represented by big_table. Silly things may happen if
|
||||
other_silly_variable is not None.
|
||||
|
||||
Args:
|
||||
big_table: An open Bigtable Table instance.
|
||||
keys: A sequence of strings representing the key of each table row
|
||||
to fetch.
|
||||
other_silly_variable: Another optional variable, that has a much
|
||||
longer name than the other args, and which does nothing.
|
||||
|
||||
Returns:
|
||||
A dict mapping keys to the corresponding table row data
|
||||
fetched. Each row is represented as a tuple of strings. For
|
||||
example:
|
||||
|
||||
{'Serak': ('Rigel VII', 'Preparer'),
|
||||
'Zim': ('Irk', 'Invader'),
|
||||
'Lrrr': ('Omicron Persei 8', 'Emperor')}
|
||||
|
||||
If a key from the keys argument is missing from the dictionary,
|
||||
then that row was not found in the table.
|
||||
"""
|
||||
pass
|
||||
```
|
||||
|
||||
## 附录2:文档规范
|
||||
|
||||
### 2.1 总体说明
|
||||
|
||||
- 文档位置:如果您增加的新功能可以补充在原有的Markdown文件中,请**不要重新新建**一个文件。如果您对添加的位置不清楚,可以先PR代码,然后在commit中询问官方人员。
|
||||
|
||||
- 新增Markdown文档名称:使用英文描述文档内容,一般由小写字母与下划线组合而成,例如 `add_new_algorithm.md`
|
||||
|
||||
- 新增Markdown文档格式:目录 - 正文 - FAQ
|
||||
|
||||
> 目录生成方法可以使用 [此网站](https://ecotrust-canada.github.io/markdown-toc/) 将md内容复制之后自动提取目录,然后在md文件的每个标题前添加
|
||||
|
||||
- 中英双语:任何对文档的改动或新增都需要分别在中文和英文文档上进行。
|
||||
|
||||
### 2.2 格式规范
|
||||
|
||||
- 标题格式:文档标题格式按照:阿拉伯数字小数点组合 - 空格 - 标题的格式(例如 `2.1 XXXX` , `2. XXXX`)
|
||||
|
||||
- 代码块:通过代码块格式展示需要运行的代码,在代码块前描述命令参数的含义。例如:
|
||||
|
||||
> 检测+方向分类器+识别全流程:设置方向分类器参数 `--use_angle_cls true` 后可对竖排文本进行识别。
|
||||
>
|
||||
> ```bash linenums="1"
|
||||
> paddleocr --image_dir ./imgs/11.jpg --use_angle_cls true
|
||||
> ```
|
||||
|
||||
- 变量引用:如果在行内引用到代码变量或命令参数,需要用行内代码表示,例如上方 `--use_angle_cls true` ,并在前后各空一格
|
||||
|
||||
- 统一命名:如PP-OCRv2、PP-OCR mobile、`paddleocr` whl包、PPOCRLabel、Paddle Lite等
|
||||
|
||||
- 补充说明:通过引用格式 `>` 补充说明,或对注意事项进行说明
|
||||
|
||||
- 图片:如果在说明文档中增加了图片,请规范图片的命名形式(描述图片内容),并将图片添加在 `doc/` 下
|
||||
|
||||
## 附录3:Pull Request说明
|
||||
|
||||
### 3.1 PaddleOCR分支说明
|
||||
|
||||
PaddleOCR未来将维护2种分支,分别为:
|
||||
|
||||
- release/x.x系列分支:为稳定的发行版本分支,也是默认分支。PaddleOCR会根据功能更新情况发布新的release分支,同时适配Paddle的release版本。随着版本迭代,release/x.x系列分支会越来越多,默认维护最新版本的release分支。
|
||||
- dygraph分支:为开发分支,适配Paddle动态图的dygraph版本,主要用于开发新功能。如果有同学需要进行二次开发,请选择dygraph分支。为了保证dygraph分支能在需要的时候拉出release/x.x分支,dygraph分支的代码只能使用Paddle最新release分支中有效的api。也就是说,如果Paddle dygraph分支中开发了新的api,但尚未出现在release分支代码中,那么请不要在PaddleOCR中使用。除此之外,对于不涉及api的性能优化、参数调整、策略更新等,都可以正常进行开发。
|
||||
|
||||
PaddleOCR的历史分支,未来将不再维护。考虑到一些同学可能仍在使用,这些分支还会继续保留:
|
||||
|
||||
- develop分支:这个分支曾用于静态图的开发与测试,目前兼容>=1.7版本的Paddle。如果有特殊需求,要适配旧版本的Paddle,那还可以使用这个分支,但除了修复bug外不再更新代码。
|
||||
|
||||
PaddleOCR欢迎大家向repo中积极贡献代码,下面给出一些贡献代码的基本流程。
|
||||
|
||||
### 3.2 PaddleOCR代码提交流程与规范
|
||||
|
||||
> 如果你熟悉Git使用,可以直接跳转到 [3.2.10 提交代码的一些约定](#提交代码的一些约定)
|
||||
|
||||
#### 3.2.1 创建你的 `远程仓库`
|
||||
|
||||
- 在PaddleOCR的 [GitHub首页](https://github.com/PaddlePaddle/PaddleOCR),点击左上角 `Fork` 按钮,在你的个人目录下创建 `远程仓库`,比如`https://github.com/{your_name}/PaddleOCR`。
|
||||
|
||||

|
||||
|
||||
- 将 `远程仓库` Clone到本地
|
||||
|
||||
```bash linenums="1"
|
||||
# 拉取dygraph分支的代码
|
||||
git clone https://github.com/{your_name}/PaddleOCR.git -b dygraph
|
||||
cd PaddleOCR
|
||||
```
|
||||
|
||||
> 多数情况下clone失败是由于网络原因,请稍后重试或配置代理
|
||||
|
||||
#### 3.2.2 通过Token方式登录与建立连接
|
||||
|
||||
首先查看当前 `远程仓库` 的信息。
|
||||
|
||||
```bash linenums="1"
|
||||
git remote -v
|
||||
# origin https://github.com/{your_name}/PaddleOCR.git (fetch)
|
||||
# origin https://github.com/{your_name}/PaddleOCR.git (push)
|
||||
```
|
||||
|
||||
只有clone的 `远程仓库` 的信息,也就是自己用户名下的 PaddleOCR。由于Github的登录方式变化,需要通过Token的方式重新配置 `远程仓库` 的地址。生成Token的方式如下:
|
||||
|
||||
1. 找到个人访问令牌(token):在Github页面右上角点击自己的头像,然后依次选择 Settings --> Developer settings --> Personal access tokens
|
||||
2. 点击 Generate new token:在Note中填入token名称,例如’paddle‘。在Select scopes选择repo(必选)、admin:repo_hook、delete_repo等,可根据自身需要勾选。然后点击Generate token生成token。最后复制生成的token。
|
||||
|
||||
删除原始的origin配置
|
||||
|
||||
```bash linenums="1"
|
||||
git remote rm origin
|
||||
```
|
||||
|
||||
将remote分支改成 `https://oauth2:{token}@github.com/{your_name}/PaddleOCR.git`。例如:如果token值为12345,你的用户名为PPOCR,则运行下方命令
|
||||
|
||||
```bash linenums="1"
|
||||
git remote add origin https://oauth2:12345@github.com/PPOCR/PaddleOCR.git
|
||||
```
|
||||
|
||||
这样我们就与自己的 `远程仓库` 建立了连接。接下来我们创建一个原始 PaddleOCR 仓库的远程主机,命名为 upstream。
|
||||
|
||||
```bash linenums="1"
|
||||
git remote add upstream https://github.com/PaddlePaddle/PaddleOCR.git
|
||||
```
|
||||
|
||||
使用 `git remote -v` 查看当前 `远程仓库` 的信息,输出如下,发现包括了origin和upstream 2个 `远程仓库` 。
|
||||
|
||||
```bash linenums="1"
|
||||
origin https://oauth2:{token}@github.com/{your_name}/PaddleOCR.git (fetch)
|
||||
origin https://oauth2:{token}@github.com/{your_name}/PaddleOCR.git (push)
|
||||
upstream https://github.com/PaddlePaddle/PaddleOCR.git (fetch)
|
||||
upstream https://github.com/PaddlePaddle/PaddleOCR.git (push)
|
||||
```
|
||||
|
||||
这主要是为了后续在提交pull request(PR)时,始终保持本地仓库最新。
|
||||
|
||||
#### 3.2.3 创建本地分支
|
||||
|
||||
首先获取 upstream 的最新代码,然后基于上游仓库 (upstream)的dygraph创建new_branch分支。
|
||||
|
||||
```bash linenums="1"
|
||||
git fetch upstream
|
||||
git checkout -b new_branch upstream/dygraph
|
||||
```
|
||||
|
||||
> 如果对于新Fork的PaddleOCR项目,用户远程仓库(origin)与上游(upstream)仓库的分支更新情况相同,也可以基于origin仓库的默认分支或指定分支创建新的本地分支,命令如下。
|
||||
>
|
||||
> ```bash linenums="1"
|
||||
> # 基于用户远程仓库(origin)的dygraph创建new_branch分支
|
||||
> git checkout -b new_branch origin/dygraph
|
||||
>
|
||||
> # 基于用户远程仓库(origin)的默认分支创建new_branch分支
|
||||
> git checkout -b new_branch
|
||||
> ```
|
||||
|
||||
最终会显示切换到新的分支,输出信息如下
|
||||
|
||||
```bash linenums="1"
|
||||
Branch new_branch set up to track remote branch develop from upstream.
|
||||
Switched to a new branch 'new_branch'
|
||||
```
|
||||
|
||||
切换分支之后即可在此分支上进行文件改动
|
||||
|
||||
#### 3.2.4 使用pre-commit勾子
|
||||
|
||||
Paddle 开发人员使用 pre-commit 工具来管理 Git 预提交钩子。 它可以帮助我们格式化源代码(C++,Python),在提交(commit)前自动检查一些基本事宜(如每个文件只有一个 EOL,Git 中不要添加大文件等)。
|
||||
|
||||
pre-commit测试是 Travis-CI 中单元测试的一部分,不满足钩子的 PR 不能被提交到 PaddleOCR,首先安装并在当前目录运行它:
|
||||
|
||||
```bash linenums="1"
|
||||
pip install pre-commit
|
||||
pre-commit install
|
||||
```
|
||||
|
||||
> 1. Paddle 使用 clang-format 来调整 C/C++ 源代码格式,请确保 `clang-format` 版本在 3.8 以上。
|
||||
>
|
||||
> 2. 通过pip install pre-commit和conda install -c conda-forge pre-commit安装的yapf稍有不同的,PaddleOCR 开发人员使用的是 `pip install pre-commit`。
|
||||
|
||||
#### 3.2.5 修改与提交代码
|
||||
|
||||
假设对PaddleOCR的 `README.md` 做了一些修改,可以通过 `git status` 查看改动的文件,然后使用 `git add` 添加改动文件。
|
||||
|
||||
```bash linenums="1"
|
||||
git status # 查看改动文件
|
||||
git add README.md
|
||||
pre-commit
|
||||
```
|
||||
|
||||
重复上述步骤,直到pre-comit格式检查不报错。如下所示。
|
||||
|
||||

|
||||
|
||||
提交修改,并写明修改内容("your commit info")
|
||||
|
||||
```bash linenums="1"
|
||||
git commit -m "your commit info"
|
||||
```
|
||||
|
||||
#### 3.2.6 Push到远程仓库
|
||||
|
||||
使用push命令将修改的commit提交到 `远程仓库`
|
||||
|
||||
```bash linenums="1"
|
||||
git push origin new_branch
|
||||
```
|
||||
|
||||
#### 3.2.7 提交Pull Request
|
||||
|
||||
打开自己的远程仓库界面,选择提交的分支。点击new pull request或contribute进入PR界面。选择本地分支和目标分支,如下图所示。在PR的描述说明中,填写该PR所完成的功能。接下来等待review,如果有需要修改的地方,参照上述步骤更新 origin 中的对应分支即可。
|
||||
|
||||

|
||||
|
||||
#### 3.2.8 签署CLA协议和通过单元测试
|
||||
|
||||
- 签署CLA 在首次向PaddlePaddle提交Pull Request时,您需要您签署一次CLA(Contributor License Agreement)协议,以保证您的代码可以被合入,具体签署方式如下:
|
||||
|
||||
1. 请您查看PR中的Check部分,找到license/cla,并点击右侧detail,进入CLA网站
|
||||
|
||||
2. 点击CLA网站中的“Sign in with GitHub to agree”,点击完成后将会跳转回您的Pull Request页面
|
||||
|
||||
#### 3.2.9 删除分支
|
||||
|
||||
- 删除远程分支
|
||||
|
||||
在 PR 被 merge 进主仓库后,我们可以在 PR 的页面删除远程仓库的分支。
|
||||
|
||||
也可以使用 `git push origin :分支名` 删除远程分支,如:
|
||||
|
||||
```bash linenums="1"
|
||||
git push origin :new_branch
|
||||
```
|
||||
|
||||
- 删除本地分支
|
||||
|
||||
```bash linenums="1"
|
||||
# 切换到dygraph分支,否则无法删除当前分支
|
||||
git checkout dygraph
|
||||
|
||||
# 删除new_branch分支
|
||||
git branch -D new_branch
|
||||
```
|
||||
|
||||
#### 3.2.10 提交代码的一些约定
|
||||
|
||||
为了使官方维护人员在评审代码时更好地专注于代码本身,请您每次提交代码时,遵守以下约定:
|
||||
|
||||
1)请保证Travis-CI 中单元测试能顺利通过。如果没过,说明提交的代码存在问题,官方维护人员一般不做评审。
|
||||
|
||||
2)提交Pull Request前:
|
||||
|
||||
- 请注意commit的数量。
|
||||
|
||||
原因:如果仅仅修改一个文件但提交了十几个commit,每个commit只做了少量的修改,这会给评审人带来很大困扰。评审人需要逐一查看每个commit才能知道做了哪些修改,且不排除commit之间的修改存在相互覆盖的情况。
|
||||
|
||||
建议:每次提交时,保持尽量少的commit,可以通过git commit --amend补充上次的commit。对已经Push到远程仓库的多个commit,可以参考[squash commits after push](https://stackoverflow.com/questions/5667884/how-to-squash-commits-in-git-after-they-have-been-pushed)。
|
||||
|
||||
- 请注意每个commit的名称:应能反映当前commit的内容,不能太随意。
|
||||
|
||||
3)如果解决了某个Issue的问题,请在该Pull Request的第一个评论框中加上:fix #issue_number,这样当该Pull Request被合并后,会自动关闭对应的Issue。关键词包括:close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved,请选择合适的词汇。详细可参考[Closing issues via commit messages](https://help.github.com/articles/closing-issues-via-commit-messages)。
|
||||
|
||||
此外,在回复评审人意见时,请您遵守以下约定:
|
||||
|
||||
1)官方维护人员的每一个review意见都希望得到回复,这样会更好地提升开源社区的贡献。
|
||||
|
||||
- 对评审意见同意且按其修改完的,给个简单的Done即可;
|
||||
- 对评审意见不同意的,请给出您自己的反驳理由。
|
||||
|
||||
2)如果评审意见比较多:
|
||||
|
||||
- 请给出总体的修改情况。
|
||||
- 请采用`start a review`进行回复,而非直接回复的方式。原因是每个回复都会发送一封邮件,会造成邮件灾难。
|
||||
116
docs/community/community_contribution.md
Normal file
@@ -0,0 +1,116 @@
|
||||
---
|
||||
comments: true
|
||||
typora-copy-images-to: images
|
||||
---
|
||||
|
||||
# 社区贡献
|
||||
|
||||
感谢大家长久以来对PaddleOCR的支持和关注,与广大开发者共同构建一个专业、和谐、相互帮助的开源社区是PaddleOCR的目标。本文档展示了已有的社区贡献、对于各类贡献说明、新的机会与流程,希望贡献流程更加高效、路径更加清晰。
|
||||
|
||||
PaddleOCR希望可以通过AI的力量助力任何一位有梦想的开发者实现自己的想法,享受创造价值带来的愉悦。
|
||||
|
||||
<a href="https://github.com/PaddlePaddle/PaddleOCR/graphs/contributors">
|
||||
<img src="https://contrib.rocks/image?repo=PaddlePaddle/PaddleOCR&max=400&columns=20" />
|
||||
</a>
|
||||
|
||||
---
|
||||
|
||||
## 1. 社区贡献
|
||||
|
||||
### 1.1 基于PaddleOCR的社区项目
|
||||
|
||||
| 类别 | 项目 | 描述 | 开发者 |
|
||||
| -------- | ------ | ------ | --------- |
|
||||
| 通用工具 | [FastOCRLabel](https://gitee.com/BaoJianQiang/FastOCRLabel) | 完整的C#版本标注GUI | [包建强](https://gitee.com/BaoJianQiang) |
|
||||
| 通用工具 | [DangoOCR离线版](https://github.com/PantsuDango/DangoOCR) | 通用型桌面级即时翻译GUI | [PantsuDango](https://github.com/PantsuDango) |
|
||||
| 通用工具 | [scr2txt](https://github.com/lstwzd/scr2txt) | 截屏转文字GUI | [lstwzd](https://github.com/lstwzd) |
|
||||
| 通用工具 | [ocr_sdk](https://github.com/mymagicpower/AIAS/blob/main/1_image_sdks/text_recognition/ocr_sdk) | OCR java SDK工具箱 | [Calvin](https://github.com/mymagicpower) |
|
||||
| 通用工具 | [iocr](https://github.com/mymagicpower/AIAS/blob/main/8_suite_hub/iocr) | IOCR 自定义模板识别(支持表格识别) | [Calvin](https://github.com/mymagicpower) |
|
||||
| 通用工具 | [Lmdb Dataset Format Conversion Tool](https://github.com/OneYearIsEnough/PaddleOCR-Recog-LmdbDataset-Conversion) | 文本识别任务中lmdb数据格式转换工具 | [OneYearIsEnough](https://github.com/OneYearIsEnough) |
|
||||
| 通用工具 | [用paddleocr打造一款“盗幕笔记”](https://github.com/kjf4096/paddleocr_dmbj) | 用PaddleOCR记笔记 | [kjf4096](https://github.com/kjf4096) |
|
||||
| 垂类工具 | [AI Studio项目](https://aistudio.baidu.com/aistudio/projectdetail/1054614?channelType=0&channel=0) | 英文视频自动生成字幕 | [叶月水狐](https://aistudio.baidu.com/aistudio/personalcenter/thirdview/322052) |
|
||||
| 垂类工具 | [id_card_ocr](https://github.com/baseli/id_card_ocr) | 身份证复印件识别 | [baseli](https://github.com/baseli) |
|
||||
| 垂类工具 | [Paddle_Table_Image_Reader](https://github.com/thunder95/Paddle_Table_Image_Reader) | 能看懂表格图片的数据助手 | [thunder95](https://github.com/thunder95]) |
|
||||
| 垂类工具 | [AI Studio项目](https://aistudio.baidu.com/aistudio/projectdetail/3382897) | OCR流程中对手写体进行过滤 | [daassh](https://github.com/daassh) |
|
||||
| 垂类场景调优 | [AI Studio项目](https://aistudio.baidu.com/aistudio/projectdetail/2803693) | 电表读数和编号识别 | [深渊上的坑](https://github.com/edencfc) |
|
||||
| 垂类场景调优 | [AI Studio项目](https://aistudio.baidu.com/aistudio/projectdetail/3284199) | LCD液晶字符检测 | [Dream拒杰](https://github.com/zhangyingying520) |
|
||||
| 前后处理 | [paddleOCRCorrectOutputs](https://github.com/yuranusduke/paddleOCRCorrectOutputs) | 获取OCR识别结果的key-value | [yuranusduke](https://github.com/yuranusduke) |
|
||||
|前处理| [optlab](https://github.com/GreatV/optlab) |OCR前处理工具箱,基于Qt和Leptonica。|[GreatV](https://github.com/GreatV)|
|
||||
|应用部署| [PaddleOCRSharp](https://github.com/raoyutian/PaddleOCRSharp) |PaddleOCR的.NET封装与应用部署。|[raoyutian](https://github.com/raoyutian/PaddleOCRSharp)|
|
||||
|应用部署| [PaddleSharp](https://github.com/sdcb/PaddleSharp) |PaddleOCR的.NET封装与应用部署,支持跨平台、GPU|[sdcb](https://github.com/sdcb)|
|
||||
| 应用部署 | [PaddleOCR-Streamlit-Demo](https://github.com/Lovely-Pig/PaddleOCR-Streamlit-Demo) | 使用Streamlit部署PaddleOCR | [Lovely-Pig](https://github.com/Lovely-Pig) |
|
||||
| 应用部署 | [PaddleOCR-PyWebIO-Demo](https://github.com/Lovely-Pig/PaddleOCR-PyWebIO-Demo) | 使用PyWebIO部署PaddleOCR | [Lovely-Pig](https://github.com/Lovely-Pig) |
|
||||
| 应用部署 | [PaddleOCR-Paddlejs-Vue-Demo](https://github.com/Lovely-Pig/PaddleOCR-Paddlejs-Vue-Demo) | 使用Paddle.js和Vue部署PaddleOCR | [Lovely-Pig](https://github.com/Lovely-Pig) |
|
||||
| 应用部署 | [PaddleOCR-Paddlejs-React-Demo](https://github.com/Lovely-Pig/PaddleOCR-Paddlejs-React-Demo) | 使用Paddle.js和React部署PaddleOCR | [Lovely-Pig](https://github.com/Lovely-Pig) |
|
||||
| 学术前沿模型训练与推理 | [AI Studio项目](https://aistudio.baidu.com/aistudio/projectdetail/3397137) | StarNet-MobileNetV3算法–中文训练 | [xiaoyangyang2](https://github.com/xiaoyangyang2) |
|
||||
| 学术前沿模型训练与推理 | [ABINet-paddle](https://github.com/Huntersdeng/abinet-paddle) | ABINet算法前向运算的paddle实现以及模型各部分的实现细节分析 | [Huntersdeng](https://github.com/Huntersdeng) |
|
||||
|
||||
### 1.2 为PaddleOCR新增功能
|
||||
|
||||
- 非常感谢 [authorfu](https://github.com/authorfu) 贡献Android([#340](https://github.com/PaddlePaddle/PaddleOCR/pull/340))和[xiadeye](https://github.com/xiadeye) 贡献IOS的demo代码([#325](https://github.com/PaddlePaddle/PaddleOCR/pull/325))
|
||||
- 非常感谢 [tangmq](https://gitee.com/tangmq) 给PaddleOCR增加Docker化部署服务,支持快速发布可调用的Restful API服务([#507](https://github.com/PaddlePaddle/PaddleOCR/pull/507))。
|
||||
- 非常感谢 [lijinhan](https://github.com/lijinhan) 给PaddleOCR增加java SpringBoot 调用OCR Hubserving接口完成对OCR服务化部署的使用([#1027](https://github.com/PaddlePaddle/PaddleOCR/pull/1027))。
|
||||
- 非常感谢 [Evezerest](https://github.com/Evezerest), [ninetailskim](https://github.com/ninetailskim), [edencfc](https://github.com/edencfc), [BeyondYourself](https://github.com/BeyondYourself), [1084667371](https://github.com/1084667371) 贡献了[PPOCRLabel](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.3/PPOCRLabel/README_ch.md) 的完整代码。
|
||||
- 非常感谢 [bupt906](https://github.com/bupt906) 贡献MicroNet结构代码([#5251](https://github.com/PaddlePaddle/PaddleOCR/pull/5251))和贡献OneCycle学习率策略代码([#5252](https://github.com/PaddlePaddle/PaddleOCR/pull/5252))
|
||||
|
||||
### 1.3 代码修复
|
||||
|
||||
- 非常感谢 [zhangxin](https://github.com/ZhangXinNan)([Blog](https://blog.csdn.net/sdlypyzq)) 贡献新的可视化方式、添加.gitgnore、处理手动设置PYTHONPATH环境变量的问题([#210](https://github.com/PaddlePaddle/PaddleOCR/pull/210))。
|
||||
- 非常感谢 [lyl120117](https://github.com/lyl120117) 贡献打印网络结构的代码([#304](https://github.com/PaddlePaddle/PaddleOCR/pull/304))。
|
||||
- 非常感谢 [BeyondYourself](https://github.com/BeyondYourself) 给PaddleOCR提了很多非常棒的建议,并简化了PaddleOCR的部分代码风格([so many commits)](https://github.com/PaddlePaddle/PaddleOCR/commits?author=BeyondYourself)。
|
||||
|
||||
### 1.4 文档优化与翻译
|
||||
|
||||
- 非常感谢 **[RangeKing](https://github.com/RangeKing),[HustBestCat](https://github.com/HustBestCat),[v3fc](https://github.com/v3fc),[1084667371](https://github.com/1084667371)** 贡献翻译《动手学OCR》notebook[电子书英文版](https://github.com/PaddlePaddle/PaddleOCR/tree/dygraph/notebook/notebook_en)。
|
||||
- 非常感谢 [thunderstudying](https://github.com/thunderstudying),[RangeKing](https://github.com/RangeKing),[livingbody](https://github.com/livingbody), [WZMIAOMIAO](https://github.com/WZMIAOMIAO),[haigang1975](https://github.com/haigang1975) 补充多个英文markdown文档。
|
||||
- 非常感谢 **[fanruinet](https://github.com/fanruinet)** 润色和修复35篇英文文档([#5205](https://github.com/PaddlePaddle/PaddleOCR/pull/5205))。
|
||||
- 非常感谢 [Khanh Tran](https://github.com/xxxpsyduck) 和 [Karl Horky](https://github.com/karlhorky) 贡献修改英文文档。
|
||||
|
||||
### 1.5 多语言语料
|
||||
|
||||
- 非常感谢 [xiangyubo](https://github.com/xiangyubo) 贡献手写中文OCR数据集([#321](https://github.com/PaddlePaddle/PaddleOCR/pull/321))。
|
||||
- 非常感谢 [Mejans](https://github.com/Mejans) 给PaddleOCR增加新语言奥克西坦语Occitan的字典和语料([#954](https://github.com/PaddlePaddle/PaddleOCR/pull/954))。
|
||||
|
||||
## 2. 贡献说明
|
||||
|
||||
### 2.1 新增功能类
|
||||
|
||||
PaddleOCR非常欢迎社区贡献以PaddleOCR为核心的各种服务、部署实例与软件应用,经过认证的社区贡献会被添加在上述社区贡献表中,为广大开发者增加曝光,也是PaddleOCR的荣耀,其中:
|
||||
|
||||
- 项目形式:官方社区认证的项目代码应有良好的规范和结构,同时,还应配备一个详细的README.md,说明项目的使用方法。通过在requirements.txt文件中增加一行 `paddleocr` 可以自动收录到PaddleOCR的usedby中。
|
||||
|
||||
- 合入方式:如果是对PaddleOCR现有工具的更新升级,则会合入主repo。如果为PaddleOCR拓展了新功能,请先与官方人员联系,确认项目是否合入主repo,*即使新功能未合入主repo,我们同样也会以社区贡献的方式为您的个人项目增加曝光。*
|
||||
|
||||
### 2.2 代码优化
|
||||
|
||||
如果您在使用PaddleOCR时遇到了代码bug、功能不符合预期等问题,可以为PaddleOCR贡献您的修改,其中:
|
||||
|
||||
- Python代码规范可参考[附录1:Python代码规范](./code_and_doc.md#附录1python代码规范)。
|
||||
|
||||
- 提交代码前请再三确认不会引入新的bug,并在PR中描述优化点。如果该PR解决了某个issue,请在PR中连接到该issue。所有的PR都应该遵守附录3中的[3.2.10 提交代码的一些约定。](./code_and_doc.md#附录3pull-request说明)
|
||||
|
||||
- 请在提交之前参考下方的[附录3:Pull Request说明](./code_and_doc.md#附录3pull-request说明)。如果您对git的提交流程不熟悉,同样可以参考附录3的3.2节。
|
||||
|
||||
### 2.3 文档优化
|
||||
|
||||
如果您在使用PaddleOCR时遇到了文档表述不清楚、描述缺失、链接失效等问题,可以为PaddleOCR贡献您的修改。文档书写规范请参考[附录2:文档规范](./code_and_doc.md#附录2文档规范)。
|
||||
|
||||
## 3. 更多贡献机会
|
||||
|
||||
我们非常鼓励开发者使用PaddleOCR实现自己的想法,同时我们也列出一些经过分析后认为有价值的拓展方向,整体收集在社区项目常规赛中。
|
||||
|
||||
## 4. 联系我们
|
||||
|
||||
我们非常欢迎广大开发者在有意向为PaddleOCR贡献代码、文档、语料等内容前与我们联系,这样可以大大降低PR过程中的沟通成本。同时,如果您觉得某些想法个人难以实现,我们也可以通过SIG的形式定向为项目招募志同道合的开发者一起共建。通过SIG渠道贡献的项目将会获得深层次的研发支持与运营资源(如公众号宣传、直播课等)。
|
||||
|
||||
我们推荐的贡献流程是:
|
||||
|
||||
- 通过在github issue的题目中增加 `【third-party】` 标记,说明遇到的问题(以及解决的思路)或想拓展的功能,等待值班人员回复。例如 `【third-party】为PaddleOCR贡献IOS示例`
|
||||
- 与我们沟通确认技术方案或bug、优化点准确无误后进行功能新增或相应的修改,代码与文档遵循相关规范。
|
||||
- PR链接到上述issue,等待review。
|
||||
|
||||
## 5. 致谢与后续
|
||||
|
||||
- 合入代码之后会在本文档第一节中更新信息,默认链接为github名字及主页,如果有需要更换主页,也可以联系我们。
|
||||
- 新增重要功能类,会在用户群广而告之,享受开源社区荣誉时刻。
|
||||
- **如果您有基于PaddleOCR的项目,但未出现在上述列表中,请按照 `4. 联系我们` 的步骤与我们联系。**
|
||||
BIN
docs/community/images/banner.png
Normal file
|
After Width: | Height: | Size: 138 KiB |
BIN
docs/community/images/pr.png
Normal file
|
After Width: | Height: | Size: 538 KiB |
BIN
docs/community/images/precommit_pass.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
31
docs/data_anno_synth/data_annotation.en.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
# DATA ANNOTATION TOOLS
|
||||
|
||||
There are the commonly used data annotation tools, which will be continuously updated. Welcome to contribute tools~
|
||||
|
||||
## 1. labelImg
|
||||
|
||||
- Tool description: Rectangular label
|
||||
- Tool address: <https://github.com/tzutalin/labelImg>
|
||||
- Sketch diagram:
|
||||
|
||||

|
||||
|
||||
## 2. roLabelImg
|
||||
|
||||
- Tool description: Label tool rewritten based on labelImg, supporting rotating rectangular label
|
||||
- Tool address: <https://github.com/cgvict/roLabelImg>
|
||||
- Sketch diagram:
|
||||
|
||||

|
||||
|
||||
## 3. labelme
|
||||
|
||||
- Tool description: Support four points, polygons, circles and other labels
|
||||
- Tool address: <https://github.com/wkentaro/labelme>
|
||||
- Sketch diagram:
|
||||
|
||||

|
||||
35
docs/data_anno_synth/data_annotation.md
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
# 数据标注工具
|
||||
|
||||
这里整理了常用的数据标注工具,持续更新中,欢迎各位小伙伴贡献工具~
|
||||
|
||||
## 1. labelImg
|
||||
|
||||
- 工具描述:矩形标注
|
||||
- 工具地址:<https://github.com/tzutalin/labelImg>
|
||||
- 示意图:
|
||||

|
||||
|
||||
## 2. roLabelImg
|
||||
|
||||
- 工具描述:基于labelImg重写的标注工具,支持旋转矩形标注
|
||||
- 工具地址:<https://github.com/cgvict/roLabelImg>
|
||||
- 示意图:
|
||||

|
||||
|
||||
## 3. labelme
|
||||
|
||||
- 工具描述:支持四点、多边形、圆形等多种标注
|
||||
- 工具地址:<https://github.com/wkentaro/labelme>
|
||||
- 示意图:
|
||||

|
||||
|
||||
## 4. Vott
|
||||
|
||||
- 工具描述:支持矩形,多边形等图片标注.支持视频标注.方便使用的快捷键以及比较好看的界面.同时支持导出多种标签格式.
|
||||
- 工具地址:<https://github.com/microsoft/VoTT>
|
||||
- 示意图:
|
||||

|
||||
17
docs/data_anno_synth/data_synthesis.en.md
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
# DATA SYNTHESIS TOOLS
|
||||
|
||||
In addition to open source data, users can also use synthesis tools to synthesize data.
|
||||
There are the commonly used data synthesis tools, which will be continuously updated. Welcome to contribute tools~
|
||||
|
||||
* [Text_renderer](https://github.com/Sanster/text_renderer)
|
||||
* [SynthText](https://github.com/ankush-me/SynthText)
|
||||
* [SynthText_Chinese_version](https://github.com/JarveeLee/SynthText_Chinese_version)
|
||||
* [TextRecognitionDataGenerator](https://github.com/Belval/TextRecognitionDataGenerator)
|
||||
* [SynthText3D](https://github.com/MhLiao/SynthText3D)
|
||||
* [UnrealText](https://github.com/Jyouhou/UnrealText/)
|
||||
* [SynthTIGER](https://github.com/clovaai/synthtiger)
|
||||
15
docs/data_anno_synth/data_synthesis.md
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
# 数据合成工具
|
||||
|
||||
除了开源数据,用户还可使用合成工具自行合成。这里整理了常用的数据合成工具,持续更新中,欢迎各位小伙伴贡献工具~
|
||||
|
||||
- [text_renderer](https://github.com/Sanster/text_renderer)
|
||||
- [SynthText](https://github.com/ankush-me/SynthText)
|
||||
- [SynthText_Chinese_version](https://github.com/JarveeLee/SynthText_Chinese_version)
|
||||
- [TextRecognitionDataGenerator](https://github.com/Belval/TextRecognitionDataGenerator)
|
||||
- [SynthText3D](https://github.com/MhLiao/SynthText3D)
|
||||
- [UnrealText](https://github.com/Jyouhou/UnrealText/)
|
||||
- [SynthTIGER](https://github.com/clovaai/synthtiger)
|
||||
BIN
docs/data_anno_synth/images/VoTT.jpg
Normal file
|
After Width: | Height: | Size: 165 KiB |
BIN
docs/data_anno_synth/images/labelimg.jpg
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
docs/data_anno_synth/images/labelme.jpg
Normal file
|
After Width: | Height: | Size: 953 KiB |
BIN
docs/data_anno_synth/images/roLabelImg.png
Normal file
|
After Width: | Height: | Size: 3.8 MiB |
6
docs/data_anno_synth/overview.en.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
- Semi-automatic Annotation Tool: PPOCRLabel: <https://github.com/PFCCLab/PPOCRLabel/blob/main/README_ch.md>
|
||||
- Data Synthesis Tool: Style-Text: <https://github.com/PFCCLab/StyleText/blob/main/README_ch.md>
|
||||
7
docs/data_anno_synth/overview.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
- 半自动标注工具 PPOCRLabel: <https://github.com/PFCCLab/PPOCRLabel/blob/main/README_ch.md>
|
||||
- 数据合成工具 Style-Text: <https://github.com/PFCCLab/StyleText/blob/main/README_ch.md>
|
||||
93
docs/datasets/datasets.en.md
Normal file
@@ -0,0 +1,93 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
This is a collection of commonly used Chinese datasets, which is being updated continuously. You are welcome to contribute to this list~
|
||||
|
||||
In addition to opensource data, users can also use synthesis tools to synthesize data themselves. Current available synthesis tools include [text_renderer](https://github.com/Sanster/text_renderer), [SynthText](https://github.com/ankush-me/SynthText), [TextRecognitionDataGenerator](https://github.com/Belval/TextRecognitionDataGenerator), etc.
|
||||
|
||||
#### 1. ICDAR2019-LSVT
|
||||
|
||||
- **Data sources**:<https://ai.baidu.com/broad/introduction?dataset=lsvt>
|
||||
- **Introduction**: A total of 45w Chinese street view images, including 5w (2w test + 3w training) fully labeled data (text coordinates + text content), 40w weakly labeled data (text content only), as shown in the following figure:
|
||||

|
||||
|
||||
(a) Fully labeled data
|
||||
|
||||

|
||||
|
||||
(b) Weakly labeled data
|
||||
- **Download link**:<https://ai.baidu.com/broad/download?dataset=lsvt>
|
||||
|
||||
#### 2. ICDAR2017-RCTW-17
|
||||
|
||||
- **Data sources**:<https://rctw.vlrlab.net/>
|
||||
- **Introduction**:It contains 12000 + images, most of them are collected in the wild through mobile camera. Some are screenshots. These images show a variety of scenes, including street views, posters, menus, indoor scenes and screenshots of mobile applications.
|
||||

|
||||
- **Download link**:<https://rctw.vlrlab.net/dataset/>
|
||||
|
||||
#### 3. Chinese Street View Text Recognition
|
||||
|
||||
- **Data sources**:<https://aistudio.baidu.com/aistudio/competition/detail/8>
|
||||
- **Introduction**:A total of 290000 pictures are included, of which 210000 are used as training sets (with labels) and 80000 are used as test sets (without labels). The dataset is collected from the Chinese street view, and is formed by by cutting out the text line area (such as shop signs, landmarks, etc.) in the street view picture. All the images are preprocessed: by using affine transform, the text area is proportionally mapped to a picture with a height of 48 pixels, as shown in the figure:
|
||||
|
||||

|
||||
|
||||
(a) Label: 魅派集成吊顶
|
||||
|
||||

|
||||
(b) Label: 母婴用品连锁
|
||||
- **Download link**
|
||||
<https://aistudio.baidu.com/aistudio/datasetdetail/8429>
|
||||
|
||||
#### 4. Chinese Document Text Recognition
|
||||
|
||||
- **Data sources**:<https://github.com/YCG09/chinese_ocr>
|
||||
- **Introduction**:
|
||||
- A total of 3.64 million pictures are divided into training set and validation set according to 99:1.
|
||||
- Using Chinese corpus (news + classical Chinese), the data is randomly generated through changes in font, size, grayscale, blur, perspective, stretching, etc.
|
||||
- 5990 characters including Chinese characters, English letters, numbers and punctuation(Characters set: <https://github.com/YCG09/chinese_ocr/blob/master/train/char_std_5990.txt> )
|
||||
- Each sample is fixed with 10 characters, and the characters are randomly intercepted from the sentences in the corpus
|
||||
- Image resolution is 280x32
|
||||
|
||||

|
||||
|
||||

|
||||
- **Download link**:<https://pan.baidu.com/s/1QkI7kjah8SPHwOQ40rS1Pw> (Password: lu7m)
|
||||
|
||||
#### 5、ICDAR2019-ArT
|
||||
|
||||
- **Data source**:<https://ai.baidu.com/broad/introduction?dataset=art>
|
||||
- **Introduction**:It includes 10166 images, 5603 in training sets and 4563 in test sets. It is composed of three parts: total text, scut-ctw1500 and Baidu curved scene text, including text with various shapes such as horizontal, multi-directional and curved.
|
||||

|
||||
- **Download link**:<https://ai.baidu.com/broad/download?dataset=art>
|
||||
|
||||
#### 6. Electronic seal dataset
|
||||
|
||||
- **Data source**: <https://aistudio.baidu.com/aistudio/datasetdetail/154271/0>
|
||||
- **Data introduction**: Contains 10,000 images in total, 8,000 images in the training set, and 2,000 images in the test set. The dataset is synthesized by a program and does not involve privacy security. It is mainly used for the training and detection of seal curved text. Contributed by developer [jingsongliujing](https://github.com/jingsongliujing)
|
||||
- **Download address**: <https://aistudio.baidu.com/aistudio/datasetdetail/154271/0>
|
||||
|
||||
## References
|
||||
|
||||
**ICDAR 2019-LSVT Challenge**
|
||||
|
||||
```bibtex
|
||||
@article{sun2019icdar,
|
||||
title={ICDAR 2019 Competition on Large-scale Street View Text with Partial Labeling--RRC-LSVT},
|
||||
author={Sun, Yipeng and Ni, Zihan and Chng, Chee-Kheng and Liu, Yuliang and Luo, Canjie and Ng, Chun Chet and Han, Junyu and Ding, Errui and Liu, Jingtuo and Karatzas, Dimosthenis and others},
|
||||
journal={arXiv preprint arXiv:1909.07741},
|
||||
year={2019}
|
||||
}
|
||||
```
|
||||
|
||||
**ICDAR 2019-ArT Challenge**
|
||||
|
||||
```bibtex
|
||||
@article{chng2019icdar2019,
|
||||
title={ICDAR2019 Robust Reading Challenge on Arbitrary-Shaped Text (RRC-ArT)},
|
||||
author={Chng, Chee-Kheng and Liu, Yuliang and Sun, Yipeng and Ng, Chun Chet and Luo, Canjie and Ni, Zihan and Fang, ChuanMing and Zhang, Shuaitao and Han, Junyu and Ding, Errui and others},
|
||||
journal={arXiv preprint arXiv:1909.07145},
|
||||
year={2019}
|
||||
}
|
||||
```
|
||||
93
docs/datasets/datasets.md
Normal file
@@ -0,0 +1,93 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
这里整理了常用中文数据集,持续更新中,欢迎各位小伙伴贡献数据集~
|
||||
|
||||
除了开源数据,用户还可使用合成工具自行合成,可参考[数据合成工具](../data_anno_synth/data_synthesis.md);
|
||||
|
||||
如果需要标注自己的数据,可参考[数据标注工具](../data_anno_synth/data_annotation.md)。
|
||||
|
||||
#### 1、ICDAR2019-LSVT
|
||||
|
||||
- **数据来源**:<https://ai.baidu.com/broad/introduction?dataset=lsvt>
|
||||
- **数据简介**: 共45w中文街景图像,包含5w(2w测试+3w训练)全标注数据(文本坐标+文本内容),40w弱标注数据(仅文本内容),如下图所示:
|
||||

|
||||
(a) 全标注数据
|
||||

|
||||
(b) 弱标注数据
|
||||
- **下载地址**:<https://ai.baidu.com/broad/download?dataset=lsvt>
|
||||
- **说明**:其中,test数据集的label目前没有开源,如要评估结果,可以去官网提交:<https://rrc.cvc.uab.es/?ch=16>
|
||||
|
||||
#### 2、ICDAR2017-RCTW-17
|
||||
|
||||
- **数据来源**:<https://rctw.vlrlab.net/>
|
||||
- **数据简介**:共包含12,000+图像,大部分图片是通过手机摄像头在野外采集的。有些是截图。这些图片展示了各种各样的场景,包括街景、海报、菜单、室内场景和手机应用程序的截图。
|
||||

|
||||
- **下载地址**:<https://rctw.vlrlab.net/dataset/>
|
||||
|
||||
#### 3、中文街景文字识别
|
||||
|
||||
- **数据来源**:<https://aistudio.baidu.com/aistudio/competition/detail/8>
|
||||
- **数据简介**:ICDAR2019-LSVT行识别任务,共包括29万张图片,其中21万张图片作为训练集(带标注),8万张作为测试集(无标注)。数据集采自中国街景,并由街景图片中的文字行区域(例如店铺标牌、地标等等)截取出来而形成。所有图像都经过一些预处理,将文字区域利用仿射变化,等比映射为一张高为48像素的图片,如图所示:
|
||||
|
||||

|
||||
|
||||
(a) 标注:魅派集成吊顶
|
||||
|
||||

|
||||
(b) 标注:母婴用品连锁
|
||||
- **下载地址**
|
||||
<https://aistudio.baidu.com/aistudio/datasetdetail/8429>
|
||||
|
||||
#### 4、中文文档文字识别
|
||||
|
||||
- **数据来源**:<https://github.com/YCG09/chinese_ocr>
|
||||
- **数据简介**:
|
||||
- 共约364万张图片,按照99:1划分成训练集和验证集。
|
||||
- 数据利用中文语料库(新闻 + 文言文),通过字体、大小、灰度、模糊、透视、拉伸等变化随机生成
|
||||
- 包含汉字、英文字母、数字和标点共5990个字符(字符集合:<https://github.com/YCG09/chinese_ocr/blob/master/train/char_std_5990.txt> )
|
||||
- 每个样本固定10个字符,字符随机截取自语料库中的句子
|
||||
- 图片分辨率统一为280x32
|
||||
|
||||

|
||||
|
||||

|
||||
- **下载地址**:<https://pan.baidu.com/s/1QkI7kjah8SPHwOQ40rS1Pw> (密码:lu7m)
|
||||
|
||||
#### 5、ICDAR2019-ArT
|
||||
|
||||
- **数据来源**:<https://ai.baidu.com/broad/introduction?dataset=art>
|
||||
- **数据简介**:共包含10,166张图像,训练集5603图,测试集4563图。由Total-Text、SCUT-CTW1500、Baidu Curved Scene Text (ICDAR2019-LSVT部分弯曲数据) 三部分组成,包含水平、多方向和弯曲等多种形状的文本。
|
||||

|
||||
- **下载地址**:<https://ai.baidu.com/broad/download?dataset=art>
|
||||
|
||||
#### 6、电子印章数据集
|
||||
|
||||
- **数据来源**:<https://aistudio.baidu.com/aistudio/datasetdetail/154271/0>
|
||||
- **数据简介**:共包含10000张图像,训练集8000图,测试集2000图。数据集是用程序合成的,并不涉及隐私安全,主要用于印章弯曲文本的训练与检测。由开发者[jingsongliujing](https://github.com/jingsongliujing)贡献
|
||||
- **下载地址**:<https://aistudio.baidu.com/aistudio/datasetdetail/154271/0>
|
||||
|
||||
## 参考文献
|
||||
|
||||
**ICDAR 2019-LSVT Challenge**
|
||||
|
||||
```bibtex
|
||||
@article{sun2019icdar,
|
||||
title={ICDAR 2019 Competition on Large-scale Street View Text with Partial Labeling--RRC-LSVT},
|
||||
author={Sun, Yipeng and Ni, Zihan and Chng, Chee-Kheng and Liu, Yuliang and Luo, Canjie and Ng, Chun Chet and Han, Junyu and Ding, Errui and Liu, Jingtuo and Karatzas, Dimosthenis and others},
|
||||
journal={arXiv preprint arXiv:1909.07741},
|
||||
year={2019}
|
||||
}
|
||||
```
|
||||
|
||||
**ICDAR 2019-ArT Challenge**
|
||||
|
||||
```bibtex
|
||||
@article{chng2019icdar2019,
|
||||
title={ICDAR2019 Robust Reading Challenge on Arbitrary-Shaped Text (RRC-ArT)},
|
||||
author={Chng, Chee-Kheng and Liu, Yuliang and Sun, Yipeng and Ng, Chun Chet and Luo, Canjie and Ni, Zihan and Fang, ChuanMing and Zhang, Shuaitao and Han, Junyu and Ding, Errui and others},
|
||||
journal={arXiv preprint arXiv:1909.07145},
|
||||
year={2019}
|
||||
}
|
||||
```
|
||||
31
docs/datasets/handwritten_datasets.en.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
# Handwritten OCR dataset
|
||||
|
||||
Here we have sorted out the commonly used handwritten OCR dataset datasets, which are being updated continuously. We welcome you to contribute datasets ~
|
||||
|
||||
- [Institute of automation, Chinese Academy of Sciences - handwritten Chinese dataset](#Institute of automation, Chinese Academy of Sciences - handwritten Chinese dataset)
|
||||
- [NIST handwritten single character dataset - English](#NIST handwritten single character dataset - English)
|
||||
|
||||
## Institute of automation, Chinese Academy of Sciences - handwritten Chinese dataset
|
||||
|
||||
- **Data source**: <http://www.nlpr.ia.ac.cn/databases/handwriting/Download.html>
|
||||
- **Data introduction**:
|
||||
- It includes online and offline handwritten data,`HWDB1.0~1.2` has totally 3895135 handwritten single character samples, which belong to 7356 categories (7185 Chinese characters and 171 English letters, numbers and symbols);`HWDB2.0~2.2` has totally 5091 pages of images, which are divided into 52230 text lines and 1349414 words. All text and text samples are stored as grayscale images. Some sample words are shown below.
|
||||
|
||||

|
||||
|
||||
- **Download address**:<http://www.nlpr.ia.ac.cn/databases/handwriting/Download.html>
|
||||
- **使用建议**:Data for single character, white background, can form a large number of text lines for training. White background can be processed into transparent state, which is convenient to add various backgrounds. For the case of semantic needs, it is suggested to extract single character from real corpus to form text lines.
|
||||
|
||||
## NIST handwritten single character dataset - English(NIST Handprinted Forms and Characters Database)
|
||||
|
||||
- **Data source**: [https://www.nist.gov/srd/nist-special-database-19](https://www.nist.gov/srd/nist-special-database-19)
|
||||
- **Data introduction**: NIST19 dataset is suitable for handwritten document and character recognition model training. It is extracted from the handwritten sample form of 3600 authors and contains 810000 character images in total. Nine of them are shown below.
|
||||
|
||||

|
||||
|
||||
- **Download address**: [https://www.nist.gov/srd/nist-special-database-19](https://www.nist.gov/srd/nist-special-database-19)
|
||||
28
docs/datasets/handwritten_datasets.md
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
# 手写OCR数据集
|
||||
|
||||
这里整理了常用手写数据集,持续更新中,欢迎各位小伙伴贡献数据集~
|
||||
|
||||
## 中科院自动化研究所-手写中文数据集
|
||||
|
||||
- **数据来源**:<http://www.nlpr.ia.ac.cn/databases/handwriting/Download.html>
|
||||
- **数据简介**:
|
||||
- 包含在线和离线两类手写数据,`HWDB1.0~1.2`总共有3895135个手写单字样本,分属7356类(7185个汉字和171个英文字母、数字、符号);`HWDB2.0~2.2`总共有5091页图像,分割为52230个文本行和1349414个文字。所有文字和文本样本均存为灰度图像。部分单字样本图片如下所示。
|
||||
|
||||

|
||||
|
||||
- **下载地址**:<http://www.nlpr.ia.ac.cn/databases/handwriting/Download.html>
|
||||
- **使用建议**:数据为单字,白色背景,可以大量合成文字行进行训练。白色背景可以处理成透明状态,方便添加各种背景。对于需要语义的情况,建议从真实语料出发,抽取单字组成文字行
|
||||
|
||||
## NIST手写单字数据集-英文(NIST Handprinted Forms and Characters Database)
|
||||
|
||||
- **数据来源**: [https://www.nist.gov/srd/nist-special-database-19](https://www.nist.gov/srd/nist-special-database-19)
|
||||
- **数据简介**: NIST19数据集适用于手写文档和字符识别的模型训练,从3600位作者的手写样本表格中提取得到,总共包含81万张字符图片。其中9张图片示例如下:
|
||||
|
||||

|
||||
|
||||
- **下载地址**: [https://www.nist.gov/srd/nist-special-database-19](https://www.nist.gov/srd/nist-special-database-19)
|
||||
BIN
docs/datasets/images/20210816_210413.gif
Normal file
|
After Width: | Height: | Size: 413 KiB |
BIN
docs/datasets/images/ArT.jpg
Normal file
|
After Width: | Height: | Size: 3.1 MiB |
BIN
docs/datasets/images/CASIA_0.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
docs/datasets/images/CDLA_demo/val_0633.jpg
Normal file
|
After Width: | Height: | Size: 594 KiB |
BIN
docs/datasets/images/CDLA_demo/val_0941.jpg
Normal file
|
After Width: | Height: | Size: 628 KiB |
BIN
docs/datasets/images/LSVT_1.jpg
Normal file
|
After Width: | Height: | Size: 123 KiB |
BIN
docs/datasets/images/LSVT_2.jpg
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
docs/datasets/images/captcha_demo.png
Normal file
|
After Width: | Height: | Size: 166 KiB |
BIN
docs/datasets/images/ccpd_demo.png
Normal file
|
After Width: | Height: | Size: 305 KiB |
BIN
docs/datasets/images/ch_doc1.jpg
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
docs/datasets/images/ch_doc3.jpg
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
docs/datasets/images/ch_street_rec_1.png
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
docs/datasets/images/ch_street_rec_2.png
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
docs/datasets/images/cmb_demo.jpg
Normal file
|
After Width: | Height: | Size: 90 KiB |
BIN
docs/datasets/images/crohme_demo/hme_00.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
docs/datasets/images/crohme_demo/hme_01.jpg
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
docs/datasets/images/crohme_demo/hme_02.jpg
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
docs/datasets/images/funsd_demo/gt_train_00040534.jpg
Normal file
|
After Width: | Height: | Size: 237 KiB |
BIN
docs/datasets/images/funsd_demo/gt_train_00070353.jpg
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
docs/datasets/images/ic15_location_download.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
docs/datasets/images/icdar_rec.png
Normal file
|
After Width: | Height: | Size: 921 KiB |
BIN
docs/datasets/images/nist_demo.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
docs/datasets/images/pme_demo/0000013.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
docs/datasets/images/pme_demo/0000099.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
docs/datasets/images/pme_demo/0000295.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
docs/datasets/images/pme_demo/0000562.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
docs/datasets/images/publaynet_demo/gt_PMC3724501_00006.jpg
Normal file
|
After Width: | Height: | Size: 163 KiB |
BIN
docs/datasets/images/publaynet_demo/gt_PMC5086060_00002.jpg
Normal file
|
After Width: | Height: | Size: 120 KiB |
BIN
docs/datasets/images/rctw.jpg
Normal file
|
After Width: | Height: | Size: 93 KiB |
BIN
docs/datasets/images/table_PubTabNet_demo/PMC524509_007_00.png
Executable file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
docs/datasets/images/table_PubTabNet_demo/PMC535543_007_01.png
Executable file
|
After Width: | Height: | Size: 28 KiB |
BIN
docs/datasets/images/table_tal_demo/1.jpg
Normal file
|
After Width: | Height: | Size: 233 KiB |
BIN
docs/datasets/images/table_tal_demo/2.jpg
Normal file
|
After Width: | Height: | Size: 233 KiB |
BIN
docs/datasets/images/tablebank_demo/004.png
Normal file
|
After Width: | Height: | Size: 613 KiB |
BIN
docs/datasets/images/tablebank_demo/005.png
Normal file
|
After Width: | Height: | Size: 224 KiB |
|
After Width: | Height: | Size: 181 KiB |
BIN
docs/datasets/images/wildreceipt_demo/2769.jpeg
Normal file
|
After Width: | Height: | Size: 175 KiB |
BIN
docs/datasets/images/xfund_demo/gt_zh_train_0.jpg
Normal file
|
After Width: | Height: | Size: 636 KiB |
BIN
docs/datasets/images/xfund_demo/gt_zh_train_1.jpg
Normal file
|
After Width: | Height: | Size: 756 KiB |
47
docs/datasets/kie_datasets.en.md
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
## Key Information Extraction dataset
|
||||
|
||||
Here are the common datasets key information extraction, which are being updated continuously. Welcome to contribute datasets.
|
||||
|
||||
### 1. FUNSD dataset
|
||||
|
||||
- **Data source**: <https://guillaumejaume.github.io/FUNSD/>
|
||||
- **Data Introduction**: The FUNSD dataset is a dataset for form comprehension. It contains 199 real, fully annotated scanned images, including market reports, advertisements, and academic reports, etc., and is divided into 149 training set and 50 test set. The FUNSD dataset is suitable for many types of DocVQA tasks, such as field-level entity classification, field-level entity connection, etc. Part of the image and the annotation box visualization are shown below:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
In the figure, the orange area represents `header`, the light blue area represents `question`, the green area represents `answer`, and the pink area represents `other`.
|
||||
|
||||
- **Download address**: <https://guillaumejaume.github.io/FUNSD/download/>
|
||||
|
||||
### 2. XFUND dataset
|
||||
|
||||
- **Data source**: <https://github.com/doc-analysis/XFUND>
|
||||
- **Data introduction**: XFUND is a multilingual form comprehension dataset, which contains form data in 7 different languages, and all are manually annotated in the form of key-value pairs. The data for each language contains 199 form data, which are divided into 149 training sets and 50 test sets. Part of the image and the annotation box visualization are shown below.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
- **Download address**: <https://github.com/doc-analysis/XFUND/releases/tag/v1.0>
|
||||
|
||||
### 3. wildreceipt dataset
|
||||
|
||||
- **Data source**: <https://arxiv.org/abs/2103.14470>
|
||||
- **Data introduction**: wildreceipt is an English receipt dataset, which contains 26 different categories. There are 1267 training images and 472 evaluation images, in which 50,000 textlines and boxes are annotated. Part of the image and the annotation box visualization are shown below.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
**Note:** Boxes with category `Ignore` or `Others` are not visualized here.
|
||||
|
||||
- **Download address**:
|
||||
- Official dataset: [link](https://download.openmmlab.com/mmocr/data/wildreceipt.tar)
|
||||
- Dataset converted for PaddleOCR training process: [link](https://paddleocr.bj.bcebos.com/ppstructure/dataset/wildreceipt.tar)
|
||||
49
docs/datasets/kie_datasets.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
# 关键信息抽取数据集
|
||||
|
||||
这里整理了常见的关键信息抽取数据集,持续更新中,欢迎各位小伙伴贡献数据集~
|
||||
|
||||
## 1. FUNSD数据集
|
||||
|
||||
- **数据来源**:<https://guillaumejaume.github.io/FUNSD/>
|
||||
- **数据简介**:FUNSD数据集是一个用于表单理解的数据集,它包含199张真实的、完全标注的扫描版图片,类型包括市场报告、广告以及学术报告等,并分为149张训练集以及50张测试集。FUNSD数据集适用于多种类型的DocVQA任务,如字段级实体分类、字段级实体连接等。部分图像以及标注框可视化如下所示:
|
||||
|
||||
<div align="center">
|
||||
<img src="./images/funsd_demo/gt_train_00040534.jpg" width="500">
|
||||
<img src="./images/funsd_demo/gt_train_00070353.jpg" width="500">
|
||||
</div>
|
||||
图中,橙色区域代表`header`,淡蓝色区域代表`question`, 绿色区域表`answer`,粉红色代区域表`other`。
|
||||
|
||||
- **下载地址**:<https://guillaumejaume.github.io/FUNSD/download/>
|
||||
|
||||
## 2. XFUND数据集
|
||||
|
||||
- **数据来源**:<https://github.com/doc-analysis/XFUND>
|
||||
- **数据简介**:XFUND是一个多语种表单理解数据集,它包含7种不同语种的表单数据,并且全部用人工进行了键-值对形式的标注。其中每个语种的数据都包含了199张表单数据,并分为149张训练集以及50张测试集。部分图像以及标注框可视化如下所示:
|
||||
|
||||
<div align="center">
|
||||
<img src="./images/xfund_demo/gt_zh_train_0.jpg" width="500">
|
||||
<img src="./images/xfund_demo/gt_zh_train_1.jpg" width="500">
|
||||
</div>
|
||||
|
||||
- **下载地址**:<https://github.com/doc-analysis/XFUND/releases/tag/v1.0>
|
||||
|
||||
## 3. wildreceipt数据集
|
||||
|
||||
- **数据来源**:<https://arxiv.org/abs/2103.14470>
|
||||
- **数据简介**:wildreceipt数据集是英文发票数据集,包含26个类别(此处类别体系包含`Ignore`类别),共标注了50000个文本框。其中训练集包含1267张图片,测试集包含472张图片。部分图像以及标注框可视化如下所示:
|
||||
|
||||
<div align="center">
|
||||
<img src="./images/wildreceipt_demo/2769.jpeg" width="500">
|
||||
<img src="./images/wildreceipt_demo/1bbe854b8817dedb8585e0732089fd1f752d2cec.jpeg" width="500">
|
||||
</div>
|
||||
|
||||
**注:** 这里对于类别为`Ignore`或者`Others`的文本,没有进行可视化。
|
||||
|
||||
- **下载地址**:
|
||||
- 原始数据下载地址:[链接](https://download.openmmlab.com/mmocr/data/wildreceipt.tar)
|
||||
- 数据格式转换后适配于PaddleOCR训练的数据下载地址:[链接](https://paddleocr.bj.bcebos.com/ppstructure/dataset/wildreceipt.tar)
|
||||
46
docs/datasets/layout_datasets.en.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
## Layout Analysis Dataset
|
||||
|
||||
Here are the common datasets of layout analysis, which are being updated continuously. Welcome to contribute datasets.
|
||||
|
||||
Most of the layout analysis datasets are object detection datasets. In addition to open source datasets, you can also label or synthesize datasets using tools such as [labelme](https://github.com/wkentaro/labelme) and so on.
|
||||
|
||||
### 1. PubLayNet dataset
|
||||
|
||||
- **Data source**: <https://github.com/ibm-aur-nlp/PubLayNet>
|
||||
- **Data introduction**: The PubLayNet dataset contains 350000 training images and 11000 validation images. There are 5 categories in total, namely: `text, title, list, table, figure`. Some images and their annotations as shown below.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
- **Download address**: <https://developer.ibm.com/exchanges/data/all/publaynet/>
|
||||
- **Note**: When using this dataset, you need to follow [CDLA-Permissive](https://cdla.io/permissive-1-0/) license.
|
||||
|
||||
### 2、CDLA dataset
|
||||
|
||||
- **Data source**: <https://github.com/buptlihang/CDLA>
|
||||
- **Data introduction**: CDLA dataset contains 5000 training images and 1000 validation images with 10 categories, which are `Text, Title, Figure, Figure caption, Table, Table caption, Header, Footer, Reference, Equation`. Some images and their annotations as shown below.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
- **Download address**: <https://github.com/buptlihang/CDLA>
|
||||
- **Note**: When you train detection model on CDLA dataset using [PaddleDetection](https://github.com/PaddlePaddle/PaddleDetection/tree/develop), you need to remove the label `__ignore__` and `_background_`.
|
||||
|
||||
### 3、TableBank dataset
|
||||
|
||||
- **Data source**: <https://doc-analysis.github.io/tablebank-page/index.html>
|
||||
- **Data introduction**: TableBank dataset contains 2 types of document: Latex (187199 training images, 7265 validation images and 5719 testing images) and Word (73383 training images 2735 validation images and 2281 testing images). Some images and their annotations as shown below.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
- **Data source**: <https://doc-analysis.github.io/tablebank-page/index.html>
|
||||
- **Note**: When using this dataset, you need to follow [Apache-2.0](https://github.com/doc-analysis/TableBank/blob/master/LICENSE) license.
|
||||
49
docs/datasets/layout_datasets.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
## 版面分析数据集
|
||||
|
||||
这里整理了常用版面分析数据集,持续更新中,欢迎各位小伙伴贡献数据集~
|
||||
|
||||
版面分析数据集多为目标检测数据集,除了开源数据,用户还可使用合成工具自行合成,如[labelme](https://github.com/wkentaro/labelme)等。
|
||||
|
||||
### 1、publaynet数据集
|
||||
|
||||
- **数据来源**:<https://github.com/ibm-aur-nlp/PubLayNet>
|
||||
- **数据简介**:publaynet数据集的训练集合中包含35万张图像,验证集合中包含1.1万张图像。总共包含5个类别,分别是: `text, title, list, table, figure`。部分图像以及标注框可视化如下所示。
|
||||
|
||||
<div align="center">
|
||||
<img src="./images/publaynet_demo/gt_PMC3724501_00006.jpg" width="500">
|
||||
<img src="./images/publaynet_demo/gt_PMC5086060_00002.jpg" width="500">
|
||||
</div>
|
||||
|
||||
- **下载地址**:<https://developer.ibm.com/exchanges/data/all/publaynet/>
|
||||
- **说明**:使用该数据集时,需要遵守[CDLA-Permissive](https://cdla.io/permissive-1-0/)协议。
|
||||
|
||||
### 2、CDLA数据集
|
||||
|
||||
- **数据来源**:<https://github.com/buptlihang/CDLA>
|
||||
- **数据简介**:CDLA据集的训练集合中包含5000张图像,验证集合中包含1000张图像。总共包含10个类别,分别是: `Text, Title, Figure, Figure caption, Table, Table caption, Header, Footer, Reference, Equation`。部分图像以及标注框可视化如下所示。
|
||||
|
||||
<div align="center">
|
||||
<img src="./images/CDLA_demo/val_0633.jpg" width="500">
|
||||
<img src="./images/CDLA_demo/val_0941.jpg" width="500">
|
||||
</div>
|
||||
|
||||
- **下载地址**:<https://github.com/buptlihang/CDLA>
|
||||
- **说明**:基于[PaddleDetection](https://github.com/PaddlePaddle/PaddleDetection/tree/develop)套件,在该数据集上训练目标检测模型时,在转换label时,需要将`label.txt`中的`__ignore__`与`_background_`去除。
|
||||
|
||||
### 3、TableBank数据集
|
||||
|
||||
- **数据来源**:<https://doc-analysis.github.io/tablebank-page/index.html>
|
||||
- **数据简介**:TableBank数据集包含Latex(训练集187199张,验证集7265张,测试集5719张)与Word(训练集73383张,验证集2735张,测试集2281张)两种类别的文档。仅包含`Table` 1个类别。部分图像以及标注框可视化如下所示。
|
||||
|
||||
<div align="center">
|
||||
<img src="./images/tablebank_demo/004.png" height="700">
|
||||
<img src="./images/tablebank_demo/005.png" height="700">
|
||||
</div>
|
||||
|
||||
- **下载地址**:<https://doc-analysis.github.io/tablebank-page/index.html>
|
||||
- **说明**:使用该数据集时,需要遵守[Apache-2.0](https://github.com/doc-analysis/TableBank/blob/master/LICENSE)协议。
|
||||
154
docs/datasets/ocr_datasets.en.md
Normal file
@@ -0,0 +1,154 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
# OCR datasets
|
||||
|
||||
Here is a list of public datasets commonly used in OCR, which are being continuously updated. Welcome to contribute datasets!
|
||||
|
||||
## 1. Text detection
|
||||
|
||||
### 1.1 PaddleOCR text detection format annotation
|
||||
|
||||
The annotation file formats supported by the PaddleOCR text detection algorithm are as follows, separated by "\t":
|
||||
|
||||
```text linenums="1"
|
||||
"Image file name Image annotation information encoded by json.dumps"
|
||||
ch4_test_images/img_61.jpg [{"transcription": "MASA", "points": [[310, 104], [416, 141], [418, 216], [312, 179]]}, {...}]
|
||||
```
|
||||
|
||||
The image annotation after **json.dumps()** encoding is a list containing multiple dictionaries.
|
||||
|
||||
The `points` in the dictionary represent the coordinates (x, y) of the four points of the text box, arranged clockwise from the point at the upper left corner.
|
||||
|
||||
`transcription` represents the text of the current text box. **When its content is "###" it means that the text box is invalid and will be skipped during training.**
|
||||
|
||||
If you want to train PaddleOCR on other datasets, please build the annotation file according to the above format.
|
||||
|
||||
### 1.2 Public dataset
|
||||
|
||||
| dataset | Image download link | PaddleOCR format annotation download link |
|
||||
|---|---|---|
|
||||
| ICDAR 2015 | <https://rrc.cvc.uab.es/?ch=4&com=downloads> | [train](https://paddleocr.bj.bcebos.com/dataset/train_icdar2015_label.txt) / [test](https://paddleocr.bj.bcebos.com/dataset/test_icdar2015_label.txt) |
|
||||
| ctw1500 | <https://paddleocr.bj.bcebos.com/dataset/ctw1500.zip> | Included in the downloaded image zip |
|
||||
| total text | <https://paddleocr.bj.bcebos.com/dataset/total_text.tar> | Included in the downloaded image zip |
|
||||
|
||||
#### 1.2.1 ICDAR 2015
|
||||
|
||||
The icdar2015 dataset contains train set which has 1000 images obtained with wearable cameras and test set which has 500 images obtained with wearable cameras. The icdar2015 dataset can be downloaded from the link in the table above. Registration is required for downloading.
|
||||
|
||||
After registering and logging in, download the part marked in the red box in the figure below. And, the content downloaded by `Training Set Images` should be saved as the folder `icdar_c4_train_imgs`, and the content downloaded by `Test Set Images` is saved as the folder `ch4_test_images`
|
||||
|
||||

|
||||
|
||||
Decompress the downloaded dataset to the working directory, assuming it is decompressed under PaddleOCR/train_data/. Then download the PaddleOCR format annotation file from the table above.
|
||||
|
||||
PaddleOCR also provides a data format conversion script, which can convert the official website label to the PaddleOCR format. The data conversion tool is in `ppocr/utils/gen_label.py`, here is the training set as an example:
|
||||
|
||||
```bash linenums="1"
|
||||
# Convert the label file downloaded from the official website to train_icdar2015_label.txt
|
||||
python gen_label.py --mode="det" --root_path="/path/to/icdar_c4_train_imgs/" \
|
||||
--input_path="/path/to/ch4_training_localization_transcription_gt" \
|
||||
--output_label="/path/to/train_icdar2015_label.txt"
|
||||
```
|
||||
|
||||
After decompressing the data set and downloading the annotation file, PaddleOCR/train_data/ has two folders and two files, which are:
|
||||
|
||||
```text linenums="1"
|
||||
/PaddleOCR/train_data/icdar2015/text_localization/
|
||||
└─ icdar_c4_train_imgs/ Training data of icdar dataset
|
||||
└─ ch4_test_images/ Testing data of icdar dataset
|
||||
└─ train_icdar2015_label.txt Training annotation of icdar dataset
|
||||
└─ test_icdar2015_label.txt Test annotation of icdar dataset
|
||||
```
|
||||
|
||||
## 2. Text recognition
|
||||
|
||||
### 2.1 PaddleOCR text recognition format annotation
|
||||
|
||||
The text recognition algorithm in PaddleOCR supports two data formats:
|
||||
|
||||
- `lmdb` is used to train data sets stored in lmdb format, use [lmdb_dataset.py](../../../ppocr/data/lmdb_dataset.py) to load;
|
||||
- `common dataset` is used to train data sets stored in text files, use [simple_dataset.py](../../../ppocr/data/simple_dataset.py) to load.
|
||||
|
||||
If you want to use your own data for training, please refer to the following to organize your data.
|
||||
|
||||
#### Training set
|
||||
|
||||
It is recommended to put the training images in the same folder, and use a txt file (rec_gt_train.txt) to store the image path and label. The contents of the txt file are as follows:
|
||||
|
||||
- Note: by default, the image path and image label are split with \t, if you use other methods to split, it will cause training error
|
||||
|
||||
```text linenums="1"
|
||||
" Image file name Image annotation "
|
||||
|
||||
train_data/rec/train/word_001.jpg 简单可依赖
|
||||
train_data/rec/train/word_002.jpg 用科技让复杂的世界更简单
|
||||
...
|
||||
```
|
||||
|
||||
The final training set should have the following file structure:
|
||||
|
||||
```text linenums="1"
|
||||
|-train_data
|
||||
|-rec
|
||||
|- rec_gt_train.txt
|
||||
|- train
|
||||
|- word_001.png
|
||||
|- word_002.jpg
|
||||
|- word_003.jpg
|
||||
| ...
|
||||
```
|
||||
|
||||
#### Test set
|
||||
|
||||
Similar to the training set, the test set also needs to be provided a folder containing all images (test) and a rec_gt_test.txt. The structure of the test set is as follows:
|
||||
|
||||
```text linenums="1"
|
||||
|-train_data
|
||||
|-rec
|
||||
|-ic15_data
|
||||
|- rec_gt_test.txt
|
||||
|- test
|
||||
|- word_001.jpg
|
||||
|- word_002.jpg
|
||||
|- word_003.jpg
|
||||
| ...
|
||||
```
|
||||
|
||||
### 2.2 Public dataset
|
||||
|
||||
| dataset | Image download link | PaddleOCR format annotation download link |
|
||||
|---|---|---|
|
||||
| en benchmark(MJ, SJ, IIIT, SVT, IC03, IC13, IC15, SVTP, and CUTE.) | [DTRB](https://github.com/clovaai/deep-text-recognition-benchmark#download-lmdb-dataset-for-traininig-and-evaluation-from-here) | LMDB format, which can be loaded directly with [lmdb_dataset.py](../../../ppocr/data/lmdb_dataset.py) |
|
||||
|ICDAR 2015| <http://rrc.cvc.uab.es/?ch=4&com=downloads> | [train](https://paddleocr.bj.bcebos.com/dataset/rec_gt_train.txt)/ [test](https://paddleocr.bj.bcebos.com/dataset/rec_gt_test.txt) |
|
||||
| Multilingual datasets |[Baidu network disk](https://pan.baidu.com/s/1bS_u207Rm7YbY33wOECKDA) Extraction code: frgi <br> [google drive](https://drive.google.com/file/d/18cSWX7wXSy4G0tbKJ0d9PuIaiwRLHpjA/view) | Included in the downloaded image zip |
|
||||
|
||||
#### 2.1 ICDAR 2015
|
||||
|
||||
The ICDAR 2015 dataset can be downloaded from the link in the table above for quick validation. The lmdb format dataset required by en benchmark can also be downloaded from the table above.
|
||||
|
||||
Then download the PaddleOCR format annotation file from the table above.
|
||||
|
||||
PaddleOCR also provides a data format conversion script, which can convert the ICDAR official website label to the data format supported by PaddleOCR. The data conversion tool is in `ppocr/utils/gen_label.py`, here is the training set as an example:
|
||||
|
||||
```bash linenums="1"
|
||||
# Convert the label file downloaded from the official website to rec_gt_label.txt
|
||||
python gen_label.py --mode="rec" --input_path="{path/of/origin/label}" --output_label="rec_gt_label.txt"
|
||||
```
|
||||
|
||||
The data format is as follows, (a) is the original picture, (b) is the Ground Truth text file corresponding to each picture:
|
||||
|
||||

|
||||
|
||||
## 3. Data storage path
|
||||
|
||||
The default storage path for PaddleOCR training data is `PaddleOCR/train_data`, if you already have a dataset on your disk, just create a soft link to the dataset directory:
|
||||
|
||||
```bash linenums="1"
|
||||
# linux and mac os
|
||||
ln -sf <path/to/dataset> <path/to/paddle_ocr>/train_data/dataset
|
||||
# windows
|
||||
mklink /d <path/to/paddle_ocr>/train_data/dataset <path/to/dataset>
|
||||
```
|
||||
160
docs/datasets/ocr_datasets.md
Normal file
@@ -0,0 +1,160 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
# OCR数据集
|
||||
|
||||
这里整理了OCR中常用的公开数据集,持续更新中,欢迎各位小伙伴贡献数据集~
|
||||
|
||||
## 1. 文本检测
|
||||
|
||||
### 1.1 PaddleOCR 文字检测数据格式
|
||||
|
||||
PaddleOCR 中的文本检测算法支持的标注文件格式如下,中间用"\t"分隔:
|
||||
|
||||
```text linenums="1"
|
||||
" 图像文件名 json.dumps编码的图像标注信息"
|
||||
ch4_test_images/img_61.jpg [{"transcription": "MASA", "points": [[310, 104], [416, 141], [418, 216], [312, 179]]}, {...}]
|
||||
```
|
||||
|
||||
json.dumps编码前的图像标注信息是包含多个字典的list,字典中的 `points` 表示文本框的四个点的坐标(x, y),从左上角的点开始顺时针排列。
|
||||
`transcription` 表示当前文本框的文字,**当其内容为“###”时,表示该文本框无效,在训练时会跳过。**
|
||||
|
||||
如果您想在我们未提供的数据集上训练,可以按照上述形式构建标注文件。
|
||||
|
||||
### 1.2 公开数据集
|
||||
|
||||
| 数据集名称 |图片下载地址| PaddleOCR 标注下载地址 |
|
||||
|---|---|---|
|
||||
| ICDAR 2015 |<https://rrc.cvc.uab.es/?ch=4&com=downloads>| [train](https://paddleocr.bj.bcebos.com/dataset/train_icdar2015_label.txt) / [test](https://paddleocr.bj.bcebos.com/dataset/test_icdar2015_label.txt) |
|
||||
| ctw1500 |<https://paddleocr.bj.bcebos.com/dataset/ctw1500.zip>| 图片下载地址中已包含 |
|
||||
| total text |<https://paddleocr.bj.bcebos.com/dataset/total_text.tar>| 图片下载地址中已包含 |
|
||||
| td tr |<https://paddleocr.bj.bcebos.com/dataset/TD_TR.tar>| 图片下载地址中已包含 |
|
||||
|
||||
#### 1.2.1 ICDAR 2015
|
||||
|
||||
ICDAR 2015 数据集包含1000张训练图像和500张测试图像。ICDAR 2015 数据集可以从上表中链接下载,首次下载需注册。
|
||||
注册完成登陆后,下载下图中红色框标出的部分,其中, `Training Set Images`下载的内容保存在`icdar_c4_train_imgs`文件夹下,`Test Set Images` 下载的内容保存早`ch4_test_images`文件夹下
|
||||
|
||||
<img src="./images/ic15_location_download.png" align="middle" width = "700"/>
|
||||
|
||||
将下载到的数据集解压到工作目录下,假设解压在 PaddleOCR/train_data/下。然后从上表中下载转换好的标注文件。
|
||||
|
||||
PaddleOCR 也提供了数据格式转换脚本,可以将官网 label 转换支持的数据格式。 数据转换工具在 `ppocr/utils/gen_label.py`, 这里以训练集为例:
|
||||
|
||||
```bash linenums="1"
|
||||
# 将官网下载的标签文件转换为 train_icdar2015_label.txt
|
||||
python gen_label.py --mode="det" --root_path="/path/to/icdar_c4_train_imgs/" \
|
||||
--input_path="/path/to/ch4_training_localization_transcription_gt" \
|
||||
--output_label="/path/to/train_icdar2015_label.txt"
|
||||
```
|
||||
|
||||
解压数据集和下载标注文件后,PaddleOCR/train_data/ 有两个文件夹和两个文件,按照如下方式组织icdar2015数据集:
|
||||
|
||||
```text linenums="1"
|
||||
/PaddleOCR/train_data/icdar2015/text_localization/
|
||||
└─ icdar_c4_train_imgs/ icdar 2015 数据集的训练数据
|
||||
└─ ch4_test_images/ icdar 2015 数据集的测试数据
|
||||
└─ train_icdar2015_label.txt icdar 2015 数据集的训练标注
|
||||
└─ test_icdar2015_label.txt icdar 2015 数据集的测试标注
|
||||
```
|
||||
|
||||
## 2. 文本识别
|
||||
|
||||
### 2.1 PaddleOCR 文字识别数据格式
|
||||
|
||||
PaddleOCR 中的文字识别算法支持两种数据格式:
|
||||
|
||||
- `lmdb` 用于训练以lmdb格式存储的数据集,使用 [lmdb_dataset.py](../../../ppocr/data/lmdb_dataset.py) 进行读取;
|
||||
- `通用数据` 用于训练以文本文件存储的数据集,使用 [simple_dataset.py](../../../ppocr/data/simple_dataset.py)进行读取。
|
||||
|
||||
下面以通用数据集为例, 介绍如何准备数据集:
|
||||
|
||||
#### 训练集
|
||||
|
||||
建议将训练图片放入同一个文件夹,并用一个txt文件(rec_gt_train.txt)记录图片路径和标签,txt文件里的内容如下:
|
||||
|
||||
**注意:** txt文件中默认请将图片路径和图片标签用 \t 分割,如用其他方式分割将造成训练报错。
|
||||
|
||||
```text linenums="1"
|
||||
" 图像文件名 图像标注信息 "
|
||||
|
||||
train_data/rec/train/word_001.jpg 简单可依赖
|
||||
train_data/rec/train/word_002.jpg 用科技让复杂的世界更简单
|
||||
...
|
||||
```
|
||||
|
||||
最终训练集应有如下文件结构:
|
||||
|
||||
```text linenums="1"
|
||||
|-train_data
|
||||
|-rec
|
||||
|- rec_gt_train.txt
|
||||
|- train
|
||||
|- word_001.png
|
||||
|- word_002.jpg
|
||||
|- word_003.jpg
|
||||
| ...
|
||||
```
|
||||
|
||||
除上述单张图像为一行格式之外,PaddleOCR也支持对离线增广后的数据进行训练,为了防止相同样本在同一个batch中被多次采样,我们可以将相同标签对应的图片路径写在一行中,以列表的形式给出,在训练中,PaddleOCR会随机选择列表中的一张图片进行训练。对应地,标注文件的格式如下:
|
||||
|
||||
```text linenums="1"
|
||||
["11.jpg", "12.jpg"] 简单可依赖
|
||||
["21.jpg", "22.jpg", "23.jpg"] 用科技让复杂的世界更简单
|
||||
3.jpg ocr
|
||||
```
|
||||
|
||||
上述示例标注文件中,"11.jpg"和"12.jpg"的标签相同,都是`简单可依赖`,在训练的时候,对于该行标注,会随机选择其中的一张图片进行训练。
|
||||
|
||||
#### 验证集
|
||||
|
||||
同训练集类似,验证集也需要提供一个包含所有图片的文件夹(test)和一个rec_gt_test.txt,验证集的结构如下所示:
|
||||
|
||||
```text linenums="1"
|
||||
|-train_data
|
||||
|-rec
|
||||
|- rec_gt_test.txt
|
||||
|- test
|
||||
|- word_001.jpg
|
||||
|- word_002.jpg
|
||||
|- word_003.jpg
|
||||
| ...
|
||||
```
|
||||
|
||||
### 2.2 公开数据集
|
||||
|
||||
| 数据集名称 | 图片下载地址 | PaddleOCR 标注下载地址 |
|
||||
|---|---|---------------------------------------------------------------------|
|
||||
| en benchmark(MJ, SJ, IIIT, SVT, IC03, IC13, IC15, SVTP, and CUTE.) | [DTRB](https://github.com/clovaai/deep-text-recognition-benchmark#download-lmdb-dataset-for-traininig-and-evaluation-from-here) | LMDB格式,可直接用[lmdb_dataset.py](../../../ppocr/data/lmdb_dataset.py)加载 |
|
||||
|ICDAR 2015| <http://rrc.cvc.uab.es/?ch=4&com=downloads> | [train](https://paddleocr.bj.bcebos.com/dataset/rec_gt_train.txt)/ [test](https://paddleocr.bj.bcebos.com/dataset/rec_gt_test.txt) |
|
||||
| 多语言数据集 |[百度网盘](https://pan.baidu.com/s/1bS_u207Rm7YbY33wOECKDA) 提取码:frgi <br> [google drive](https://drive.google.com/file/d/18cSWX7wXSy4G0tbKJ0d9PuIaiwRLHpjA/view) | 图片下载地址中已包含 |
|
||||
|
||||
#### 2.1 ICDAR 2015
|
||||
|
||||
ICDAR 2015 数据集可以在上表中链接下载,用于快速验证。也可以从上表中下载 en benchmark 所需的lmdb格式数据集。
|
||||
|
||||
下载完图片后从上表中下载转换好的标注文件。
|
||||
|
||||
PaddleOCR 也提供了数据格式转换脚本,可以将ICDAR官网 label 转换为PaddleOCR支持的数据格式。 数据转换工具在 `ppocr/utils/gen_label.py`, 这里以训练集为例:
|
||||
|
||||
```bash linenums="1"
|
||||
# 将官网下载的标签文件转换为 rec_gt_label.txt
|
||||
python gen_label.py --mode="rec" --input_path="{path/of/origin/label}" --output_label="rec_gt_label.txt"
|
||||
```
|
||||
|
||||
数据样式格式如下,(a)为原始图片,(b)为每张图片对应的 Ground Truth 文本文件:
|
||||
|
||||

|
||||
|
||||
## 3. 数据存放路径
|
||||
|
||||
PaddleOCR训练数据的默认存储路径是 `PaddleOCR/train_data`,如果您的磁盘上已有数据集,只需创建软链接至数据集目录:
|
||||
|
||||
```bash linenums="1"
|
||||
# linux and mac os
|
||||
ln -sf <path/to/dataset> <path/to/paddle_ocr>/train_data/dataset
|
||||
# windows
|
||||
mklink /d <path/to/paddle_ocr>/train_data/dataset <path/to/dataset>
|
||||
```
|
||||
40
docs/datasets/table_datasets.en.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
# Table Recognition Datasets
|
||||
|
||||
Here are the commonly used table recognition datasets, which are being updated continuously. Welcome to contribute datasets~
|
||||
|
||||
## Dataset Summary
|
||||
|
||||
| dataset | Image download link | PPOCR format annotation download link |
|
||||
|---|---|---|
|
||||
| PubTabNet |<https://github.com/ibm-aur-nlp/PubTabNet>| jsonl format, which can be loaded directly with [pubtab_dataset.py](https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/data/pubtab_dataset.py) |
|
||||
| TAL Table Recognition Competition Dataset |<https://ai.100tal.com/dataset>| jsonl format, which can be loaded directly with [pubtab_dataset.py](https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/data/pubtab_dataset.py) |
|
||||
| WTW Chinese scene table dataset |<https://github.com/wangwen-whu/WTW-Dataset>| Conversion is required to load with [pubtab_dataset.py](https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/data/pubtab_dataset.py)|
|
||||
|
||||
## 1. PubTabNet
|
||||
|
||||
- **Data Introduction**:The training set of the PubTabNet dataset contains 500,000 images and the validation set contains 9000 images. Part of the image visualization is shown below.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
- **illustrate**:When using this dataset, the [CDLA-Permissive](https://cdla.io/permissive-1-0/) protocol is required.
|
||||
|
||||
## 2. TAL Table Recognition Competition Dataset
|
||||
|
||||
- **Data Introduction**:The training set of the TAL table recognition competition dataset contains 16,000 images. The validation set does not give trainable annotations.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## 3. WTW Chinese scene table dataset
|
||||
|
||||
- **Data Introduction**:The WTW Chinese scene table dataset consists of two parts: table detection and table data. The dataset contains images of two scenes, scanned and photographed.
|
||||
|
||||

|
||||
43
docs/datasets/table_datasets.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
comments: true
|
||||
typora-copy-images-to: images
|
||||
---
|
||||
|
||||
|
||||
# 表格识别数据集
|
||||
|
||||
这里整理了常用表格识别数据集,持续更新中,欢迎各位小伙伴贡献数据集~
|
||||
|
||||
## 数据集汇总
|
||||
|
||||
| 数据集名称 |图片下载地址| PPOCR标注下载地址 |
|
||||
|---|---|---|
|
||||
| PubTabNet |<https://github.com/ibm-aur-nlp/PubTabNet>| jsonl格式,可直接用[pubtab_dataset.py](https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/data/pubtab_dataset.py)加载 |
|
||||
| 好未来表格识别竞赛数据集 |<https://ai.100tal.com/dataset>| jsonl格式,可直接用[pubtab_dataset.py](https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/data/pubtab_dataset.py)加载 |
|
||||
| WTW中文场景表格数据集 |<https://github.com/wangwen-whu/WTW-Dataset>| 需要进行转换后才能用[pubtab_dataset.py](https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/data/pubtab_dataset.py)加载 |
|
||||
|
||||
## 1. PubTabNet数据集
|
||||
|
||||
- **数据简介**:PubTabNet数据集的训练集合中包含50万张图像,验证集合中包含0.9万张图像。部分图像可视化如下所示。
|
||||
|
||||
<div align="center">
|
||||
<img src="./images/table_PubTabNet_demo/PMC524509_007_00.png" width="500">
|
||||
<img src="./images/table_PubTabNet_demo/PMC535543_007_01.png" width="500">
|
||||
</div>
|
||||
|
||||
- **说明**:使用该数据集时,需要遵守[CDLA-Permissive](https://cdla.io/permissive-1-0/)协议。
|
||||
|
||||
## 2. 好未来表格识别竞赛数据集
|
||||
|
||||
- **数据简介**:好未来表格识别竞赛数据集的训练集合中包含1.6万张图像。验证集未给出可训练的标注。
|
||||
|
||||
<div align="center">
|
||||
<img src="./images/table_tal_demo/1.jpg" width="500">
|
||||
<img src="./images/table_tal_demo/2.jpg" width="500">
|
||||
</div>
|
||||
|
||||
## 3. WTW中文场景表格数据集
|
||||
|
||||
- **数据简介**:WTW中文场景表格数据集包含表格检测和表格数据两部分数据,数据集中同时包含扫描和拍照两张场景的图像。
|
||||
|
||||

|
||||
72
docs/datasets/vertical_and_multilingual_datasets.en.md
Normal file
@@ -0,0 +1,72 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
# Vertical multi-language OCR dataset
|
||||
|
||||
Here we have sorted out the commonly used vertical multi-language OCR dataset datasets, which are being updated continuously. We welcome you to contribute datasets ~
|
||||
|
||||
- [Chinese urban license plate dataset](#Chinese urban license plate dataset)
|
||||
- [Bank credit card dataset](#Bank credit card dataset)
|
||||
- [Captcha dataset-Captcha](#Captcha dataset-Captcha)
|
||||
- [multi-language dataset](#multi-language dataset)
|
||||
|
||||
## Chinese urban license plate dataset
|
||||
|
||||
- **Data source**:[CCPD](https://github.com/detectRecog/CCPD)
|
||||
|
||||
- **Data introduction**: It contains more than 250000 vehicle license plate images and vehicle license plate detection and recognition information labeling. It contains the following license plate image information in different scenes.
|
||||
|
||||
- CCPD-Base: General license plate picture
|
||||
- CCPD-DB: The brightness of license plate area is bright, dark or uneven
|
||||
- CCPD-FN: The license plate is farther or closer to the camera location
|
||||
- CCPD-Rotate: License plate includes rotation (horizontal 20\~50 degrees, vertical-10\~10 degrees)
|
||||
- CCPD-Tilt: License plate includes rotation (horizontal 15\~45 degrees, vertical 15\~45 degrees)
|
||||
- CCPD-Blur: The license plate contains blurring due to camera lens jitter
|
||||
- CCPD-Weather: The license plate is photographed on rainy, snowy or foggy days
|
||||
- CCPD-Challenge: So far, some of the most challenging images in license plate detection and recognition tasks
|
||||
- CCPD-NP: Pictures of new cars without license plates.
|
||||
|
||||

|
||||
|
||||
- **Download address**
|
||||
- Baidu cloud download address (extracted code is hm0U): [https://pan.baidu.com/s/1i5AOjAbtkwb17Zy-NQGqkw](https://pan.baidu.com/s/1i5AOjAbtkwb17Zy-NQGqkw)
|
||||
- Google drive download address:[https://drive.google.com/file/d/1rdEsCUcIUaYOVRkx5IMTRNA7PcGMmSgc/view](https://drive.google.com/file/d/1rdEsCUcIUaYOVRkx5IMTRNA7PcGMmSgc/view)
|
||||
|
||||
## Bank credit card dataset
|
||||
|
||||
- **Data source**: [source](https://www.kesci.com/home/dataset/5954cf1372ead054a5e25870)
|
||||
|
||||
- **Data introduction**: There are three types of training data
|
||||
- 1.Sample card data of China Merchants Bank: including card image data and annotation data, a total of 618 pictures
|
||||
- 2.Single character data: including pictures and annotation data, 37 pictures in total.
|
||||
- 3.There are only other bank cards, no more detailed information, a total of 50 pictures.
|
||||
|
||||
- The demo image is shown as follows. The annotation information is stored in excel, and the demo image below is marked as
|
||||
- Top 8 card number: 62257583
|
||||
- Card type: card of our bank
|
||||
- End of validity: 07/41
|
||||
- Chinese phonetic alphabet of card users: MICHAEL
|
||||
|
||||

|
||||
|
||||
- **Download address**: [cmb2017-2.zip](https://cdn.kesci.com/cmb2017-2.zip)
|
||||
|
||||
## Captcha dataset-Captcha
|
||||
|
||||
- **Data source**: [captcha](https://github.com/lepture/captcha)
|
||||
- **Data introduction**: This is a toolkit for data synthesis. You can output captcha images according to the input text. Use the toolkit to generate several demo images as follows.
|
||||
|
||||

|
||||
|
||||
- **Download address**: The dataset is generated and has no download address.
|
||||
|
||||
## multi-language dataset(Multi-lingual scene text detection and recognition)
|
||||
|
||||
- **Data source**: [source](https://rrc.cvc.uab.es/?ch=15&com=downloads)
|
||||
- **Data introduction**: Multi language detection dataset MLT contains both language recognition and detection tasks.
|
||||
- In the detection task, the training set contains 10000 images in 10 languages, and each language contains 1000 training images. The test set contains 10000 images.
|
||||
- In the recognition task, the training set contains 111998 samples.
|
||||
- **Download address**: The training set is large and can be downloaded in two parts. It can only be downloaded after registering on the website:
|
||||
[source](https://rrc.cvc.uab.es/?ch=15&com=downloads)
|
||||
65
docs/datasets/vertical_and_multilingual_datasets.md
Normal file
@@ -0,0 +1,65 @@
|
||||
---
|
||||
comments: true
|
||||
---
|
||||
|
||||
|
||||
# 垂类多语言OCR数据集
|
||||
|
||||
这里整理了常用垂类和多语言OCR数据集,持续更新中,欢迎各位小伙伴贡献数据集~
|
||||
|
||||
## 中国城市车牌数据集
|
||||
|
||||
- **数据来源**:[CCPD](https://github.com/detectRecog/CCPD)
|
||||
- **数据简介**: 包含超过25万张中国城市车牌图片及车牌检测、识别信息的标注。包含以下几种不同场景中的车牌图片信息。
|
||||
- CCPD-Base: 通用车牌图片
|
||||
- CCPD-DB: 车牌区域亮度较亮、较暗或者不均匀
|
||||
- CCPD-FN: 车牌离摄像头拍摄位置相对更远或者更近
|
||||
- CCPD-Rotate: 车牌包含旋转(水平20\~50度,竖直-10\~10度)
|
||||
- CCPD-Tilt: 车牌包含旋转(水平15\~45度,竖直15\~45度)
|
||||
- CCPD-Blur: 车牌包含由于摄像机镜头抖动导致的模糊情况
|
||||
- CCPD-Weather: 车牌在雨天、雪天或者雾天拍摄得到
|
||||
- CCPD-Challenge: 至今在车牌检测识别任务中最有挑战性的一些图片
|
||||
- CCPD-NP: 没有安装车牌的新车图片。
|
||||
|
||||

|
||||
|
||||
- **下载地址**
|
||||
- 百度云下载地址(提取码是hm0U): [link](https://pan.baidu.com/s/1i5AOjAbtkwb17Zy-NQGqkw)
|
||||
- Google drive下载地址:[link](https://drive.google.com/file/d/1rdEsCUcIUaYOVRkx5IMTRNA7PcGMmSgc/view)
|
||||
|
||||
## 银行信用卡数据集
|
||||
|
||||
- **数据来源**: [source](https://www.kesci.com/home/dataset/5954cf1372ead054a5e25870)
|
||||
|
||||
- **数据简介**: 训练数据共提供了三类数据
|
||||
- 1.招行样卡数据: 包括卡面图片数据及标注数据,总共618张图片
|
||||
- 2.单字符数据: 包括图片及标注数据,总共37张图片。
|
||||
- 3.仅包含其他银行卡面,不具有更细致的信息,总共50张图片。
|
||||
|
||||
- demo图片展示如下,标注信息存储在excel表格中,下面的demo图片标注为
|
||||
- 前8位卡号:62257583
|
||||
- 卡片种类:本行卡
|
||||
- 有效期结束:07/41
|
||||
- 卡用户拼音:MICHAEL
|
||||
|
||||

|
||||
|
||||
- **下载地址**: [cmb2017-2.zip](https://cdn.kesci.com/cmb2017-2.zip)
|
||||
|
||||
## 验证码数据集-Captcha
|
||||
|
||||
- **数据来源**: [captcha](https://github.com/lepture/captcha)
|
||||
- **数据简介**: 这是一个数据合成的工具包,可以根据输入的文本,输出验证码图片,使用该工具包生成几张demo图片如下:
|
||||
|
||||

|
||||
|
||||
- **下载地址**: 该数据集是生成得到,无下载地址。
|
||||
|
||||
## 多语言数据集(Multi-lingual scene text detection and recognition)
|
||||
|
||||
- **数据来源**: [source](https://rrc.cvc.uab.es/?ch=15&com=downloads)
|
||||
- **数据简介**: 多语言检测数据集MLT同时包含了语种识别和检测任务。
|
||||
- 在检测任务中,训练集包含10000张图片,共有10种语言,每种语言包含1000张训练图片。测试集包含10000张图片。
|
||||
- 在识别任务中,训练集包含111998个样本。
|
||||
- **下载地址**: 训练集较大,分2部分下载,需要在网站上注册之后才能下载:
|
||||
[link](https://rrc.cvc.uab.es/?ch=15&com=downloads)
|
||||
BIN
docs/images/00006737.jpg
Normal file
|
After Width: | Height: | Size: 212 KiB |
|
After Width: | Height: | Size: 234 KiB |
|
After Width: | Height: | Size: 143 KiB |
|
After Width: | Height: | Size: 910 KiB |
|
After Width: | Height: | Size: 247 KiB |
|
After Width: | Height: | Size: 189 KiB |
|
After Width: | Height: | Size: 344 KiB |
BIN
docs/images/Arch.png
Normal file
|
After Width: | Height: | Size: 212 KiB |
BIN
docs/images/Arch_cn.png
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
BIN
docs/images/Banner.png
Normal file
|
After Width: | Height: | Size: 448 KiB |
BIN
docs/images/Banner_cn.png
Normal file
|
After Width: | Height: | Size: 442 KiB |
BIN
docs/images/Banner_ja.png
Normal file
|
After Width: | Height: | Size: 521 KiB |
BIN
docs/images/PP-OCRv3-pic001.jpg
Normal file
|
After Width: | Height: | Size: 97 KiB |
BIN
docs/images/PP-OCRv3-pic002.jpg
Normal file
|
After Width: | Height: | Size: 139 KiB |
BIN
docs/images/PP-OCRv3-pic003.jpg
Normal file
|
After Width: | Height: | Size: 89 KiB |
BIN
docs/images/blue_v3.gif
Normal file
|
After Width: | Height: | Size: 2.9 MiB |
BIN
docs/images/demo.gif
Normal file
|
After Width: | Height: | Size: 3.0 MiB |
BIN
docs/images/en_1.png
Normal file
|
After Width: | Height: | Size: 636 KiB |
BIN
docs/images/en_2.png
Normal file
|
After Width: | Height: | Size: 626 KiB |
BIN
docs/images/en_3-0398013.png
Normal file
|
After Width: | Height: | Size: 498 KiB |
BIN
docs/images/en_3.png
Normal file
|
After Width: | Height: | Size: 498 KiB |
BIN
docs/images/japan_2.jpg
Normal file
|
After Width: | Height: | Size: 478 KiB |
BIN
docs/images/korean_1.jpg
Normal file
|
After Width: | Height: | Size: 158 KiB |
BIN
docs/images/ppocrv4.png
Normal file
|
After Width: | Height: | Size: 1.5 MiB |
BIN
docs/images/ppocrv4_en.jpg
Normal file
|
After Width: | Height: | Size: 409 KiB |
BIN
docs/images/ppstructure-20240708082235651.gif
Normal file
|
After Width: | Height: | Size: 2.5 MiB |
BIN
docs/images/test_add_91.jpg
Normal file
|
After Width: | Height: | Size: 78 KiB |
43
docs/index.en.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
comments: true
|
||||
hide:
|
||||
- navigation
|
||||
- toc
|
||||
---
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
Since its initial release, PaddleOCR has gained widespread acclaim across academia, industry, and research communities, thanks to its cutting-edge algorithms and proven performance in real-world applications. It’s already powering popular open-source projects like Umi-OCR, OmniParser, MinerU, and RAGFlow, making it the go-to OCR toolkit for developers worldwide.
|
||||
|
||||
On May 20, 2025, the PaddlePaddle team unveiled PaddleOCR 3.0, fully compatible with the official release of the [PaddlePaddle 3.0](https://github.com/PaddlePaddle/Paddle) framework. This update further **boosts text-recognition accuracy**, adds support for **multiple text-type recognition** and **handwriting recognition**, and meets the growing demand from large-model applications for **high-precision parsing of complex documents**. When combined with the **ERNIE 4.5 Turbo**, it significantly enhances key-information extraction accuracy. PaddleOCR 3.0 also introduces support for domestic hardware platforms such as **KUNLUNXIN** and **Ascend**.
|
||||
|
||||
|
||||
Three Major New Features in PaddleOCR 3.0:
|
||||
|
||||
- 🖼️ Universal-Scene Text Recognition Model [PP-OCRv5](version3.x/algorithm/PP-OCRv5/PP-OCRv5.en.md): A single model that handles five different text types plus complex handwriting. Overall recognition accuracy has increased by 13 percentage points over the previous generation.[Online Demo](https://aistudio.baidu.com/community/app/91660/webUI)
|
||||
|
||||
- 🧮 General Document-Parsing Solution [PP-StructureV3](./version3.x/algorithm/PP-StructureV3/PP-StructureV3.en.md): Delivers high-precision parsing of multi-layout, multi-scene PDFs, outperforming many open- and closed-source solutions on public benchmarks. [Online Demo](https://aistudio.baidu.com/community/app/518494/webUI)
|
||||
|
||||
- 📈 Intelligent Document-Understanding Solution [PP-ChatOCRv4](./version3.x/algorithm/PP-ChatOCRv4/PP-ChatOCRv4.en.md): Natively powered by the ERNIE 4.5 Turbo, achieving 15 percentage points higher accuracy than its predecessor.[Online Demo](https://aistudio.baidu.com/community/app/518493/webUI)
|
||||
|
||||
In addition to providing an outstanding model library, PaddleOCR 3.0 also offers user-friendly tools covering model training, inference, and service deployment, so developers can rapidly bring AI applications to production.
|
||||
|
||||

|
||||
|
||||
You can [Quick Start](./quick_start.en.md) directly, find comprehensive documentation in the [PaddleOCR Docs](https://paddlepaddle.github.io/PaddleOCR/main/index.html), get support via [Github Issus](https://github.com/PaddlePaddle/PaddleOCR/issues), and explore our OCR courses on [OCR courses on AIStudio](https://aistudio.baidu.com/course/introduce/25207).
|
||||
|
||||
## 🔄 Quick Overview of Execution Results
|
||||
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
## 👩👩👧👦 Community
|
||||
* 👫 Join the [PaddlePaddle Community](https://github.com/PaddlePaddle/community), where you can engage with [paddlepaddle developers](https://www.paddlepaddle.org.cn/developercommunity), researchers, and enthusiasts from around the world.
|
||||
* 🎓 Learn from experts through workshops, tutorials, and Q&A sessions [hosted by the AI Studio](https://aistudio.baidu.com/learn/center).
|
||||
* 🏆 Participate in [hackathons, challenges, and competitions](https://aistudio.baidu.com/competition) to showcase your skills and win exciting prizes.
|
||||
* 📣 Stay updated with the latest news, announcements, and events by following our [Twitter](https://x.com/PaddlePaddle) and [WeChat](https://mp.weixin.qq.com/s/vYj1ZDcAfJ1lu_DzlOKgtQ)).
|
||||
60
docs/index.md
Normal file
@@ -0,0 +1,60 @@
|
||||
---
|
||||
comments: true
|
||||
hide:
|
||||
- navigation
|
||||
- toc
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<p>
|
||||
<a href="https://paddlepaddle.github.io/PaddleOCR/latest/index.html" target="_blank">
|
||||
<img width="100%" src="./images/Banner_cn.png" alt="PaddleOCR Banner"></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
PaddleOCR自发布以来凭借学术前沿算法和产业落地实践,受到了产学研各方的喜爱,并被广泛应用于众多知名开源项目,例如:Umi-OCR、OmniParser、MinerU、RAGFlow等,已成为广大开发者心中的开源OCR领域的首选工具。2025年5月20日,飞桨团队发布**PaddleOCR 3.0**,全面适配[飞桨框架3.0](https://github.com/PaddlePaddle/Paddle)正式版,进一步**提升文字识别精度**,支持**多文字类型识别**和**手写体识别**,满足大模型应用对**复杂文档高精度解析**的旺盛需求,结合**文心大模型4.5 Turbo**显著提升关键信息抽取精度,并新增**对昆仑芯、昇腾等国产硬件**的支持。
|
||||
|
||||
|
||||
PaddleOCR 3.0**新增**三大特色能力:
|
||||
|
||||
- 🖼️全场景文字识别模型[PP-OCRv5](./version3.x/algorithm/PP-OCRv5/PP-OCRv5.md):单模型支持五种文字类型和复杂手写体识别;整体识别精度相比上一代**提升13个百分点**。[在线体验](https://aistudio.baidu.com/community/app/91660/webUI)
|
||||
|
||||
- 🧮通用文档解析方案[PP-StructureV3](./version3.x/algorithm/PP-StructureV3/PP-StructureV3.md):支持多场景、多版式 PDF 高精度解析,在公开评测集中**领先众多开源和闭源方案**。[在线体验](https://aistudio.baidu.com/community/app/518494/webUI)
|
||||
|
||||
- 📈智能文档理解方案[PP-ChatOCRv4](./version3.x/algorithm/PP-ChatOCRv4/PP-ChatOCRv4.md):原生支持文心大模型4.5 Turbo,精度相比上一代**提升15个百分点**。[在线体验](https://aistudio.baidu.com/community/app/518493/webUI)
|
||||
|
||||
|
||||
PaddleOCR 3.0除了提供优秀的模型库外,还提供好学易用的工具,覆盖模型训练、推理和服务化部署,方便开发者快速落地AI应用。
|
||||
<div align="center">
|
||||
<p>
|
||||
<a href="https://paddlepaddle.github.io/PaddleOCR/latest/index.html" target="_blank">
|
||||
<img width="100%" src="./images/Arch_cn.png" alt="PaddleOCR Architecture"></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
您可直接[快速开始](./quick_start.md),或查阅完整的 [PaddleOCR 文档](https://paddlepaddle.github.io/PaddleOCR/main/index.html),或通过 [Github Issues](https://github.com/PaddlePaddle/PaddleOCR/issues) 获取支持,或在 [AIStudio 课程平台](https://aistudio.baidu.com/course/introduce/25207) 探索我们的 OCR 课程。
|
||||
|
||||
|
||||
## 🔄 快速一览运行效果
|
||||
|
||||
<div align="center">
|
||||
<p>
|
||||
<a href="https://paddlepaddle.github.io/PaddleOCR/latest/index.html" target="_blank">
|
||||
<img width="100%" src="./images/demo.gif" alt="PP-OCRv5 Demo"></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
<p>
|
||||
<a href="https://paddlepaddle.github.io/PaddleOCR/latest/index.html" target="_blank">
|
||||
<img width="100%" src="./images/blue_v3.gif" alt="PP-StructureV3 Demo"></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
## 👩👩👧👦 开发者社区
|
||||
* 👫 加入 [PaddlePaddle 开发者社区](https://github.com/PaddlePaddle/community),与全球开发者、研究人员互动交流
|
||||
* 🎓 通过 AI Studio 的 [技术研讨会](https://aistudio.baidu.com/learn/center) 学习前沿技术
|
||||
* 🏆 参与 [黑客马拉松](https://aistudio.baidu.com/competition) 展示才能,赢取奖励
|
||||
* 📣 关注 [微信公众号](https://mp.weixin.qq.com/s/vYj1ZDcAfJ1lu_DzlOKgtQ) 获取最新动态
|
||||