(关于图像分类)
将32x32x3图像转换为1x3072数组的最简单方法是: 1024为红色,1024为绿色,1024为蓝色?
发布于 2018-12-16 23:37:24
使用numpy:(arr
是图像数组)
swapped = np.swapaxes(arr,0,2)
flattened = swapped.flatten()
数组将位于flattened
中。
在第一轴和最后一轴之间交换,然后使结果变平。
发布于 2018-12-16 23:34:34
img = img.transpose(2, 0, 1) # Depends on your original order
img = img.reshape(1, -1)
请参见:
https://stackoverflow.com/questions/53810650
复制相似问题