View/save a bunch of stats about the saliency map. More...
#include <Neuro/SimulationViewerStats.H>
Public Member Functions | |
Constructors and destructors | |
SimulationViewerStats (OptionManager &mgr, const std::string &descrName="Simulation Viewer Stats", const std::string &tagName="SimulationViewerStats") | |
Constructor. See ModelComponent.H. | |
virtual | ~SimulationViewerStats () |
Destructor. | |
Protected Member Functions | |
SIMCALLBACK_DECLARE (SimulationViewerStats, SimEventSaveOutput) | |
Callback for every time we should save our outputs. | |
virtual void | start2 () |
Get started: | |
virtual void | stop2 () |
Get stopped: | |
void | lockFile (const std::string fileName, int &fd, struct flock &fl) const |
apply an advisory lock on a file | |
void | unlockFile (const std::string fileName, const int fd, struct flock &fl) const |
remove an advisory lock on a file | |
virtual void | save1 (const ModelComponentSaveInfo &sinfo) |
Save our various results. | |
virtual void | computeAGStats (SimEventQueue &q) |
Compute and save target stats with mask and AttentionGate? | |
virtual void | computeLAMStats (const Image< float > &img) |
Compute Last Attention Map stats from AttentionGate? | |
virtual void | saveCompat (const Image< float > &img, const std::string suffix=".final.txt", const int frameOffset=0) |
Save our various results in a channel compatable format used in SingleChannel.C. | |
virtual void | saveAGMaskStats (const Image< float > &img, const std::string caller, const std::string suffix=".final-AGmask.txt") |
Save Attention Gate stats if requested. | |
Protected Attributes | |
OModelParam< std::string > | itsStatsFname |
Filename for the stats. | |
OModelParam< bool > | itsSaveXcombo |
Save images too. | |
OModelParam< bool > | itsSaveYcombo |
Save images too. | |
OModelParam< bool > | itsComputeAGStats |
Save Attention Gate Stats. | |
OModelParam< int > | itsAGTargetFrame |
Which frame is the target? | |
OModelParam< std::string > | itsAGMaskFile |
Which file has the Ground Truth. | |
OModelParam< std::string > | itsAGStatsSaveFile |
File save AG stats to. | |
Compatable statistics with SingleChannels stats | |
OModelParam< bool > | itsGetSingleChannelStats |
Save basic single channel stats. | |
OModelParam< std::string > | itsGetSingleChannelStatsFile |
File name for single channel stats. | |
OModelParam< bool > | itsSaveStatsPerChannelFreq |
Should we save frequency information using 2D FFT? |
View/save a bunch of stats about the saliency map.
This SimulationViewer's purpose is mainly to save a variety of stats about the saliency map, including about locations of highest peak, mean/variance of saliency, number of peaks, etc.
Definition at line 49 of file SimulationViewerStats.H.
SimulationViewerStats::SimulationViewerStats | ( | OptionManager & | mgr, | |
const std::string & | descrName = "Simulation Viewer Stats" , |
|||
const std::string & | tagName = "SimulationViewerStats" | |||
) |
Constructor. See ModelComponent.H.
Definition at line 63 of file SimulationViewerStats.C.
SimulationViewerStats::~SimulationViewerStats | ( | ) | [virtual] |
Destructor.
Definition at line 82 of file SimulationViewerStats.C.
void SimulationViewerStats::computeAGStats | ( | SimEventQueue & | q | ) | [protected, virtual] |
Compute and save target stats with mask and AttentionGate?
This method requires a mask file for ground truth. If none is avialable, then use computeLAMStats to save basic attention gate stats only
Definition at line 476 of file SimulationViewerStats.C.
References Image< T >::begin(), Image< T >::beginw(), SimEventQueue::check(), Image< T >::end(), Image< T >::endw(), Image< T >::getHeight(), getMinMaxAvg(), OModelParam< T >::getVal(), Image< T >::getWidth(), Image< T >::initialized(), itsAGMaskFile, itsAGTargetFrame, max(), min(), Raster::ReadRGB(), rescale(), Image< T >::resize(), saveAGMaskStats(), and saveCompat().
Referenced by save1().
void SimulationViewerStats::computeLAMStats | ( | const Image< float > & | img | ) | [protected, virtual] |
Compute Last Attention Map stats from AttentionGate?
Definition at line 454 of file SimulationViewerStats.C.
References Image< T >::beginw(), Image< T >::endw(), rescale(), saveAGMaskStats(), and saveCompat().
Referenced by save1().
void SimulationViewerStats::lockFile | ( | const std::string | fileName, | |
int & | fd, | |||
struct flock & | fl | |||
) | const [protected] |
apply an advisory lock on a file
Definition at line 109 of file SimulationViewerStats.C.
Referenced by save1().
void SimulationViewerStats::save1 | ( | const ModelComponentSaveInfo & | sinfo | ) | [protected, virtual] |
Save our various results.
Save the overlap image
Reimplemented from ModelComponent.
Definition at line 166 of file SimulationViewerStats.C.
References SimEventQueue::check(), colGreyCombo(), computeAGStats(), computeLAMStats(), drawPatch(), findMax(), findMin(), findPeaks(), Image< T >::getHeight(), SimulationViewer::getMap(), getMinMaxAvg(), ModelComponent::getRootObject(), OModelParam< T >::getVal(), Image< T >::getWidth(), Point2D< T >::i, Image< T >::initialized(), itsComputeAGStats, SimulationViewer::itsDisplayInterp, itsGetSingleChannelStats, itsSaveXcombo, itsSaveYcombo, itsStatsFname, lockFile(), SimTime::msecs(), NamedImage< T >::name(), SimEventQueue::now(), ModelComponent::printout(), ImageSet< T >::push_back(), randomUpToNotIncluding(), SimEventQueue::request(), saveCompat(), SEQ_ANY, ImageSet< T >::size(), SRC_POS, stdev(), and unlockFile().
void SimulationViewerStats::saveAGMaskStats | ( | const Image< float > & | img, | |
const std::string | caller, | |||
const std::string | suffix = ".final-AGmask.txt" | |||
) | [protected, virtual] |
Save Attention Gate stats if requested.
Definition at line 724 of file SimulationViewerStats.C.
References getMinMaxAvgEtc(), OModelParam< T >::getVal(), itsGetSingleChannelStatsFile, max(), and min().
Referenced by computeAGStats(), and computeLAMStats().
void SimulationViewerStats::saveCompat | ( | const Image< float > & | img, | |
const std::string | suffix = ".final.txt" , |
|||
const int | frameOffset = 0 | |||
) | [protected, virtual] |
Save our various results in a channel compatable format used in SingleChannel.C.
Definition at line 653 of file SimulationViewerStats.C.
References Image< T >::begin(), Image< T >::end(), Image< T >::getHeight(), getMinMaxAvgEtc(), OModelParam< T >::getVal(), Image< T >::getWidth(), itsGetSingleChannelStatsFile, itsSaveStatsPerChannelFreq, max(), and min().
Referenced by computeAGStats(), computeLAMStats(), and save1().
SimulationViewerStats::SIMCALLBACK_DECLARE | ( | SimulationViewerStats | , | |
SimEventSaveOutput | ||||
) | [protected] |
Callback for every time we should save our outputs.
void SimulationViewerStats::start2 | ( | ) | [protected, virtual] |
Get started:
Reimplemented from ModelComponent.
Definition at line 86 of file SimulationViewerStats.C.
void SimulationViewerStats::stop2 | ( | ) | [protected, virtual] |
Get stopped:
Reimplemented from ModelComponent.
Definition at line 96 of file SimulationViewerStats.C.
void SimulationViewerStats::unlockFile | ( | const std::string | fileName, | |
const int | fd, | |||
struct flock & | fl | |||
) | const [protected] |
remove an advisory lock on a file
Definition at line 142 of file SimulationViewerStats.C.
Referenced by save1().
OModelParam<std::string> SimulationViewerStats::itsAGMaskFile [protected] |
Which file has the Ground Truth.
Definition at line 73 of file SimulationViewerStats.H.
Referenced by computeAGStats().
File save AG stats to.
Definition at line 74 of file SimulationViewerStats.H.
OModelParam<int> SimulationViewerStats::itsAGTargetFrame [protected] |
Which frame is the target?
Definition at line 72 of file SimulationViewerStats.H.
Referenced by computeAGStats().
OModelParam<bool> SimulationViewerStats::itsComputeAGStats [protected] |
Save Attention Gate Stats.
Definition at line 71 of file SimulationViewerStats.H.
Referenced by save1().
OModelParam<bool> SimulationViewerStats::itsGetSingleChannelStats [protected] |
Save basic single channel stats.
we also save final saliency stats using the same format
Definition at line 80 of file SimulationViewerStats.H.
Referenced by save1().
File name for single channel stats.
we also save final saliency stats using the same format
Definition at line 84 of file SimulationViewerStats.H.
Referenced by saveAGMaskStats(), and saveCompat().
OModelParam<bool> SimulationViewerStats::itsSaveStatsPerChannelFreq [protected] |
Should we save frequency information using 2D FFT?
Definition at line 87 of file SimulationViewerStats.H.
Referenced by saveCompat().
OModelParam<bool> SimulationViewerStats::itsSaveXcombo [protected] |
OModelParam<bool> SimulationViewerStats::itsSaveYcombo [protected] |
OModelParam<std::string> SimulationViewerStats::itsStatsFname [protected] |
Filename for the stats.
Definition at line 68 of file SimulationViewerStats.H.
Referenced by save1().