Public Member Functions

PatchDataset2 Class Reference
[Auxilliary Tools]

Auxilliary Tool: A tool for managing the data used in training GentleBoost classifiers. More...

#include <PatchDataset2.h>

Collaboration diagram for PatchDataset2:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PatchDataset2 ()
 Default Constructor.
 PatchDataset2 (const PatchDataset2 &copy)
 Copy Constructor.
PatchDataset2operator= (const PatchDataset2 &rhs)
 Assignment operator.
 PatchDataset2 (cv::Size patchsize, const std::string &positiveImageListFilename="", const std::string &positiveImageLabelsFilename="", const std::string &negativeImageListFilename="", int posExamplePatchRadius=0, int posExampleScaleRadius=0, int numPosPatches=-1, int numNegPatches=-1, int useFastPatchList=1, double scale=1.)
 Constructor.
 ~PatchDataset2 ()
 Destructor.
std::vector< ImagePatch2getPatches () const
 Get all patches in the dataset.
std::vector< ImagePatch2getPosPatches () const
 Get the positive patches in the dataset.
std::vector< ImagePatch2getNegPatches () const
 Get the negative patches in the dataset.
void getLabels (cv::Mat &dest) const
 Get the labels for all patches.
cv::Size getPatchSize () const
 Get the size of the patches in the dataset.
ImageDataSet2 getNegImagesDataset () const
 Reconstruct the ImageDataSet object (used by other Machine Perception Primitives in NMPT) used to create the negative examples in this PatchDataset.
ImageDataSet2 getPosImagesDataset () const
 Reconstruct the ImageDataSet object (used by other Machine Perception Primitives in NMPT) used to create the positive examples in this PatchDataset.
std::string getNegImagesFileName () const
 Query the name of the source file that was used to locate files containing the negative patches in this dataset.
std::string getPosImagesFileName () const
 Query the name of the source file that was used to locate files containing the positive examples in this dataset.
std::string getPosLabelsFileName () const
 Query the name of the source file that was used to locate the positive examples in their source images for this dataset.
int getNumUniquePositiveImages () const
 Get the number of unique positive images (unique by name) in the dataset.
std::string getUniquePosImageName (int num) const
 Get the file name of an image in the dataset.
std::vector< cv::Rect > getObjectLocationsInPosImage (int num) const
 Get the location of all marked objects in the image (if any).
void setUseFastPatchList (int yesorno)
 Sets the method of patch extraction for creating the dataset.
int getUseFastPatchList () const
 Get the method of patch extraction used for creating the dataset.
int empty () const
 Test whether this dataset contains any information.

Detailed Description

Auxilliary Tool: A tool for managing the data used in training GentleBoost classifiers.

The primary purpose of this class is to quickly save and load collections of pathches for training and testing classifiers. However, it is also useful for remembering the disk location of the dataset files used to construct a dataset.

Author:
Nicholas Butko
Date:
2010
Version:
0.4

Constructor & Destructor Documentation

PatchDataset2::PatchDataset2 ( cv::Size  patchsize,
const std::string &  positiveImageListFilename = "",
const std::string &  positiveImageLabelsFilename = "",
const std::string &  negativeImageListFilename = "",
int  posExamplePatchRadius = 0,
int  posExampleScaleRadius = 0,
int  numPosPatches = -1,
int  numNegPatches = -1,
int  useFastPatchList = 1,
double  scale = 1. 
)

Constructor.

Parameters:
patchsizeBasic size of patches to use for training. When constructing a PatchDataset, this must be specified. When reading a PatchDataset from an istream, any size may be initially specified, which will be subsequently overwritten.
positiveImageListFilenamePath to a file containing a list of files, one per line, that contain the object you're trying to learn to detect. If the same file contains more than one of the object, it can appear on more than one line.
positiveImageLabelsFilenamePath to a file containing the same number of lines as imageListFile, and on each line should be one label for that image. Each label consists of three doubles describing the location of an object in the respective image from positiveImageListFilename: [center-x] [center-y] [object-width].
negativeImageListFilenamePath to a file containing a list of files, one per line, of images that are known to not contain the object of interest.
posExamplePatchRadiusTake positive examples that are slightly left/right/up/down from the labeled example. This can help get a wider variety of positive examples, at the expense of memory and making the classifier harder to train. Note that a radius of 1 gives 9x the training examples, and a radius of 2 gives 25x.
posExampleScaleRadiusTake positive examples that are slightly larger or smaller than the labeled object. This size is radius is in terms of search scale, not pixels. This can help get a wider variety of positive examples, at the expense of memory and making the classifier harder to train. Note that a radius of 1 gives 3x the training examples, and a radius of 2 gives 5x.
numPosPatchesNumber of positive patches to include in the dataset. If this is less than 0 or greater than the total number of available patches, the total number of available patches is used.
numNegPatchesNumber of negative patches to include in the dataset. If this is less than 0, then a balanced dataset is created, where there are as many negative patches as positive patches.
useFastPatchListSets the patch extraction method.
scaleTunes the size of the object window, making it narrower or wider than indicated in the dataset by a factor of [scale]. A scale less than 1 will crop the patches smaller around the center of the object, will greater than 1 will include more of a border around the object.

Member Function Documentation

void PatchDataset2::getLabels ( cv::Mat &  dest ) const

Get the labels for all patches.

Returns:
A vector of labels, of size Nx1, where N is the total number of patches returned by getPatches(), and the order of labels is respective to the patches returned by getPatches().
vector< ImagePatch2 > PatchDataset2::getNegPatches (  ) const

Get the negative patches in the dataset.

Returns:
The negative patches in the dataset.
vector< ImagePatch2 > PatchDataset2::getPatches (  ) const

Get all patches in the dataset.

Returns:
All patches in the dataset.
Size PatchDataset2::getPatchSize (  ) const

Get the size of the patches in the dataset.

Returns:
The size of the image patches in the dataset.
vector< ImagePatch2 > PatchDataset2::getPosPatches (  ) const

Get the positive patches in the dataset.

Returns:
The positive in the dataset.

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