The Visual Cortex Class. More...
#include <Channels/IntegerRawVisualCortex.H>
Public Member Functions | |
virtual Image< float > | getOutput () |
Overload to not only convert to float but also apply our output factor. | |
virtual void | saveResults (const nub::ref< FrameOstream > &ofs) |
Save our results. | |
Constructors/Destructor | |
IntegerRawVisualCortex (OptionManager &mgr, nub::ref< IntegerMathEngine > eng, const std::string &descrName="Integer Visual Cortex", const std::string &tagName="IntegerRawVisualCortex") | |
Construct with no channel; channels must then be added with addSubChan(). | |
virtual | ~IntegerRawVisualCortex () |
Virtual destructor for safe inheritance. | |
Protected Member Functions | |
virtual void | doInputInt (const IntegerInput &inp, const SimTime &t, PyramidCache< int > *cache, const Image< byte > &clipMask) |
virtual Image< int > | combineOutputsInt () |
Combine the outputs of our subchannels. | |
virtual Image< int > | getChannelOutputMap (IntegerChannel &chan) const |
get weighted (but not resized) channel output map | |
virtual Image< int > | postProcessOutputMap (const Image< int > &outmap) |
post-process raw weighted sum of channel output maps | |
virtual void | paramChanged (ModelParamBase *const param, const bool valueChanged, ParamClient::ChangeStatus *status) |
Called whenever a ModelParamBase has its value changed. | |
virtual void | start1 () |
start | |
virtual void | stop2 () |
stop | |
Protected Attributes | |
OModelParam< std::string > | itsType |
OModelParam< std::string > | itsLogFile |
text log file name | |
OModelParam< MaxNormType > | itsNormType |
maxNormalization to use | |
OModelParam< bool > | itsUseRandom |
add random noise to output | |
OModelParam< float > | itsOutputFactor |
output range factor | |
OModelParam< bool > | itsUseOlderVersion |
use old version? see Visualcortex.H | |
OModelParam< LevelSpec > | itsLevelSpec |
LevelSpec used by our channels, used to compute output dims. | |
OModelParam< bool > | itsSaveOutput |
save our output? | |
OModelParam< bool > | itsUseMax |
use max across features instead of sum? |
The Visual Cortex Class.
In brief, IntegerRawVisualCortex holds a collection of IntegerChannel objects, and most of IntegerRawVisualCortex's operations are achieved by some kind of iteration over that collection. That is, IntegerRawVisualCortex now does little work by itself, but delegates its operations to the channels, accumulating their results if necessary.
Definition at line 79 of file IntegerRawVisualCortex.H.
IntegerRawVisualCortex::IntegerRawVisualCortex | ( | OptionManager & | mgr, | |
nub::ref< IntegerMathEngine > | eng, | |||
const std::string & | descrName = "Integer Visual Cortex" , |
|||
const std::string & | tagName = "IntegerRawVisualCortex" | |||
) |
Construct with no channel; channels must then be added with addSubChan().
mgr | our ModelManager (see ModelManager.H) | |
descrName | descriptive name for human usage | |
tagName | name for ParamMap usage |
Definition at line 72 of file IntegerRawVisualCortex.C.
IntegerRawVisualCortex::~IntegerRawVisualCortex | ( | ) | [virtual] |
Virtual destructor for safe inheritance.
Definition at line 91 of file IntegerRawVisualCortex.C.
Image< int > IntegerRawVisualCortex::combineOutputsInt | ( | ) | [protected, virtual] |
Combine the outputs of our subchannels.
We do this in a slightly different way than the ComplexChannel base version.
Reimplemented from IntegerComplexChannel.
Definition at line 244 of file IntegerRawVisualCortex.C.
References getChannelOutputMap(), Image< T >::getDims(), ChannelBase::getInputDims(), getMinMax(), IntegerComplexChannel::getSubchanTotalWeight(), OModelParam< T >::getVal(), Dims::h(), Image< T >::initialized(), itsLevelSpec, itsUseMax, LevelSpec::mapLevel(), MYLOGVERB, IntegerComplexChannel::numChans(), postProcessOutputMap(), IntegerComplexChannel::subChan(), takeMax(), Dims::w(), and ZEROS.
Image< int > IntegerRawVisualCortex::getChannelOutputMap | ( | IntegerChannel & | chan | ) | const [protected, virtual] |
get weighted (but not resized) channel output map
Definition at line 120 of file IntegerRawVisualCortex.C.
References IntegerComplexChannel::getSubchanTotalWeight(), OModelParam< T >::getVal(), itsUseOlderVersion, IntegerComplexChannel::numChans(), ChannelBase::numSubmaps(), IntegerComplexChannel::subChan(), and ModelComponent::tagName().
Referenced by combineOutputsInt().
Image< float > IntegerRawVisualCortex::getOutput | ( | ) | [virtual] |
Overload to not only convert to float but also apply our output factor.
Reimplemented from IntegerComplexChannel.
Definition at line 301 of file IntegerRawVisualCortex.C.
References getMinMax(), OModelParam< T >::getVal(), and itsOutputFactor.
void IntegerRawVisualCortex::paramChanged | ( | ModelParamBase *const | param, | |
const bool | valueChanged, | |||
ParamClient::ChangeStatus * | status | |||
) | [protected, virtual] |
Called whenever a ModelParamBase has its value changed.
Subclasses of ModelComponent should override this function if they need to do any internal reconfiguration when their parameters change value (whether due to a command-line option, or a setModelParamString(), or a readParamsFrom()). See OrientationChannel::paramChanged() in Channels/OrientationChannel.C for an example; also see SaccadeControllerConfigurator::paramChanged() in Neuro/SaccadeControllers.C for for how to use this to select subcomponents at runtime.
param | the address of the ModelParamBase that changed; subclasses can compare this with the addresses of their model param members to figure out which is the relevant param | |
valueChanged | true if the value actually changed, false if the value was "set" but the new value is the same as the old value; some clients may want to avoid re-doing expensive operations if the value did not actually change | |
status | the subclass that implements paramChanged() should set *status to CHANGE_REJECTED if it wishes to reject a particular parameter change; the caller of paramChanged() is expected to set *status to CHANGE_ACCEPTED prior to calling paramChanged(), so the implentation of paramChanged() does not need to set *status CHANGE_ACCEPTED if it wishes to allow the change since that will already be the default status |
HISTORICAL NOTE: In the past, subclasses would override setModelParamString() for this same purpose, but in the new setup, setModelParamString() is NOT virtual and hence should not be (cannot be) overridden by subclasses. This setup is cleaner (and potentially more efficient) because subclasses don't have to compare string names to figure out which param changed; instead they are passed the address of the param itself. Furthermore, the new setup is more robust, since we can handle param value changes that come from any source (e.g., setModelParamVal(), or ModelParamBase::setValString(), or OModelParam::setVal()), and not just those that come through setModelParamString().
Reimplemented from ModelComponent.
Definition at line 315 of file IntegerRawVisualCortex.C.
References IntegerComplexChannel::addSubChan(), ASSERT, ModelComponent::getManager(), OModelParam< T >::getVal(), makeSharedComp(), MC_RECURSE, IntegerComplexChannel::numChans(), IntegerComplexChannel::removeAllSubChans(), IntegerComplexChannel::setSubchanTotalWeight(), and IntegerComplexChannel::subChan().
Image< int > IntegerRawVisualCortex::postProcessOutputMap | ( | const Image< int > & | outmap | ) | [protected, virtual] |
post-process raw weighted sum of channel output maps
Derived classes may overload this to provide custom post-processing. For example, IntegerRawVisualCortexSurprise may pass the output through a sigmoidal nonlinearity or spatial competition. Default implementation is to treat the special case of VCXNORM_LANDMARK.
Definition at line 188 of file IntegerRawVisualCortex.C.
References OModelParam< T >::getVal(), itsNormType, maxNormTypeName(), VCXNORM_LANDMARK, and VCXNORM_SURPRISE.
Referenced by combineOutputsInt().
void IntegerRawVisualCortex::saveResults | ( | const nub::ref< FrameOstream > & | ofs | ) | [virtual] |
Save our results.
Reimplemented from IntegerComplexChannel.
Definition at line 391 of file IntegerRawVisualCortex.C.
References FLOAT_NORM_0_255, OModelParam< T >::getVal(), itsSaveOutput, IntegerComplexChannel::numChans(), SRC_POS, and IntegerComplexChannel::subChan().
void IntegerRawVisualCortex::start1 | ( | ) | [protected, virtual] |
start
Reimplemented from IntegerComplexChannel.
Definition at line 97 of file IntegerRawVisualCortex.C.
References featureHierarchyLevel(), featureHierarchyName(), featureName(), IntegerComplexChannel::numChans(), IntegerComplexChannel::subChan(), and ChannelBase::visualFeature().
void IntegerRawVisualCortex::stop2 | ( | ) | [protected, virtual] |
stop
Reimplemented from IntegerComplexChannel.
Definition at line 112 of file IntegerRawVisualCortex.C.
OModelParam<LevelSpec> IntegerRawVisualCortex::itsLevelSpec [protected] |
LevelSpec used by our channels, used to compute output dims.
Definition at line 159 of file IntegerRawVisualCortex.H.
Referenced by combineOutputsInt().
OModelParam<std::string> IntegerRawVisualCortex::itsLogFile [protected] |
text log file name
Definition at line 133 of file IntegerRawVisualCortex.H.
OModelParam<MaxNormType> IntegerRawVisualCortex::itsNormType [protected] |
maxNormalization to use
Reimplemented from IntegerComplexChannel.
Definition at line 134 of file IntegerRawVisualCortex.H.
Referenced by postProcessOutputMap().
OModelParam<float> IntegerRawVisualCortex::itsOutputFactor [protected] |
output range factor
Definition at line 136 of file IntegerRawVisualCortex.H.
Referenced by getOutput().
OModelParam<bool> IntegerRawVisualCortex::itsSaveOutput [protected] |
save our output?
Definition at line 160 of file IntegerRawVisualCortex.H.
Referenced by saveResults().
OModelParam<bool> IntegerRawVisualCortex::itsUseMax [protected] |
use max across features instead of sum?
Definition at line 161 of file IntegerRawVisualCortex.H.
Referenced by combineOutputsInt().
OModelParam<bool> IntegerRawVisualCortex::itsUseOlderVersion [protected] |
use old version? see Visualcortex.H
Reimplemented from IntegerComplexChannel.
Definition at line 156 of file IntegerRawVisualCortex.H.
Referenced by getChannelOutputMap().
OModelParam<bool> IntegerRawVisualCortex::itsUseRandom [protected] |
add random noise to output
Definition at line 135 of file IntegerRawVisualCortex.H.