iT邦幫忙

0

跑人臉辨識跑出的問題

  • 分享至 

  • xImage

[ERROR:0@0.010] global persistence.cpp:505 cv::FileStorage::Impl::open Can't open file: 'xml/haarcascade_frontalface_default.xml' in read mode
Traceback (most recent call last):
File "456.py", line 4, in
recog = cv2.face.LBPHFaceRecognizer_create() # 啟用訓練人臉模型方法
AttributeError: module 'cv2' has no attribute 'face'

ccutmis iT邦高手 2 級 ‧ 2023-03-13 14:55:03 檢舉
Google it : AttributeError: module 'cv2' has no attribute 'face'
froce iT邦大師 1 級 ‧ 2023-03-13 15:19:09 檢舉
pip install opencv_contrib_python
neocaffe iT邦新手 4 級 ‧ 2023-03-14 14:29:16 檢舉
GPT 如是說:
It seems like there are two errors in your code.

The first error is related to not being able to open a file in read mode. It appears that the file 'haarcascade_frontalface_default.xml' cannot be found in the 'xml' folder. Double-check if the file exists in the correct directory.

The second error is related to the fact that the 'cv2' module does not have an attribute called 'face'. This error occurs when you try to create an instance of the LBPHFaceRecognizer class from the 'cv2.face' module. This suggests that you might have an outdated version of OpenCV installed.

Try upgrading OpenCV to a newer version that includes the 'cv2.face' module. If that does not work, you may need to install a specific version of OpenCV that includes the 'cv2.face' module.
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答