教程地址:http://deeplearning.stanford.edu/wiki/index.php/UFLDL_Tutorial
Exercise地址:http://deeplearning.stanford.edu/wiki/index.php/Exercise:Convolution_and_Pooling
代码
Step 1: Load learned features ——cnnExercise.m
% --------------------------- YOUR CODE HERE --------------------------
% Train the sparse autoencoder and fill the following variables with
% the optimal parameters:
optTheta = zeros(2*hiddenSize*visibleSize+hiddenSize+visibleSize, 1);
ZCAWhite = zeros(visibleSize, visibleSize);
meanPatch = zeros(visibleSize, 1);
load STL10Features.mat;
% --------------------------------------------------------------------
Step 2: Implement and test convolution and pooling
Step 2a: Implement convolution——cnnConvolve.m
function convolvedFeatures = cnnConvolve(patchDim, numFeatures, images, W, b, ZCAWhite, meanPatch)
%cnnConvolve Returns the convolution of the features given by W and b with
%the given images
%
% Parameters:
% patchDim - patch (feature) dimension
% numFeatures - number of features特征数 hiddenSize隐藏层单元数
% images - large images to convolve with, matrix in the form
% images(r, c, channel, image number) 需要被卷积的大尺寸图像
% W, b - W, b for features from the spa