Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
1e6af3bb
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看板
提交
1e6af3bb
编写于
5月 05, 2022
作者:
qq_25193841
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
merge from new
merge from new
上级
15be3c54
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
29 addition
and
20 deletion
+29
-20
PPOCRLabel/PPOCRLabel.py
PPOCRLabel/PPOCRLabel.py
+9
-12
PPOCRLabel/libs/dataPartitionDialog.py
PPOCRLabel/libs/dataPartitionDialog.py
+20
-8
未找到文件。
PPOCRLabel/PPOCRLabel.py
浏览文件 @
1e6af3bb
...
...
@@ -2285,13 +2285,15 @@ class MainWindow(QMainWindow):
import
pandas
as
pd
from
libs.dataPartitionDialog
import
DataPartitionDialog
if
self
.
lang
==
'ch'
:
QMessageBox
.
information
(
self
,
"Information"
,
"导出JSON前请保存所有图像的标注且关闭EXCEL!!!!!!!!!!!!"
)
else
:
QMessageBox
.
information
(
self
,
"Information"
,
"Please save all the annotations and close the EXCEL before exporting JSON!!!!!!!!!!!!"
)
# data partition user input
partitionDialog
=
DataPartitionDialog
(
parent
=
self
)
partitionDialog
.
exec
()
if
partitionDialog
.
getStatus
()
==
False
:
return
# automatically save annotations
self
.
saveLabelFile
()
self
.
saveFilestate
()
self
.
savePPlabel
(
mode
=
'auto'
)
# load box annotations
labeldict
=
{}
...
...
@@ -2319,11 +2321,6 @@ class MainWindow(QMainWindow):
# QMessageBox.information(self, "Information", msg)
# return
# data partition user input
partitionDialog
=
DataPartitionDialog
()
partitionDialog
.
exec
()
if
partitionDialog
.
getStatus
()
==
False
:
return
train_split
,
val_split
,
test_split
=
partitionDialog
.
getDataPartition
()
# check validate
...
...
@@ -2379,7 +2376,7 @@ class MainWindow(QMainWindow):
# save json
with
open
(
"{}/annotation.json"
.
format
(
self
.
lastOpenDir
),
"w"
,
encoding
=
'utf-8'
)
as
fid
:
fid
.
write
(
json
.
dumps
(
json_results
))
fid
.
write
(
json
.
dumps
(
json_results
,
ensure_ascii
=
False
))
msg
=
'JSON sucessfully saved in {}/annotation.json'
.
format
(
self
.
lastOpenDir
)
QMessageBox
.
information
(
self
,
"Information"
,
msg
)
...
...
PPOCRLabel/libs/dataPartitionDialog.py
浏览文件 @
1e6af3bb
...
...
@@ -18,8 +18,9 @@ import numpy as np
BB
=
QDialogButtonBox
class
DataPartitionDialog
(
QDialog
):
def
__init__
(
self
):
def
__init__
(
self
,
parent
=
None
):
super
().
__init__
()
self
.
parnet
=
parent
self
.
title
=
'DATA PARTITION'
self
.
train_ratio
=
70
...
...
@@ -34,6 +35,16 @@ class DataPartitionDialog(QDialog):
self
.
flag_accept
=
True
if
self
.
parnet
.
lang
==
'ch'
:
msg
=
"导出JSON前请保存所有图像的标注且关闭EXCEL!"
else
:
msg
=
"Please save all the annotations and close the EXCEL before exporting JSON!"
info_msg
=
QLabel
(
msg
,
self
)
info_msg
.
setWordWrap
(
True
)
info_msg
.
setStyleSheet
(
"color: red"
)
info_msg
.
setFont
(
QFont
(
'Arial'
,
12
))
train_lbl
=
QLabel
(
'Train split: '
,
self
)
train_lbl
.
setFont
(
QFont
(
'Arial'
,
15
))
val_lbl
=
QLabel
(
'Valid split: '
,
self
)
...
...
@@ -58,19 +69,20 @@ class DataPartitionDialog(QDialog):
self
.
test_input
.
setValidator
(
validator
)
gridlayout
=
QGridLayout
()
gridlayout
.
addWidget
(
train_lbl
,
0
,
0
)
gridlayout
.
addWidget
(
val_lbl
,
1
,
0
)
gridlayout
.
addWidget
(
test_lbl
,
2
,
0
)
gridlayout
.
addWidget
(
self
.
train_input
,
0
,
1
)
gridlayout
.
addWidget
(
self
.
val_input
,
1
,
1
)
gridlayout
.
addWidget
(
self
.
test_input
,
2
,
1
)
gridlayout
.
addWidget
(
info_msg
,
0
,
0
,
1
,
2
)
gridlayout
.
addWidget
(
train_lbl
,
1
,
0
)
gridlayout
.
addWidget
(
val_lbl
,
2
,
0
)
gridlayout
.
addWidget
(
test_lbl
,
3
,
0
)
gridlayout
.
addWidget
(
self
.
train_input
,
1
,
1
)
gridlayout
.
addWidget
(
self
.
val_input
,
2
,
1
)
gridlayout
.
addWidget
(
self
.
test_input
,
3
,
1
)
bb
=
BB
(
BB
.
Ok
|
BB
.
Cancel
,
Qt
.
Horizontal
,
self
)
bb
.
button
(
BB
.
Ok
).
setIcon
(
newIcon
(
'done'
))
bb
.
button
(
BB
.
Cancel
).
setIcon
(
newIcon
(
'undo'
))
bb
.
accepted
.
connect
(
self
.
validate
)
bb
.
rejected
.
connect
(
self
.
cancel
)
gridlayout
.
addWidget
(
bb
,
3
,
0
,
1
,
2
)
gridlayout
.
addWidget
(
bb
,
4
,
0
,
1
,
2
)
self
.
setLayout
(
gridlayout
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录