Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
23eb335d
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看板
提交
23eb335d
编写于
1月 12, 2022
作者:
文幕地方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add need_reset to dataset
上级
f671f133
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
4 deletion
+16
-4
ppocr/data/lmdb_dataset.py
ppocr/data/lmdb_dataset.py
+3
-0
ppocr/data/pgnet_dataset.py
ppocr/data/pgnet_dataset.py
+2
-0
ppocr/data/pubtab_dataset.py
ppocr/data/pubtab_dataset.py
+11
-4
未找到文件。
ppocr/data/lmdb_dataset.py
浏览文件 @
23eb335d
...
@@ -38,6 +38,9 @@ class LMDBDataSet(Dataset):
...
@@ -38,6 +38,9 @@ class LMDBDataSet(Dataset):
np
.
random
.
shuffle
(
self
.
data_idx_order_list
)
np
.
random
.
shuffle
(
self
.
data_idx_order_list
)
self
.
ops
=
create_operators
(
dataset_config
[
'transforms'
],
global_config
)
self
.
ops
=
create_operators
(
dataset_config
[
'transforms'
],
global_config
)
ratio_list
=
dataset_config
.
get
(
"ratio_list"
,
[
1.0
])
self
.
need_reset
=
True
in
[
x
<
1
for
x
in
ratio_list
]
def
load_hierarchical_lmdb_dataset
(
self
,
data_dir
):
def
load_hierarchical_lmdb_dataset
(
self
,
data_dir
):
lmdb_sets
=
{}
lmdb_sets
=
{}
dataset_idx
=
0
dataset_idx
=
0
...
...
ppocr/data/pgnet_dataset.py
浏览文件 @
23eb335d
...
@@ -49,6 +49,8 @@ class PGDataSet(Dataset):
...
@@ -49,6 +49,8 @@ class PGDataSet(Dataset):
self
.
ops
=
create_operators
(
dataset_config
[
'transforms'
],
global_config
)
self
.
ops
=
create_operators
(
dataset_config
[
'transforms'
],
global_config
)
self
.
need_reset
=
True
in
[
x
<
1
for
x
in
ratio_list
]
def
shuffle_data_random
(
self
):
def
shuffle_data_random
(
self
):
if
self
.
do_shuffle
:
if
self
.
do_shuffle
:
random
.
seed
(
self
.
seed
)
random
.
seed
(
self
.
seed
)
...
...
ppocr/data/pubtab_dataset.py
浏览文件 @
23eb335d
...
@@ -53,6 +53,9 @@ class PubTabDataSet(Dataset):
...
@@ -53,6 +53,9 @@ class PubTabDataSet(Dataset):
self
.
shuffle_data_random
()
self
.
shuffle_data_random
()
self
.
ops
=
create_operators
(
dataset_config
[
'transforms'
],
global_config
)
self
.
ops
=
create_operators
(
dataset_config
[
'transforms'
],
global_config
)
ratio_list
=
dataset_config
.
get
(
"ratio_list"
,
[
1.0
])
self
.
need_reset
=
True
in
[
x
<
1
for
x
in
ratio_list
]
def
shuffle_data_random
(
self
):
def
shuffle_data_random
(
self
):
if
self
.
do_shuffle
:
if
self
.
do_shuffle
:
random
.
seed
(
self
.
seed
)
random
.
seed
(
self
.
seed
)
...
@@ -70,7 +73,7 @@ class PubTabDataSet(Dataset):
...
@@ -70,7 +73,7 @@ class PubTabDataSet(Dataset):
prob
=
self
.
img_select_prob
[
file_name
]
prob
=
self
.
img_select_prob
[
file_name
]
if
prob
<
random
.
uniform
(
0
,
1
):
if
prob
<
random
.
uniform
(
0
,
1
):
select_flag
=
False
select_flag
=
False
if
self
.
table_select_type
:
if
self
.
table_select_type
:
structure
=
info
[
'html'
][
'structure'
][
'tokens'
].
copy
()
structure
=
info
[
'html'
][
'structure'
][
'tokens'
].
copy
()
structure_str
=
''
.
join
(
structure
)
structure_str
=
''
.
join
(
structure
)
...
@@ -79,13 +82,17 @@ class PubTabDataSet(Dataset):
...
@@ -79,13 +82,17 @@ class PubTabDataSet(Dataset):
table_type
=
"complex"
table_type
=
"complex"
if
table_type
==
"complex"
:
if
table_type
==
"complex"
:
if
self
.
table_select_prob
<
random
.
uniform
(
0
,
1
):
if
self
.
table_select_prob
<
random
.
uniform
(
0
,
1
):
select_flag
=
False
select_flag
=
False
if
select_flag
:
if
select_flag
:
cells
=
info
[
'html'
][
'cells'
].
copy
()
cells
=
info
[
'html'
][
'cells'
].
copy
()
structure
=
info
[
'html'
][
'structure'
].
copy
()
structure
=
info
[
'html'
][
'structure'
].
copy
()
img_path
=
os
.
path
.
join
(
self
.
data_dir
,
file_name
)
img_path
=
os
.
path
.
join
(
self
.
data_dir
,
file_name
)
data
=
{
'img_path'
:
img_path
,
'cells'
:
cells
,
'structure'
:
structure
}
data
=
{
'img_path'
:
img_path
,
'cells'
:
cells
,
'structure'
:
structure
}
if
not
os
.
path
.
exists
(
img_path
):
if
not
os
.
path
.
exists
(
img_path
):
raise
Exception
(
"{} does not exist!"
.
format
(
img_path
))
raise
Exception
(
"{} does not exist!"
.
format
(
img_path
))
with
open
(
data
[
'img_path'
],
'rb'
)
as
f
:
with
open
(
data
[
'img_path'
],
'rb'
)
as
f
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录