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
1effa5f3
Commit
1effa5f3
authored
Sep 27, 2021
by
tink2123
Browse files
rm anno
parent
3c906d41
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 addition
and
14 deletions
+1
-14
ppocr/data/imaug/label_ops.py
ppocr/data/imaug/label_ops.py
+1
-1
ppocr/modeling/backbones/rec_resnet_aster.py
ppocr/modeling/backbones/rec_resnet_aster.py
+0
-7
ppocr/modeling/heads/rec_aster_head.py
ppocr/modeling/heads/rec_aster_head.py
+0
-1
ppocr/modeling/transforms/tps_spatial_transformer.py
ppocr/modeling/transforms/tps_spatial_transformer.py
+0
-5
No files found.
ppocr/data/imaug/label_ops.py
View file @
1effa5f3
...
...
@@ -369,7 +369,7 @@ class SEEDLabelEncode(BaseRecLabelEncode):
return
None
if
len
(
text
)
>=
self
.
max_text_len
:
return
None
data
[
'length'
]
=
np
.
array
(
len
(
text
))
+
1
# conclue eos
data
[
'length'
]
=
np
.
array
(
len
(
text
))
+
1
# conclu
d
e eos
text
=
text
+
[
len
(
self
.
character
)
-
1
]
*
(
self
.
max_text_len
-
len
(
text
)
)
data
[
'label'
]
=
np
.
array
(
text
)
...
...
ppocr/modeling/backbones/rec_resnet_aster.py
View file @
1effa5f3
...
...
@@ -138,10 +138,3 @@ class ResNet_ASTER(nn.Layer):
return
rnn_feat
else
:
return
cnn_feat
if
__name__
==
"__main__"
:
x
=
paddle
.
randn
([
3
,
3
,
32
,
100
])
net
=
ResNet_ASTER
()
encoder_feat
=
net
(
x
)
print
(
encoder_feat
.
shape
)
ppocr/modeling/heads/rec_aster_head.py
View file @
1effa5f3
...
...
@@ -150,7 +150,6 @@ class AttentionRecognitionHead(nn.Layer):
# https://github.com/IBM/pytorch-seq2seq/blob/fede87655ddce6c94b38886089e05321dc9802af/seq2seq/models/TopKDecoder.py
batch_size
,
l
,
d
=
x
.
shape
# inflated_encoder_feats = _inflate(encoder_feats, beam_width, 0) # ABC --> AABBCC -/-> ABCABC
x
=
paddle
.
tile
(
paddle
.
transpose
(
x
.
unsqueeze
(
1
),
perm
=
[
1
,
0
,
2
,
3
]),
[
beam_width
,
1
,
1
,
1
])
...
...
ppocr/modeling/transforms/tps_spatial_transformer.py
View file @
1effa5f3
...
...
@@ -63,8 +63,6 @@ def build_output_control_points(num_control_points, margins):
ctrl_pts_y_bottom
=
np
.
ones
(
num_ctrl_pts_per_side
)
*
(
1.0
-
margin_y
)
ctrl_pts_top
=
np
.
stack
([
ctrl_pts_x
,
ctrl_pts_y_top
],
axis
=
1
)
ctrl_pts_bottom
=
np
.
stack
([
ctrl_pts_x
,
ctrl_pts_y_bottom
],
axis
=
1
)
# ctrl_pts_top = ctrl_pts_top[1:-1,:]
# ctrl_pts_bottom = ctrl_pts_bottom[1:-1,:]
output_ctrl_pts_arr
=
np
.
concatenate
(
[
ctrl_pts_top
,
ctrl_pts_bottom
],
axis
=
0
)
output_ctrl_pts
=
paddle
.
to_tensor
(
output_ctrl_pts_arr
)
...
...
@@ -85,7 +83,6 @@ class TPSSpatialTransformer(nn.Layer):
target_control_points
=
build_output_control_points
(
num_control_points
,
margins
)
N
=
num_control_points
# N = N - 4
# create padded kernel matrix
forward_kernel
=
paddle
.
zeros
(
shape
=
[
N
+
3
,
N
+
3
])
...
...
@@ -112,7 +109,6 @@ class TPSSpatialTransformer(nn.Layer):
target_coordinate
=
paddle
.
to_tensor
(
target_coordinate
)
# HW x 2
Y
,
X
=
paddle
.
split
(
target_coordinate
,
target_coordinate
.
shape
[
1
],
axis
=
1
)
#Y, X = target_coordinate.split(1, dim = 1)
Y
=
Y
/
(
self
.
target_height
-
1
)
X
=
X
/
(
self
.
target_width
-
1
)
target_coordinate
=
paddle
.
concat
(
...
...
@@ -136,7 +132,6 @@ class TPSSpatialTransformer(nn.Layer):
assert
source_control_points
.
ndimension
()
==
3
assert
source_control_points
.
shape
[
1
]
==
self
.
num_control_points
assert
source_control_points
.
shape
[
2
]
==
2
#batch_size = source_control_points.shape[0]
batch_size
=
paddle
.
shape
(
source_control_points
)[
0
]
self
.
padding_matrix
=
paddle
.
expand
(
...
...
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