Object recognition model inspired from Riesenhuber & Poggio's HMAX model. More...
#include <HMAX/HmaxFL.H>
Public Member Functions | |
HmaxFL () | |
Default constructor. Need to call init() later. | |
HmaxFL (const int nori, const std::vector< int > &spacess, const std::vector< int > &scaless, const int c1spaceol=2, const bool angleflag=true, const float s2t=1.0F, const float s2s=1.0F, const float gamma=0.3F, const float divstart=4.05F, const float divstep=-0.05F, const int fsmin=5, const int fsstep=2) | |
Constructor. | |
void | init (const int nori, const std::vector< int > &spacess, const std::vector< int > &scaless, const int c1spaceol=2, const bool angleflag=true, const float s2t=1.0F, const float s2s=1.0F, const float gamma=0.3F, const float divstart=4.05F, const float divstep=-0.05F, const int fsmin=5, const int fsstep=2) |
Initialization. | |
void | initFilters (const float gamma, const float divstart, const float divstep, const int fsmin, const int fsstep) |
void | freeMem () |
Free internal memory. | |
void | freeC1Patches () |
~HmaxFL () | |
Destructor. | |
void | getC2 (const Image< float > &input, float **&c2Res) |
Compute C2 responses from an input image. | |
void | extractRandC1Patch (std::string dirname, Image< float > &image, int index, std::vector< int > patchSizes) |
Randomly extract a set of C1Patches from positive training images. | |
void | extractRandC1Patches (std::string dirname, Image< float > *&posTrainingImages, int numPosTrainImages, std::vector< int > patchSizes, int nPatchesPerSize) |
void | setC1Patches (Image< float > ***&patches, std::vector< int > patchSizes, int numPatchesPerSize) |
Set the c1patches that should be used. | |
void | readInC1Patches (std::string fileName) |
void | writeOutC1Patch (std::string dirName, Image< float > &patch, int i, int j, int k) |
void | writeOutC1Patches (std::string dirName) |
std::vector< int > | getC1PatchSizes () |
int | getC1PatchesPerSize () |
Image< float > ***& | getC1Patches () |
Get the c1patches that are being used. | |
void | windowedPatchDistance (Image< float > *&images, int nimages, Image< float > *&patches, int npatches, Image< float > &D) |
Calculate the distance from a patch to an image. | |
Protected Attributes | |
int | nswb |
number of scales within a scale band | |
Image< float > *** | c1Patches |
patches that should be compared in S2 activation c1Patches[patchSizes][patchesPerSize] | |
std::vector< int > | c1PatchSizes |
Number of square patch sizes of c1Patches. | |
int | nC1PatchesPerSize |
Number of patches per patch size of c1Patches. |
Object recognition model inspired from Riesenhuber & Poggio's HMAX model.
See Riesenhuber & Poggio, Nature Neuroscience, 1999.
Definition at line 56 of file HmaxFL.H.
HmaxFL::HmaxFL | ( | ) |
Default constructor. Need to call init() later.
Definition at line 62 of file HmaxFL.C.
References Hmax::initialized.
HmaxFL::HmaxFL | ( | const int | nori, | |
const std::vector< int > & | spacess, | |||
const std::vector< int > & | scaless, | |||
const int | c1spaceol = 2 , |
|||
const bool | angleflag = true , |
|||
const float | s2t = 1.0F , |
|||
const float | s2s = 1.0F , |
|||
const float | gamma = 0.3F , |
|||
const float | divstart = 4.05F , |
|||
const float | divstep = -0.05F , |
|||
const int | fsmin = 5 , |
|||
const int | fsstep = 2 | |||
) |
void HmaxFL::extractRandC1Patch | ( | std::string | dirname, | |
Image< float > & | image, | |||
int | index, | |||
std::vector< int > | patchSizes | |||
) |
Randomly extract a set of C1Patches from positive training images.
Definition at line 312 of file HmaxFL.C.
References Hmax::c1SpaceOL, Image< T >::getHeight(), Image< T >::getWidth(), and Rectangle::tlbrI().
void HmaxFL::freeMem | ( | ) |
Free internal memory.
Reimplemented from Hmax.
Definition at line 122 of file HmaxFL.C.
References Hmax::filter, and Hmax::initialized.
Referenced by ~HmaxFL().
Image< float > ***& HmaxFL::getC1Patches | ( | ) |
void HmaxFL::getC2 | ( | const Image< float > & | input, | |
float **& | c2Res | |||
) |
Compute C2 responses from an input image.
Definition at line 396 of file HmaxFL.C.
References c1Patches, c1PatchSizes, getMinMax(), min(), nC1PatchesPerSize, Hmax::nsb, and windowedPatchDistance().
void HmaxFL::init | ( | const int | nori, | |
const std::vector< int > & | spacess, | |||
const std::vector< int > & | scaless, | |||
const int | c1spaceol = 2 , |
|||
const bool | angleflag = true , |
|||
const float | s2t = 1.0F , |
|||
const float | s2s = 1.0F , |
|||
const float | gamma = 0.3F , |
|||
const float | divstart = 4.05F , |
|||
const float | divstep = -0.05F , |
|||
const int | fsmin = 5 , |
|||
const int | fsstep = 2 | |||
) |
void HmaxFL::setC1Patches | ( | Image< float > ***& | patches, | |
std::vector< int > | patchSizes, | |||
int | numPatchesPerSize | |||
) |
Set the c1patches that should be used.
Definition at line 151 of file HmaxFL.C.
References c1Patches, c1PatchSizes, and nC1PatchesPerSize.
void HmaxFL::windowedPatchDistance | ( | Image< float > *& | images, | |
int | nimages, | |||
Image< float > *& | patches, | |||
int | npatches, | |||
Image< float > & | D | |||
) |
Calculate the distance from a patch to an image.
Definition at line 350 of file HmaxFL.C.
References CONV_BOUNDARY_ZERO, convolve(), Image< T >::getHeight(), Image< T >::getWidth(), sum(), Rectangle::tlbrI(), and ZEROS.
Referenced by getC2().
Image<float>*** HmaxFL::c1Patches [protected] |
patches that should be compared in S2 activation c1Patches[patchSizes][patchesPerSize]
Definition at line 108 of file HmaxFL.H.
Referenced by getC1Patches(), getC2(), init(), and setC1Patches().
std::vector<int> HmaxFL::c1PatchSizes [protected] |
Number of square patch sizes of c1Patches.
Definition at line 109 of file HmaxFL.H.
Referenced by getC2(), and setC1Patches().
int HmaxFL::nC1PatchesPerSize [protected] |
Number of patches per patch size of c1Patches.
Definition at line 110 of file HmaxFL.H.
Referenced by getC2(), and setC1Patches().
int HmaxFL::nswb [protected] |