diff --git a/test_tipc/configs/rec_r34_vd_tps_bilstm_att_v2.0/train_infer_python.txt b/test_tipc/configs/rec_r34_vd_tps_bilstm_att_v2.0/train_infer_python.txt index 9cee5d0b7d01eb5ae04c6ae9fef9990d3788a741..55e937881bec1852fade4f99d81a319b8b2c5b67 100644 --- a/test_tipc/configs/rec_r34_vd_tps_bilstm_att_v2.0/train_infer_python.txt +++ b/test_tipc/configs/rec_r34_vd_tps_bilstm_att_v2.0/train_infer_python.txt @@ -37,7 +37,7 @@ export2:null train_model:./inference/rec_r34_vd_tps_bilstm_att_v2.0_train/best_accuracy infer_export:tools/export_model.py -c test_tipc/configs/rec_r34_vd_tps_bilstm_att_v2.0/rec_r34_vd_tps_bilstm_att.yml -o infer_quant:False -inference:tools/infer/predict_rec.py --rec_char_dict_path=./ppocr/utils/ic15_dict.txt --rec_image_shape="3,32,100" --rec_algorithm="RARE" +inference:tools/infer/predict_rec.py --rec_char_dict_path=./ppocr/utils/ic15_dict.txt --rec_image_shape="3,32,100" --rec_algorithm="RARE" --min_subgraph_size=5 --use_gpu:True|False --enable_mkldnn:True|False --cpu_threads:1|6 diff --git a/tools/infer/predict_rec.py b/tools/infer/predict_rec.py index eebb2b3ba4a1489512de3b977ddf9f1ef8f67ec1..c5aacb060060068ec4b0b9432b2fb045aaff0370 100755 --- a/tools/infer/predict_rec.py +++ b/tools/infer/predict_rec.py @@ -119,6 +119,10 @@ class TextRecognizer(object): resized_w = imgW else: resized_w = int(math.ceil(imgH * ratio)) + if self.rec_algorithm == 'RARE': + if resized_w > self.rec_image_shape[2]: + resized_w = self.rec_image_shape[2] + imgW = self.rec_image_shape[2] resized_image = cv2.resize(img, (resized_w, imgH)) resized_image = resized_image.astype('float32') resized_image = resized_image.transpose((2, 0, 1)) / 255 diff --git a/tools/infer/utility.py b/tools/infer/utility.py index fd2605d963db38ed74908f4e069fa480cfd01baf..b16aecd496ec291fcbe9c66dccf3ec04bb662034 100644 --- a/tools/infer/utility.py +++ b/tools/infer/utility.py @@ -323,6 +323,10 @@ def get_output_tensors(args, mode, predictor): output_name = 'softmax_0.tmp_0' if output_name in output_names: return [predictor.get_output_handle(output_name)] + else: + for output_name in output_names: + output_tensor = predictor.get_output_handle(output_name) + output_tensors.append(output_tensor) else: for output_name in output_names: output_tensor = predictor.get_output_handle(output_name)