From 38192934aceed39afeddd31a9bf8fcca6bfc4184 Mon Sep 17 00:00:00 2001 From: zhangxin Date: Wed, 24 Jun 2020 19:42:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=89=E5=87=A0=E8=A1=8C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E7=94=A8=E6=96=B0=E7=9A=84=E4=BB=A3=E7=A0=81=EF=BC=8C=E6=97=A7?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B3=A8=E9=87=8A=E4=BA=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/infer/predict_rec.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/infer/predict_rec.py b/tools/infer/predict_rec.py index 06625eaf..5ec3cc60 100755 --- a/tools/infer/predict_rec.py +++ b/tools/infer/predict_rec.py @@ -64,11 +64,11 @@ class TextRecognizer(object): def __call__(self, img_list): img_num = len(img_list) - # 统计所有文本条的宽高比 + # Calculate the aspect ratio of all text bars width_list = [] for img in img_list: width_list.append(img.shape[1] / float(img.shape[0])) - # 对于文本框比较多且长短差异较大的情况下,通过排序再组合batch可以明显加速识别 + # Sorting can be accelerated indices = np.argsort(np.array(width_list)) # rec_res = [] @@ -80,13 +80,13 @@ class TextRecognizer(object): norm_img_batch = [] max_wh_ratio = 0 for ino in range(beg_img_no, end_img_no): - h, w = img_list[ino].shape[0:2] - # h, w = img_list[indices[ino]].shape[0:2] + # h, w = img_list[ino].shape[0:2] + h, w = img_list[indices[ino]].shape[0:2] wh_ratio = w * 1.0 / h max_wh_ratio = max(max_wh_ratio, wh_ratio) for ino in range(beg_img_no, end_img_no): - norm_img = self.resize_norm_img(img_list[ino], max_wh_ratio) - # norm_img = self.resize_norm_img(img_list[indices[ino]], max_wh_ratio) + # norm_img = self.resize_norm_img(img_list[ino], max_wh_ratio) + norm_img = self.resize_norm_img(img_list[indices[ino]], max_wh_ratio) norm_img = norm_img[np.newaxis, :] norm_img_batch.append(norm_img) norm_img_batch = np.concatenate(norm_img_batch) -- GitLab