Auxilliary Tool:
A data structure for maintaining a list of image files and image labels to facilitate training and testing.
More...
#include <ImageDataSet2.h>
List of all members.
Public Member Functions |
| ImageDataSet2 (const std::string &imageListFile, const std::string &imageLabelsFile="") |
| Constructor. Create a data set automatically by parsing a file containing list of files and a file containing a list of labels.
|
| ImageDataSet2 () |
| Default Constructor.
|
| ImageDataSet2 (const ImageDataSet2 ©) |
| Copy Constructor.
|
ImageDataSet2 & | operator= (const ImageDataSet2 &rhs) |
| Assignment operator.
|
virtual | ~ImageDataSet2 () |
| Destructor.
|
ImageDataSet2 | split (int splitStart, int splitEnd) |
| Split the dataset into two sets: Removes a continuous block of elements from this dataset and adds them to a new one. The total number of elements in both sets is the same as the original number of elements in this set.
|
ImageDataSet2 | split (const std::vector< int > &removeToNewList, int numToRemove) |
| Split the dataset into two sets: Removes specified elements from this dataset and adds them to a new one. The total number of elements in both sets is the same as the original number of elements in this set.
|
void | merge (const ImageDataSet2 &setToAdd) |
| Combine the elements from another dataset into this dataset. This method is non-destructive, so the second dataset still has all of its elements (i.e. the number of elements across both datasets is not conserved).
|
std::string | getFileName (int fileNumber) const |
| Access the name of the file located at a certain index.
|
std::vector< double > | getFileLabels (int fileNumber) const |
| Access the name of the labels located at a certain index.
|
int | numLabelsPerImage () const |
| Number of labels describing each image.
|
int | getNumEntries () const |
| Number of records currently in the dataset.
|
void | addEntry (const std::string &filename, const std::vector< double > &labels=std::vector< double >(0)) |
| Programmatically add a single record to the dataset.
|
int | empty () const |
| Check whether any elements have been added.
|
Friends |
cv::FileStorage & | operator<< (cv::FileStorage &fs, const ImageDataSet2 &data) |
| Write to a file.
|
void | operator>> (const cv::FileNode &fs, ImageDataSet2 &data) |
| Read from a file.
|
Detailed Description
Auxilliary Tool:
A data structure for maintaining a list of image files and image labels to facilitate training and testing.
Each ImageDataSet entry consists of a filename and an array of doubles that constitute some information particular to each image. While this class is agnostic to the semantic content of the labels, other classes assume that the 0 and 1 elements of this array contain the (x, y) coordinates of the center of the target object.
An image data set can be constructed programmatically by adding one element at a time, or it can be created from two files. The first file should have a list of file names, one per line. The second file should have the same number of lines, and on each line should be the labels for that image, separated by spaces. All images should have the same number of labels. The data type of each label is assumed to be double.
- Author:
- Nicholas Butko
- Date:
- 2010 version 0.4
Constructor & Destructor Documentation
ImageDataSet2::ImageDataSet2 |
( |
const std::string & |
imageListFile, |
|
|
const std::string & |
imageLabelsFile = "" |
|
) |
| |
Constructor. Create a data set automatically by parsing a file containing list of files and a file containing a list of labels.
- Parameters:
-
imageListFile | A file containing a list of file names, one per line. The files should either be absolute file paths, or should be relative to the directory from which the program is being run. |
imageLabelsFile | A file containing the same number of lines as imageListFile, and on each line should be the labels for that image, separated by spaces. All images should have the same number of labels. The data type of each label is assumed to be double. |
Member Function Documentation
void ImageDataSet2::addEntry |
( |
const std::string & |
filename, |
|
|
const std::vector< double > & |
labels = std::vector< double >(0) |
|
) |
| |
Programmatically add a single record to the dataset.
- Parameters:
-
filename | The location (absolute or relative) of an image file that will be described by labels. |
labels | An array of labels describing the image of length numLabelsPerImage(); |
vector< double > ImageDataSet2::getFileLabels |
( |
int |
fileNumber ) |
const |
Access the name of the labels located at a certain index.
- Parameters:
-
fileNumber | Index of the record to access. Must be between 0 and getNumEntries()-1, inclusive. |
- Returns:
- A pointer to a string containing the array of labels. This array has length numLabelsPerImage().
std::string ImageDataSet2::getFileName |
( |
int |
fileNumber ) |
const |
Access the name of the file located at a certain index.
- Parameters:
-
fileNumber | Index of the record to access. Must be between 0 and getNumEntries()-1, inclusive. |
- Returns:
- A pointer to a string containing the file name.
Combine the elements from another dataset into this dataset. This method is non-destructive, so the second dataset still has all of its elements (i.e. the number of elements across both datasets is not conserved).
- Parameters:
-
setToAdd | After merging, all of setToAdd's records will be added to those in the current object |
ImageDataSet2 ImageDataSet2::split |
( |
const std::vector< int > & |
removeToNewList, |
|
|
int |
numToRemove |
|
) |
| |
Split the dataset into two sets: Removes specified elements from this dataset and adds them to a new one. The total number of elements in both sets is the same as the original number of elements in this set.
- Parameters:
-
removeToNewList | An array of the indexes of elements that you want put into a new list. For example, to remove every-other element, this would be 0, 2, 4, 6, ... After removal, the remaining elements will maintain their same ordering, but the list will be compacted. So in the above example, element 1 will move to index 0, element 3 will move to index 1, element 5 will move to index 2, etc. |
numToRemove | The length of the supplied list. |
ImageDataSet2 ImageDataSet2::split |
( |
int |
splitStart, |
|
|
int |
splitEnd |
|
) |
| |
Split the dataset into two sets: Removes a continuous block of elements from this dataset and adds them to a new one. The total number of elements in both sets is the same as the original number of elements in this set.
- Parameters:
-
splitStart | Index of the first element to remove, inclusive. After the split, the element previously at this index in in this list will be located at index 0 in the new list. |
splitEnd | Index of the last element to remove, incluseive. After the split, the element located at the index splitEnd+1 will be located at index splitStart in this list. |
The documentation for this class was generated from the following files:
- /Users/nick/projects/NickThesis/Code/OpenCV/src/ImageDataSet2.h
- /Users/nick/projects/NickThesis/Code/OpenCV/src/ImageDataSet2.cpp