Exercise:Convolution and Pooling

From Ufldl

Jump to: navigation, search
(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
-
       filter = flipud(fliplr(squeeze(Wfeat(:, :, channel))));
+
       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, filter), 'valid');
+
       convolvedImage = convolvedImage + conv2(im, feature), 'valid');
     end
     end

Revision as of 01:59, 23 May 2011

Personal tools