Не удается прочитать каскады OpenCV python

Недавно я установил модуль deepface для того, чтобы сравнить лица людей. Но при запуске моего кода выдается ошибка. Код:

from deepface import DeepFace


def comparison():
    result = DeepFace.verify(img1_path='photos/Malek.jpg', img2_path='photos/Malek.jpg')
    print(result)


def main():
    comparison()


if __name__ == '__main__':
    main()

Ошибка:

[ERROR:[email protected]] global persistence.cpp:505 cv::FileStorage::Impl::open Can't open file: 'C:/Users/xxx/AppData/Local/Programs/Python/Python310/lib/site-packages/cv2/data/haarcascade_frontalface_default.xml' in read mode
[ERROR:[email protected]] global persistence.cpp:505 cv::FileStorage::Impl::open Can't open file: 'C:/Users/xxx/AppData/Local/Programs/Python/Python310/lib/site-packages/cv2/data/haarcascade_eye.xml' in read mode
     Traceback (most recent call last):
      File "C:\Users\xxx\PycharmProjects\pythonProject\Telegram\Deep face\prn bot\find_prn_actress.py", line 37, in <module>
        main()
      File "C:\Users\xxx\PycharmProjects\pythonProject\Telegram\Deep face\prn bot\find_prn_actress.py", line 31, in main
        comparison()
      File "C:\Users\xxx\PycharmProjects\pythonProject\Telegram\Deep face\prn bot\find_prn_actress.py", line 9, in comparison
        result = DeepFace.verify(img1_path='photos/Malek.jpg', img2_path='photos/Malek.jpg')
      File "C:\Users\xxx\AppData\Local\Programs\Python\Python310\lib\site-packages\deepface\DeepFace.py", line 163, in verify
        img1_representation = represent(img_path = img1_path
      File "C:\Users\xxx\AppData\Local\Programs\Python\Python310\lib\site-packages\deepface\DeepFace.py", line 754, in represent
        img = functions.preprocess_face(img = img_path
      File "C:\Users\xxx\AppData\Local\Programs\Python\Python310\lib\site-packages\deepface\commons\functions.py", line 178, in preprocess_face
        img, region = detect_face(img = img, detector_backend = detector_backend, grayscale = grayscale, enforce_detection = enforce_detection, align = align)
      File "C:\Users\xxx\AppData\Local\Programs\Python\Python310\lib\site-packages\deepface\commons\functions.py", line 124, in detect_face
        raise ValueError("Face could not be detected. Please confirm that the picture is a face photo or consider to set enforce_detection param to False.")
    ValueError: Face could not be detected. Please confirm that the picture is a face photo or consider to set enforce_detection param to False.

Уже пробовал удалять и заново скачивать haarcascade_frontalface_default.xml и haarcascade_eye.xml, также копировал с вставлял содержимое файлов с гитхаба, ничего не помогло. Как решить данную проблему?


Ответы (0 шт):