嗨,当我在下面运行 python3 brain.py 时,我正在尝试解决这个问题,我收到此错误非法指令(核心已转储)
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)
Run Code Online (Sandbox Code Playgroud)
我曾尝试将 Tensorflow 降级到 1.5.0,但是在我运行之后,我收到了这些错误
[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.0
Run Code Online (Sandbox Code Playgroud)
另一种解决方案是从源代码编译它,但我不知道从源代码编译它。我可以解决这个问题吗?
我有同样的问题。似乎这个问题是针对较旧的 CPU。正如您所说,一种解决方案是降级到 tensorflow 1.5.0。
另一种解决方案(对我有用的解决方案)是从源代码构建 tensorflow。
我编译了 2.1.0 版本,使用 Intel(R) Pentium(R) Dual CPU T2370 @ 1.73GHz 和 2GB RAM 花了我大约 25 个小时。
您需要安装正确版本的 Bazel。在下面找到来自 tensorflow 的完整说明:
https://www.tensorflow.org/install/source
我需要添加一个 4GB 的交换文件。否则,您将在编译期间内存不足。
无论如何,我已经上传了我的 .whl 文件,以防您不想花费 25 小时(或更长时间)来编译自己的文件:
https://drive.google.com/open?id=1ISgMcDiCw5W5MFvS5Zbme6pNBbA7xWMH
| 归档时间: |
|
| 查看次数: |
19137 次 |
| 最近记录: |