人脸静态图检测部分:detect_face_images.py
module ‘tensorflow’ has no attribute ‘gpuoption’
是可以解决但是还是会有其他类似错误,比如:module ‘tensorflow’ has no attribute ‘Session’
是因为我的代码是基于1.1.3版本的tensorflow,使用云平台的Jupyter运行是2.0版本,所以引入tengsorflow时:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
Tensorflow强制使用CPU训练,不使用GPU
之前没有配置GPU时候运行没有问题,现在一堆错。。头疼🤦
强制使用CPU吧!
import os
os.environ["CUDA_VISIBLE_DEVICES"]="-1"
🆗!!
多人脸也可以
人脸聚类过程 :cluster.py
module ‘scipy.misc’ has no attribute ‘imread’
https://blog.csdn.net/fu6543210/article/details/103515909
import imageio
——省略中间代码——
img = imageio.imread(os.path.join(folder, filename))
😂出现新bug: Could not find a format to read the specified file in single-image mode
So:安装1.2.1的scipy
[Errno 21] Is a directory: 'data/images/.ipynb_checkpo
我使用jupyter 所以有隐藏文件夹 ipynb_checkpoints,加上判断语句,筛掉它即可.
最后还是很多报错,强制使用cpu训练,这些都解决了,最后运行结果
images文件夹中有这些图:
聚类后对人脸部分进行裁剪并保存在七个文件夹中,对3.jpg中的多人脸也可以识别并裁剪,放入三个文件夹.