Compare commits

..

150 Commits

Author SHA1 Message Date
Double_V d6ee6bdb48
Merge pull request #2347 from littletomatodonkey/dyg/fix_pre_rec
5 years ago
littletomatodonkey 113d8a8eb5 fix eval res vary for different times
5 years ago
Double_V 76946e8372
Merge pull request #2325 from littletomatodonkey/dyg/fix_log
5 years ago
littletomatodonkey 9e7dc2b88e fix logger info for empty log
5 years ago
MissPenguin 311d1a10cd
Update README_ch.md
5 years ago
MissPenguin 5f1802e768
Update README_CN.md
5 years ago
MissPenguin 27f5df3583
Update README.md
5 years ago
MissPenguin c59a58e55c
Update README.md
5 years ago
MissPenguin 0a98b213fd
Merge pull request #2323 from LDOUBLEV/pdserver_dyg
5 years ago
Double_V 9ba0bcf250
Merge branch 'dygraph' into pdserver_dyg
5 years ago
LDOUBLEV 7ec717544c refine server readme
5 years ago
LDOUBLEV 90c3304c0b fix readme
5 years ago
LDOUBLEV fdacfe1474 fix readme
5 years ago
MissPenguin 43d7dcc3d6
Merge pull request #2311 from LDOUBLEV/pdserver_dyg
5 years ago
LDOUBLEV 271a88a69e fix readme
5 years ago
LDOUBLEV 4cdc823761 add en readme
5 years ago
LDOUBLEV bb2a0273dd add pdserver demo to dygraph
5 years ago
littletomatodonkey 9749cad317
add google drive link (#2277)
5 years ago
zhoujun 81cce82b92
Merge pull request #2093 from WenmuZhou/fix_doc
5 years ago
zhoujun ae7e150231
Merge branch 'dygraph' into fix_doc
5 years ago
zhoujun ddbba2b182
Merge pull request #2228 from WenmuZhou/fix_attn_export
5 years ago
zhoujun 592c41875d
Merge branch 'dygraph' into fix_attn_export
5 years ago
zhoujun 4370693fc7
Merge branch 'dygraph' into fix_doc
5 years ago
Double_V f687e092b6
Merge pull request #2226 from WenmuZhou/fix_mem
5 years ago
Double_V e0908dd523
Merge branch 'dygraph' into fix_mem
5 years ago
Double_V c2449bded2
Merge branch 'dygraph' into fix_attn_export
5 years ago
Double_V 5eafd4672c
Merge pull request #2230 from LDOUBLEV/fix_dyg
5 years ago
LDOUBLEV 4c9d141c6f enable memory optim
5 years ago
zhoujun 6783c2a4c1
Merge branch 'dygraph' into fix_mem
5 years ago
zhoujun b0e04e06ce
Merge branch 'dygraph' into fix_attn_export
5 years ago
WenmuZhou acffd750f7 fix attn export
5 years ago
WenmuZhou 1271db6d7c fix mem
5 years ago
zhoujun 8bffec92e2
Merge branch 'dygraph' into fix_doc
5 years ago
littletomatodonkey 0e332fb59a
add prob for ra (#2194)
5 years ago
zhoujun 5a2b578e75
Merge branch 'dygraph' into fix_doc
5 years ago
Double_V 1a087990d0
Merge pull request #2098 from TingquanGao/dygraph
5 years ago
Double_V c5d4ff8248
Merge branch 'dygraph' into fix_doc
5 years ago
Double_V f7ac6ba8d2
Merge branch 'dygraph' into dygraph
5 years ago
Double_V 63f3769a1b
Merge pull request #2163 from xmy0916/dygraph
5 years ago
xmy0916 d31ba7cc1b fix type error
5 years ago
WenmuZhou b480916e28 Merge remote-tracking branch 'origin/fix_doc' into fix_doc
5 years ago
WenmuZhou 6b12c81a72 fix bug of custom rec dict path
5 years ago
WenmuZhou b5334047c2 Merge branch 'dygraph' of https://github.com/PaddlePaddle/PaddleOCR into fix_doc
5 years ago
Double_V 08efbb9608
Merge branch 'dygraph' into dygraph
5 years ago
Double_V 10af9f7d37
Merge branch 'dygraph' into fix_doc
5 years ago
Double_V f1cd0c35e4
Merge pull request #2091 from LDOUBLEV/trt_cpp
5 years ago
Double_V ac436d750b
Merge branch 'dygraph' into trt_cpp
5 years ago
Double_V c978085e27
Merge branch 'dygraph' into fix_doc
5 years ago
Daniel Yang 6d7be3e03b
Merge pull request #2101 from Evezerest/dy1
5 years ago
littletomatodonkey 233e1116fb
Merge branch 'dygraph' into dygraph
5 years ago
littletomatodonkey 768326886e
Merge branch 'dygraph' into trt_cpp
5 years ago
Double_V 6cb7404698
Merge pull request #2073 from LDOUBLEV/fix2013
5 years ago
LDOUBLEV 85fd65c8f0 fix typo
5 years ago
gaotingquan 1751be75b0 Fix the bug about raising error when reading image failed
5 years ago
Leif 453f9e5cf9 Change the path of joinus.png to absolute path
5 years ago
Leif 07b6d63522 Merge remote-tracking branch 'upstream/dygraph' into dy1
5 years ago
Double_V ca7be744dc
update ocr_rec.cpp
5 years ago
tingquangao add9faa822 Fix the log about length of valid_dataloader
5 years ago
WenmuZhou 20a9d30865 remove blank line
5 years ago
WenmuZhou 8e6c03f537 remove blank line
5 years ago
WenmuZhou fa8a0e3805 Add hint
5 years ago
Double_V 6335b0d842
Merge branch 'dygraph' into fix2013
5 years ago
LDOUBLEV 87f0aeed70 fix gap between train_model predict and inference
5 years ago
LDOUBLEV a898305ca4 fix issue 2072
5 years ago
littletomatodonkey 3ce97f18ec
fix predict rec (#2065)
5 years ago
littletomatodonkey d8719969ba
improve style text infer process (#2055)
5 years ago
Double_V 6a42745f96
Merge pull request #2060 from LDOUBLEV/fix2013
5 years ago
Double_V 816471aa42
Merge pull request #2027 from LDOUBLEV/trt_cpp
5 years ago
LDOUBLEV 8f9dda8608 fix issue 2013
5 years ago
Double_V e2e4002fd0
Merge pull request #2039 from LDOUBLEV/cpd
5 years ago
LDOUBLEV fa4a9962bd fix dilation
5 years ago
Double_V f664d7e1ae
Merge pull request #2035 from LDOUBLEV/server_dilation
5 years ago
LDOUBLEV 9da00464a0 add use_dilation params in hubserving
5 years ago
zhoujun 253cd0f770
Merge pull request #2029 from WenmuZhou/fix_doc
5 years ago
WenmuZhou 0507402a0f fix export bug
5 years ago
Double_V 85d340bd27
Merge pull request #1951 from light1003/patch-1
5 years ago
LDOUBLEV 6e07bf08a2 delete dist when export model
5 years ago
LDOUBLEV 6bafa1cec4 add prune demo
5 years ago
LDOUBLEV e0851f2b3f add prune demo
5 years ago
Double_V 1e5c6e43f3
Merge pull request #2022 from LDOUBLEV/trt_cpp
5 years ago
LDOUBLEV 9291c87271 keep postprocess params same
5 years ago
Double_V 77cc1d5cd8
Merge pull request #2021 from LDOUBLEV/trt_cpp
5 years ago
LDOUBLEV cf550d0524 set dilation as False
5 years ago
Double_V f65a5f6e57
Merge pull request #1920 from LDOUBLEV/trt_cpp
5 years ago
LDOUBLEV bbd7665c47 fix commit
5 years ago
LDOUBLEV 5fc33c1213 keep dilation as False
5 years ago
LDOUBLEV bbdbf598d4 keep dilation as False
5 years ago
LDOUBLEV 6ec9aa4def Merge branch 'dygraph' of https://github.com/PaddlePaddle/PaddleOCR into trt_cpp
5 years ago
MissPenguin 65e61f441c
Update inference.md
5 years ago
MissPenguin ddf548ad5e
Update inference_en.md
5 years ago
Double_V 5fe690a06b
Merge pull request #1973 from littletomatodonkey/dyg/fix_area_calc
5 years ago
zhoujun 3ab2d46310
support img_h < 32 (#1992)
5 years ago
Tingquan Gao 0b53465894
Adapt to paddle inference 2.0 (#1976)
5 years ago
Daniel Yang e7ef5ee49e
Merge pull request #1975 from Evezerest/dy1
5 years ago
Leif ee9c1bcfc9 Fix 4 points and shortcut bugs
5 years ago
WenmuZhou 33f302e5ff support img_h < 32
5 years ago
Leif 92207b9e0d Update joinus.png
5 years ago
zhoujun 95a1c6176d
Merge pull request #1985 from WenmuZhou/fix_doc
5 years ago
WenmuZhou ed2b527c9f fix rare export error
5 years ago
WenmuZhou 4eb351866c predict_rec support rare
5 years ago
xiaoting c7b86ec7bb
Merge pull request #1983 from tink2123/cherry_pick_dygrpah
5 years ago
tink2123 b658e10b35 fix srn for eval
5 years ago
xiaoting 0d74b46cd7
Merge pull request #1980 from tink2123/fix_encode_dygraph
5 years ago
tink2123 3d8b42dc0c fix encode for srn
5 years ago
tink2123 4b845ca159 fix attn encode
5 years ago
Leif 35f6d18fab Update readme and delete redundancy codes
5 years ago
littletomatodonkey 3728183276 fix are calc for polygon
5 years ago
xiaoting 895d44bc39
Merge pull request #1971 from tink2123/fix_eval_for_srn
5 years ago
tink2123 ff6b193a61 polish code for srn eval
5 years ago
zhoujun 810cba3979
Merge pull request #1955 from WenmuZhou/fix_doc
5 years ago
WenmuZhou 4410b78340 update srn dataset path
5 years ago
WenmuZhou 3b5360dcd9 update rare dataset path
5 years ago
zhoujun baafb29918
Merge pull request #1945 from WenmuZhou/update_requirements
5 years ago
zhoujun 757501995a
Merge pull request #1926 from WenmuZhou/fix_doc
5 years ago
light1003 4a8fc9176d
Update det_basic_loss.py
5 years ago
Leif ecf8b569d8 New functions like batch move, delete, withdraw with redundant codes
5 years ago
zhoujun a2fb623feb
Merge pull request #1938 from WenmuZhou/check_empty_data
5 years ago
WenmuZhou b97ff21324 update readme and requirements.txt
5 years ago
WenmuZhou 3b1703e3eb add dataset len check
5 years ago
WenmuZhou b9d3e8eeec add dataset len check
5 years ago
WenmuZhou 1617cfdd1e update angle doc
5 years ago
xiaoting 84bf657299
Merge pull request #1929 from tink2123/fix_typo
5 years ago
tink2123 44420593e7 fix typo
5 years ago
MissPenguin d36a929b27
Merge pull request #1913 from WenmuZhou/dygraph_rc
5 years ago
MissPenguin d9335d2a1e
Merge pull request #1921 from littletomatodonkey/dyg/improve_doc
5 years ago
WenmuZhou 6443988d44 merge paddleocr
5 years ago
WenmuZhou 69c85d976a update whl doc
5 years ago
WenmuZhou bae07f51b5 update angle cls doc
5 years ago
WenmuZhou 94278781c6 update rec doc
5 years ago
WenmuZhou 248669a81e update rec doc
5 years ago
littletomatodonkey 4489b7dd17 fix model doc
5 years ago
Daniel Yang e4db8a5703
Merge pull request #1912 from Evezerest/dy1
5 years ago
littletomatodonkey 94478fa1db fix model size
5 years ago
littletomatodonkey 4316b15798 add png
5 years ago
littletomatodonkey 4e98a521ec improve doc
5 years ago
LDOUBLEV df1c97af80 fix bug
5 years ago
LDOUBLEV adc83ca9ae opt deploy doc
5 years ago
LDOUBLEV c4303163bd Merge branch 'dygraph' of https://github.com/PaddlePaddle/PaddleOCR into trt_cpp
5 years ago
xiaoting f02dcc063b
Merge pull request #1918 from tink2123/fix_rare
5 years ago
tink2123 2cda3b614a fix typo for attention
5 years ago
Leif 0ae2b779ce Update joinus.png
5 years ago
Daniel Yang 9f6b3a1188
Merge pull request #1902 from Evezerest/dy1
5 years ago
Double_V 221dbf5c20
Merge pull request #1905 from littletomatodonkey/dyg/fix_typo
5 years ago
littletomatodonkey 077fcabcbc fix doc
5 years ago
Leif 81ce7642af Update joinus.png
5 years ago
LDOUBLEV de37eedf26 fix doc of quant demo
5 years ago
LDOUBLEV 2a53789d1d fix doc of quant demo
5 years ago
WenmuZhou 8e697e349f add note
5 years ago
WenmuZhou b30add8ae5 fix bug
5 years ago
WenmuZhou 6a38af5890 fix starnet export
5 years ago

File diff suppressed because it is too large Load Diff

@ -8,6 +8,10 @@ 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.
@ -16,7 +20,6 @@ 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
@ -76,12 +79,11 @@ 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(The results will not be written directly to the file at this time).
8. Click "Check", the image status will switch to "√",then the program automatically jump to the next.
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 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>.
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>.
### Note
@ -89,8 +91,7 @@ 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.
@ -106,22 +107,23 @@ Therefore, if the recognition result has been manually changed before, it may ch
### Shortcut keys
| 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 |
| 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 |
### Built-in Model
@ -136,7 +138,7 @@ Therefore, if the recognition result has been manually changed before, it may ch
PPOCRLabel supports three ways to save Label.txt
- 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.
- 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.
- Manual save: Click "File-Save Marking Results" to manually save the label.
- Close application save
@ -160,11 +162,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,6 +8,10 @@ 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)
- 用户可在“视图 - 弹出标记输入框”选择在画完检测框后标记输入框是否弹出。
- 识别结果与检测框同步滚动。
@ -17,9 +21,8 @@ PPOCRLabel是一款适用于OCR领域的半自动化图形标注工具内置P
#### 尽请期待
- 锁定框模式:针对同一场景数据,被锁定的检测框的大小与位置能在不同图片之间传递。
- 体验优化:增加撤销操作,批量移动、复制、删除等功能。优化标注流程。
如果您对以上内容感兴趣或对完善工具有不一样的想法,欢迎加入我们的队伍与我们共同开发
如果您对以上内容感兴趣或对完善工具有不一样的想法,欢迎加入我们的SIG队伍与我们共同开发。可以在[此处](https://github.com/PaddlePaddle/PaddleOCR/issues/1728)完成问卷和前置任务经过我们确认相关内容后即可正式加入享受SIG福利共同为OCR开源事业贡献特别说明针对PPOCRLabel的改进也属于PaddleOCR前置任务
## 安装
@ -65,9 +68,9 @@ python3 PPOCRLabel.py --lang ch
5. 标记框绘制完成后,用户点击 “确认”,检测框会先被预分配一个 “待识别” 标签。
6. 重新识别:将图片中的所有检测画绘制/调整完成后,点击 “重新识别”PPOCR模型会对当前图片中的**所有检测框**重新识别<sup>[3]</sup>
7. 内容更改:双击识别结果,对不准确的识别结果进行手动更改。
8. 确认标记:点击 “确认”,图片状态切换为 “√”,跳转至下一张(此时不会直接将结果写入文件)
8. **确认标记**:点击 “确认”,图片状态切换为 “√”,跳转至下一张。
9. 删除:点击 “删除图像”,图片将会被删除至回收站。
10. 保存结果:用户可以通过菜单中“文件-保存标记结果”手动保存,同时程序也会在用户每确认5张图片后自动保存一次。手动确认过的标记将会被存放在所打开图片文件夹下的*Label.txt*中。在菜单栏点击 “文件” - "保存识别结果"后,会将此类图片的识别训练数据保存在*crop_img*文件夹下,识别标签保存在*rec_gt.txt*中<sup>[4]</sup>
10. 保存结果:用户可以通过菜单中“文件-保存标记结果”手动保存,同时也可以点击“文件 - 自动保存标记结果”开启自动保存。手动确认过的标记将会被存放在所打开图片文件夹下的*Label.txt*中。在菜单栏点击 “文件” - "保存识别结果"后,会将此类图片的识别训练数据保存在*crop_img*文件夹下,识别标签保存在*rec_gt.txt*中<sup>[4]</sup>
### 注意
@ -93,12 +96,13 @@ 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 | 删除本张图片 |
@ -120,7 +124,7 @@ python3 PPOCRLabel.py --lang ch
PPOCRLabel支持三种保存方式
- 程序自动保存当检测到用户手动确认过5张图片后程序自动将标记结果写入Label.txt中。其中用户可通过更改```PPOCRLabel.py```中的```self.autoSaveNum```的数值设置确认几张图片后进行自动保存。
- 自动保存:点击“文件 - 自动保存标记结果”后用户每确认过一张图片程序自动将标记结果写入Label.txt中。若未开启此选项则检测到用户手动确认过5张图片后进行自动保存。
- 手动保存:点击“文件 - 保存标记结果”手动保存标记。
- 关闭应用程序保存

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():
if not self.reachMaxPoints(): # 4个点时发出close信号
self.points.append(point)
def popPoint(self):

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

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

@ -9,7 +9,6 @@ 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.
@ -43,7 +42,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="./doc/joinus.PNG" width = "200" height = "200" />
<img src="https://raw.githubusercontent.com/PaddlePaddle/PaddleOCR/release/2.0/doc/joinus.PNG" width = "200" height = "200" />
</div>
@ -94,7 +93,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/hubserving/readme_en.md)
- [Serving](./deploy/pdserving/README.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,8 +8,7 @@ PaddleOCR同时支持动态图与静态图两种编程范式
- 静态图版本develop分支
**近期更新**
- 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.2.1 [FAQ](./doc/doc_ch/FAQ.md)新增5个高频问题总数162个每周一都会更新欢迎大家持续关注。
- 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),可以批量合成大量与目标场景类似的图像,在多个场景验证,效果明显提升。
@ -47,7 +46,7 @@ PaddleOCR同时支持动态图与静态图两种编程范式
- 微信扫描二维码加入官方交流群,获得更高效的问题答疑,与各行各业开发者充分交流,期待您的加入。
<div align="center">
<img src="./doc/joinus.PNG" width = "200" height = "200" />
<img src="https://raw.githubusercontent.com/PaddlePaddle/PaddleOCR/release/2.0/doc/joinus.PNG" width = "200" height = "200" />
</div>
## 快速体验
@ -89,7 +88,7 @@ PaddleOCR同时支持动态图与静态图两种编程范式
- [基于pip安装whl包快速推理](./doc/doc_ch/whl.md)
- [基于Python脚本预测引擎推理](./doc/doc_ch/inference.md)
- [基于C++预测引擎推理](./deploy/cpp_infer/readme.md)
- [服务化部署](./deploy/hubserving/readme.md)
- [服务化部署](./deploy/pdserving/README_CN.md)
- [端侧部署](https://github.com/PaddlePaddle/PaddleOCR/blob/develop/deploy/lite/readme.md)
- [Benchmark](./doc/doc_ch/benchmark.md)
- 数据集
@ -104,8 +103,8 @@ PaddleOCR同时支持动态图与静态图两种编程范式
- [效果展示](#效果展示)
- FAQ
- [【精选】OCR精选10个问题](./doc/doc_ch/FAQ.md)
- [【理论篇】OCR通用37个问题](./doc/doc_ch/FAQ.md)
- [【实战篇】PaddleOCR实战141个问题](./doc/doc_ch/FAQ.md)
- [【理论篇】OCR通用32个问题](./doc/doc_ch/FAQ.md)
- [【实战篇】PaddleOCR实战110个问题](./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` is the generated image with the same font style as `Style Input`.
`fake_text.jpg` * `fake_text.jpg` is the generated image with the same font style as `Style Input`.
<div align="center">

@ -38,7 +38,15 @@ class StyleTextRecPredictor(object):
self.std = config["Predictor"]["std"]
self.expand_result = config["Predictor"]["expand_result"]
def predict(self, style_input, text_input):
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):
style_input = self.rep_style_input(style_input, text_input)
tensor_style_input = self.preprocess(style_input)
tensor_text_input = self.preprocess(text_input)
@ -64,6 +72,21 @@ 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,6 +12,8 @@
# 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
@ -36,8 +38,9 @@ class ImageSynthesiser(object):
self.predictor = getattr(predictors, predictor_method)(self.config)
def synth_image(self, corpus, style_input, language="en"):
corpus, text_input = self.text_drawer.draw_text(corpus, language)
synth_result = self.predictor.predict(style_input, text_input)
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)
return synth_result
@ -59,12 +62,15 @@ 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, text_input = self.text_drawer.draw_text(
text_input_label, corpus_language)
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])
synth_result = self.predictor.predict(style_input, text_input)
text_input_label = "".join(text_input_label_list)
synth_result = self.predictor.predict(style_input, text_input_list)
fake_fusion = synth_result["fake_fusion"]
self.writer.save_image(fake_fusion, text_input_label)
self.writer.save_label()

@ -1,5 +1,6 @@
from PIL import Image, ImageDraw, ImageFont
import numpy as np
import cv2
from utils.logging import get_logger
@ -28,7 +29,11 @@ class StdTextDrawer(object):
else:
return int((self.height - 4)**2 / font_height)
def draw_text(self, corpus, language="en", crop=True):
def draw_text(self,
corpus,
language="en",
crop=True,
style_input_width=None):
if language not in self.support_languages:
self.logger.warning(
"language {} not supported, use en instead.".format(language))
@ -37,21 +42,43 @@ class StdTextDrawer(object):
width = min(self.max_width, len(corpus) * self.height) + 4
else:
width = len(corpus) * self.height + 4
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))
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:]
break
text_input = np.array(bg).astype(np.uint8)
text_input = text_input[:, 0:char_x, :]
return corpus, text_input
return corpus_list, text_input_list

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

@ -7,7 +7,6 @@ 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:
@ -93,4 +92,4 @@ Eval:
shuffle: False
drop_last: False
batch_size_per_card: 512
num_workers: 4
num_workers: 4

@ -7,7 +7,10 @@ Global:
save_epoch_step: 1200
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [3000, 2000]
# if pretrained_model is saved in static mode, load_static_weights must set to True
# 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.
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/MobileNetV3_large_x0_5_pretrained

@ -7,7 +7,10 @@ Global:
save_epoch_step: 1200
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [3000, 2000]
# if pretrained_model is saved in static mode, load_static_weights must set to True
# 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.
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/ResNet18_vd_pretrained

@ -7,7 +7,10 @@ Global:
save_epoch_step: 1200
# evaluation is run every 2000 iterations
eval_batch_step: [0, 2000]
# if pretrained_model is saved in static mode, load_static_weights must set to True
# 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.
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/MobileNetV3_large_x0_5_pretrained

@ -7,7 +7,10 @@ Global:
save_epoch_step: 1000
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [4000, 5000]
# if pretrained_model is saved in static mode, load_static_weights must set to True
# 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.
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/MobileNetV3_large_x0_5_pretrained

@ -7,7 +7,10 @@ Global:
save_epoch_step: 1200
# evaluation is run every 2000 iterations
eval_batch_step: [0,2000]
# if pretrained_model is saved in static mode, load_static_weights must set to True
# 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.
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/ResNet50_vd_ssld_pretrained

@ -7,7 +7,10 @@ Global:
save_epoch_step: 1000
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [4000, 5000]
# if pretrained_model is saved in static mode, load_static_weights must set to True
# 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.
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/ResNet50_vd_pretrained/

@ -7,7 +7,10 @@ Global:
save_epoch_step: 1000
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [4000, 5000]
# if pretrained_model is saved in static mode, load_static_weights must set to True
# 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.
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/ResNet50_vd_ssld_pretrained/

@ -7,7 +7,10 @@ Global:
save_epoch_step: 1000
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step: [4000, 5000]
# if pretrained_model is saved in static mode, load_static_weights must set to True
# 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.
load_static_weights: True
cal_metric_during_train: False
pretrained_model: ./pretrain_models/ResNet50_vd_ssld_pretrained/

@ -7,7 +7,6 @@ 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