Skip to content

Commit

Permalink
Merge pull request #1984 from WenmuZhou/update_reqire
Browse files Browse the repository at this point in the history
[cherry-pick] predict_rec support rare and fix rare export error
  • Loading branch information
WenmuZhou authored Feb 8, 2021
2 parents 890546c + 4dfc583 commit 364a777
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ppocr/modeling/heads/rec_att_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ def forward(self, inputs, targets=None, batch_max_length=25):
else:
targets = paddle.zeros(shape=[batch_size], dtype="int32")
probs = None
char_onehots = None
outputs = None
alpha = None

for i in range(num_steps):
char_onehots = self._char_to_onehot(
Expand Down
7 changes: 7 additions & 0 deletions tools/infer/predict_rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ def __init__(self, args):
"character_dict_path": args.rec_char_dict_path,
"use_space_char": args.use_space_char
}
elif self.rec_algorithm == "RARE":
postprocess_params = {
'name': 'AttnLabelDecode',
"character_type": args.rec_char_type,
"character_dict_path": args.rec_char_dict_path,
"use_space_char": args.use_space_char
}
self.postprocess_op = build_post_process(postprocess_params)
self.predictor, self.input_tensor, self.output_tensors = \
utility.create_predictor(args, 'rec', logger)
Expand Down

0 comments on commit 364a777

Please sign in to comment.