libeblearntools
|
#include <patch_dataset.h>
Public Member Functions | |
patch_dataset (const char *name, const char *inroot, const char *outdir, uint max_folders=1) | |
virtual | ~patch_dataset () |
Destructor. | |
virtual bool | add_data (idx< Tdata > &d, const t_label label, const string *class_name, const char *filename=NULL, const rect< int > *r=NULL, pair< int, int > *center=NULL, const rect< int > *visr=NULL, const rect< int > *cropr=NULL, const vector< object * > *objs=NULL, const jitter *jittforce=NULL) |
Extract patches from image. | |
Protected Member Functions | |
void | save_patches (vector< idx< Tdata > > &patches, const string &outdir, uint max_folders, const string &filename, double scale, const t_label label) |
Protected Attributes | |
uint | max_folders |
The patch_dataset class extracts random patches at differents scales from images. This can be used to generate background patches from a set of images known to exclude the non-background classes. All possible patches at each specified scale and matching the output size are found, then randomized and only the first n patches of the random list are saved per image, n being specified in the constructor as 'max_folders' variable.
ebl::patch_dataset< Tdata >::patch_dataset | ( | const char * | name, |
const char * | inroot, | ||
const char * | outdir, | ||
uint | max_folders = 1 |
||
) |
Initialize the dataset's name and other internal variables, but does not allocate data matrices, user must call alloc for that effect. outdims are the target output dimensions of each sample. inroot is the root directory from which we extract data.
max_folders | The first 'max_folders' patches of each image's random list of patches are saved in a different folder each. |
void ebl::patch_dataset< Tdata >::save_patches | ( | vector< idx< Tdata > > & | patches, |
const string & | outdir, | ||
uint | max_folders, | ||
const string & | filename, | ||
double | scale, | ||
const t_label | label | ||
) | [protected] |
save patches into directory outdir, creating 1 subdirectory per patch until reaching max_folders, then filling last folder with remaining patches, using filename as base filename for patches filenames.