lib/ccv_icf.c
ccv_icf_classifier_cascade_new
ccv_icf_classifier_cascade_new(ccv_array_t *posfiles, int posnum, ccv_array_t *bgfiles, int negnum, ccv_array_t *testfiles, const char *dir, ccv_icf_new_param_t params)
Create a new ICF classifier cascade from given positive examples and background images. This function has a hard dependency on GSL and better be used with libdispatch for maximum efficiency.
- posfiles: An array of ccv_file_info_t that gives the positive examples and their locations.
- posnum: The number of positive examples that we want to use (with certain random distortions if so choose).
- bgfiles: An array of ccv_file_info_t that gives the background images.
- negnum: The number of negative examples will be collected during bootstrapping / initialization.
- testfiles: An array of ccv_file_info_t that gives the validation examples and their locations.
- dir: The directory that saves the progress.
- params: A ccv_icf_new_param_t structure that defines various aspects of the training function.
return: A trained classifier cascade.
ccv_icf_new_param_t
- acceptance: The percentage of validation examples will be accepted when soft cascading the classifiers that will be sued for bootstrap.
- bootstrap: The number of boostrap to collect negatives.
- deform_angle: The range of rotations to add distortion, in radius.
- deform_scale: The range of scale changes to add distortion.
- deform_shift: The range of translations to add distortion, in pixel.
- detector: A ccv_icf_param_t structure that defines various aspects of the detector.
- feature_size: The number of ICF features to pool from.
- grayscale: Whether to exploit color in a given image.
- min_dimension: The minimal size of a ICF feature region.
- size: A ccv_size_t structure that defines the width and height of the classifier.
- weak_classifier: The number of weak classifiers that will be used to construct the strong classifier.
ccv_icf_param_t
- interval: Interval images between the full size image and the half size one. e.g. 2 will generate 2 images in between full size image and half size one: image with full size, image with 5/6 size, image with 2/3 size, image with 1/2 size.
- min_neighbors: 0: no grouping afterwards. 1: group objects that intersects each other. > 1: group objects that intersects each other, and only passes these that have at least min_neighbors intersected objects.
- step_through: The step size for detection.
ccv_icf_classifier_cascade_soft
void ccv_icf_classifier_cascade_soft(ccv_icf_classifier_cascade_t *cascade, ccv_array_t *posfiles, double acceptance)
Compute soft cascade thresholds to speed up the classifier cascade performance.
- cascade: The trained classifier that we want to optimize soft cascade thresholds on.
- posfiles: An array of ccv_array_t that gives the positive examples and their locations.
- acceptance: The percentage of positive examples will be accepted when optimizing the soft cascade thresholds.
ccv_icf_read_classifier_cascade
ccv_icf_read_classifier_cascade(const char *filename)
Read a ICF classifier from a file.
- filename: The file path that contains the trained ICF classifier.
return: The classifier cascade, 0 if no valid classifier cascade available.
ccv_icf_write_classifier_cascade
void ccv_icf_write_classifier_cascade(ccv_icf_classifier_cascade_t *classifier, const char *filename)
Write a ICF classifier to a file.
- classifier: The classifier that we want to write to file.
- filename: The file path that we want to persist the ICF classifier.
ccv_icf_classifier_cascade_free
void ccv_icf_classifier_cascade_free(ccv_icf_classifier_cascade_t *classifier)
Free up the memory of ICF classifier cascade.
- classifier: The ICF classifier cascade.
ccv_icf_detect_objects
ccv_icf_detect_objects(ccv_dense_matrix_t *a, void *cascade, int count, ccv_icf_param_t params)
Using a ICF classifier cascade to detect objects in a given image. If you have several classifier cascades, it is better to use them in one method call. In this way, ccv will try to optimize the overall performance.
- a: The input image.
- cascade: An array of classifier cascades.
- count: How many classifier cascades you’ve passed in.
- params: A ccv_icf_param_t structure that defines various aspects of the detector.
return: A ccv_array_t of ccv_comp_t with detection results.
comments powered by