Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
2365c70e
Commit
2365c70e
authored
Apr 21, 2021
by
Jethong
Browse files
fix dataset
parent
243bd994
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
ppocr/data/pgnet_dataset.py
ppocr/data/pgnet_dataset.py
+5
-3
No files found.
ppocr/data/pgnet_dataset.py
View file @
2365c70e
...
@@ -72,6 +72,7 @@ class PGDataSet(Dataset):
...
@@ -72,6 +72,7 @@ class PGDataSet(Dataset):
def
__getitem__
(
self
,
idx
):
def
__getitem__
(
self
,
idx
):
file_idx
=
self
.
data_idx_order_list
[
idx
]
file_idx
=
self
.
data_idx_order_list
[
idx
]
data_line
=
self
.
data_lines
[
file_idx
]
data_line
=
self
.
data_lines
[
file_idx
]
img_id
=
0
try
:
try
:
data_line
=
data_line
.
decode
(
'utf-8'
)
data_line
=
data_line
.
decode
(
'utf-8'
)
substr
=
data_line
.
strip
(
"
\n
"
).
split
(
self
.
delimiter
)
substr
=
data_line
.
strip
(
"
\n
"
).
split
(
self
.
delimiter
)
...
@@ -79,8 +80,9 @@ class PGDataSet(Dataset):
...
@@ -79,8 +80,9 @@ class PGDataSet(Dataset):
label
=
substr
[
1
]
label
=
substr
[
1
]
img_path
=
os
.
path
.
join
(
self
.
data_dir
,
file_name
)
img_path
=
os
.
path
.
join
(
self
.
data_dir
,
file_name
)
if
self
.
mode
.
lower
()
==
'eval'
:
if
self
.
mode
.
lower
()
==
'eval'
:
try
:
img_id
=
int
(
data_line
.
split
(
"."
)[
0
][
7
:])
img_id
=
int
(
data_line
.
split
(
"."
)[
0
][
7
:])
else
:
except
:
img_id
=
0
img_id
=
0
data
=
{
'img_path'
:
img_path
,
'label'
:
label
,
'img_id'
:
img_id
}
data
=
{
'img_path'
:
img_path
,
'label'
:
label
,
'img_id'
:
img_id
}
if
not
os
.
path
.
exists
(
img_path
):
if
not
os
.
path
.
exists
(
img_path
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment