Back to Ccv

lib/ccv_icf.c

site/0.6/lib/ccv-icf/index.html

latest4.9 KB
Original Source

lib/ccv_icf.c

ccv_icf_classifier_cascade_new

ccv_icf_classifier_cascade_t* 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.

ccv_icf_new_param_t

  • 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.
  • margin : a ccv_margin_t structure that extends the size so that we can includes more information for our classifier.
  • feature_size : the number of ICF features to pool from.
  • weak_classifier : the number of weak classifiers that will be used to construct the strong classifier.
  • boostrap : 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.
  • acceptance : the percentage of validation examples will be accepted when soft cascading the classifiers that will be sued for bootstrap.
  • detector : a ccv_icf_param_t structure that defines various aspects of the detector.

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_detect_objects

ccv_array_t* ccv_icf_detect_objects(ccv_dense_matrix_t* a, ccv_classifier_cascade_t** cascades, int count, ccv_icf_param_t params)
ccv_array_t* ccv_icf_detect_objects(ccv_dense_matrix_t* a, ccv_multiscale_classifier_cascade_t** cascades, 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.
  • cascades : 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.

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_read_classifier_cascade

ccv_icf_classifier_cascade_t* 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.

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_classifier_cascade_free

void ccv_icf_classifier_cascade_free(ccv_icf_classifier_cascade_t* classifier)

Free up the memory of ICF classifier cascade.

  • cascade : the ICF classifier cascade.

‹ back

comments powered by Disqus