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
e33e38d1
Commit
e33e38d1
authored
Jun 16, 2020
by
LDOUBLEV
Browse files
add error message when image shape are not divisible by 4
parent
a5f1efdf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
15 deletions
+10
-15
ppocr/modeling/architectures/det_model.py
ppocr/modeling/architectures/det_model.py
+10
-15
No files found.
ppocr/modeling/architectures/det_model.py
View file @
e33e38d1
...
...
@@ -59,28 +59,23 @@ class DetModel(object):
return: (image, corresponding label, dataloader)
"""
image_shape
=
deepcopy
(
self
.
image_shape
)
if
image_shape
[
1
]
%
4
!=
0
or
image_shape
[
2
]
%
4
!=
0
:
raise
Exception
(
"The size of the image must be divisible by 4, "
"received image shape is {}, please reset the "
"Global.image_shape in the yml file"
.
format
(
image_shape
))
image
=
fluid
.
layers
.
data
(
name
=
'image'
,
shape
=
image_shape
,
dtype
=
'float32'
)
if
mode
==
"train"
:
if
self
.
algorithm
==
"EAST"
:
h
,
w
=
int
(
image_shape
[
1
]
//
4
),
int
(
image_shape
[
2
]
//
4
)
score
=
fluid
.
layers
.
data
(
name
=
'score'
,
shape
=
[
1
,
int
(
image_shape
[
1
]
//
4
),
int
(
image_shape
[
2
]
//
4
)
],
dtype
=
'float32'
)
name
=
'score'
,
shape
=
[
1
,
h
,
w
],
dtype
=
'float32'
)
geo
=
fluid
.
layers
.
data
(
name
=
'geo'
,
shape
=
[
9
,
int
(
image_shape
[
1
]
//
4
),
int
(
image_shape
[
2
]
//
4
)
],
dtype
=
'float32'
)
name
=
'geo'
,
shape
=
[
9
,
h
,
w
],
dtype
=
'float32'
)
mask
=
fluid
.
layers
.
data
(
name
=
'mask'
,
shape
=
[
1
,
int
(
image_shape
[
1
]
//
4
),
int
(
image_shape
[
2
]
//
4
)
],
dtype
=
'float32'
)
name
=
'mask'
,
shape
=
[
1
,
h
,
w
],
dtype
=
'float32'
)
feed_list
=
[
image
,
score
,
geo
,
mask
]
labels
=
{
'score'
:
score
,
'geo'
:
geo
,
'mask'
:
mask
}
elif
self
.
algorithm
==
"DB"
:
...
...
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