From d3f78558fffdb4fdbac14311f9a4f0b658c5182b Mon Sep 17 00:00:00 2001 From: RayVik Date: Thu, 27 Apr 2023 15:49:32 +0300 Subject: [PATCH] Fix bug with unicode filenames --- deepface/commons/functions.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deepface/commons/functions.py b/deepface/commons/functions.py index 81a2753..515ab17 100644 --- a/deepface/commons/functions.py +++ b/deepface/commons/functions.py @@ -103,7 +103,12 @@ def load_image(img): if os.path.isfile(img) is not True: raise ValueError(f"Confirm that {img} exists") - return cv2.imread(img) + img = open(img, "rb") + chunk = img.read() + chunk_arr = np.frombuffer(chunk, dtype=np.uint8) + img = cv2.imdecode(chunk_arr, cv2.IMREAD_COLOR) + + return img # --------------------------------------------------