我正在尝试解决这个问题,当我在下面运行 python3brain.py 时出现此错误非法指令(核心转储)
from imageai.Prediction import ImagePrediction导入操作系统execution_path=os.getcwd()预测 = ImagePrediction()预测.setModelTypeAsSqueezeNet()预测.setModelPath(os.path.join(execution_path,squeezenet_weights_tf_dim_ordering_tf_kernels.h5"))预测.loadModel()预测,概率 = predict.predictImage(os.path.join(execution_path, "giraffe.jpg"), result_count=5 )对于eachPrediction,zip中的eachProbability(预测,概率):打印(每个预测,:",每个概率)我曾尝试将 Tensorflow 降级到 1.5.0,但在我运行后出现这些错误
[ons mar 25 23:11:45] Jonathan@Whats next?:~/ReallySmartBrain$ pip3 install tensorflow==1.5.0默认为用户安装,因为普通站点包不可写错误:找不到满足 tensorflow==1.5.0 要求的版本(来自版本:1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.14.0, 1.14.0, 1.14.0.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc.0, 2.0.0rc.2.0, 2.0.1, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0, 2.2.0rc0, 2.2.0rc1)错误:找不到 tensorflow==1.5.0 的匹配分布另一种解决方案是从源代码编译它,但我不知道从源代码编译它.我可以解决这个问题吗?
解决方案我遇到了同样的问题.似乎这个问题是针对较旧的 CPU.正如您所说,一种解决方案是降级到 tensorflow 1.5.0.
另一种解决方案(对我有用的那个)是从源代码构建 tensorflow.
我编译了 2.1.0 版本,使用 Intel(R) Pentium(R) Dual CPU T2370 @ 1.73GHz 和 2GB RAM 花了我大约 25 小时.
您需要安装正确版本的 Bazel.在下面找到来自 tensorflow 的完整说明:
www.tensorflow/install/source
我需要添加一个 4GB 的交换文件.否则,您将在编译期间内存不足.
无论如何,我已经上传了我的 .whl 文件,以防您不想花费 25 小时(或更长时间)来编译自己的文件:
drive.google/open?id=1ISgMcDiCw5W5MFvS5Zbme6pNBbA7xWMH/p>
Hi i am trying to fix this issue when i run python3 brain.py below i get this error Illegal instruction (core dumped)
from imageai.Prediction import ImagePrediction import os execution_path=os.getcwd() prediction = ImagePrediction() prediction.setModelTypeAsSqueezeNet() prediction.setModelPath(os.path.join(execution_path, "squeezenet_weights_tf_dim_ordering_tf_kernels.h5")) prediction.loadModel() predictions, probabilities = prediction.predictImage(os.path.join(execution_path, "giraffe.jpg"), result_count=5 ) for eachPrediction, eachProbability in zip(predictions, probabilities): print(eachPrediction , " : " , eachProbability)I have tried to downgrade Tensorflow to 1.5.0 but then after i run that i get these errors
[ons mar 25 23:11:45] Jonathan@Whats next?:~/ReallySmartBrain$ pip3 install tensorflow==1.5.0 Defaulting to user installation because normal site-packages is not writeable ERROR: Could not find a version that satisfies the requirement tensorflow==1.5.0 (from versions: 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0, 2.2.0rc0, 2.2.0rc1) ERROR: No matching distribution found for tensorflow==1.5.0The other solution is to compile it from source code but i'don't have any idea to compile it from source code. Can i fix this anyway?
解决方案I had the same problem. It seems that this problem is for older CPUs. As you said, one solution is with a downgrade to tensorflow 1.5.0.
The other solution (that one that worked for me) is to build tensorflow from source.
I compiled the version 2.1.0, it took me around 25 hours with a Intel(R) Pentium(R) Dual CPU T2370 @ 1.73GHz and 2GB RAM.
You would need to install the proper version of Bazel. Find below the complete instructions from tensorflow:
www.tensorflow/install/source
I needed to add a swap file of 4GB. Otherwise you will go out of memory during the compilation.
Anyway, I have uploaded my .whl file in case you don't want to expend 25 hours (or more) to compile your own file:
drive.google/open?id=1ISgMcDiCw5W5MFvS5Zbme6pNBbA7xWMH
更多推荐
如何修复非法指令(核心转储)
发布评论