TIEVisionCascadeClassifierTrainer.mergeSamples
Declaration
procedure mergeSamples(sourceVec: PAnsiChar; destVec: PAnsiChar); safecall;
Description
Merges two samples files.
This function is useful if you have generated positive samples using
createSamples which produces samples from a single positive and want to merge the generated files before training.
Parameter | Description |
sourceVec | Source samples file |
destVec | Destination samples file. If exists then its content is merged with "sourceVec". If doesn't exist it will be a copy of "sourceVec" |
// create training samples file "samples.vec", containing 1000 samples synthesized from the single file "company_logo_1.png"
cascadeTrainer.createSamples('positive_images\company_logo_1.png', 'negative_images', 'samples.vec', 1000, 40, 40, 0, 10, false, false, 40, 1.1, 1.1, 0.5);
// create training samples file "samples2.vec" containing 1000 samples synthesized from the single file "company_logo_2.png"
cascadeTrainer.createSamples('positive_images\company_logo_2.png', 'negative_images', 'samples2.vec', 1000, 40, 40, 0, 10, false, false, 40, 1.1, 1.1, 0.5);
// merge samples.vec and samples2.vec into samples2.vec
cascadeTrainer.mergeSamples('samples.vec', 'samples2.vec');
// train the cascade classifier with 10 stages using LBP. The output will be "trainingresult\cascade.xml", the you should use in TIEVisionObjectsFinder to find objects.
imagesCount := trunc(cascadeTrainer.getSamplesCount('samples.vec') * 0.85); // trainCascade images count must be less than 85% of the images in "vec" file
cascadeTrainer.trainCascade('trainingresult', 'samples.vec', 'negative_images', imagesCount, 40, 40, 10, ievLBP);
See Also
◼getSamplesCount