当前位置:   article > 正文

python+opencv人脸识别训练报错及解决方法_you'll need more than one sample to learn a model

you'll need more than one sample to learn a model

1.AttributeError: module 'tensorflow' has no attribute 'variable_scope'

解决:

将原代码:

import tensorflow as tf

改为:

import tensorflow.compat.v1 as tf

若未能解决,重新下载tensorflow

.whl文件:Links for tensorflow

源代码:https://github.com/tensorflow/tensorflow

:若下载源代码文件,将原来的tensorflow文件替换为下载好的tensorflow文件即可

2.AttributeError: module 'cv2' has no attribute 'face'

解决:需要opencv-contrib-python,在win+R中输入cmd进入windows命令行程序,输入pip install opencv-contrib-python,并检查opencv-python和opencv-contrib-python是否同版本

3.Empty training data was given. You'll need more than one sample to learn a model. in function 'cv::face::LBPH::train'

解决:原来是我的项目中,cv2的 imwrite仅支持png和jpeg格式,将jpg改成png即可

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/569674
推荐阅读
相关标签
  

闽ICP备14008679号