00001 /*!@file ModelNeuron/CompLayer.H Class declarations for structure that 00002 consists of an Gaussian excitatory layer which projects to an inhibitory layer, 00003 which projects in a gaussian pattern pack to the excitatory layer. Inspired by 00004 the layout of the mamillian SC. */ 00005 00006 // //////////////////////////////////////////////////////////////////// // 00007 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00008 // University of Southern California (USC) and the iLab at USC. // 00009 // See http://iLab.usc.edu for information about this project. // 00010 // //////////////////////////////////////////////////////////////////// // 00011 // Major portions of the iLab Neuromorphic Vision Toolkit are protected // 00012 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00013 // in Visual Environments, and Applications'' by Christof Koch and // 00014 // Laurent Itti, California Institute of Technology, 2001 (patent // 00015 // pending; application number 09/912,225 filed July 23, 2001; see // 00016 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00017 // //////////////////////////////////////////////////////////////////// // 00018 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00019 // // 00020 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00021 // redistribute it and/or modify it under the terms of the GNU General // 00022 // Public License as published by the Free Software Foundation; either // 00023 // version 2 of the License, or (at your option) any later version. // 00024 // // 00025 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00026 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00027 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00028 // PURPOSE. See the GNU General Public License for more details. // 00029 // // 00030 // You should have received a copy of the GNU General Public License // 00031 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00032 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00033 // Boston, MA 02111-1307 USA. // 00034 // //////////////////////////////////////////////////////////////////// // 00035 // 00036 // Primary maintainer for this file: David Berg <dberg@usc.edu> 00037 // $HeadURL: svn://isvn.usc.edu:/software/invt/trunk/saliency/src/ModelNeuron/CompLayer.H $ 00038 00039 #ifndef NEURALMODEL_COMPLAYER_H_DEFINED 00040 #define NEURALMODEL_COMPLAYER_H_DEFINED 00041 00042 #include "ModelNeuron/Structure.H" 00043 #include "ModelNeuron/Layer.H" 00044 #include "ModelNeuron/Weights.H" 00045 00046 // ###################################################################### 00047 // CompLayer 00048 // ###################################################################### 00049 // A class representing a single lamina containing excitatory and 00050 // inhibitory neurons. A network containing interacting excitatory and 00051 // inhhibitory units where an excitatory layer (input layer) has local 00052 // recurrent excitation. Each unit in the exciatory layer connects 00053 // directly to a single unit in the inhibitory layer. The inhibitory 00054 // units connect in a gaussian pattern back to the excitatory 00055 // network. A variety of behaviors can be obtained such as bumbs, 00056 // waves, weak winner take all selection etc.... 00057 // 00058 // It is hypothesized that each layer of the primate colliculus (Sgs, 00059 // Sgi) supperior colliculus is organized in such a way, with 00060 // different sized excitation and inhibition regions. 00061 // 00062 // Computational framework inspired by work from SI Amari. See SC 00063 // class for citations on inspiration for the construction of a model 00064 // Sgs and Sgi, and interlaminar connectivity. 00065 // ###################################################################### 00066 template <class EUnit, class IUnit> 00067 struct CompLayer : public Structure<SimLayer*> 00068 { 00069 //! constructor 00070 CompLayer(const double& excite_std, const double& inhibit_std, 00071 const double& excite_w, const double& feedforward, const double& feedback, 00072 const BorderPolicy bp, const SimTime& timestep, 00073 const uint width, const uint height, const std::string name = "", const std::string units = "") 00074 : Structure<SimLayer*>(timestep, width, height, name, units), 00075 itsW(inhibit_std, feedback, false, bp), itsFF(feedforward) 00076 { 00077 Layer<EUnit, WeightsBinomial> itsE(excite_std, excite_w, true, bp, timestep, width, height, "Excitatory"); 00078 Layer<IUnit, WeightsEmpty> itsI(timestep, width, height, "Inhibitory"); 00079 addSub(itsE); 00080 addSub(itsI); 00081 setDefaultIO(0,0); 00082 } 00083 00084 //default copy and assignment OK 00085 00086 //!destructor 00087 virtual ~CompLayer() { }; 00088 00089 //set the modules 00090 void setModules(const SimUnit& excite_module, const SimUnit& inhibit_module) 00091 { 00092 editSub(0).setModule(excite_module); 00093 editSub(1).setModule(inhibit_module); 00094 } 00095 00096 //!get the current display output 00097 Image<double> getDisplayOutput(const int pos = -1) const 00098 { 00099 if (pos < 0) 00100 { 00101 Image<double> e = getSub(0).getDisplayOutput(); 00102 const Image<double> i = getSub(1).getDisplayOutput(); 00103 e -= i; 00104 return e; 00105 } 00106 else 00107 return getSub(pos).getDisplayOutput(); 00108 } 00109 00110 //!cone the unit 00111 CompLayer<EUnit, IUnit>* clone() const {return new CompLayer<EUnit,IUnit>(*this); } 00112 00113 private: 00114 //!do our class specific interactions 00115 void interact() 00116 { 00117 00118 //excite->inhibit 00119 Image<double> e = getSub(0).getOutput(); 00120 e *= itsFF; 00121 input(e, 1); 00122 00123 //inhbit->excite 00124 const Image<double> i = getSub(1).getOutput(); 00125 const Image<double> iw = itsW.compute(i); 00126 input(iw, 0); 00127 } 00128 00129 WeightsBinomial itsW; 00130 double itsFF; 00131 }; 00132 00133 #endif 00134 // ###################################################################### 00135 /* So things look consistent in everyone's emacs... */ 00136 /* Local Variables: */ 00137 /* indent-tabs-mode: nil */ 00138 /* End: */