From 9faa8c523d9408f4284a959880a3ae11d3f58a86 Mon Sep 17 00:00:00 2001 From: Zhao Zuohong Date: Sat, 30 Sep 2023 18:48:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E9=80=89=E4=BA=BA=E7=95=8C=E9=9D=A2Pa?= =?UTF-8?q?ddleOCR=E8=AF=86=E5=88=AB=E7=BB=93=E6=9E=9C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=A3=80=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arknights_mower/utils/character_recognize.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/arknights_mower/utils/character_recognize.py b/arknights_mower/utils/character_recognize.py index a7c060ca9..3b7ede38d 100644 --- a/arknights_mower/utils/character_recognize.py +++ b/arknights_mower/utils/character_recognize.py @@ -173,10 +173,11 @@ def agent(img, draw=False): ret_succ.append(poly) continue if len(res := arknights_mower.utils.paddleocr.ocr(__img)[1]) > 0: - logger.debug(f"PaddleOCR识别结果:{res[0]}") - ret_agent.append(res[0][0]) - ret_succ.append(poly) - continue + logger.debug(f"PaddleOCR识别结果:{res}") + if op_name := next((r[0] for r in res if r[0] in agent_list), None): + ret_agent.append(op_name) + ret_succ.append(poly) + continue res = sift_recog(__img, resolution, draw) if (res is not None) and res in agent_list: ret_agent.append(res) @@ -191,10 +192,11 @@ def agent(img, draw=False): if 80 <= np.min(__img): continue if len(res := arknights_mower.utils.paddleocr.ocr(__img)[1]) > 0: - logger.debug(f"PaddleOCR识别结果:{res[0]}") - ret_agent.append(res[0][0]) - ret_succ.append(poly) - continue + logger.debug(f"PaddleOCR识别结果:{res}") + if op_name := next((r[0] for r in res if r[0] in agent_list), None): + ret_agent.append(op_name) + ret_succ.append(poly) + continue res = sift_recog(__img, resolution, draw) if res is not None: ret_agent.append(res)