lib/ccv_scd.c
ccv_scd_classifier_cascade_new
ccv_scd_classifier_cascade_new(ccv_array_t *posfiles, ccv_array_t *hard_mine, int negative_count, const char *filename, ccv_scd_train_param_t params)
Create a new SCD classifier cascade from given positive examples and background images. This function has a hard dependency on GSL.
- posfiles: An array of ccv_file_info_t that gives the positive examples.
- hard_mine: An array of ccv_file_info_t that gives images don’t contain any positive examples (for example, to train a face detector, these are images that doesn’t contain any faces).
- negative_count: Number of negative examples that is harvested from background images.
- filename: The file that saves both progress and final classifier, this will be in sqlite3 database format.
- params: A ccv_scd_train_param_t that defines various aspects of the training function.
return: The trained SCD classifier cascade.
ccv_scd_train_param_t
- C: The C parameter to train the weak linear SVM classifier.
- boosting: How many stages of boosting should be performed.
- feature.base: A ccv_size_t structure defines the minimal feature dimensions.
- feature.range_through: The step size to increase feature dimensions.
- feature.step_through: The step size to move to cover the whole window size.
- grayscale: To train the classifier with grayscale image.
- size: What’s the window size of the final classifier.
- stop_criteria.accu_false_positive_rate: The targeted accumulative false positive rate for classifier cascade, the training will be terminated once the accumulative false positive rate target reached.
- stop_criteria.auc_crit: The epsilon to decide if auc (area under curve) can no longer be improved. Once auc can no longer be improved and the targeted false positive rate reached, this stage of training will be terminated and start the next stage training.
- stop_criteria.false_positive_rate: The targeted false positive rate for each stage of classifier.
- stop_criteria.hit_rate: The targeted hit rate for each stage of classifier.
- stop_criteria.maximum_feature: Maximum number of features one stage can have.
- stop_criteria.prune_feature: How many features a prune stage should have, it should be a very small number to enable efficient pruning.
- stop_criteria.prune_stage: How many stages will act as “prune” stage, which means will take minimal effort to prune as much negative areas as possible.
- weight_trimming: Only consider examples with weights in this percentile for training, this avoid to consider examples with tiny weights.
ccv_scd_classifier_cascade_write
void ccv_scd_classifier_cascade_write(ccv_scd_classifier_cascade_t *cascade, const char *filename)
Write SCD classifier cascade to a file.
- cascade: The BBF classifier cascade.
- filename: The file that will be written to, it is in sqlite3 database format.
ccv_scd_classifier_cascade_read
ccv_scd_classifier_cascade_read(const char *filename)
Read SCD classifier cascade from file.
- filename: The file that contains a SCD classifier cascade, it is in sqlite3 database format.
return: A classifier cascade, 0 returned if no valid classifier cascade available.
ccv_scd_classifier_cascade_free
void ccv_scd_classifier_cascade_free(ccv_scd_classifier_cascade_t *cascade)
Free up the memory of SCD classifier cascade.
- cascade: The SCD classifier cascade.
ccv_scd
void ccv_scd(ccv_dense_matrix_t *a, ccv_dense_matrix_t **b, int type)
Generate 8-channel output matrix which extract SURF features (dx, dy, |dx|, |dy|, du, dv, |du|, |dv|) for input. If input is multi-channel matrix (such as RGB), will pick the strongest responses among these channels.
- a: The input matrix.
- b: The output matrix.
- type: The type of output matrix, if 0, ccv will try to match the input matrix for appropriate type.
ccv_scd_detect_objects
ccv_scd_detect_objects(ccv_dense_matrix_t *a, ccv_scd_classifier_cascade_t **cascades, int count, ccv_scd_param_t params)
Using a SCD 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_scd_param_t structure that defines various aspects of the detector.
return: A ccv_array_t of ccv_comp_t with detection results.
ccv_scd_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.
- size: The smallest object size that will be interesting to us.
- step_through: The step size for detection.
comments powered by