【读书1】【2017】MATLAB与深度学习——示例:MNIST(7)

该过程如图6-19所示。

The process is illustrated in Figure 6-19.

在这里插入图片描述

图6-19 图像经过卷积和池化层的处理过程How the image isprocessed while it passes through the convolution and pooling layers

通过卷积层和池化层后的最终结果是与卷积滤波器数量一样多的较小的图像;ConvNet将输入图像转换为许多小尺度的特征映射。

The final result after passing theconvolution and pooling layers is as many smaller images as the number of theconvolution filters; ConvNet converts the input image into the many smallfeature maps.

现在,我们将看到输入图像如何在每一层神经网络中进化。

Now, we will see how the image actuallyevolves at each layer of ConvNet.

通过执行TestMnistConv.m文件,然后是PlotFeatures.m文件,屏幕将显示出五幅图像。

By executing the TestMnistConv.m file,followed by the PlotFeatures.m file, the screen will display the five images.

以下为PlotFeatures.m文件的代码清单。

The following listing is in the PlotFeatures.mfile.

clear all

load(‘MnistConv.mat’)

k = 2;

x = X(:, :, k); %Input, 28x28

y1 = Conv(x, W1);% Convolution, 20x20x20

y2 = ReLU(y1); %

y3 = Pool(y2); %Pool, 10x10x20

y4 = reshape(y3,[], 1); % 2000

v5 = W5*y4; %ReLU, 360

y5 = ReLU(v5); %

v = Wo*y5; % Softmax, 10

y = Softmax(v); %

figure;

display_network(x(?);

title(‘Input Image’)

convFilters = zeros(9*9, 20);

for i = 1:20

   filter= W1(:, :, i);

   convFilters(:,i) = filter(:);

end

figure

display_network(convFilters);

title(‘Convolution Filters’)

fList = zeros(20*20, 20);

for i = 1:20

   feature= y1(:, :, i);

   fList(:,i) = feature(:);

end

figure

display_network(fList);

title(‘Features [Convolution]’)

fList = zeros(20*20, 20);

for i = 1:20

   feature= y2(:, :, i);

   fList(:,i) = feature(:);

end

figure

display_network(fList);

title(‘Features [Convolution + ReLU]’)

fList = zeros(10*10, 20);

for i = 1:20

   feature= y3(:, :, i);

   fList(:,i) = feature(:);

end

figure

display_network(fList);

title(‘Features [Convolution + ReLU +MeanPool]’)

该代码将测试数据的第二幅图像(k = 2)输入到神经网络,并显示最后的输出结果。

The code enters the second image (k = 2) ofthe test data into the neural network and displays the results of all thesteps.

函数display_network将图像矩阵显示到屏幕上,该函数与TestMnistConv.m 文件中的loadMNISTImages和loadMNISTLabels函数都来自于相同的网络下载地址。

The display of the matrix on the screen isperformed by the function display_network, which is originally from the sameresource where the loadMNISTImages and loadMNISTLabels of the TestMnistConv.mfile are from.

——本文译自Phil Kim所著的《Matlab Deep Learning》

更多精彩文章请关注微信号:在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值