我正在尝试将cifar10图像集从32x32调整为96x96。
(train_images, train_labels), (test_images, test_labels) = cifar10.load_data()
train_images_reshaped = np.array((50000, 96, 96, 3,))
for a in range(len(train_images)):
train_images_reshaped[a] = cv2.resize(train_images[a], dsize=(96, 96), interpolation=cv2.INTER_CUBIC)但是我得到了一个错误
ValueError: setting an array element with a sequence.出什么问题了?除了这个,还有没有别的办法来实现我的目标?
发布于 2019-11-06 22:56:16
我想你是故意的
train_images_reshaped = np.zeros((50000, 96, 96, 3,))而不是
train_images_reshaped = np.array((50000, 96, 96, 3,))发布于 2019-11-06 22:56:57
你错误地初始化了train_images_reshaped,它是一个形状为(50000,96,96,3,)的数组,而不是(50000,96,96,3,)的数组。试试这个:
train_images_reshaped = np.zeros_like(train_images, shape=(50000, 96, 96, 3,))https://stackoverflow.com/questions/58732447
复制相似问题