123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- #ifndef _H_SIMMODULES
- #define _H_SIMMODULES
- #include "libcsim.hpp"
- #include "input.hpp"
- #include "simmodule.hpp"
- using namespace std;
- enum SimMod_StimSetType {Test, Parametric, Scan, FileName, IdlMovieFile, Ascii, MovieScan, Sequence};
- static const int SimMod_NumberStimSetTypes=8;
- class SimMod_CompetitiveInhibition: SimModule
- {
- private:
- layer* ExLayer;
- layer* InhLayer;
- int NInhNeurons;
- int NExInhConnections;
- int NInhExConnections;
- int NInhInhConnections;
- float ExInhStrength;
- float InhExStrength;
- float InhInhStrength;
- float NmdaAmpaRatio;
- Connection* conInhEx;
- Connection* conInhInh;
- Connection* conExInh;
- public:
- SimMod_CompetitiveInhibition(AnyOptionWrapper* _opt);
- virtual void SetCmdLineOptions();
- virtual layer* Setup(layer* _ExLayer, bool LoadWeights=false, bool VecCon=false, bool SaveInitialWeights=true);
- void SetAllInhExWeights(float WeightValue);
- void SetInhExWeightStrength(float WeightStrength);
- };
- class SimModuleITLayer: SimModule
- {
- private:
- float ITTauInhibition;
- // float ITTauFeeding;
- float NmdaAmpaRatio;
- int ITNx, ITNy;
- float ITLateralInhibitionWeight;
- float ITSelfLearnRate;
- bool ITSelfInhFacilitation;
- float SelfInhCdep;
- float SelfInhMaxWeight;
- float SelfInhMinWeight;
- float LatInhDistance;
- layer* ITLayer;
- connection *ConITSelfInh;
- SimMod_CompetitiveInhibition CompInh;
- public:
- SimModuleITLayer(AnyOptionWrapper* _opt);
- ~SimModuleITLayer();
- virtual void SetCmdLineOptions();
- virtual layer* Setup(
- SimLoop *MainSimLoop,
- int NType,
- bool LoadWeights,
- bool Learn,
- bool InhResetable=false, // inhibition layer per default not resetable (to keep inhibition level in network after reset)
- bool SaveInitialWeights=true
- );
- void SetInhExWeightStrength(float NewInhExStrength);
- bool LoadITWeights;
- SimMod_CompetitiveInhibition* GetCompInhibitionPtr(){return &CompInh;};
- SpikeTrain* ItSpikeTrain();
- };
- // erhaelt nur Gauss-Blob-verschalteten Vorwaerts-Input von MapLayer
- class InvarLayer: SimModule
- {
- private:
- float FWConStrength;
- layer* MapLayer;
- csimNeuronType NType;
- layer* LInvar;
- Connection* conMapLInvar;
- int Nx, Ny;
- bool VecCon;
- public:
- InvarLayer(AnyOptionWrapper* _opt);
- ~InvarLayer();
- virtual void SetCmdLineOptions();
- virtual layer* Setup(layer* _MapLayer, bool _veccon=false, bool SaveInitialWeights=true);
- virtual void TurnOn();
- virtual void TurnOff();
- };
- class SimModuleInput: SimModule
- {
- private:
- int StimulusSet;
- int StimulusNumber;
- string MovieDir;
- string StimFileName;
- string StimSequence;
- ObjMovie* MyMovie;
- SimMod_StimSetType SType;
- bool XContinuous;
- int NXParas, NYParas;
- int NTestStimuli;
- public:
- SimModuleInput(AnyOptionWrapper* _opt);
- // ~SimModuleInput();
- virtual void SetCmdLineOptions();
- virtual input* Setup(layer* TargetLayer, csimInputChannel InputNumber, float InputStrength);
- virtual void LoadMovie(int &InputNx, int &InputNy, int &NStimuli);
- int StimDur;
- int IsiDur;
- };
- class SimModuleMovieInput: SimModule
- {
- private:
- int NFilters, NLayers;
- string MovieDir;
- string StimFileName;
- string StimSequence;
- ObjMovie* MyMovie;
- // SimMod_StimSetType SType;
- bool XContinuous;
- int NXParas, NYParas;
- int InputNx, InputNy;
- float InitialWeights;
- float FRateNormThreshold;
- bool CommonInhibition;
- bool RewireForwardCon;
- layer* InhLayer;
- float ExInhWeights, InhExWeights;
- int TestStepSize; // default==1, wenn ==2, dann wird nur jeder zweite Stimulus in X bzw. Y Richtung als Test verwendet
- void LoadMovie();
- public:
- SimModuleMovieInput(AnyOptionWrapper* _opt);
- ~SimModuleMovieInput();
- virtual void SetCmdLineOptions();
- virtual int Setup(csimInputChannel InputNumber, float InputStrength, bool LoadWeights=false);
- virtual void SetTestMode();
- virtual void SetInputMode(InputMode mode);
- virtual void ConnectTo(layer* tolayer, bool LoadForwardWeights, bool Learn);
- int NStimuli;
- int NTestStimuli;
- int StimDur;
- int IsiDur;
- float LearnRate;
- };
- // smodMovieInput ist eine Weiterentwicklung von SimModuleMovieInput
- // sie soll die Nutzung von VecConnections ermoeglichen
- // smodMovieInput soll SimModuleMovieInput abloesen
- class smodMovieInput: SimModule
- {
- private:
- int NFilters, NLayers;
- string MovieDir;
- string StimFileName;
- string TestStimFileName;
- string SequenceFileName;
- ObjMovie* MyMovie;
- ObjMovie* StimMovie, TestMovie;
- // SimMod_StimSetType SType;
- bool XContinuous;
- int NXParas, NYParas;
- int InputNx, InputNy;
- float InitialWeights;
- float TauDecLearnPre;
- float TauDecLearnPost;
- float FRateNormThreshold;
- bool CommonInhibition;
- bool RewireForwardCon;
- bool OnOffInput; //< true: every input frame is feed into two layers: on layer (positive values) and off layer (negative values)
- layer* InhLayer;
- float ExInhWeights, InhExWeights;
- int TestStepSize; // default==1, wenn ==2, dann wird nur jeder zweite Stimulus in X bzw. Y Richtung als Test verwendet
- void LoadMovie(string _StimFileName);
- void ChangeMovie(ObjMovie* _NewMovie);
- public:
- smodMovieInput(AnyOptionWrapper* _opt);
- ~smodMovieInput();
- virtual void SetCmdLineOptions();
- virtual int Setup(csimInputChannel InputNumber, float InputStrength, bool LoadWeights=false);
- void SetNoiseAmplitude(float sigma);
- virtual void SetTestMode();
- virtual void SetInputMode(InputMode mode);
- virtual void ConnectTo(layer* tolayer, bool LoadForwardWeights, bool Learn, bool VecCon=false, bool SaveInitialWeights=true);
- int NStimuli;
- int NTestStimuli;
- int StimDur;
- int IsiDur;
- float LearnRate;
- };
- #endif /*_H_SIMMODULES */
|