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

I encountered a problem when using the source code package provided by PaddleSeg official website for template pruning training: 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 .

The official website tutorial link for PaddleSeg model pruning is: Add link description
Insert image description here

The error occurs at line 218 of metrics.py, as follows. In this for loop, the precision and recall of each category are mainly calculated. After calculating the precision, there is a problem when converting to an array. The list elements need to be unified into one category. Use gnp.array() to successfully convert to an array:

Insert image description here
Insert image description here

Insert image description here

Modifying the above line of code can solve this problem, and then run the code to prune and train normally.

Guess you like

Origin blog.csdn.net/qq_40280673/article/details/133876075