Open Detection  1.0
od::g2d::ODHOGTrainer Class Reference

Class for training HOG based detector. More...

#include <ODHOGTrainer.h>

Inheritance diagram for od::g2d::ODHOGTrainer:
Collaboration diagram for od::g2d::ODHOGTrainer:

Public Member Functions

 ODHOGTrainer (std::string const &training_input_location_="", std::string const &trained_data_location_="", cv::Size winsize=cv::Size(64, 128), cv::Size blocksize=cv::Size(16, 16), cv::Size blockstride=cv::Size(8, 8), cv::Size cellsize=cv::Size(8, 8), float hitshreshold=0.0)
 
int train ()
 
void init ()
 
std::string const & getPosSamplesDir () const
 
void setPosSamplesDir (std::string const &posSamplesDir)
 
std::string const & getNegSamplesDir () const
 
void setNegSamplesDir (std::string const &negSamplesDir)
 
int getNOFeaturesNeg () const
 
void setNOFeaturesNeg (int featno)
 
cv::Point const & getStartHogPos () const
 
void setStartHogPos (cv::Point const &start_hog_pos)
 
cv::Size const & getWinSize () const
 
void setWinSize (cv::Size const &winSize)
 
cv::Size const & getBlockSize () const
 
void setBlockSize (cv::Size const &blockSize)
 
cv::Size const & getBlockStride () const
 
void setBlockStride (cv::Size const &blockStride)
 
cv::Size const & getCellSize () const
 
void setCellSize (cv::Size const &cellSize)
 
cv::Size const & getTrainingPadding () const
 
void setTrainingPadding (cv::Size const &trainingPadding)
 
bool isTrainHardNegetive () const
 
void setTrainHardNegetive (bool train_hard_negetive)
 
double getHitThreshold () const
 
- Public Member Functions inherited from od::ODTrainer
 ODTrainer (std::string const &training_input_location="", std::string const &training_data_location="")
 
- Public Member Functions inherited from od::ODDetectorCommon
 ODDetectorCommon (std::string const &trained_data_location_="")
 
std::string getTrainingInputLocation () const
 Gets/Sets the directory containing the data for training. More...
 
void setTrainingInputLocation (std::string training_input_location_)
 Gets/Sets the directory containing the data for training. More...
 
std::string getTrainedDataLocation () const
 Gets/Sets the base directory for trained data. More...
 
virtual void setTrainedDataLocation (std::string trained_data_location_)
 The base directory for trained data. More...
 
std::string getSpecificTrainingDataLocation ()
 Gets the specific directory for a Trainer or a Detector inside trained_data_location_. More...
 
std::string getSpecificTrainingData ()
 
std::string const & getTrainedDataID () const
 
void setTrainedDataID (std::string const &trainedDataID)
 

Protected Attributes

cv::Size winSize
 
cv::Size blockSize
 
cv::Size blockStride
 
cv::Size cellSize
 
cv::HOGDescriptor hog_
 
cv::Size trainingPadding
 
cv::Point start_hog_pos
 
int nofeatures_neg
 
cv::Size winStride
 
bool train_hard_negetive_
 
std::string posSamplesDir
 
std::string negSamplesDir
 
double hitThreshold
 
- Protected Attributes inherited from od::ODDetectorCommon
std::string training_input_location_
 
std::string trained_data_location_
 
std::string TRAINED_DATA_ID_
 
std::string TRAINED_LOCATION_DENTIFIER_
 

Detailed Description

Class for training HOG based detector.

Use ODHOGDetector after training with this class. This is the training class for training HOG based detector. SVMlight is used here to train linear SVM on the HOG features. It supports the usage of multiple random windows in negetive training images to increase the number of negetive features by the function 'setNOFeaturesNeg'. It also supports "Hard negetive" training which collects all the false positive windows after initial training to retrain and obtain a new feature vector. Use the function 'setTrainHardNegetive' to enable this feature.

Author
Kripasindhu Sarkar
Examples:
objectdetector/od_hog_train.cpp.

Definition at line 53 of file ODHOGTrainer.h.

Constructor & Destructor Documentation

od::g2d::ODHOGTrainer::ODHOGTrainer ( std::string const &  training_input_location_ = "",
std::string const &  trained_data_location_ = "",
cv::Size  winsize = cv::Size(64,128),
cv::Size  blocksize = cv::Size(16,16),
cv::Size  blockstride = cv::Size(8,8),
cv::Size  cellsize = cv::Size(8,8),
float  hitshreshold = 0.0 
)
inline

Member Function Documentation

cv::Size const& od::g2d::ODHOGTrainer::getBlockSize ( ) const
inline

Definition at line 144 of file ODHOGTrainer.h.

References blockSize.

cv::Size const& od::g2d::ODHOGTrainer::getBlockStride ( ) const
inline

Definition at line 154 of file ODHOGTrainer.h.

References blockStride.

cv::Size const& od::g2d::ODHOGTrainer::getCellSize ( ) const
inline

Definition at line 164 of file ODHOGTrainer.h.

References cellSize.

double od::g2d::ODHOGTrainer::getHitThreshold ( ) const
inline

Definition at line 194 of file ODHOGTrainer.h.

References hitThreshold.

std::string const& od::g2d::ODHOGTrainer::getNegSamplesDir ( ) const
inline

Definition at line 104 of file ODHOGTrainer.h.

References negSamplesDir.

int od::g2d::ODHOGTrainer::getNOFeaturesNeg ( ) const
inline

Definition at line 114 of file ODHOGTrainer.h.

References nofeatures_neg.

std::string const& od::g2d::ODHOGTrainer::getPosSamplesDir ( ) const
inline

Definition at line 94 of file ODHOGTrainer.h.

References posSamplesDir.

cv::Point const& od::g2d::ODHOGTrainer::getStartHogPos ( ) const
inline

Definition at line 124 of file ODHOGTrainer.h.

References start_hog_pos.

cv::Size const& od::g2d::ODHOGTrainer::getTrainingPadding ( ) const
inline

Definition at line 174 of file ODHOGTrainer.h.

References trainingPadding.

cv::Size const& od::g2d::ODHOGTrainer::getWinSize ( ) const
inline

Definition at line 134 of file ODHOGTrainer.h.

References winSize.

void od::g2d::ODHOGTrainer::init ( )
inlinevirtual

Implements od::ODDetectorCommon.

Definition at line 92 of file ODHOGTrainer.h.

bool od::g2d::ODHOGTrainer::isTrainHardNegetive ( ) const
inline

Definition at line 184 of file ODHOGTrainer.h.

References train_hard_negetive_.

void od::g2d::ODHOGTrainer::setBlockSize ( cv::Size const &  blockSize)
inline

Definition at line 149 of file ODHOGTrainer.h.

References blockSize.

void od::g2d::ODHOGTrainer::setBlockStride ( cv::Size const &  blockStride)
inline

Definition at line 159 of file ODHOGTrainer.h.

References blockStride.

void od::g2d::ODHOGTrainer::setCellSize ( cv::Size const &  cellSize)
inline

Definition at line 169 of file ODHOGTrainer.h.

References cellSize.

void od::g2d::ODHOGTrainer::setNegSamplesDir ( std::string const &  negSamplesDir)
inline
Examples:
objectdetector/od_hog_train.cpp.

Definition at line 109 of file ODHOGTrainer.h.

References negSamplesDir.

void od::g2d::ODHOGTrainer::setNOFeaturesNeg ( int  featno)
inline
Examples:
objectdetector/od_hog_train.cpp.

Definition at line 119 of file ODHOGTrainer.h.

References nofeatures_neg.

void od::g2d::ODHOGTrainer::setPosSamplesDir ( std::string const &  posSamplesDir)
inline
Examples:
objectdetector/od_hog_train.cpp.

Definition at line 99 of file ODHOGTrainer.h.

References posSamplesDir.

void od::g2d::ODHOGTrainer::setStartHogPos ( cv::Point const &  start_hog_pos)
inline

Definition at line 129 of file ODHOGTrainer.h.

References start_hog_pos.

void od::g2d::ODHOGTrainer::setTrainHardNegetive ( bool  train_hard_negetive)
inline
Examples:
objectdetector/od_hog_train.cpp.

Definition at line 189 of file ODHOGTrainer.h.

References train_hard_negetive_.

void od::g2d::ODHOGTrainer::setTrainingPadding ( cv::Size const &  trainingPadding)
inline

Definition at line 179 of file ODHOGTrainer.h.

References trainingPadding.

void od::g2d::ODHOGTrainer::setWinSize ( cv::Size const &  winSize)
inline

Definition at line 139 of file ODHOGTrainer.h.

References winSize.

int od::g2d::ODHOGTrainer::train ( )
virtual

Member Data Documentation

cv::Size od::g2d::ODHOGTrainer::blockSize
protected

Definition at line 202 of file ODHOGTrainer.h.

Referenced by getBlockSize(), and setBlockSize().

cv::Size od::g2d::ODHOGTrainer::blockStride
protected

Definition at line 203 of file ODHOGTrainer.h.

Referenced by getBlockStride(), and setBlockStride().

cv::Size od::g2d::ODHOGTrainer::cellSize
protected

Definition at line 204 of file ODHOGTrainer.h.

Referenced by getCellSize(), and setCellSize().

double od::g2d::ODHOGTrainer::hitThreshold
protected

Definition at line 220 of file ODHOGTrainer.h.

Referenced by getHitThreshold().

cv::HOGDescriptor od::g2d::ODHOGTrainer::hog_
protected

Definition at line 206 of file ODHOGTrainer.h.

std::string od::g2d::ODHOGTrainer::negSamplesDir
protected

Definition at line 217 of file ODHOGTrainer.h.

Referenced by getNegSamplesDir(), ODHOGTrainer(), and setNegSamplesDir().

int od::g2d::ODHOGTrainer::nofeatures_neg
protected

Definition at line 211 of file ODHOGTrainer.h.

Referenced by getNOFeaturesNeg(), ODHOGTrainer(), and setNOFeaturesNeg().

std::string od::g2d::ODHOGTrainer::posSamplesDir
protected

Definition at line 216 of file ODHOGTrainer.h.

Referenced by getPosSamplesDir(), ODHOGTrainer(), and setPosSamplesDir().

cv::Point od::g2d::ODHOGTrainer::start_hog_pos
protected

Definition at line 210 of file ODHOGTrainer.h.

Referenced by getStartHogPos(), ODHOGTrainer(), and setStartHogPos().

bool od::g2d::ODHOGTrainer::train_hard_negetive_
protected

Definition at line 213 of file ODHOGTrainer.h.

Referenced by isTrainHardNegetive(), ODHOGTrainer(), and setTrainHardNegetive().

cv::Size od::g2d::ODHOGTrainer::trainingPadding
protected

Definition at line 209 of file ODHOGTrainer.h.

Referenced by getTrainingPadding(), ODHOGTrainer(), and setTrainingPadding().

cv::Size od::g2d::ODHOGTrainer::winSize
protected

Definition at line 201 of file ODHOGTrainer.h.

Referenced by getWinSize(), and setWinSize().

cv::Size od::g2d::ODHOGTrainer::winStride
protected

Definition at line 212 of file ODHOGTrainer.h.

Referenced by ODHOGTrainer().


The documentation for this class was generated from the following file: