Home > SaliencyToolbox > makeLTUsegmentNetwork.m

makeLTUsegmentNetwork

PURPOSE ^

makeLTUsegmentNetwork - creates an LTU network for map segmentation.

SYNOPSIS ^

function LTUnetwork = makeLTUsegmentNetwork(mapSize,thresh)

DESCRIPTION ^

 makeLTUsegmentNetwork - creates an LTU network for map segmentation.

 LTUnetwork = makeLTUSsegmentNetwork(mapSize,thresh)
    Creates a network of linear threshold units for segmenting
    a map of size mapSize with threshold thresh.
    See section 3 of this paper for details:
      Walther, D., and Koch, C. (2006). Modeling attention to salient 
      proto-objects. Neural Networks 19, pp. 1395-1407.

 See also LTUsegmentMap, LTUsimulate, dataStructures.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % makeLTUsegmentNetwork - creates an LTU network for map segmentation.
0002 %
0003 % LTUnetwork = makeLTUSsegmentNetwork(mapSize,thresh)
0004 %    Creates a network of linear threshold units for segmenting
0005 %    a map of size mapSize with threshold thresh.
0006 %    See section 3 of this paper for details:
0007 %      Walther, D., and Koch, C. (2006). Modeling attention to salient
0008 %      proto-objects. Neural Networks 19, pp. 1395-1407.
0009 %
0010 % See also LTUsegmentMap, LTUsimulate, dataStructures.
0011 
0012 % This file is part of the SaliencyToolbox - Copyright (C) 2006-2013
0013 % by Dirk B. Walther and the California Institute of Technology.
0014 % See the enclosed LICENSE.TXT document for the license agreement.
0015 % More information about this project is available at:
0016 % http://www.saliencytoolbox.net
0017 
0018 function LTUnetwork = makeLTUsegmentNetwork(mapSize,thresh)
0019 
0020 numPix = prod(mapSize);
0021 h = mapSize(1);
0022 w = mapSize(2);
0023 
0024 units = 5;
0025 numCells = numPix * units;
0026 
0027 % set up the connection matrix as a sparse matrix
0028 con = sparse(numCells,numCells);
0029 
0030 % now wire up all the connections
0031 % cell 1 is the input from the select signal
0032 % cell 2 is the input from the image
0033 % cell 3 is an inhibitory interneuron fed from cell 2
0034 % cell 4 pools the lateral input from the neighbors (P cell)
0035 % cell 5 computes the output from all this (S cell)
0036 
0037 % set up the network connections
0038 hunits = h * units;
0039 for x = 1:w
0040   for y = 1:h
0041     base = (x-1)*hunits + (y-1)*units + 1;
0042     
0043     % cell 1 to cell 5
0044     con(base,base+4) = 1;
0045     
0046     % cell 2 to cell 3 to cell 5
0047     con(base+1,base+2) = -1;
0048     con(base+2,base+4) = -2;
0049     
0050     % inputs from neighboring pixels to cell 4
0051     if (x > 1) con(base-hunits+4,base+3) = 1; end
0052     if (x < w) con(base+hunits+4,base+3) = 1; end
0053     if (y > 1) con(base- units+4,base+3) = 1; end
0054     if (y < h) con(base+ units+4,base+3) = 1; end
0055     
0056     % finally, connect cell 4 to cell 5
0057     con(base+3,base+4) = 1;
0058   end
0059 end
0060 
0061 LTUnetwork.connections = con;
0062 LTUnetwork.thresholds = repmat([0 0 -thresh 1 1],1,numPix);
0063 idx = ([1:numPix] - 1) * units + 1;
0064 LTUnetwork.input_idx = [idx+1,idx];
0065 LTUnetwork.output_idx = idx+4;
0066 LTUnetwork.numCells = numCells;
0067 LTUnetwork.label = sprintf('segmentation network for %d x %d maps',w,h);

Generated on Thu 18-Jul-2013 06:10:46 by m2html © 2005