From 535d3b45016ca0fd93b9c9056c47e1b6c400b687 Mon Sep 17 00:00:00 2001 From: UserUnknownFactor <63057995+UserUnknownFactor@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:46:29 +0300 Subject: [PATCH] Don't break overall processing on a bad image (#10216) --- paddleocr.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/paddleocr.py b/paddleocr.py index 36980aec4..afb1059a8 100644 --- a/paddleocr.py +++ b/paddleocr.py @@ -635,14 +635,12 @@ class PaddleOCR(predict_system.TextSystem): def ocr(self, img, det=True, rec=True, cls=True, bin=False, inv=False, alpha_color=(255, 255, 255)): """ OCR with PaddleOCR + args: img: img for OCR, support ndarray, img_path and list or ndarray det: use text detection or not. If False, only rec will be exec. Default is True rec: use text recognition or not. If False, only det will be exec. Default is True cls: use angle classifier or not. Default is True. If True, the text with rotation of 180 degrees can be recognized. If no text is rotated by 180 degrees, use cls=False to get better performance. Text with rotation of 90 or 270 degrees can be recognized even if cls=False. - bin: binarize image to black and white. Default is False. - inv: invert image colors. Default is False. - alpha_color: set RGB color Tuple for transparent parts replacement. Default is pure white. """ assert isinstance(img, (np.ndarray, list, str, bytes)) if isinstance(img, list) and det == True: