Compare commits

..

122 Commits

Author SHA1 Message Date
xiaoting a09604f897
Merge pull request #2357 from caopulan/fix_srn_post
5 years ago
caopu 39a34ac80f fix srn_postprocess
5 years ago
Double_V cfdefbe1ba
Merge pull request #2334 from tink2123/fix_doc
5 years ago
Double_V 0ee4358329
Merge branch 'release/2.0' into fix_doc
5 years ago
tink2123 5ea613dc4f use pretrained_model for eval
5 years ago
MissPenguin d3a4f78864
Merge pull request #2283 from caopulan/modify
5 years ago
zhoujun 0067516142
Merge pull request #2306 from Intsigstephon/release/2.0
5 years ago
Bin Lu b99f352df5
Update FAQ.md
5 years ago
zhoujun 4b1428d838
Merge branch 'release/2.0' into modify
5 years ago
Bin Lu b602397134
Update README_ch.md
5 years ago
Bin Lu 523c778557
Update FAQ.md
5 years ago
Bin Lu f745eef560
Update FAQ.md
5 years ago
Bin Lu c386f01254
Update FAQ.md
5 years ago
dyning 6c381485c4
Merge pull request #2264 from dyning/release/2.0
5 years ago
dyning 8608f3463c
Merge branch 'release/2.0' into release/2.0
5 years ago
Daniel Yang 8647a503b1
Merge pull request #2292 from Evezerest/release2.0
5 years ago
Evezerest d5f5a38881
Merge branch 'release/2.0' into release2.0
5 years ago
Leif 881758fab5 Update joinus.png
5 years ago
caopu f56abaff7c Update eval.py
5 years ago
dyning ece8449815 add faq 20210316
5 years ago
zhoujun a7937102db
Merge pull request #2229 from LDOUBLEV/fix_2.0
5 years ago
xiaoting 4431a09c28
Merge branch 'release/2.0' into fix_2.0
5 years ago
Double_V ef3f72f07c
Merge pull request #2250 from tink2123/rename_lang
5 years ago
tink2123 f3de116010 add multi-lang
5 years ago
Double_V 15d30741bd
Merge branch 'release/2.0' into fix_2.0
5 years ago
tink2123 28c1f2497f add multi-lang
5 years ago
tink2123 66a44f222a rename lang for doc
5 years ago
tink2123 5b0e46d341 rename multi-lang
5 years ago
tink2123 68dd6afaa4 rename language abbreviations
5 years ago
Daniel Yang c7be8856e9
Merge pull request #2245 from Evezerest/release2.0
5 years ago
Leif eb1fab55f2 Merge remote-tracking branch 'upstream/release/2.0' into release2.0
5 years ago
Leif f9b113649a Update joinus.png
5 years ago
LDOUBLEV 1cfe43c9a6 enable memory optim
5 years ago
Wei Shengyu fd5ea74b00
update FAQ (#2189)
5 years ago
zhoujun f0b1032813
Merge pull request #2200 from Intsigstephon/release/2.0
5 years ago
Bin Lu cece6d201f
Update README.md
5 years ago
Bin Lu 10b1bc78fd
Update image_list.txt
5 years ago
Daniel Yang 978807038a
Merge pull request #2181 from Evezerest/release2.0
5 years ago
Evezerest 84ef96f35d
Merge branch 'release/2.0' into release2.0
5 years ago
Leif bec2f3f490 Merge remote-tracking branch 'origin/release2.0' into release2.0
5 years ago
Leif e07e168cda Update joinus.png
5 years ago
Double_V ac31a18b61
Merge pull request #2171 from LDOUBLEV/cp20
5 years ago
LDOUBLEV 6bd6bee58f fix issue 2086
5 years ago
LDOUBLEV 45111a7b46 Merge branch 'release/2.0' of https://github.com/PaddlePaddle/PaddleOCR into cp20
5 years ago
LDOUBLEV cbd812bc99 fix issue 2086
5 years ago
xiaoting f97fc1d03f
Merge pull request #2164 from xmy0916/release/2.0
5 years ago
xmy0916 1f23c7ad2f fix type error
5 years ago
dyning 3a11283588
Merge pull request #2140 from LDOUBLEV/cp20
5 years ago
LDOUBLEV 222a821ad6 fix typo
5 years ago
LDOUBLEV 909d9c17ff fix serial number
5 years ago
LDOUBLEV 6f794f6ff9 fix serial number
5 years ago
LDOUBLEV 342c7aedb0 add faq, 2021.3.1
5 years ago
LDOUBLEV fd9d8c39d2 Merge branch 'release/2.0' of https://github.com/PaddlePaddle/PaddleOCR into cp20
5 years ago
Double_V 76752b6084
Merge pull request #2105 from LDOUBLEV/cp20
5 years ago
LDOUBLEV b0b8db0654 add faq, 2021.3.1
5 years ago
littletomatodonkey dd9b456bb6
Merge branch 'release/2.0' into cp20
5 years ago
MissPenguin 7d31b5e1c8
Merge pull request #2125 from Evezerest/release2.0
5 years ago
Leif 5ed055e7dd Merge remote-tracking branch 'upstream/release/2.0' into release2.0
5 years ago
Evezerest 0faa016137
Merge branch 'release/2.0' into release2.0
5 years ago
Leif 843053e2ec Update joinus.png
5 years ago
LDOUBLEV cf2bd52989 fix issue #2080
5 years ago
LDOUBLEV 2c7c60bec2 fix issue #2072
5 years ago
Leif 1886647f1d Change the path of joinun.png to absolute path
5 years ago
Daniel Yang fa32b9b184
Merge pull request #2076 from Evezerest/release2.0
5 years ago
Leif f1383e17a1 Update joinus.png
5 years ago
littletomatodonkey 152ab8f3da
add faq 20210222 (#2068)
5 years ago
xiaoting c3d700fa41
fix test_hubserving (#2071)
5 years ago
Double_V e083b9c228
Merge pull request #2014 from lamhoangtung/release/2.0
5 years ago
Double_V ff1b0a3621
Merge pull request #2038 from LDOUBLEV/cp_dilation
5 years ago
LDOUBLEV b61af980eb fix dilation
5 years ago
Double_V 714ca4a73e
Merge pull request #2037 from LDOUBLEV/cp_dilation
5 years ago
LDOUBLEV 21ad9026d3 fix typo
5 years ago
Double_V dcdf083203
Merge pull request #2036 from LDOUBLEV/cp_dilation
5 years ago
LDOUBLEV 611c70f68c add use_dilation params in hubserving
5 years ago
Double_V 4a7214963f
Merge pull request #2023 from LDOUBLEV/doc_cp
5 years ago
Double_V 9deee44a7a
Merge branch 'release/2.0' into doc_cp
5 years ago
Double_V 59b3921d9b
Merge pull request #2024 from LDOUBLEV/cp
5 years ago
Double_V f23aa77757 Merge pull request #1920 from LDOUBLEV/trt_cpp
5 years ago
LDOUBLEV 5e555a8047 cherry-pick fix doc and fix dilation
5 years ago
MissPenguin ecc408a6db
Update inference_en.md
5 years ago
MissPenguin 97d71f0bba
Update inference.md
5 years ago
lamhoangtung e1c44d1f2c
Fix #2013
5 years ago
Daniel Yang d91c3e7c6b
Merge pull request #2010 from Evezerest/release2.0
5 years ago
Leif 67e951d0be Update joinus.png
5 years ago
xiaoting d231cc3cd7
Merge pull request #1989 from tink2123/faq_2.0
5 years ago
xiaoting 7bffc58e89
Merge branch 'release/2.0' into faq_2.0
5 years ago
tink2123 5fc2de704b add faq for 2.8
5 years ago
tink2123 38303bfd02 add faq for 2.8
5 years ago
dyning 8045cee558
Update README_ch.md
5 years ago
Daniel Yang 8d3d0eb15e
Merge pull request #1988 from Evezerest/release2.0
5 years ago
Leif b5d56d1c83 Update joinus.png
5 years ago
MissPenguin e6a95c3a71
Update README.md
5 years ago
MissPenguin c6811aa833
Update README.md
5 years ago
zhoujun 364a777763
Merge pull request #1984 from WenmuZhou/update_reqire
5 years ago
WenmuZhou 4dfc583850 predict_rec support rare
5 years ago
WenmuZhou 9cc6363b0e fix rare export error
5 years ago
xiaoting 890546ca34
Merge pull request #1982 from tink2123/fix_srn_eval
5 years ago
tink2123 807cd824a5 fix srn for eval
5 years ago
zhoujun fe6e31705f
Merge pull request #1981 from WenmuZhou/update_reqire
5 years ago
WenmuZhou 9050c6f933 update srn dataset path
5 years ago
xiaoting 1b1f170c7a
Merge pull request #1979 from tink2123/fix_encode
5 years ago
tink2123 1599a4590f fix attn encode
5 years ago
tink2123 e7187dac83 fix encode for srn
5 years ago
xiaoting a3afc162fa
Merge pull request #1972 from tink2123/fix_eval_for_srn_2.0
5 years ago
tink2123 ad15a64569 polish code for srn eval
5 years ago
zhoujun 6b73d8ed2f
Merge pull request #1954 from WenmuZhou/update_reqire
5 years ago
WenmuZhou 647f85dfca update srn dataset path
5 years ago
WenmuZhou 76f50d89e3 update rare dataset path
5 years ago
zhoujun 4c33d20dae
Merge pull request #1953 from WenmuZhou/update_reqire
5 years ago
WenmuZhou 36b5c0dafa update readme and requirements.txt
5 years ago
zhoujun 3b9c7b82bc
Merge pull request #1949 from WenmuZhou/check_empty_data
5 years ago
WenmuZhou 8e9d851563 add dataset len check
5 years ago
zhoujun 1d41d8903a
Merge pull request #1936 from WenmuZhou/dygraph_rc
5 years ago
xiaoting 60effbd748
Merge pull request #1928 from tink2123/cherry-pick
5 years ago
tink2123 25008de315 fix typo
5 years ago
xiaoting a6146ffc43
Merge pull request #1919 from tink2123/fix_rare
5 years ago
tink2123 da344d539a fix typo for attention
5 years ago
Double_V cdf732289d
Merge pull request #1906 from littletomatodonkey/2.0/fix_typo
5 years ago
littletomatodonkey 0c75cbc55b fix doc
5 years ago
MissPenguin 36dae990b8
Merge pull request #1901 from MissPenguin/release/2.0
5 years ago
root f6daae41e5 fix conflict
5 years ago
root f2bc513a68 delete slim related content
5 years ago

File diff suppressed because it is too large Load Diff

@ -8,10 +8,6 @@ PPOCRLabel is a semi-automatic graphic annotation tool suitable for OCR field, w
### Recent Update
- 2021.2.5: New batch processing and undo functions (by [Evezerest](https://github.com/Evezerest)):
- Batch processing function: Press and hold the Ctrl key to select the box, you can move, copy, and delete in batches.
- Undo function: In the process of drawing a four-point label box or after editing the box, press Ctrl+Z to undo the previous operation.
- Fix image rotation and size problems, optimize the process of editing the mark frame (by [ninetailskim](https://github.com/ninetailskim)、 [edencfc](https://github.com/edencfc)).
- 2021.1.11: Optimize the labeling experience (by [edencfc](https://github.com/edencfc)),
- Users can choose whether to pop up the label input dialog after drawing the detection box in "View - Pop-up Label Input Dialog".
- The recognition result scrolls synchronously when users click related detection box.
@ -20,6 +16,7 @@ PPOCRLabel is a semi-automatic graphic annotation tool suitable for OCR field, w
### TODO:
- Lock box mode: For the same scene data, the size and position of the locked detection box can be transferred between different pictures.
- Experience optimization: Add undo, batch operation include move, copy, delete and so on, optimize the annotation process.
## Installation
@ -79,11 +76,12 @@ python3 PPOCRLabel.py
7. Double click the result in 'recognition result' list to manually change inaccurate recognition results.
8. Click "Check", the image status will switch to "√",then the program automatically jump to the next.
8. Click "Check", the image status will switch to "√",then the program automatically jump to the next(The results will not be written directly to the file at this time).
9. Click "Delete Image" and the image will be deleted to the recycle bin.
10. Labeling result: the user can save manually through the menu "File - Save Label", while the program will also save automatically if "File - Auto Save Label Mode" is selected. The manually checked label will be stored in *Label.txt* under the opened picture folder. Click "PaddleOCR"-"Save Recognition Results" in the menu bar, the recognition training data of such pictures will be saved in the *crop_img* folder, and the recognition label will be saved in *rec_gt.txt*<sup>[4]</sup>.
10. Labeling result: the user can save manually through the menu "File - Save Label", while the program will also save automatically after every 5 images confirmed by the user.the manually checked label will be stored in *Label.txt* under the opened picture folder.
Click "PaddleOCR"-"Save Recognition Results" in the menu bar, the recognition training data of such pictures will be saved in the *crop_img* folder, and the recognition label will be saved in *rec_gt.txt*<sup>[4]</sup>.
### Note
@ -91,7 +89,8 @@ python3 PPOCRLabel.py
[2] The image status indicates whether the user has saved the image manually. If it has not been saved manually it is "X", otherwise it is "√", PPOCRLabel will not relabel pictures with a status of "√".
[3] After clicking "Re-recognize", the model will overwrite ALL recognition results in the picture. Therefore, if the recognition result has been manually changed before, it may change after re-recognition.
[3] After clicking "Re-recognize", the model will overwrite ALL recognition results in the picture.
Therefore, if the recognition result has been manually changed before, it may change after re-recognition.
[4] The files produced by PPOCRLabel can be found under the opened picture folder including the following, please do not manually change the contents, otherwise it will cause the program to be abnormal.
@ -107,23 +106,22 @@ python3 PPOCRLabel.py
### Shortcut keys
| Shortcut keys | Description |
| ------------------------ | ------------------------------------------------ |
| Ctrl + Shift + R | Re-recognize all the labels of the current image |
| W | Create a rect box |
| Q | Create a four-points box |
| Ctrl + E | Edit label of the selected box |
| Ctrl + R | Re-recognize the selected box |
| Ctrl + C | Copy and paste the selected box |
| Ctrl + Left Mouse Button | Multi select the label box |
| Backspace | Delete the selected box |
| Ctrl + V | Check image |
| Ctrl + Shift + d | Delete image |
| D | Next image |
| A | Previous image |
| Ctrl++ | Zoom in |
| Ctrl-- | Zoom out |
| ↑→↓← | Move selected box |
| Shortcut keys | Description |
| ---------------- | ------------------------------------------------ |
| Ctrl + shift + A | Automatically label all unchecked images |
| Ctrl + shift + R | Re-recognize all the labels of the current image |
| W | Create a rect box |
| Q | Create a four-points box |
| Ctrl + E | Edit label of the selected box |
| Ctrl + R | Re-recognize the selected box |
| Backspace | Delete the selected box |
| Ctrl + V | Check image |
| Ctrl + Shift + d | Delete image |
| D | Next image |
| A | Previous image |
| Ctrl++ | Zoom in |
| Ctrl-- | Zoom out |
| ↑→↓← | Move selected box |
### Built-in Model
@ -138,7 +136,7 @@ python3 PPOCRLabel.py
PPOCRLabel supports three ways to save Label.txt
- Automatically save: After selecting "File - Auto Save Label Mode", the program will automatically write the annotations into Label.txt every time the user confirms an image. If this option is not turned on, it will be automatically saved after detecting that the user has manually checked 5 images.
- Automatically save: When it detects that the user has manually checked 5 pictures, the program automatically writes the annotations into Label.txt. The user can change the value of ``self.autoSaveNum`` in ``PPOCRLabel.py`` to set the number of images to be automatically saved after confirmation.
- Manual save: Click "File-Save Marking Results" to manually save the label.
- Close application save
@ -162,11 +160,11 @@ For some data that are difficult to recognize, the recognition results will not
```
pyrcc5 -o libs/resources.py resources.qrc
```
- If you get an error ``` module 'cv2' has no attribute 'INTER_NEAREST'```, you need to delete all opencv related packages first, and then reinstall the 4.2.0.32 version of headless opencv
- If you get an error ``` module 'cv2' has no attribute 'INTER_NEAREST'```, you need to delete all opencv related packages first, and then reinstall the 4.2.0.32 version of headless opencv
```
pip install opencv-contrib-python-headless==4.2.0.32
```
### Related
1.[Tzutalin. LabelImg. Git code (2015)](https://github.com/tzutalin/labelImg)
1.[Tzutalin. LabelImg. Git code (2015)](https://github.com/tzutalin/labelImg)

@ -8,10 +8,6 @@ PPOCRLabel是一款适用于OCR领域的半自动化图形标注工具内置P
#### 近期更新
- 2021.2.5新增批处理与撤销功能by [Evezerest](https://github.com/Evezerest))
- 批处理功能按住Ctrl键选择标记框后可批量移动、复制、删除。
- 撤销功能在绘制四点标注框过程中或对框进行编辑操作后按下Ctrl+Z可撤销上一部操作。
- 修复图像旋转和尺寸问题、优化编辑标记框过程by [ninetailskim](https://github.com/ninetailskim)、 [edencfc](https://github.com/edencfc)
- 2021.1.11优化标注体验by [edencfc](https://github.com/edencfc)
- 用户可在“视图 - 弹出标记输入框”选择在画完检测框后标记输入框是否弹出。
- 识别结果与检测框同步滚动。
@ -21,8 +17,9 @@ PPOCRLabel是一款适用于OCR领域的半自动化图形标注工具内置P
#### 尽请期待
- 锁定框模式:针对同一场景数据,被锁定的检测框的大小与位置能在不同图片之间传递。
- 体验优化:增加撤销操作,批量移动、复制、删除等功能。优化标注流程。
如果您对以上内容感兴趣或对完善工具有不一样的想法,欢迎加入我们的SIG队伍与我们共同开发。可以在[此处](https://github.com/PaddlePaddle/PaddleOCR/issues/1728)完成问卷和前置任务经过我们确认相关内容后即可正式加入享受SIG福利共同为OCR开源事业贡献特别说明针对PPOCRLabel的改进也属于PaddleOCR前置任务
如果您对以上内容感兴趣或对完善工具有不一样的想法,欢迎加入我们的队伍与我们共同开发
## 安装
@ -68,9 +65,9 @@ python3 PPOCRLabel.py --lang ch
5. 标记框绘制完成后,用户点击 “确认”,检测框会先被预分配一个 “待识别” 标签。
6. 重新识别:将图片中的所有检测画绘制/调整完成后,点击 “重新识别”PPOCR模型会对当前图片中的**所有检测框**重新识别<sup>[3]</sup>
7. 内容更改:双击识别结果,对不准确的识别结果进行手动更改。
8. **确认标记**:点击 “确认”,图片状态切换为 “√”,跳转至下一张。
8. 确认标记:点击 “确认”,图片状态切换为 “√”,跳转至下一张(此时不会直接将结果写入文件)
9. 删除:点击 “删除图像”,图片将会被删除至回收站。
10. 保存结果:用户可以通过菜单中“文件-保存标记结果”手动保存,同时也可以点击“文件 - 自动保存标记结果”开启自动保存。手动确认过的标记将会被存放在所打开图片文件夹下的*Label.txt*中。在菜单栏点击 “文件” - "保存识别结果"后,会将此类图片的识别训练数据保存在*crop_img*文件夹下,识别标签保存在*rec_gt.txt*中<sup>[4]</sup>
10. 保存结果:用户可以通过菜单中“文件-保存标记结果”手动保存,同时程序也会在用户每确认5张图片后自动保存一次。手动确认过的标记将会被存放在所打开图片文件夹下的*Label.txt*中。在菜单栏点击 “文件” - "保存识别结果"后,会将此类图片的识别训练数据保存在*crop_img*文件夹下,识别标签保存在*rec_gt.txt*中<sup>[4]</sup>
### 注意
@ -96,13 +93,12 @@ python3 PPOCRLabel.py --lang ch
| 快捷键 | 说明 |
| ---------------- | ---------------------------- |
| Ctrl + shift + A | 自动标注所有未确认过的图片 |
| Ctrl + shift + R | 对当前图片的所有标记重新识别 |
| W | 新建矩形框 |
| Q | 新建四点框 |
| Ctrl + E | 编辑所选框标签 |
| Ctrl + R | 重新识别所选标记 |
| Ctrl + C | 复制并粘贴选中的标记框 |
| Ctrl + 鼠标左键 | 多选标记框 |
| Backspace | 删除所选框 |
| Ctrl + V | 确认本张图片标记 |
| Ctrl + Shift + d | 删除本张图片 |
@ -124,7 +120,7 @@ python3 PPOCRLabel.py --lang ch
PPOCRLabel支持三种保存方式
- 自动保存:点击“文件 - 自动保存标记结果”后用户每确认过一张图片程序自动将标记结果写入Label.txt中。若未开启此选项则检测到用户手动确认过5张图片后进行自动保存。
- 程序自动保存当检测到用户手动确认过5张图片后程序自动将标记结果写入Label.txt中。其中用户可通过更改```PPOCRLabel.py```中的```self.autoSaveNum```的数值设置确认几张图片后进行自动保存。
- 手动保存:点击“文件 - 保存标记结果”手动保存标记。
- 关闭应用程序保存

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -82,7 +82,7 @@ class Shape(object):
return False
def addPoint(self, point):
if not self.reachMaxPoints(): # 4个点时发出close信号
if not self.reachMaxPoints():
self.points.append(point)
def popPoint(self):

@ -96,7 +96,4 @@ hideBox=隐藏所有标注
showBox=显示所有标注
saveLabel=保存标记结果
singleRe=重识别此区块
labelDialogOption=弹出标记输入框
undo=撤销
undoLastPoint=撤销上个点
autoSaveMode=自动保存标记结果
labelDialogOption=弹出标记输入框

@ -96,7 +96,4 @@ hideBox=Hide All Box
showBox=Show All Box
saveLabel=Save Label
singleRe=Re-recognition RectBox
labelDialogOption=Pop-up Label Input Dialog
undo=Undo
undoLastPoint=Undo Last Point
autoSaveMode=Auto Save Label Mode
labelDialogOption=Pop-up Label Input Dialog

@ -9,6 +9,7 @@ PaddleOCR supports both dynamic graph and static graph programming paradigm
- Static graph: develop branch
**Recent updates**
- 2021.2.8 Release PaddleOCRv2.0(branch release/2.0) and set as default branch. Check release note here: https://github.com/PaddlePaddle/PaddleOCR/releases/tag/v2.0.0
- 2021.1.21 update more than 25+ multilingual recognition models [models list](./doc/doc_en/models_list_en.md), includingEnglish, Chinese, German, French, JapaneseSpanishPortuguese Russia Arabic and so on. Models for more languages will continue to be updated [Develop Plan](https://github.com/PaddlePaddle/PaddleOCR/issues/1048).
- 2020.12.15 update Data synthesis tool, i.e., [Style-Text](./StyleText/README.md)easy to synthesize a large number of images which are similar to the target scene image.
- 2020.11.25 Update a new data annotation tool, i.e., [PPOCRLabel](./PPOCRLabel/README.md), which is helpful to improve the labeling efficiency. Moreover, the labeling results can be used in training of the PP-OCR system directly.
@ -42,7 +43,7 @@ The above pictures are the visualizations of the general ppocr_server model. For
- Scan the QR code below with your Wechat, you can access to official technical exchange group. Look forward to your participation.
<div align="center">
<img src="https://raw.githubusercontent.com/PaddlePaddle/PaddleOCR/release/2.0/doc/joinus.PNG" width = "200" height = "200" />
<img src="./doc/joinus.PNG" width = "200" height = "200" />
</div>
@ -93,7 +94,7 @@ For a new language request, please refer to [Guideline for new language_requests
- [Quick Inference Based on PIP](./doc/doc_en/whl_en.md)
- [Python Inference](./doc/doc_en/inference_en.md)
- [C++ Inference](./deploy/cpp_infer/readme_en.md)
- [Serving](./deploy/pdserving/README.md)
- [Serving](./deploy/hubserving/readme_en.md)
- [Mobile](https://github.com/PaddlePaddle/PaddleOCR/blob/develop/deploy/lite/readme_en.md)
- [Benchmark](./doc/doc_en/benchmark_en.md)
- Data Annotation and Synthesis

@ -8,7 +8,8 @@ PaddleOCR同时支持动态图与静态图两种编程范式
- 静态图版本develop分支
**近期更新**
- 2021.2.1 [FAQ](./doc/doc_ch/FAQ.md)新增5个高频问题总数162个每周一都会更新欢迎大家持续关注。
- 2021.3.22 [FAQ](./doc/doc_ch/FAQ.md)新增5个高频问题总数193个每周一都会更新欢迎大家持续关注。
- 2021.2.8 正式发布PaddleOCRv2.0(branch release/2.0)并设置为推荐用户使用的默认分支. 发布的详细内容,请参考: https://github.com/PaddlePaddle/PaddleOCR/releases/tag/v2.0.0
- 2021.1.26,28,29 PaddleOCR官方研发团队带来技术深入解读三日直播课1月26日、28日、29日晚上19:30[直播地址](https://live.bilibili.com/21689802)
- 2021.1.21 更新多语言识别模型目前支持语种超过27种[多语言模型下载](./doc/doc_ch/models_list.md),包括中文简体、中文繁体、英文、法文、德文、韩文、日文、意大利文、西班牙文、葡萄牙文、俄罗斯文、阿拉伯文等,后续计划可以参考[多语言研发计划](https://github.com/PaddlePaddle/PaddleOCR/issues/1048)
- 2020.12.15 更新数据合成工具[Style-Text](./StyleText/README_ch.md),可以批量合成大量与目标场景类似的图像,在多个场景验证,效果明显提升。
@ -46,7 +47,7 @@ PaddleOCR同时支持动态图与静态图两种编程范式
- 微信扫描二维码加入官方交流群,获得更高效的问题答疑,与各行各业开发者充分交流,期待您的加入。
<div align="center">
<img src="https://raw.githubusercontent.com/PaddlePaddle/PaddleOCR/release/2.0/doc/joinus.PNG" width = "200" height = "200" />
<img src="./doc/joinus.PNG" width = "200" height = "200" />
</div>
## 快速体验
@ -88,7 +89,7 @@ PaddleOCR同时支持动态图与静态图两种编程范式
- [基于pip安装whl包快速推理](./doc/doc_ch/whl.md)
- [基于Python脚本预测引擎推理](./doc/doc_ch/inference.md)
- [基于C++预测引擎推理](./deploy/cpp_infer/readme.md)
- [服务化部署](./deploy/pdserving/README_CN.md)
- [服务化部署](./deploy/hubserving/readme.md)
- [端侧部署](https://github.com/PaddlePaddle/PaddleOCR/blob/develop/deploy/lite/readme.md)
- [Benchmark](./doc/doc_ch/benchmark.md)
- 数据集
@ -103,8 +104,8 @@ PaddleOCR同时支持动态图与静态图两种编程范式
- [效果展示](#效果展示)
- FAQ
- [【精选】OCR精选10个问题](./doc/doc_ch/FAQ.md)
- [【理论篇】OCR通用32个问题](./doc/doc_ch/FAQ.md)
- [【实战篇】PaddleOCR实战110个问题](./doc/doc_ch/FAQ.md)
- [【理论篇】OCR通用37个问题](./doc/doc_ch/FAQ.md)
- [【实战篇】PaddleOCR实战141个问题](./doc/doc_ch/FAQ.md)
- [技术交流群](#欢迎加入PaddleOCR技术交流群)
- [参考文献](./doc/doc_ch/reference.md)
- [许可证书](#许可证书)

@ -98,7 +98,7 @@ What's more, the medium result `fake_bg.jpg` will also be saved, which is the ba
</div>
`fake_text.jpg` * `fake_text.jpg` is the generated image with the same font style as `Style Input`.
`fake_text.jpg` is the generated image with the same font style as `Style Input`.
<div align="center">

@ -38,15 +38,7 @@ class StyleTextRecPredictor(object):
self.std = config["Predictor"]["std"]
self.expand_result = config["Predictor"]["expand_result"]
def reshape_to_same_height(self, img_list):
h = img_list[0].shape[0]
for idx in range(1, len(img_list)):
new_w = round(1.0 * img_list[idx].shape[1] /
img_list[idx].shape[0] * h)
img_list[idx] = cv2.resize(img_list[idx], (new_w, h))
return img_list
def predict_single_image(self, style_input, text_input):
def predict(self, style_input, text_input):
style_input = self.rep_style_input(style_input, text_input)
tensor_style_input = self.preprocess(style_input)
tensor_text_input = self.preprocess(text_input)
@ -72,21 +64,6 @@ class StyleTextRecPredictor(object):
"fake_bg": fake_bg,
}
def predict(self, style_input, text_input_list):
if not isinstance(text_input_list, (tuple, list)):
return self.predict_single_image(style_input, text_input_list)
synth_result_list = []
for text_input in text_input_list:
synth_result = self.predict_single_image(style_input, text_input)
synth_result_list.append(synth_result)
for key in synth_result:
res = [r[key] for r in synth_result_list]
res = self.reshape_to_same_height(res)
synth_result[key] = np.concatenate(res, axis=1)
return synth_result
def preprocess(self, img):
img = (img.astype('float32') * self.scale - self.mean) / self.std
img_height, img_width, channel = img.shape

@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import numpy as np
import cv2
from utils.config import ArgsParser, load_config, override_config
from utils.logging import get_logger
@ -38,9 +36,8 @@ class ImageSynthesiser(object):
self.predictor = getattr(predictors, predictor_method)(self.config)
def synth_image(self, corpus, style_input, language="en"):
corpus_list, text_input_list = self.text_drawer.draw_text(
corpus, language, style_input_width=style_input.shape[1])
synth_result = self.predictor.predict(style_input, text_input_list)
corpus, text_input = self.text_drawer.draw_text(corpus, language)
synth_result = self.predictor.predict(style_input, text_input)
return synth_result
@ -62,15 +59,12 @@ class DatasetSynthesiser(ImageSynthesiser):
for i in range(self.output_num):
style_data = self.style_sampler.sample()
style_input = style_data["image"]
corpus_language, text_input_label = self.corpus_generator.generate()
text_input_label_list, text_input_list = self.text_drawer.draw_text(
text_input_label,
corpus_language,
style_input_width=style_input.shape[1])
corpus_language, text_input_label = self.corpus_generator.generate(
)
text_input_label, text_input = self.text_drawer.draw_text(
text_input_label, corpus_language)
text_input_label = "".join(text_input_label_list)
synth_result = self.predictor.predict(style_input, text_input_list)
synth_result = self.predictor.predict(style_input, text_input)
fake_fusion = synth_result["fake_fusion"]
self.writer.save_image(fake_fusion, text_input_label)
self.writer.save_label()

@ -1,6 +1,5 @@
from PIL import Image, ImageDraw, ImageFont
import numpy as np
import cv2
from utils.logging import get_logger
@ -29,11 +28,7 @@ class StdTextDrawer(object):
else:
return int((self.height - 4)**2 / font_height)
def draw_text(self,
corpus,
language="en",
crop=True,
style_input_width=None):
def draw_text(self, corpus, language="en", crop=True):
if language not in self.support_languages:
self.logger.warning(
"language {} not supported, use en instead.".format(language))
@ -42,43 +37,21 @@ class StdTextDrawer(object):
width = min(self.max_width, len(corpus) * self.height) + 4
else:
width = len(corpus) * self.height + 4
if style_input_width is not None:
width = min(width, style_input_width)
corpus_list = []
text_input_list = []
while len(corpus) != 0:
bg = Image.new("RGB", (width, self.height), color=(127, 127, 127))
draw = ImageDraw.Draw(bg)
char_x = 2
font = self.font_dict[language]
i = 0
while i < len(corpus):
char_i = corpus[i]
char_size = font.getsize(char_i)[0]
# split when char_x exceeds char size and index is not 0 (at least 1 char should be wroten on the image)
if char_x + char_size >= width and i != 0:
text_input = np.array(bg).astype(np.uint8)
text_input = text_input[:, 0:char_x, :]
corpus_list.append(corpus[0:i])
text_input_list.append(text_input)
corpus = corpus[i:]
break
draw.text((char_x, 2), char_i, fill=(0, 0, 0), font=font)
char_x += char_size
i += 1
# the whole text is shorter than style input
if i == len(corpus):
text_input = np.array(bg).astype(np.uint8)
text_input = text_input[:, 0:char_x, :]
corpus_list.append(corpus[0:i])
text_input_list.append(text_input)
corpus = corpus[i:]
bg = Image.new("RGB", (width, self.height), color=(127, 127, 127))
draw = ImageDraw.Draw(bg)
char_x = 2
font = self.font_dict[language]
for i, char_i in enumerate(corpus):
char_size = font.getsize(char_i)[0]
draw.text((char_x, 2), char_i, fill=(0, 0, 0), font=font)
char_x += char_size
if char_x >= width:
corpus = corpus[0:i + 1]
self.logger.warning("corpus length exceed limit: {}".format(
corpus))
break
return corpus_list, text_input_list
text_input = np.array(bg).astype(np.uint8)
text_input = text_input[:, 0:char_x, :]
return corpus, text_input

@ -1,2 +1,2 @@
style_images/1.jpg NEATNESS
style_images/2.jpg 锁店君和宾馆
style_images/2.jpg 卡丹鑫宇通

@ -7,6 +7,7 @@ Global:
save_epoch_step: 3
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [0, 1000]
# if pretrained_model is saved in static mode, load_static_weights must set to True
cal_metric_during_train: True
pretrained_model:
checkpoints:
@ -92,4 +93,4 @@ Eval:
shuffle: False
drop_last: False
batch_size_per_card: 512
num_workers: 4
num_workers: 4

@ -7,10 +7,7 @@ Global:
save_epoch_step: 1200
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [3000, 2000]
# 1. If pretrained_model is saved in static mode, such as classification pretrained model
# from static branch, load_static_weights must be set as True.
# 2. If you want to finetune the pretrained models we provide in the docs,
# you should set load_static_weights as False.
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/MobileNetV3_large_x0_5_pretrained

@ -7,10 +7,7 @@ Global:
save_epoch_step: 1200
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [3000, 2000]
# 1. If pretrained_model is saved in static mode, such as classification pretrained model
# from static branch, load_static_weights must be set as True.
# 2. If you want to finetune the pretrained models we provide in the docs,
# you should set load_static_weights as False.
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/ResNet18_vd_pretrained

@ -7,10 +7,7 @@ Global:
save_epoch_step: 1200
# evaluation is run every 2000 iterations
eval_batch_step: [0, 2000]
# 1. If pretrained_model is saved in static mode, such as classification pretrained model
# from static branch, load_static_weights must be set as True.
# 2. If you want to finetune the pretrained models we provide in the docs,
# you should set load_static_weights as False.
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/MobileNetV3_large_x0_5_pretrained

@ -7,10 +7,7 @@ Global:
save_epoch_step: 1000
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [4000, 5000]
# 1. If pretrained_model is saved in static mode, such as classification pretrained model
# from static branch, load_static_weights must be set as True.
# 2. If you want to finetune the pretrained models we provide in the docs,
# you should set load_static_weights as False.
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/MobileNetV3_large_x0_5_pretrained

@ -7,10 +7,7 @@ Global:
save_epoch_step: 1200
# evaluation is run every 2000 iterations
eval_batch_step: [0,2000]
# 1. If pretrained_model is saved in static mode, such as classification pretrained model
# from static branch, load_static_weights must be set as True.
# 2. If you want to finetune the pretrained models we provide in the docs,
# you should set load_static_weights as False.
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/ResNet50_vd_ssld_pretrained

@ -7,10 +7,7 @@ Global:
save_epoch_step: 1000
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [4000, 5000]
# 1. If pretrained_model is saved in static mode, such as classification pretrained model
# from static branch, load_static_weights must be set as True.
# 2. If you want to finetune the pretrained models we provide in the docs,
# you should set load_static_weights as False.
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/ResNet50_vd_pretrained/

@ -7,10 +7,7 @@ Global:
save_epoch_step: 1000
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [4000, 5000]
# 1. If pretrained_model is saved in static mode, such as classification pretrained model
# from static branch, load_static_weights must be set as True.
# 2. If you want to finetune the pretrained models we provide in the docs,
# you should set load_static_weights as False.
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/ResNet50_vd_ssld_pretrained/

@ -7,10 +7,7 @@ Global:
save_epoch_step: 1000
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [4000, 5000]
# 1. If pretrained_model is saved in static mode, such as classification pretrained model
# from static branch, load_static_weights must be set as True.
# 2. If you want to finetune the pretrained models we provide in the docs,
# you should set load_static_weights as False.
# if pretrained_model is saved in static mode, load_static_weights must set to True
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/ResNet50_vd_ssld_pretrained/

@ -7,6 +7,7 @@ Global:
save_epoch_step: 3
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [0, 2000]
# if pretrained_model is saved in static mode, load_static_weights must set to True
cal_metric_during_train: True
pretrained_model:
checkpoints:

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save