00001 /*!@file ModelNeuron/SimStructures.H Class declarations for various 00002 simulation structures */ 00003 00004 // //////////////////////////////////////////////////////////////////// // 00005 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2001 by the // 00006 // University of Southern California (USC) and the iLab at USC. // 00007 // See http://iLab.usc.edu for information about this project. // 00008 // //////////////////////////////////////////////////////////////////// // 00009 // Major portions of the iLab Neuromorphic Vision Toolkvit are protected // 00010 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency // 00011 // in Visual Environments, and Applications'' by Christof Koch and // 00012 // Laurent Itti, California Institute of Technology, 2001 (patent // 00013 // pending; application number 09/912,225 filed July 23, 2001; see // 00014 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status). // 00015 // //////////////////////////////////////////////////////////////////// // 00016 // This file is part of the iLab Neuromorphic Vision C++ Toolkit. // 00017 // // 00018 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can // 00019 // redistribute it and/or modify it under the terms of the GNU General // 00020 // Public License as published by the Free Software Foundation; either // 00021 // version 2 of the License, or (at your option) any later version. // 00022 // // 00023 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope // 00024 // that it will be useful, but WITHOUT ANY WARRANTY; without even the // 00025 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // 00026 // PURPOSE. See the GNU General Public License for more details. // 00027 // // 00028 // You should have received a copy of the GNU General Public License // 00029 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write // 00030 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, // 00031 // Boston, MA 02111-1307 USA. // 00032 // //////////////////////////////////////////////////////////////////// // 00033 // 00034 // Primary maintainer for this file: David Berg <dberg@usc.edu> 00035 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/ModelNeuron/SimStructures.H $ 00036 00037 #ifndef MODELNEURON_SIMSTRUCTURES_H_DEFINED 00038 #define MODELNEURON_SIMSTRUCTURES_H_DEFINED 00039 00040 #include "Util/SimTime.H" 00041 #include "ModelNeuron/Layer.H" 00042 #include "ModelNeuron/CompLayer.H" 00043 #include "ModelNeuron/LowPass.H" 00044 #include "ModelNeuron/LowpassNeuron.H" 00045 #include "ModelNeuron/IZNeuron.H" 00046 #include "ModelNeuron/SC.H" 00047 00048 //###################################################################### 00049 // Some different neural field type models 00050 //###################################################################### 00051 // All equations for the below classes are inspired by Neural Field 00052 // dynamics: Amari & Arbib, 77; Coombs, 05; Erlhagen & Bicho, 2006 00053 //###################################################################### 00054 00055 //###################################################################### 00056 // A neural field with local gaussian connectivity 00057 //###################################################################### 00058 struct NeuralFieldGauss : public Layer<LowPassSigmoid, WeightsBinomial> 00059 { 00060 NeuralFieldGauss(const double& tau, const double& h, const double& estd, const BorderPolicy bp, 00061 const SimTime& timestep, const uint width, const uint height) 00062 : Layer<LowPassSigmoid, WeightsBinomial>(estd, 1.0, true, bp, //weights related options 00063 timestep, width, height, //structuremodule related options 00064 "NFG", "pA") //set the name and units 00065 { 00066 //set a configured lowpass filter for all positions in layer 00067 setModule(LowPassSigmoid(tau, h, 0.55, 12, timestep)); 00068 } 00069 }; 00070 00071 //###################################################################### 00072 // A neural field where the interaction kernel is a Gaussian minus 00073 // a constant 00074 //###################################################################### 00075 struct NeuralFieldCS : public Layer<LowPassSigmoid, WeightsCS> 00076 { 00077 NeuralFieldCS(const double& tau, const double& h, const double& estd, const double& inhibit, 00078 const BorderPolicy bp, const SimTime& timestep, const uint width, const uint height) 00079 : Layer<LowPassSigmoid, WeightsCS>(estd, 1.0, inhibit, false, bp, //weights related options 00080 timestep, width, height, //structuremodule related options 00081 "NFCS", "pA") //set the name and units 00082 { 00083 //set a configured lowpass filter for all positions in layer 00084 setModule(LowPassSigmoid(tau, h, 0.55, 12, timestep)); 00085 } 00086 }; 00087 00088 //###################################################################### 00089 // A neural field where the interaction kernel is a difference of 00090 // Gaussians. 00091 //###################################################################### 00092 struct NeuralFieldDoG : public Layer<LowPassSigmoid, WeightsDoG> 00093 { 00094 NeuralFieldDoG(const double& tau, const double& h, const double& estd, const double& istd, const double& e_i_ratio, 00095 const BorderPolicy bp, const SimTime& timestep, const uint width, const uint height) 00096 : Layer<LowPassSigmoid, WeightsDoG>(estd, istd, e_i_ratio, 1.0, false, bp, //weights related options 00097 timestep, width, height, //structuremodule related options 00098 "NFDoG", "pA") //set the name and units 00099 { 00100 //set a configured lowpass filter for all positions in layer 00101 setModule(LowPassSigmoid(tau, h, 0.55, 12, timestep)); 00102 } 00103 }; 00104 00105 // ###################################################################### 00106 // register the neural field SC 00107 // ###################################################################### 00108 namespace 00109 { 00110 typedef SimStructure::Factory NFFactory; 00111 typedef SimStructure::Creator NFCreator; 00112 00113 //define creation functions 00114 struct RegisterNeuralField 00115 { 00116 RegisterNeuralField() 00117 { 00118 const double tau = 25.0; //decay constant for low pass modules 00119 const SimTime time = SimTime::MSECS(5.0); //default simulation time 00120 const uint w(100), h(100); //default dimensions 00121 00122 //a simple gaussian neural field with either a null stable or full stable solution 00123 // ###################################################################### 00124 NFFactory::instance().add("NFGauss", NFCreator::make<NeuralFieldGauss>(tau, -0.5, 1.5, NONE, time, w, h)); 00125 00126 //a global inhibition neural field - global inhibition (4th param) adjusts selection process. values around 0.95 00127 //and below will lead to stable solutions, with values close to 0 approaching full activity solution. N-bump 00128 //solutions for values < around .45 00129 // ###################################################################### 00130 //stable n-bump solution 00131 NFFactory::instance().add("NFNbumpCS", NFCreator::make<NeuralFieldCS>(tau,-0.05, 1.5,.3, NONE, time, w, h)); 00132 //stable 1-bump solution 00133 NFFactory::instance().add("NF1bumpCS", NFCreator::make<NeuralFieldCS>(tau,-0.05, 1.5,.6, NONE, time, w, h)); 00134 00135 //a local inhibition neural field - ratio fo excitation/inhibition strength (5th param) can be used to adjust the 00136 //selection process for a fixed size of excitation and inhibition (3rd and 4th param). ratio > 1 and < around 2.5 00137 //will lead to a stable solution of N-regions each consisting of 1 bump. < 1 solutions are degenerating. 00138 //###################################################################### 00139 NFFactory::instance().add("NFNbumpDoG",NFCreator::make<NeuralFieldDoG>(tau,-0.05,2.0,8.0,2.00,NONE,time,w,h)); 00140 NFFactory::instance().add("NF0bumpDoG",NFCreator::make<NeuralFieldDoG>(tau,-0.05,2.0,8.0,1.0,NONE,time,w,h)); 00141 } 00142 }; 00143 static RegisterNeuralField registernf; 00144 } 00145 00146 //###################################################################### 00147 // Models were the units are still esentially low-pass filters, but 00148 // the excitatory and inhibitory layers are more explicitly modeld. 00149 //###################################################################### 00150 00151 //###################################################################### 00152 // 2-layer (excitatory and inhibitory) competitive network 00153 //###################################################################### 00154 struct LowpassCompLayer : public CompLayer<LowPassSigmoid, LowPassRectify> 00155 { 00156 LowpassCompLayer(const double& tau, const double& h1, const double& h2, 00157 const double& excite_std, const double& inhibit_std, 00158 const double& excite_w, const double& feedforward, const double& feedback, 00159 const BorderPolicy bp, const SimTime& timestep, const uint width, const uint height) : 00160 CompLayer<LowPassSigmoid, LowPassRectify>(excite_std, inhibit_std, excite_w, feedforward, feedback, 00161 bp, timestep, width, height, "LowpassCompLayer", "") 00162 { 00163 setModules(LowPassSigmoid(tau, h1, 0.55, 12, timestep), LowPassRectify(tau, h2, 0.0, timestep)); 00164 } 00165 }; 00166 00167 //###################################################################### 00168 // 2-layer (excitatory and inhibitory) competitive network with a 00169 // LowpassNeuronRectify 00170 //###################################################################### 00171 /* 00172 struct LowpassNeuronCompLayer : public CompLayer<LowpassNeuronRectify, LowpassNeuronRectify> 00173 { 00174 LowpassNeuronCompLayer(const double& excite_std, const double& inhibit_std, 00175 const double& excite_w, const double& feedforward, const double& feedback, 00176 const BorderPolicy bp, const SimTime& timestep, const uint width, const uint height) : 00177 CompLayer<LowpassNeuronRectify, LowpassNeuronRectify>(excite_std, inhibit_std, excite_w, feedforward, feedback, 00178 bp, timestep, width, height, "LowpassCompLayer","PA") 00179 { 00180 const double& taue, const double& taui, const double& taus, const double& gain, const double& h; 00181 LowpassNeuronRectify lpn(taue, taui, taus, gain, -0.5, 0.0, timestep);//excitatory neuron 00182 setModules(lpn, lpn); 00183 } 00184 }; 00185 */ 00186 00187 //###################################################################### 00188 // A Lowpass filter model of the mammilian superior colliculus where 00189 // superficial and deep layers are each modeled with two layer competitive 00190 // networks of lowpass filters with sigmoidal firing rate functions 00191 //###################################################################### 00192 struct LowpassSC : public SC 00193 { 00194 LowpassSC(const double tau, 00195 const double& SCs_SCi, const double& SCi_PreM, const double& PreM_SCi, const double& SCi_SCs, 00196 const BorderPolicy bp, const SimTime& timestep, const uint width, const uint height, 00197 const std::string name = "LowpassSC", const std::string units = "") : 00198 SC(SCs_SCi, SCi_PreM, PreM_SCi, SCi_SCs, bp, timestep, width, height, name, units) 00199 { 00200 LowpassCompLayer SCs(tau, -0.05, -0.05, 1.5, 3.0, 0.25, 1.0, -0.75, bp, timestep, width, height); 00201 LowpassCompLayer SCi(tau, -0.05, -0.05, 1.0, 1.0, 0.15, 1.0, -0.10, bp, timestep, width, height); 00202 setLayers(SCs, SCi, LowPassSigmoid(tau, 0.0, 1.0, 1.0, timestep)); 00203 } 00204 }; 00205 00206 // ###################################################################### 00207 // register the neural field models 00208 // ###################################################################### 00209 namespace 00210 { 00211 typedef SimStructure::Factory SSFactory; 00212 typedef SimStructure::Creator SSCreator; 00213 00214 //define creation functions 00215 struct RegisterLowpass 00216 { 00217 RegisterLowpass() 00218 { 00219 const double tau = 25.0; //decay constant for low pass modules 00220 const SimTime time = SimTime::MSECS(5.0); //default simulation time 00221 const uint w(100), h(100); //default dimensions 00222 00223 00224 //two layer competitive neural field, a weak wta version 00225 //###################################################################### 00226 SSFactory::instance().add("WeakWTA",SSCreator::make<LowpassCompLayer>(tau,-0.05, -0.05, 00227 1.0, 9.0, 0.1, 1.0, -10.0, 00228 NONE,time,w,h)); 00229 00230 /* 00231 //###################################################################### 00232 SSFactory::instance().add("WeakWTANeuron",SSCreator::make<LowpassNeuronCompLayer>(tau, tau 00233 1.0, 9.0, 0.1, 1.0, -10.0, 00234 NONE,time,w,h)); 00235 */ 00236 00237 //two layer competitive neural field, growing blob version 00238 //###################################################################### 00239 SSFactory::instance().add("WeakBlob",SSCreator::make<LowpassCompLayer>(tau,-0.05, -0.05, 00240 1.0, 1.0, 0.15, 1.0, -0.1, 00241 NONE,time,w,h)); 00242 //lowpass filter version of the SC model 00243 //###################################################################### 00244 SSFactory::instance().add("LowpassSC",SSCreator::make<LowpassSC>(tau, 1.0, 1.0, 1.0, -1.0, NONE, time, w, h)); 00245 } 00246 }; 00247 static RegisterLowpass registerlowpass; 00248 } 00249 00250 //###################################################################### 00251 // spiking models 00252 //###################################################################### 00253 00254 //###################################################################### 00255 // Two layer competetive networks using spiking neurons, inspired by the 00256 // construction of each layer in the mammalian superior colliculus. 00257 //###################################################################### 00258 struct IZCompLayer : public CompLayer<FSNeuron, FSNeuron> 00259 { 00260 IZCompLayer(const double& excite_std, const double& inhibit_std, 00261 const double& excite_w, const double& feedforward, const double& feedback, 00262 const BorderPolicy bp, const SimTime& timestep, const uint width, const uint height) : 00263 CompLayer<FSNeuron, FSNeuron>(excite_std,inhibit_std,excite_w,feedforward,feedback, 00264 bp, timestep, width, height, "IZCompLayer", "") 00265 { 00266 setModules(FSNeuron(), FSNeuron()); 00267 } 00268 }; 00269 00270 //###################################################################### 00271 // A spiking model of the mamillian superior colliculus 00272 //###################################################################### 00273 struct SpikingSC : public SC 00274 { 00275 SpikingSC(const double& SCs_SCi, const double& SCi_PreM, const double& PreM_SCi, const double& SCi_SCs, 00276 const BorderPolicy bp, const SimTime& timestep, const uint width, const uint height, 00277 const std::string name = "SpikingSC", const std::string units = "") : 00278 SC(SCs_SCi, SCi_PreM, PreM_SCi, SCi_SCs, bp, timestep, width, height, name, units) 00279 { 00280 IZCompLayer SCs(1.0, 9.0, 3.0, 2.0, -0.05, bp, timestep, width, height); 00281 IZCompLayer SCi(1.0, 0.0, 2.0, 6.0, -0.3, bp, timestep, width, height); 00282 setLayers(SCs, SCi, EBNeuron()); 00283 } 00284 }; 00285 00286 // ###################################################################### 00287 // register the neural simulation models 00288 // ###################################################################### 00289 namespace 00290 { 00291 typedef SimStructure::Factory SpikeLayerFactory; 00292 typedef SimStructure::Creator SpikeLayerCreator; 00293 00294 //define creation functions 00295 struct RegisterSpikeLayers 00296 { 00297 RegisterSpikeLayers() 00298 { 00299 const SimTime time = SimTime::MSECS(1.0); 00300 const uint w(100), h(100); //default dimensions 00301 00302 // superficial SGs model 00303 // ###################################################################### 00304 SpikeLayerFactory::instance().add("SCs", SpikeLayerCreator::make<IZCompLayer>(1.0, 9.0, 3.0, 2.0, -0.05, 00305 NONE, time, w, h)); 00306 00307 // our intermediate SC model 00308 // ###################################################################### 00309 SpikeLayerFactory::instance().add("SCi", SpikeLayerCreator::make<IZCompLayer>(1.0, 0.0, 2.0, 6.0, -0.3, 00310 NONE, time, w, h)); 00311 00312 //spiking version of the SC model 00313 //###################################################################### 00314 SpikeLayerFactory::instance().add("SC", SpikeLayerCreator::make<SpikingSC>(1.0, 1.0, 1.0, -1.0, 00315 NONE, time, w, h)); 00316 } 00317 }; 00318 static RegisterSpikeLayers registersspikelayers; 00319 } 00320 00321 #endif 00322 // ###################################################################### 00323 /* So things look consistent in everyone's emacs... */ 00324 /* Local Variables: */ 00325 /* indent-tabs-mode: nil */ 00326 /* End: */