python dlib运行时报错【已解决】:RuntimeError: Unsupported image type, must be 8bit gray or RGB image

实验现象

faces = detector(gray)

RuntimeError: Unsupported image type, must be 8bit gray or RGB image.

解决方法


主标题要是 numpy 版本比较高,和 dlib 不兼容

指定版本安装 numpy

重新指定版本安装 numpy

pip uninstall numpy

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ numpy==1.8

查看当前可用的 numpy 版本
pip index versions numpy

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ numpy==1.26.4

重新运行人脸检测

原始图片
s
灰度图片

识别并框选出人脸

作者:homelook

物联沃分享整理
物联沃-IOTWORD物联网 » python dlib运行时报错【已解决】:RuntimeError: Unsupported image type, must be 8bit gray or RGB image

发表回复