1. 前言
在https://blog.youkuaiyun.com/ShenWeiKKX/article/details/100169276我也遇到该问题并得到解决,但是,那是我自己写代码,但是别人的工具报这个问题那就得自从其源码定位并改正。
2. 问题复原
在https://github.com/ipazc/mtcnn按照说明安装MTCNN当工具使用,过程如下:
2.1MTCNN工具安装
pip install mtcnn
2.2MTCNN工具使用
from mtcnn.mtcnn import MTCNN
import cv2
img = cv2.imread("./image29162.jpg")
detector = MTCNN()
face = detector.detect_faces(img)
print(face)
2.3MTCNN工具使用结果
Failed to get convolution algorith…
3. 问题解决
直到我找到该文件:home/.local/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py
在该文件前面首先添加:
import tensorflow as tf
然后在第48行添加并保存
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
tf_keras_backend.set_session(tf.Session(config=config))
再次运行继续报错,晕,然后我又琢磨半小时,想着我没restart jupyter notebook,然后restart,竟然好了,以后就按照这个套路来。