美文网首页
keras报错:AttributeError: '_thread

keras报错:AttributeError: '_thread

作者: 牛奶大泡芙 | 来源:发表于2019-10-11 17:39 被阅读0次

用keras框架时候,用模型对预处理后的图片数据进行预测,也就是在运行这样一段代码时,出现了标题中的报错,AttributeError: '_thread._local' object has no attribute 'value'

img_data = self.preprocess(path)
feature = self.model.predict(img_data)
运行报错.png

查找了好多方案,最后采纳这种

pip install tensorflow==1.14 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install keras==2.2.5 -i https://pypi.tuna.tsinghua.edu.cn/simple

如果网络不好,加上“-i https://pypi.tuna.tsinghua.edu.cn/simple”清华的镜像资源后缀可以加速
原因是keras和tensorflow版本不同,导致有些特性不能支持,具体的原因小编也没有深究了
不同的情况解决方法不同,这个方法仅供参考

相关文章

网友评论

      本文标题:keras报错:AttributeError: '_thread

      本文链接:https://www.haomeiwen.com/subject/gbdxmctx.html