1 A trick when you want to flatten a matrix X of shape (a,b,c,d) to a matrix X_flatten of shape (b∗c∗d, a) is to use:
X_flatten = X.reshape(X.shape[0], -1).T # X.T is the transpose of X
2 for picture datasets, it is simpler and more convenient and works almost as well to just divide every row of the dataset by 255 (the maximum value of a pixel channel)
本文介绍了一种将多维矩阵展平为二维矩阵的方法,特别适用于深度学习中对图像数据集的处理。此外,还提供了一个简便的图片数据集预处理技巧:通过将数据集中每个像素通道的最大值除以255来简化操作。
5万+

被折叠的 条评论
为什么被折叠?



