YOLOv5训练过程中遇到该问题的解决方法ValueError: The requested array has an inhomogeneous shape after 1 dimensions

YOLOv5训练时遇到问题ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions.可以参考以下解决方案

问题分析: 数组append时前后数组的shape不一致,当时我在自己遇到问题时也没有找到解决方法,最后发现是训练集中有一个图片名字太长导致读不到东西,里面插了一个none值从而导致shape不一致(数据是从roboflow下的,没有检查)。

解决方法:先debug到出问题那行,接着看shape,找到值none对应的图片(也就是出错的那张图),再到训练集文件夹中把对应图片的名字修改一下,重新运行即可解决问题。

猜你喜欢

转载自blog.csdn.net/weixin_48778017/article/details/128433984