实验现象

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
灰度图片
在这里插入图片描述

识别并框选出人脸
在这里插入图片描述

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐