PaddleSeg解决问题:ValueError: setting an array element with a sequence. The requested array has an inhom

在使用PaddleSeg官网提供的源码包进行模版剪枝训练时遇到问题:ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.

PaddleSeg模型剪枝的官网教程链接为:添加链接描述
在这里插入图片描述

出错地方在metrics.py 218行处,如下,在这个for循环中主要是计算了各类别的精度和召回率,在计算精度后进行转换为数组时出了问题,列表元素需要统一为一类才能使用gnp.array()转换成功为数组:

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

修改上面一行代码就可以解决该问题,再运行代码就可以正常剪枝训练了。

猜你喜欢

转载自blog.csdn.net/qq_40280673/article/details/133876075
今日推荐