属性错误:'list'对象在代码中没有属性'dtype' yolo_outputs = yolo_head(yolo_model.output, anchors, len(class_name


yolo_outputs = yolo_head(yolo_model.output, anchors, len(class_names))

我试图在谷歌collab中执行此代码,但出现错误:

AttributeError                            Traceback (most recent call last)
<ipython-input-92-d69bb71a2d56> in <module>()
----> 1 yolo_outputs = yolo_head(yolo_model.output, anchors, len(class_names))
1 frames
/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py in dtype(x)
903     {{np_implementation}}
904     """
--> 905     return x.dtype.base_dtype.name
906 
907 
AttributeError: 'list' object has no attribute 'dtype'

我正在尝试使用yolo算法来检测对象。

yolo_head需要一个numpy数组,但您为它提供了一个内置的Python列表。

据我所说,这个错误是由于您在使用旧版本TensorFlow的keras_yolo程序中使用的代码造成的。谷歌拼贴画使用了TensorFlow的最新版本。我建议安装旧版本的TensorFlow,然后运行您为keras_yolo.py制作的相同程序。如果你想让你的环境使用conda,你可以在你的终端中使用这些命令。

conda create --name tensorflow python=3.5 jupyter -y
conda install --name tensorflow tensorflow=1.0.0 --channel conda-forge -y 

如果你仍然想继续使用谷歌拼贴,你可以在这里使用最新版本的符号编辑keras_yolo.py文件。

它帮助我用YOLO制作了一个汽车检测模型。

最新更新