From a898305ca44ffd92bacac14048918fd4f56f7452 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Mon, 22 Feb 2021 20:53:39 +0800 Subject: [PATCH 1/2] fix issue 2072 --- deploy/cpp_infer/src/ocr_rec.cpp | 2 +- ppocr/data/imaug/make_shrink_map.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/deploy/cpp_infer/src/ocr_rec.cpp b/deploy/cpp_infer/src/ocr_rec.cpp index fa1e44ff7a..e16e02d423 100644 --- a/deploy/cpp_infer/src/ocr_rec.cpp +++ b/deploy/cpp_infer/src/ocr_rec.cpp @@ -76,7 +76,7 @@ void CRNNRecognizer::Run(std::vector>> boxes, float(*std::max_element(&predict_batch[n * predict_shape[2]], &predict_batch[(n + 1) * predict_shape[2]])); - if (argmax_idx > 0 && (!(i > 0 && argmax_idx == last_index))) { + if (argmax_idx > 0 && (!(i >= 0 && argmax_idx == last_index))) { score += max_value; count += 1; str_res.push_back(label_list_[argmax_idx]); diff --git a/ppocr/data/imaug/make_shrink_map.py b/ppocr/data/imaug/make_shrink_map.py index 03385e3e10..15e8afa05b 100644 --- a/ppocr/data/imaug/make_shrink_map.py +++ b/ppocr/data/imaug/make_shrink_map.py @@ -32,7 +32,6 @@ class MakeShrinkMap(object): text_polys, ignore_tags = self.validate_polygons(text_polys, ignore_tags, h, w) gt = np.zeros((h, w), dtype=np.float32) - # gt = np.zeros((1, h, w), dtype=np.float32) mask = np.ones((h, w), dtype=np.float32) for i in range(len(text_polys)): polygon = text_polys[i] From ca7be744dc5c9ffb877048cdfb0a0fca8320c2a1 Mon Sep 17 00:00:00 2001 From: Double_V Date: Wed, 24 Feb 2021 16:10:37 +0800 Subject: [PATCH 2/2] update ocr_rec.cpp --- deploy/cpp_infer/src/ocr_rec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/cpp_infer/src/ocr_rec.cpp b/deploy/cpp_infer/src/ocr_rec.cpp index e16e02d423..76873dad3c 100644 --- a/deploy/cpp_infer/src/ocr_rec.cpp +++ b/deploy/cpp_infer/src/ocr_rec.cpp @@ -76,7 +76,7 @@ void CRNNRecognizer::Run(std::vector>> boxes, float(*std::max_element(&predict_batch[n * predict_shape[2]], &predict_batch[(n + 1) * predict_shape[2]])); - if (argmax_idx > 0 && (!(i >= 0 && argmax_idx == last_index))) { + if (argmax_idx > 0 && (!(n > 0 && argmax_idx == last_index))) { score += max_value; count += 1; str_res.push_back(label_list_[argmax_idx]);