错误提示:"Numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject."

7
我在按照这个教程https://www.youtube.com/watch?v=yqkISICHH-U时遇到了错误文件。
目前,我已经创建了一个训练数据集来输入到Tensorflow中。我正在使用预先训练的TensorFlow对象识别模型之一进行迁移学习。当我尝试使用我的新数据集训练模型时,我会遇到错误。这是完整的错误消息的图片
我尝试通过以下方式解决问题:
  • 重新安装Numpy
  • 安装Numpy 1.20.x
  • 安装Numpy 1.18.x
  • 重新安装pycocotools
当我安装了Numpy 1.20.x后,错误消失了,但是出现了一个单独的错误:notimplementederror: cannot convert a symbolic Tensor (cond_2/strided:0) to a numpy array。这似乎是Tensorflow和Numpy 1.20.x之间的兼容性问题。调试此错误时,我发现每个人都通过将其Numpy降级到1.19.x来解决它。然而,在我的情况下,我仍然遇到第一个错误。
我正在使用带有Anaconda的Python 3.8.9。 这里是我安装的软件包: https://pastebin.com/BNW8tU2A
(tfod) (base) C:\Users\piper\python\Tensorflow\TFODCourse>pip list
Package                 Version             Location
----------------------- ------------------- ---------------------------------------------------------------------------
absl-py                 0.13.0
astunparse              1.6.3
backcall                0.2.0
cachetools              4.2.2
certifi                 2021.5.30
charset-normalizer      2.0.3
colorama                0.4.4
cycler                  0.10.0
Cython                  0.29.24
debugpy                 1.3.0
decorator               5.0.9
flatbuffers             1.12
gast                    0.4.0
gin-config              0.4.0
google-auth             1.33.1
google-auth-oauthlib    0.4.4
google-cloud-bigquery   1.21.0
google-pasta            0.2.0
grpcio                  1.34.1
h5py                    3.1.0
idna                    3.2
ipykernel               6.0.3
ipython                 7.25.0
ipython-genutils        0.2.0
jedi                    0.18.0
jupyter-client          6.1.12
jupyter-core            4.7.1
keras-nightly           2.5.0.dev2021032900
Keras-Preprocessing     1.1.2
kiwisolver              1.3.1
lvis                    0.5.3
lxml                    4.6.3
Markdown                3.3.4
matplotlib              3.2.0
matplotlib-inline       0.1.2
numpy                   1.19.5
oauthlib                3.1.1
object-detection        0.1
opencv-python           4.5.3.56
opt-einsum              3.3.0
pandas                  1.3.0
parso                   0.8.2
pickleshare             0.7.5
Pillow                  8.3.1
pip                     21.1.3
prompt-toolkit          3.0.19
protobuf                3.17.3
pyasn1                  0.4.8
pyasn1-modules          0.2.8
pycocotools             2.0.2
Pygments                2.9.0
pyparsing               2.4.7
PyQt5                   5.15.4
PyQt5-Qt5               5.15.2
PyQt5-sip               12.9.0
python-dateutil         2.8.2
pytz                    2021.1
pywin32                 225
PyYAML                  5.4.1
pyzmq                   22.1.0
requests                2.26.0
requests-oauthlib       1.3.0
rsa                     4.7.2
scipy                   1.7.0
setuptools              49.2.1
six                     1.15.0
slim                    0.1                 c:\users\piper\python\tensorflow\tfodcourse\tensorflow\models\research\slim
tensorboard             2.5.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit  1.8.0
tensorflow              2.5.0
tensorflow-addons       0.13.0
tensorflow-estimator    2.5.0
tensorflow-gpu          2.5.0
termcolor               1.1.0
tf-models-official      2.5.0
tf-slim                 1.1.0
tornado                 6.1
traitlets               5.0.5
typeguard               2.12.1
typing-extensions       3.7.4.3
urllib3                 1.26.6
wcwidth                 0.2.5
Werkzeug                2.0.1
wget                    3.2
wheel                   0.36.2
wrapt                   1.12.1

希望能得到您的帮助!

所以我通过使用--no-cache-dir标志重新安装了pycocotools来解决这个问题。所以我执行了以下操作:

pip uninstall pycocotools
pip install --no-cache-dir pycocotools

这完全解决了问题。


谢谢,pycocotools的东西对我有用! - Dev_Man
1个回答

1

我在虚拟环境中使用python3.6也遇到了同样的问题。重新安装时使用--no-cache-dir标志并没有解决问题。

我通过在虚拟环境中使用python3.7从头开始解决了这个问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接