Exercise:Convolution and Pooling
From Ufldl
(→Step 2a: Implement convolution) |
(→Step 2a: Implement convolution) |
||
Line 59: | Line 59: | ||
% Flip the feature matrix because of the definition of convolution, as explained later | % Flip the feature matrix because of the definition of convolution, as explained later | ||
- | + | feature = flipud(fliplr(squeeze(Wfeat(:, :, channel)))); | |
im = squeeze(images(:, :, channel, imageNum)); | im = squeeze(images(:, :, channel, imageNum)); | ||
% Convolve "filter" with "im", adding the result | % Convolve "filter" with "im", adding the result | ||
- | convolvedImage = convolvedImage + conv2(im, | + | convolvedImage = convolvedImage + conv2(im, feature), 'valid'); |
end | end |