Matlab Tricks(二十五) —— 二维图像的 shuffle

比如对于 mnist (手写字符图像),每幅图像的像素点为 28*28,所以有:

perm = randperm(28*28);             % 重排列
mnist.train_images = reshape(mnist.train_images, [28*28 60000]);        % 三维 ⇒ 二维,将每一副图像展成列向量;
mnist.train_images = mnist.train_images(perm, :);       % 重排列
mnist.train_images = reshape(mnist.train_images, [28 28 60000]);        % 恢复三维的形式
原文地址:https://www.cnblogs.com/mtcnn/p/9422519.html