Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
15be3c54
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看板
提交
15be3c54
编写于
5月 05, 2022
作者:
qq_25193841
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Auto stash before merge of "table" and "origin/new"
上级
e15cf0d1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
16 deletion
+23
-16
PPOCRLabel/PPOCRLabel.py
PPOCRLabel/PPOCRLabel.py
+23
-16
未找到文件。
PPOCRLabel/PPOCRLabel.py
浏览文件 @
15be3c54
...
...
@@ -2131,7 +2131,7 @@ class MainWindow(QMainWindow):
TableRec_excel_dir
=
self
.
lastOpenDir
+
'/tableRec_excel_output/'
os
.
makedirs
(
TableRec_excel_dir
,
exist_ok
=
True
)
filename
=
os
.
path
.
basename
(
self
.
filePath
)
filename
,
_
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
self
.
filePath
)
)
excel_path
=
TableRec_excel_dir
+
'{}.xlsx'
.
format
(
filename
)
if
res
is
None
:
...
...
@@ -2203,19 +2203,26 @@ class MainWindow(QMainWindow):
return
# automatically open excel annotation file
try
:
import
win32com.client
except
:
print
(
"CANNOT OPEN .xlsx. It could be one of the following reasons: "
\
"Only support Windows | No python win32com"
)
if
platform
.
system
()
==
'Windows'
:
try
:
import
win32com.client
except
:
print
(
"CANNOT OPEN .xlsx. It could be one of the following reasons: "
\
"Only support Windows | No python win32com"
)
try
:
xl
=
win32com
.
client
.
Dispatch
(
"Excel.Application"
)
xl
.
Visible
=
True
xl
.
Workbooks
.
Open
(
excel_path
)
except
:
print
(
"CANNOT OPEN .xlsx. It could be the following reasons: "
\
".xlsx is not existed"
)
try
:
xl
=
win32com
.
client
.
Dispatch
(
"Excel.Application"
)
xl
.
Visible
=
True
xl
.
Workbooks
.
Open
(
excel_path
)
# excelEx = "You need to show the excel executable at this point"
# subprocess.Popen([excelEx, excel_path])
# os.startfile(excel_path)
except
:
print
(
"CANNOT OPEN .xlsx. It could be the following reasons: "
\
".xlsx is not existed"
)
else
:
os
.
system
(
'open '
+
os
.
path
.
normpath
(
excel_path
))
print
(
'time cost: '
,
time
.
time
()
-
start
)
...
...
@@ -2337,7 +2344,7 @@ class MainWindow(QMainWindow):
imgid
=
0
for
image_path
in
labeldict
.
keys
():
# load csv annotations
filename
=
os
.
path
.
basename
(
image_path
)
filename
,
_
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
image_path
)
)
csv_path
=
os
.
path
.
join
(
TableRec_excel_dir
,
filename
+
'.xlsx'
)
if
not
os
.
path
.
exists
(
csv_path
):
msg
=
'ERROR, Can not find '
+
csv_path
...
...
@@ -2347,7 +2354,7 @@ class MainWindow(QMainWindow):
# read xlsx file, convert to HTML
xd
=
pd
.
ExcelFile
(
csv_path
)
df
=
xd
.
parse
()
structure
=
df
.
to_html
()
structure
=
df
.
to_html
(
index
=
False
)
# load box annotations
cells
=
[]
...
...
@@ -2371,7 +2378,7 @@ class MainWindow(QMainWindow):
imgid
+=
1
# save json
with
open
(
"{}/annotation.json"
.
format
(
self
.
lastOpenDir
),
"w"
)
as
fid
:
with
open
(
"{}/annotation.json"
.
format
(
self
.
lastOpenDir
),
"w"
,
encoding
=
'utf-8'
)
as
fid
:
fid
.
write
(
json
.
dumps
(
json_results
))
msg
=
'JSON sucessfully saved in {}/annotation.json'
.
format
(
self
.
lastOpenDir
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录