Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
411d764c
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
大约 1 年 前同步成功
通知
1528
Star
32962
Fork
6643
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
108
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
108
Issue
108
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
411d764c
编写于
8月 09, 2021
作者:
D
Daniel Yang
提交者:
GitHub
8月 09, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3388 from Wei-JL/dygraph
【SIG】增添打开当前正在标注的数据集文件夹
上级
4743843a
d656da7e
变更
5
展开全部
显示空白变更内容
内联
并排
Showing
5 changed file
with
11798 addition
and
11138 deletion
+11798
-11138
PPOCRLabel/PPOCRLabel.py
PPOCRLabel/PPOCRLabel.py
+102
-22
PPOCRLabel/libs/resources.py
PPOCRLabel/libs/resources.py
+11688
-11116
PPOCRLabel/resources.qrc
PPOCRLabel/resources.qrc
+2
-0
PPOCRLabel/resources/strings/strings-zh-CN.properties
PPOCRLabel/resources/strings/strings-zh-CN.properties
+3
-0
PPOCRLabel/resources/strings/strings.properties
PPOCRLabel/resources/strings/strings.properties
+3
-0
未找到文件。
PPOCRLabel/PPOCRLabel.py
浏览文件 @
411d764c
...
...
@@ -27,7 +27,12 @@ import json
import
cv2
__dir__
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
import
numpy
as
np
sys
.
path
.
append
(
__dir__
)
sys
.
path
.
append
(
os
.
path
.
abspath
(
os
.
path
.
join
(
__dir__
,
'../..'
)))
sys
.
path
.
append
(
".."
)
...
...
@@ -267,6 +272,8 @@ class MainWindow(QMainWindow, WindowMixin):
self
.
colorDialog
=
ColorDialog
(
parent
=
self
)
self
.
zoomWidgetValue
=
self
.
zoomWidget
.
value
()
self
.
msgBox
=
QMessageBox
()
########## thumbnail #########
hlayout
=
QHBoxLayout
()
m
=
(
0
,
0
,
0
,
0
)
...
...
@@ -360,6 +367,9 @@ class MainWindow(QMainWindow, WindowMixin):
opendir
=
action
(
getStr
(
'openDir'
),
self
.
openDirDialog
,
'Ctrl+u'
,
'open'
,
getStr
(
'openDir'
))
open_dataset_dir
=
action
(
getStr
(
'openDatasetDir'
),
self
.
openDatasetDirDialog
,
'Ctrl+p'
,
'open'
,
getStr
(
'openDatasetDir'
),
enabled
=
False
)
save
=
action
(
getStr
(
'save'
),
self
.
saveFile
,
'Ctrl+V'
,
'verify'
,
getStr
(
'saveDetail'
),
enabled
=
False
)
...
...
@@ -457,6 +467,12 @@ class MainWindow(QMainWindow, WindowMixin):
undoLastPoint
=
action
(
getStr
(
"undoLastPoint"
),
self
.
canvas
.
undoLastPoint
,
'Ctrl+Z'
,
"undo"
,
getStr
(
"undoLastPoint"
),
enabled
=
False
)
rotateLeft
=
action
(
getStr
(
"rotateLeft"
),
self
.
rotateLeftImg
,
'Ctrl+Alt+L'
,
"rotateLeft"
,
getStr
(
"rotateLeft"
),
enabled
=
False
)
rotateRight
=
action
(
getStr
(
"rotateRight"
),
self
.
rotateRightImg
,
'Ctrl+Alt+R'
,
"rotateRight"
,
getStr
(
"rotateRight"
),
enabled
=
False
)
undo
=
action
(
getStr
(
"undo"
),
self
.
undoShapeEdit
,
'Ctrl+Z'
,
"undo"
,
getStr
(
"undo"
),
enabled
=
False
)
...
...
@@ -520,13 +536,14 @@ class MainWindow(QMainWindow, WindowMixin):
zoom
=
zoom
,
zoomIn
=
zoomIn
,
zoomOut
=
zoomOut
,
zoomOrg
=
zoomOrg
,
fitWindow
=
fitWindow
,
fitWidth
=
fitWidth
,
zoomActions
=
zoomActions
,
saveLabel
=
saveLabel
,
undo
=
undo
,
undoLastPoint
=
undoLastPoint
,
undo
=
undo
,
undoLastPoint
=
undoLastPoint
,
open_dataset_dir
=
open_dataset_dir
,
rotateLeft
=
rotateLeft
,
rotateRight
=
rotateRight
,
fileMenuActions
=
(
opendir
,
saveLabel
,
resetAll
,
quit
),
opendir
,
open_dataset_dir
,
saveLabel
,
resetAll
,
quit
),
beginner
=
(),
advanced
=
(),
editMenu
=
(
createpoly
,
edit
,
copy
,
delete
,
singleRere
,
None
,
undo
,
undoLastPoint
,
None
,
color1
,
self
.
drawSquaresOption
),
beginnerContext
=
(
create
,
edit
,
copy
,
delete
,
singleRere
),
None
,
rotateLeft
,
rotateRight
,
None
,
color1
,
self
.
drawSquaresOption
),
beginnerContext
=
(
create
,
edit
,
copy
,
delete
,
singleRere
,
rotateLeft
,
rotateRight
,
),
advancedContext
=
(
createMode
,
editMode
,
edit
,
copy
,
delete
,
shapeLineColor
,
shapeFillColor
),
onLoadActive
=
(
...
...
@@ -564,7 +581,7 @@ class MainWindow(QMainWindow, WindowMixin):
self
.
autoSaveOption
.
triggered
.
connect
(
self
.
autoSaveFunc
)
addActions
(
self
.
menus
.
file
,
(
opendir
,
None
,
saveLabel
,
saveRec
,
self
.
autoSaveOption
,
None
,
resetAll
,
deleteImg
,
quit
))
(
opendir
,
open_dataset_dir
,
None
,
saveLabel
,
saveRec
,
self
.
autoSaveOption
,
None
,
resetAll
,
deleteImg
,
quit
))
addActions
(
self
.
menus
.
help
,
(
showKeys
,
showSteps
,
showInfo
))
addActions
(
self
.
menus
.
view
,
(
...
...
@@ -778,6 +795,48 @@ class MainWindow(QMainWindow, WindowMixin):
self
.
actions
.
create
.
setEnabled
(
False
)
self
.
actions
.
undoLastPoint
.
setEnabled
(
True
)
def
rotateImg
(
self
,
filename
,
k
,
_value
):
self
.
actions
.
rotateRight
.
setEnabled
(
_value
)
pix
=
cv2
.
imread
(
filename
)
pix
=
np
.
rot90
(
pix
,
k
)
cv2
.
imwrite
(
filename
,
pix
)
self
.
canvas
.
update
()
self
.
loadFile
(
filename
)
def
rotateImgWarn
(
self
):
if
self
.
lang
==
'ch'
:
self
.
msgBox
.
warning
(
self
,
"提示"
,
"
\n
该图片已经有标注框,旋转操作会打乱标注,建议清除标注框后旋转。"
)
else
:
self
.
msgBox
.
warning
(
self
,
"Warn"
,
"
\n
The picture already has a label box, and rotation will disrupt the label.
\
It is recommended to clear the label box and rotate it."
)
def
rotateLeftImg
(
self
,
_value
=
False
):
filename
=
self
.
mImgList
[
self
.
currIndex
]
if
os
.
path
.
exists
(
filename
):
if
self
.
itemsToShapesbox
:
self
.
rotateImgWarn
()
else
:
self
.
rotateImg
(
filename
=
filename
,
k
=
1
,
_value
=
True
)
else
:
self
.
rotateImgWarn
()
self
.
actions
.
rotateRight
.
setEnabled
(
False
)
def
rotateRightImg
(
self
,
_value
=
False
):
filename
=
self
.
mImgList
[
self
.
currIndex
]
if
os
.
path
.
exists
(
filename
):
if
self
.
itemsToShapesbox
:
self
.
rotateImgWarn
()
else
:
self
.
rotateImg
(
filename
=
filename
,
k
=-
1
,
_value
=
True
)
else
:
self
.
rotateImgWarn
()
self
.
actions
.
rotateRight
.
setEnabled
(
False
)
def
toggleDrawingSensitive
(
self
,
drawing
=
True
):
"""In the middle of drawing, toggling between modes should be disabled."""
self
.
actions
.
editMode
.
setEnabled
(
not
drawing
)
...
...
@@ -1423,6 +1482,7 @@ class MainWindow(QMainWindow, WindowMixin):
def
loadRecent
(
self
,
filename
):
if
self
.
mayContinue
():
print
(
filename
,
"======"
)
self
.
loadFile
(
filename
)
def
scanAllImages
(
self
,
folderPath
):
...
...
@@ -1458,6 +1518,22 @@ class MainWindow(QMainWindow, WindowMixin):
self
.
lastOpenDir
=
targetDirPath
self
.
importDirImages
(
targetDirPath
)
def
openDatasetDirDialog
(
self
,):
if
not
self
.
mayContinue
():
return
if
self
.
lastOpenDir
and
os
.
path
.
exists
(
self
.
lastOpenDir
):
os
.
startfile
(
self
.
lastOpenDir
)
defaultOpenDirPath
=
self
.
lastOpenDir
else
:
if
self
.
lang
==
'ch'
:
self
.
msgBox
.
warning
(
self
,
"提示"
,
"
\n
原文件夹已不存在,请从新选择数据集路径!"
)
else
:
self
.
msgBox
.
warning
(
self
,
"Warn"
,
"
\n
The original folder no longer exists, please choose the data set path again!"
)
self
.
actions
.
open_dataset_dir
.
setEnabled
(
False
)
defaultOpenDirPath
=
os
.
path
.
dirname
(
self
.
filePath
)
if
self
.
filePath
else
'.'
def
importDirImages
(
self
,
dirpath
,
isDelete
=
False
):
if
not
self
.
mayContinue
()
or
not
dirpath
:
return
...
...
@@ -1505,6 +1581,10 @@ class MainWindow(QMainWindow, WindowMixin):
self
.
reRecogButton
.
setEnabled
(
True
)
self
.
actions
.
AutoRec
.
setEnabled
(
True
)
self
.
actions
.
reRec
.
setEnabled
(
True
)
self
.
actions
.
open_dataset_dir
.
setEnabled
(
True
)
self
.
actions
.
rotateLeft
.
setEnabled
(
True
)
self
.
actions
.
rotateRight
.
setEnabled
(
True
)
def
openPrevImg
(
self
,
_value
=
False
):
...
...
PPOCRLabel/libs/resources.py
浏览文件 @
411d764c
此差异已折叠。
点击以展开。
PPOCRLabel/resources.qrc
浏览文件 @
411d764c
...
...
@@ -18,6 +18,8 @@
<file
alias=
"quit"
>
resources/icons/quit.png
</file>
<file
alias=
"copy"
>
resources/icons/copy.png
</file>
<file
alias=
"edit"
>
resources/icons/edit.png
</file>
<file
alias=
"rotateLeft"
>
resources/icons/rotateLeft.png
</file>
<file
alias=
"rotateRight"
>
resources/icons/rotateRight.png
</file>
<file
alias=
"open"
>
resources/icons/open.png
</file>
<file
alias=
"save"
>
resources/icons/save.png
</file>
<file
alias=
"format_voc"
>
resources/icons/format_voc.png
</file>
...
...
PPOCRLabel/resources/strings/strings-zh-CN.properties
浏览文件 @
411d764c
...
...
@@ -31,6 +31,7 @@ save=确认
saveAs
=
另存为
fitWinDetail
=
缩放到当前窗口大小
openDir
=
打开目录
openDatasetDir
=
打开数据集路径
copyPrevBounding
=
复制当前图像中的上一个边界框
showHide
=
显示/隐藏标签
changeSaveFormat
=
更改存储格式
...
...
@@ -85,6 +86,8 @@ detectionBoxposition=检测框位置
recognitionResult
=
识别结果
creatPolygon
=
四点标注
drawSquares
=
正方形标注
rotateLeft
=
图片左旋转90度
rotateRight
=
图片右旋转90度
saveRec
=
保存识别结果
tempLabel
=
待识别
nullLabel
=
无法识别
...
...
PPOCRLabel/resources/strings/strings.properties
浏览文件 @
411d764c
...
...
@@ -3,6 +3,7 @@ openFileDetail=Open image or label file
quit
=
Quit
quitApp
=
Quit application
openDir
=
Open Dir
openDatasetDir
=
Open DatasetDir
copyPrevBounding
=
Copy previous Bounding Boxes in the current image
changeSavedAnnotationDir
=
Change default saved Annotation dir
openAnnotation
=
Open Annotation
...
...
@@ -84,6 +85,8 @@ iconList=Icon List
detectionBoxposition
=
Detection box position
recognitionResult
=
Recognition result
creatPolygon
=
Create Quadrilateral
rotateLeft
=
Left turn 90 degrees
rotateRight
=
Right turn 90 degrees
drawSquares
=
Draw Squares
saveRec
=
Save Recognition Result
tempLabel
=
TEMPORARY
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录