关于深度学习工具箱的疑问

导入数据部分网上的示范都是直接读取了样本的文件,我想请教如果要用自己的图片训练应该怎么做 。
function test_example_CNN
load mnist_uint8; %手写数字样本,每个样本特征为28*28的向量

train_x = double(reshape(train_x',28,28,60000))/255; %训练数据,重塑数组为28*28,60000份,并归一化
test_x = double(reshape(test_x',28,28,10000))/255; %测试数据,10000份
train_y = double(train_y');
test_y = double(test_y');

%% ex1 Train a 6c-2s-12c-2s Convolutional neural network
%will run 1 epoch in about 200 second and get around 11% error.
%With 100 epochs you'll get around 1.2% error

rand('state',0) %每次产生的随机数都相同

cnn.layers = {
struct('type', 'i') %input layer 输入层
struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer 卷积层
% outputmaps:卷积输出特征图像个数 6
% kernelsize:卷积核尺寸 5
struct('type', 's', 'scale', 2) %sub sampling layer 降采样层,功能类似于pooling
% 降采样尺寸 2
struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer 卷积层
% outputmaps:卷积输出特征图像个数 12
% kernelsize:卷积核尺寸 5
struct('type', 's', 'scale', 2) %subsampling layer 降采样层
%降采样尺寸 2
};
% 此处定义神经网络一共有5层:输入层-卷积层-降采样层-卷积层-降采样层

opts.alpha = 1; %学习效率
opts.batchsize = 50; %批训练样本数量
opts.numepochs = 1; %迭代次数

cnn = cnnsetup(cnn, train_x, train_y); %CNN初始化
cnn = cnntrain(cnn, train_x, train_y, opts); %训练CNN

[er, bad] = cnntest(cnn, test_x, test_y); %测试CNN

%plot mean squared error
figure; plot(cnn.rL); %画出MSE,均方误差
assert(er<0.12, 'Too big error');

重新做个mnist_uint8