1 / 44

Biologically Inspired Intelligent Systems

Biologically Inspired Intelligent Systems. Lecture 5 Dr. Roger S. Gaborski. Class Presentations. Simple r eceptive field Matlab script. %Dog128Filter.m %Generates difference of Gaussians 128x128 imageSize = 128; sigmaex = .095* imageSize ; sigmainh = .19* imageSize ;

knoton
Download Presentation

Biologically Inspired Intelligent Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Biologically Inspired Intelligent Systems Lecture 5 Dr. Roger S. Gaborski Roger S. Gaborski

  2. Class Presentations • Simple receptive field Matlab script Roger S. Gaborski

  3. %Dog128Filter.m %Generates difference of Gaussians 128x128 imageSize = 128; sigmaex = .095*imageSize; sigmainh = .19*imageSize; [x,y] = meshgrid(-63:64 -63:64); %First Term exp1 = exp( -1*( x .* x + y .* y)./(2*sigmaex*sigmaex)); FirstTerm = 7.5 *exp1; %SecondTerm exp2 = exp( -1*( x .* x + y .* y)./(2*sigmainh*sigmainh)); SecondTerm = 1.95*exp2; Dog128 =.0013*(FirstTerm - SecondTerm); figure, subplot(2,2,1), plot(1:128,FirstTerm(64,:)), grid subplot(2,2,2), plot(1:128,SecondTerm(64,:)), grid subplot(2,2,3), plot(1:128, Dog128(64,:)), grid Roger S. Gaborski

  4. Roger S. Gaborski

  5. Receptive Fields • We can model a RF as a filter • To obtain the response of a RF and an image we convolve (or correlate with a slight change to the filtering operation) the RF with the image. • The same similar approach can be used with other modalities, such as, acoustic information Roger S. Gaborski

  6. Convolution/Correlation • First, we need to obtain an understanding of the convolution/correlation operation • Second, we need to understand how to implement the operation in Matlab Roger S. Gaborski

  7. BACKGROUND: Convolution and Correlation using a visual scene as an example • Neighborhood processing • Define center point (x,y) • Perform operations involving only pixels in the neighborhood • Result of operation is responseof receptive fieldat that point • Moving the pixel results in a new neighborhood • Repeat process for every point in the image Roger S. Gaborski

  8. Linear and Nonlinear Filtering • Linear operation • Multiply each pixel in the neighborhood by the corresponding coefficient and sum the results to get the response for each point (x,y) • If neighborhood is m x n , then mn coefficients are required • Coefficients are arranged in a matrix, called • Filter • Filter mask • Kernel • Template • Mask sizes are typically odd sizes (3x3, 5x5, etc.) • Larger the mask, greater the compute time • A nonlinear function is applied to the output of the linear operation • Values less than zero are set to 0 • Or, the output values are squared to obtain RF output Roger S. Gaborski

  9. Correlation -- Convolution • Correlation • Place mask w on the image array f as previously described • Convolution • First rotate mask w by 180 degrees • Place rotated mask on image as described previously Roger S. Gaborski

  10. Example - Correlation • Assume w and f are one dimensional • Origin of f is its left most point • Place w so that its right most point coincides with the origin of f • Pad f with 0s so that there are corresponding f points for each w point (also pad end with 0s) • Multiply corresponding points and sum • In this case (example on next page) result is zero • More w to the right one value, repeat process • Continue process for whole length of f Roger S. Gaborski

  11. ‘Same’ correlation etc. Roger S. Gaborski

  12. Example - Convolution • Convolution is the same procedure, but the filter is first rotated 180 degrees. • If the filter is symmetric, correlation and convolution results are the same Roger S. Gaborski

  13. Two dimension correlation and convolution Roger S. Gaborski

  14. Linear Filtering in MATLAB • g = imfilter(f, w, filtering mode, boundary_options, size_options) • f is the input filter • w is filter mask • g is filtered output • filtering mode specifies either corr or conv • boundary_options deals with padding issues • size_options is either full or same Roger S. Gaborski

  15. MATLAB function for filtering: imfilter • g = imfilter(f, w, ‘replicate’) • Correlation is the default . • If filters are pre-rotated 180 degrees, can simply use default • If filter is symmetric, doesn’t matter Roger S. Gaborski

  16. - Boundary options X Input array values outside the bounds of the array are implicitly assumed to have the value X. When no boundary option is specified, imfilter uses X = 0. 'symmetric' Input array values outside the bounds of the array are computed by mirror-reflecting the array across the array border. 'replicate' Input array values outside the bounds of the array are assumed to equal the nearest array border value. 'circular' Input array values outside the bounds of the array are computed by implicitly assuming the input array is periodic. Roger S. Gaborski

  17. - Output size options (Output size options for imfilter are analogous to the SHAPE option in the functions CONV2 and FILTER2.) 'same' The output array is the same size as the input array. This is the default behavior when no output size options are specified. 'full' The output array is the full filtered result, and so is larger than the input array. - Correlation and convolution 'corr' imfilter performs multidimensional filtering using correlation, which is the same way that FILTER2 performs filtering. When no correlation or convolution option is specified, imfilter uses correlation. 'conv' imfilter performs multidimensional filtering using convolution. Roger S. Gaborski

  18. We would like To implement thisbasic neuron model Output function Neuron Firing Rate Value (Output Spikes) Filter Output Fires strongest when Image matches linear filter Linear Filter Non-linear Function Roger S. Gaborski

  19. Read in image • At this point, we are only detecting the contrast in an image, so we will use a gray scale image im = im2double(imread('FlagImage.jpg')); figure, imshow(im), title(’Flag in Color') imGray = rgb2gray(im); figure, imshow(imGray), title(‘GrayscaleFlag') Roger S. Gaborski

  20. Roger S. Gaborski

  21. Dog128 ResponseWhat diameter circle will have a maximum result? Roger S. Gaborski

  22. Dog128 ResponseWhat diameter circle will have a maximum result? Matched Filter Diameter= 87-41 = 46 pixels 41 87 Roger S. Gaborski

  23. LINEAR RESPONSE imContrast128 = imfilter(imGray,Dog128); figure, imshow(imContrast128, [ ]), title('imContrast128’) colorbar Roger S. Gaborski

  24. NONLINEAR RESPONSE DOES THE RESPONSE MAKE SENSE?? WHERE ARE THE STRONGEST RESPONSES? NLcon128 = double(imContrast128>0) .* imContrast128; figure, imshow(Con128, [ ]), title('Nonlinear imContrast128’) colorbar Roger S. Gaborski

  25. NONLINEAR RESPONSE DOES THE RESPONSE MAKE SENSE?? WHERE ARE THE STRONGEST RESPONSES? NLcon128 = double(imContrast128>0) .* imContrast128; figure, imshow(Con128, [ ]), title('Nonlinear imContrast128’) colorbar Roger S. Gaborski

  26. NONLINEAR RESPONSE About 40 pixels DOES THE RESPONSE MAKE SENSE?? WHERE ARE THE STRONGEST RESPONSES? NLcon128 = double(imContrast128>0) .* imContrast128; figure, imshow(Con128, [ ]), title('Nonlinear imContrast128’) colorbar Roger S. Gaborski

  27. figure, imshow(Con128,[]), colormap(hot) >> colorbar Roger S. Gaborski

  28. 128 x 128 Receptive field Roger S. Gaborski

  29. 128 x 128 Receptive field Roger S. Gaborski

  30. 128x128 – 1D Roger S. Gaborski

  31. Responses to smaller receptive filters Roger S. Gaborski

  32. Use imresize to create different size receptive filters: Code example D64 = imresize(Dog128,.5, 'bilinear'); figure, surf(D64), title('DoG64') Roger S. Gaborski

  33. Roger S. Gaborski

  34. Roger S. Gaborski

  35. Roger S. Gaborski

  36. Roger S. Gaborski

  37. Roger S. Gaborski

  38. Roger S. Gaborski

  39. Color Flag Image Roger S. Gaborski

  40. Small Gray Flag Image Roger S. Gaborski

  41. Roger S. Gaborski

  42. Roger S. Gaborski

  43. Roger S. Gaborski

  44. We need to expand our models of receptive fields to contain ‘bars’ at different orientations and sizes • We need to consider color • We need to consider motion Roger S. Gaborski

More Related