[Bug集合]Cast string to int32 is not supported

出现于我想打乱训练集输入顺序的时候。
如:

temp = np.array([image_list, label_list])
temp = temp.transpose()
np.random.shuffle(temp)

all_image_list = temp[:, 0]
all_label_list = temp[:, 1]

原来的图像list和标签list合前,标签是int32型,结果拆开后,标签list变成了str型,然后它就做不了神经网络中的输出层内容了。
送到模型训练之后就会报错。
所以正常运行程序需要把它改回int32型。

all_label_list = [int(float(i)) for i in all_label_list]

猜你喜欢

转载自blog.csdn.net/unlimitedai/article/details/83856684
今日推荐