Auxilliary Tool:
A tool for managing the data used in training GentleBoost classifiers.
More...
#include <PatchDataset2.h>
Public Member Functions | |
PatchDataset2 () | |
Default Constructor. | |
PatchDataset2 (const PatchDataset2 ©) | |
Copy Constructor. | |
PatchDataset2 & | operator= (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< ImagePatch2 > | getPatches () const |
Get all patches in the dataset. | |
std::vector< ImagePatch2 > | getPosPatches () const |
Get the positive patches in the dataset. | |
std::vector< ImagePatch2 > | getNegPatches () 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. |
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.
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.
patchsize | Basic 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. |
positiveImageListFilename | Path 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. |
positiveImageLabelsFilename | Path 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]. |
negativeImageListFilename | Path to a file containing a list of files, one per line, of images that are known to not contain the object of interest. |
posExamplePatchRadius | Take 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. |
posExampleScaleRadius | Take 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. |
numPosPatches | Number 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. |
numNegPatches | Number 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. |
useFastPatchList | Sets the patch extraction method. |
scale | Tunes 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. |
void PatchDataset2::getLabels | ( | cv::Mat & | dest ) | const |
Get the labels for all patches.
vector< ImagePatch2 > PatchDataset2::getNegPatches | ( | ) | const |
Get the negative patches in the dataset.
vector< ImagePatch2 > PatchDataset2::getPatches | ( | ) | const |
Get all patches in the dataset.
Size PatchDataset2::getPatchSize | ( | ) | const |
Get the size of the patches in the dataset.
vector< ImagePatch2 > PatchDataset2::getPosPatches | ( | ) | const |
Get the positive patches in the dataset.