VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tupl

VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify ‘dtype=object’ when creating the ndarray
bboxes = np.array(bboxes)

在这里插入图片描述
这个警告不影响代码运行,但是整个屏幕都是警告,就特别不爽,
debug了好长时间。

加了它给的提示,原有的代码上加入dtype=object
即np.array(x, dtype=object),原先代码中没有dtype=object
运行结果还是不行,可能是我只在其中警告的代码中加了这个,其他相同的地方没改。

找啊找,终于找到一条信息
如下:
在这里插入图片描述
大概的意思就是,numpy版本的问题,此时我恍然大悟!!

查看了自己的numpy的版本,是1.19.1,
我将其换成1.15.1再运行代码,不再警告了
完美解决问题。

附上链接:
https://stackoverflow.com/questions/63097829/debugging-numpy-visibledeprecationwarning-ndarray-from-ragged-nested-sequences

猜你喜欢

转载自blog.csdn.net/AugustMe/article/details/107971451