Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
647db30f
P
PaddleOCR
项目概览
weixin_41840029
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
647db30f
编写于
1月 29, 2021
作者:
qq_25193841
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bugs during save recognition results
上级
6b27cdc1
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
19 addition
and
11 deletion
+19
-11
PPOCRLabel/PPOCRLabel.py
PPOCRLabel/PPOCRLabel.py
+19
-11
未找到文件。
PPOCRLabel/PPOCRLabel.py
浏览文件 @
647db30f
...
...
@@ -1450,7 +1450,7 @@ class MainWindow(QMainWindow, WindowMixin):
item
=
QListWidgetItem
(
closeicon
,
filename
)
self
.
fileListWidget
.
addItem
(
item
)
print
(
'
d
irPath in importDirImages is'
,
dirpath
)
print
(
'
D
irPath in importDirImages is'
,
dirpath
)
self
.
iconlist
.
clear
()
self
.
additems5
(
dirpath
)
self
.
changeFileFolder
=
True
...
...
@@ -1459,7 +1459,6 @@ class MainWindow(QMainWindow, WindowMixin):
self
.
reRecogButton
.
setEnabled
(
True
)
self
.
actions
.
AutoRec
.
setEnabled
(
True
)
self
.
actions
.
reRec
.
setEnabled
(
True
)
self
.
actions
.
saveLabel
.
setEnabled
(
True
)
def
openPrevImg
(
self
,
_value
=
False
):
...
...
@@ -1862,6 +1861,8 @@ class MainWindow(QMainWindow, WindowMixin):
for
each
in
states
:
file
,
state
=
each
.
split
(
'
\t
'
)
self
.
fileStatedict
[
file
]
=
1
self
.
actions
.
saveLabel
.
setEnabled
(
True
)
self
.
actions
.
saveRec
.
setEnabled
(
True
)
def
saveFilestate
(
self
):
...
...
@@ -1919,22 +1920,29 @@ class MainWindow(QMainWindow, WindowMixin):
rec_gt_dir
=
os
.
path
.
dirname
(
self
.
PPlabelpath
)
+
'/rec_gt.txt'
crop_img_dir
=
os
.
path
.
dirname
(
self
.
PPlabelpath
)
+
'/crop_img/'
ques_img
=
[]
if
not
os
.
path
.
exists
(
crop_img_dir
):
os
.
mkdir
(
crop_img_dir
)
with
open
(
rec_gt_dir
,
'w'
,
encoding
=
'utf-8'
)
as
f
:
for
key
in
self
.
fileStatedict
:
idx
=
self
.
getImglabelidx
(
key
)
try
:
img
=
cv2
.
imread
(
key
)
for
i
,
label
in
enumerate
(
self
.
PPlabel
[
idx
]):
if
label
[
'difficult'
]:
continue
img
=
cv2
.
imread
(
key
)
img_crop
=
get_rotate_crop_image
(
img
,
np
.
array
(
label
[
'points'
],
np
.
float32
))
img_name
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
idx
))[
0
]
+
'_crop_'
+
str
(
i
)
+
'.jpg'
cv2
.
imwrite
(
crop_img_dir
+
img_name
,
img_crop
)
f
.
write
(
'crop_img/'
+
img_name
+
'
\t
'
)
f
.
write
(
label
[
'transcription'
]
+
'
\n
'
)
QMessageBox
.
information
(
self
,
"Information"
,
"Cropped images has been saved in "
+
str
(
crop_img_dir
))
except
Exception
as
e
:
ques_img
.
append
(
key
)
print
(
"Can not read image "
,
e
)
if
ques_img
:
QMessageBox
.
information
(
self
,
"Information"
,
"The following images can not be saved, "
"please check the image path and labels.
\n
"
+
""
.
join
(
str
(
i
)
+
'
\n
'
for
i
in
ques_img
))
QMessageBox
.
information
(
self
,
"Information"
,
"Cropped images have been saved in "
+
str
(
crop_img_dir
))
def
speedChoose
(
self
):
if
self
.
labelDialogOption
.
isChecked
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录