
Object recognition model inspired from Riesenhuber & Poggio's HMAX model. More...
#include <CUDA/CudaHmaxFL.H>


Public Member Functions | |
| CudaHmaxFL () | |
| Default constructor. Need to call init() later. | |
| CudaHmaxFL (MemoryPolicy mp, int dev, 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 (MemoryPolicy mp, int dev, 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 () |
| ~CudaHmaxFL () | |
| Destructor. | |
| void | getC2 (const CudaImage< float > &input, float **&c2Res) |
| Compute C2 responses from an input image. | |
| void | extractRandC1Patches (Image< float > *&posTrainingImages, int numPosTrainImages, std::vector< int > patchSizes, int nPatchesPerSize, int no) |
| Randomly extract a set of C1Patches from positive training images. | |
| void | setC1Patches (CudaImage< float > ***&patches, std::vector< int > patchSizes, int numPatchesPerSize) |
| Set the c1patches that should be used. | |
| void | readInC1Patches (std::string fileName) |
| void | writeOutC1Patches (std::string fileName) |
| std::vector< int > | getC1PatchSizes () |
| int | getC1PatchesPerSize () |
| CudaImage< float > ***& | getC1Patches () |
| Get the c1patches that are being used. | |
| void | windowedPatchDistance (CudaImage< float > *&images, int nimages, CudaImage< float > *&patches, int npatches, CudaImage< float > &D, float sumSquaredPatch) |
| Calculate the distance from a patch to an image. | |
Protected Attributes | |
| int | nswb |
| number of scales within a scale band | |
| CudaImage< float > *** | c1Patches |
| patches that should be compared in S2 activation c1Patches[patchSizes][patchesPerSize] | |
| float ** | sumPSq |
| 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 CudaHmaxFL.H.
| CudaHmaxFL::CudaHmaxFL | ( | ) |
Default constructor. Need to call init() later.
Definition at line 65 of file CudaHmaxFL.C.
References CudaHmax::initialized.
Referenced by CudaHmaxFLSal::CudaHmaxFLSal().
| CudaHmaxFL::CudaHmaxFL | ( | MemoryPolicy | mp, | |
| int | dev, | |||
| 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.
Definition at line 69 of file CudaHmaxFL.C.
References init(), and CudaHmax::initialized.
| CudaHmaxFL::~CudaHmaxFL | ( | ) |
| void CudaHmaxFL::extractRandC1Patches | ( | Image< float > *& | posTrainingImages, | |
| int | numPosTrainImages, | |||
| std::vector< int > | patchSizes, | |||
| int | nPatchesPerSize, | |||
| int | no | |||
| ) |
Randomly extract a set of C1Patches from positive training images.
Reimplemented in CudaHmaxFLSal.
Definition at line 325 of file CudaHmaxFL.C.
References cudaCrop(), CudaImage< T >::getHeight(), CudaImage< T >::getWidth(), CudaImage< T >::resize(), setC1Patches(), Rectangle::tlbrI(), and ZEROS.
| void CudaHmaxFL::freeMem | ( | ) |
Free internal memory.
Reimplemented from CudaHmax.
Definition at line 127 of file CudaHmaxFL.C.
References CudaHmax::initialized.
Referenced by ~CudaHmaxFL().
| CudaImage< float > ***& CudaHmaxFL::getC1Patches | ( | ) |
Get the c1patches that are being used.
Definition at line 310 of file CudaHmaxFL.C.
References c1Patches.
| void CudaHmaxFL::getC2 | ( | const CudaImage< float > & | input, | |
| float **& | c2Res | |||
| ) |
Compute C2 responses from an input image.
Definition at line 435 of file CudaHmaxFL.C.
References c1Patches, c1PatchSizes, Timer::getSecs(), min(), CudaHmax::nsb, Timer::reset(), and windowedPatchDistance().
| void CudaHmaxFL::init | ( | MemoryPolicy | mp, | |
| int | dev, | |||
| 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.
Definition at line 80 of file CudaHmaxFL.C.
References c1Patches, max(), CudaHmax::nsb, and nswb.
Referenced by CudaHmaxFL().
| void CudaHmaxFL::setC1Patches | ( | CudaImage< float > ***& | patches, | |
| std::vector< int > | patchSizes, | |||
| int | numPatchesPerSize | |||
| ) |
Set the c1patches that should be used.
Definition at line 157 of file CudaHmaxFL.C.
References c1Patches, c1PatchSizes, CudaImage< T >::clear(), nC1PatchesPerSize, and NO_INIT.
Referenced by CudaHmaxFLSal::extractRandC1Patches(), and extractRandC1Patches().
| void CudaHmaxFL::windowedPatchDistance | ( | CudaImage< float > *& | images, | |
| int | nimages, | |||
| CudaImage< float > *& | patches, | |||
| int | npatches, | |||
| CudaImage< float > & | D, | |||
| float | sumSquaredPatch | |||
| ) |
Calculate the distance from a patch to an image.
Definition at line 388 of file CudaHmaxFL.C.
References CONV_BOUNDARY_ZERO, CudaImage< T >::getHeight(), CudaImage< T >::getWidth(), Rectangle::tlbrI(), and ZEROS.
Referenced by getC2().
CudaImage<float>*** CudaHmaxFL::c1Patches [protected] |
patches that should be compared in S2 activation c1Patches[patchSizes][patchesPerSize]
Definition at line 106 of file CudaHmaxFL.H.
Referenced by getC1Patches(), getC2(), init(), and setC1Patches().
std::vector<int> CudaHmaxFL::c1PatchSizes [protected] |
Number of square patch sizes of c1Patches.
Definition at line 108 of file CudaHmaxFL.H.
Referenced by getC2(), and setC1Patches().
int CudaHmaxFL::nC1PatchesPerSize [protected] |
Number of patches per patch size of c1Patches.
Definition at line 109 of file CudaHmaxFL.H.
Referenced by setC1Patches().
int CudaHmaxFL::nswb [protected] |
number of scales within a scale band
Definition at line 105 of file CudaHmaxFL.H.
Referenced by init().
1.6.3