lib/ccv_dpm.c
ccv_dpm_mixture_model_new
void ccv_dpm_mixture_model_new(char **posfiles, ccv_rect_t *bboxes, int posnum, char **bgfiles, int bgnum, int negnum, const char *dir, ccv_dpm_new_param_t params)
Create a new DPM mixture model from given positive examples and background images. This function has hard dependencies on GSL and LibLinear.
- posfiles: An array of positive images.
- bboxes: An array of bounding boxes for positive images.
- posnum: Number of positive examples.
- bgfiles: An array of background images.
- bgnum: Number of background images.
- negnum: Number of negative examples that is harvested from background images.
- dir: The working directory to store/retrieve intermediate data.
- params: A ccv_dpm_new_param_t structure that defines various aspects of the training function.
ccv_dpm_new_param_t
- C: C in SVM.
- alpha: The step size for stochastic gradient descent.
- alpha_ratio: Decrease the step size for each iteration. 0.85 is a reasonable number.
- balance: To balance the weight of positive examples and negative examples. 1.5 is a reasonable number.
- components: The number of root filters in the mixture model.
- data_minings: How many data mining procedures are needed for discovering hard examples.
- detector: A ccv_dpm_params_t structure that will be used to search positive examples and negative examples from background images.
- grayscale: Whether to exploit color in a given image.
- include_overlap: The percentage of overlap between expected bounding box and the bounding box from detection. Beyond this threshold, it is ensured to be the same object. 0.7 is a reasonable number.
- iterations: How many iterations needed for stochastic gradient descent.
- max_area: The maximum area that one part classifier can occupy. 5000 is a reasonable number.
- min_area: The minimum area that one part classifier can occupy, 3000 is a reasonable number.
- negative_cache_size: The cache size for negative examples. 1000 is a reasonable number.
- parts: The number of part filters for each root filter.
- percentile_breakdown: The percentile use for breakdown threshold. 0.05 is the default.
- relabels: How many relabel procedures are needed.
- root_relabels: How many relabel procedures for root classifier are needed.
- symmetric: Whether to exploit symmetric property of the object.
ccv_dpm_detect_objects
ccv_dpm_detect_objects(ccv_dense_matrix_t *a, ccv_dpm_mixture_model_t **model, int count, ccv_dpm_param_t params)
Using a DPM mixture model to detect objects in a given image. If you have several DPM mixture models, 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.
- model: An array of mixture models.
- count: How many mixture models you’ve passed in.
- params: A ccv_dpm_param_t structure that defines various aspects of the detector.
return: A ccv_array_t of ccv_root_comp_t that contains the root bounding box as well as its parts.
ccv_dpm_param_t
- flags: CCV_DPM_NO_NESTED, if one class of object is inside another class of object, this flag will reject the first object.
- 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.
- threshold: The threshold the determines the acceptance of an object.
ccv_dpm_read_mixture_model
ccv_dpm_read_mixture_model(const char *directory)
Read DPM mixture model from a model file.
- directory: The model file for DPM mixture model.
return: A DPM mixture model, 0 if no valid DPM mixture model available.
ccv_dpm_mixture_model_free
void ccv_dpm_mixture_model_free(ccv_dpm_mixture_model_t *model)
Free up the memory of DPM mixture model.
- model: The DPM mixture model.
comments powered by