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

来源:互联网 发布:学vb必看书 编辑:程序博客网 时间:2024/06/05 20:29

比如对于 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]);        % 恢复三维的形式
0 0
原创粉丝点击