From a1cb2782f014db2e35c8aa60e1cbc96ce2c149c9 Mon Sep 17 00:00:00 2001 From: Andrii Minets <124877173+HyenaSeba@users.noreply.github.com> Date: Thu, 16 May 2024 19:38:33 +0300 Subject: [PATCH 1/2] Update utils.py Added new ValueError to reformat_input_batched function. The old version would raise "The input image array contains images of different sizes." even if the array is empty which would misled the debug process. --- easyocr/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/easyocr/utils.py b/easyocr/utils.py index 987baf2c9..38a5bb9dd 100644 --- a/easyocr/utils.py +++ b/easyocr/utils.py @@ -779,6 +779,8 @@ def reformat_input_batched(image, n_width=None, n_height=None): list of byte stream objects] """ if ((isinstance(image, np.ndarray) and len(image.shape) == 4) or isinstance(image, list)): + if len(image) == 0: + raise ValueError("The input image array is empty." # process image batches if image is list of image np arr, paths, bytes img, img_cv_grey = [], [] for single_img in image: From fe1bea3f631cd0e3113609a7cbec8018eb7379a0 Mon Sep 17 00:00:00 2001 From: Andrii Minets <124877173+HyenaSeba@users.noreply.github.com> Date: Fri, 17 May 2024 12:10:57 +0300 Subject: [PATCH 2/2] Update utils.py Missed closing bracket --- easyocr/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easyocr/utils.py b/easyocr/utils.py index 38a5bb9dd..3c44c3333 100644 --- a/easyocr/utils.py +++ b/easyocr/utils.py @@ -780,7 +780,7 @@ def reformat_input_batched(image, n_width=None, n_height=None): """ if ((isinstance(image, np.ndarray) and len(image.shape) == 4) or isinstance(image, list)): if len(image) == 0: - raise ValueError("The input image array is empty." + raise ValueError("The input image array is empty.") # process image batches if image is list of image np arr, paths, bytes img, img_cv_grey = [], [] for single_img in image: