python dlib运行时报错【已解决】:RuntimeError: Unsupported image type, must be 8bit gray or RGB image
查看当前可用的 numpy 版本。重新指定版本安装 numpy。
·
实验现象
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

重新运行人脸检测
原始图片
灰度图片
识别并框选出人脸
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)