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
053cc43d
"...resnet50_tensorflow.git" did not exist on "e608245823f7d3cf0e597245246f897463ea93bc"
Commit
053cc43d
authored
Jun 22, 2021
by
MissPenguin
Browse files
refine
parent
c0492e02
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
15 deletions
+4
-15
ppocr/modeling/heads/rec_srn_head.py
ppocr/modeling/heads/rec_srn_head.py
+2
-1
tools/program.py
tools/program.py
+2
-14
No files found.
ppocr/modeling/heads/rec_srn_head.py
View file @
053cc43d
...
...
@@ -250,7 +250,8 @@ class SRNHead(nn.Layer):
self
.
gsrm
.
wrap_encoder1
.
prepare_decoder
.
emb0
=
self
.
gsrm
.
wrap_encoder0
.
prepare_decoder
.
emb0
def
forward
(
self
,
inputs
,
others
):
def
forward
(
self
,
inputs
,
targets
=
None
):
others
=
targets
[
-
4
:]
encoder_word_pos
=
others
[
0
]
gsrm_word_pos
=
others
[
1
]
gsrm_slf_attn_bias1
=
others
[
2
]
...
...
tools/program.py
View file @
053cc43d
...
...
@@ -209,14 +209,8 @@ def train(config,
lr
=
optimizer
.
get_lr
()
images
=
batch
[
0
]
if
use_srn
:
others
=
batch
[
-
4
:]
preds
=
model
(
images
,
others
)
model_average
=
True
elif
model_type
==
"table"
:
others
=
batch
[
1
:]
preds
=
model
(
images
,
others
)
else
:
preds
=
model
(
images
)
preds
=
model
(
images
,
data
=
batch
[
1
:])
loss
=
loss_class
(
preds
,
batch
)
avg_loss
=
loss
[
'loss'
]
avg_loss
.
backward
()
...
...
@@ -358,13 +352,7 @@ def eval(model, valid_dataloader, post_process_class, eval_class,
break
images
=
batch
[
0
]
start
=
time
.
time
()
if
use_srn
:
others
=
batch
[
-
4
:]
preds
=
model
(
images
,
others
)
else
:
preds
=
model
(
images
)
preds
=
model
(
images
,
data
=
batch
[
1
:])
batch
=
[
item
.
numpy
()
for
item
in
batch
]
# Obtain usable results from post-processing methods
total_time
+=
time
.
time
()
-
start
...
...
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