KanduAI SDK API
KanduAI SDK API

Auto Classification Module

Auto Classification Module description

Functions

void *rf_auto_classification_init(const char *models_base_path, const char *model_params, rf_error_type *error)

Initializes classifier.

Return

classifier handle

Parameters
  • models_base_path: path to the models base directory or to models compound package file

  • model_params: settings, can be NULL to use defaults

  • error: output parameter to return an error details

float rf_get_device_temperature(void *classifier_handle, rf_error_type *error)

Get myriad device temperature.

Parameters
  • classifier_handle: classifier handle

  • error: output parameter to return an error details

void rf_auto_classification_close(void *classifier_handle, rf_error_type *error)

Deletes classifier.

Parameters
  • classifier_handle: classifier handle

  • error: output parameter to return an error details

void rf_auto_classification_infer(void *classifier_handle, void *image_handle, char **out_class_id, int max_stirng_len_out_class_id, float *out_confidence, int *top_k, rf_error_type *error)

Infer class from image

Parameters
  • classifier_handle: classifier handle

  • image_handle: image handle (use image API to create)

  • out_class_id: output parameter that returns a list of class ids (list should be preallocated to at least *top_k size, and each string in the list should be preallocated to at least of max_stirng_len_out_class_id size)

  • max_stirng_len_out_class_id: maximun preallocated length of strings in out_class_id)

  • out_confidence: output parameter that returns a corresponding list of confidences (should be preallocated to at least *top_k size)

  • top_k: input/output parameter which indicates the k top classes and confidences to return, on the output holds the value of the actual len of out_class_id and out_confidence

  • error: output parameter to return an error details

int rf_auto_classification_get_enrolled_labels_count(void *classifier_handle, rf_error_type *error)

Get the amount of enrolled labels

Return

enrolled labels count

Parameters
  • classifier_handle: classifier handle

  • error: output parameter to return an error details

void rf_auto_classification_get_enrolled_labels(void *classifier_handle, char **out_labels, int max_string_len, int *labels_count, rf_error_type *error)

Get enrolled labels

Parameters
  • classifier_handle: classifier handle

  • image_handle: image handle (use image API to create)

  • out_labels: output parameter that returns a list of labels (list should be preallocated to at least *labels_count size, and each string in the list should be preallocated to at least of max_stirng_len size)

  • max_stirng_len: maximal size of each preallocated string in out_labels, string less than that size will be truncated to this size

  • labels_count: input/output parameter which indicates the amount of labels to return, out_labels should be allocated to be able to hold them

  • error: output parameter to return an error details

void rf_auto_classification_how_confident(void *classifier_handle, void *image_handle, char *class_id, float *out_confidence, rf_error_type *error)

Return how much the model is confident that the specified class is shown in the image

Parameters
  • classifier_handle: classifier handle

  • image_handle: image handle (use image API to create)

  • class_id: class id of the class that presumably shown in the image

  • out_confidence: output parameter that returns the confidence level

  • error: output parameter to return an error details

void rf_auto_classification_enroll(void *classifier_handle, void *image_handle, const char *label, rf_error_type *error)

Enroll image of a specific class

Parameters
  • classifier_handle: classifier handle

  • image_handle: image handle (use image API to create)

  • label: class label of the class shown in the image

  • error: output parameter to return an error details

void rf_auto_classification_train(void *classifier_handle, rf_error_type *error)

Train the classification module on enrolled data

Parameters
  • classifier_handle: classifier handle

  • error: output parameter to return an error details

void rf_auto_classification_save(void *classifier_handle, rf_error_type *error)

Save the classification module enrolled data

Parameters
  • classifier_handle: classifier handle

  • error: output parameter to return an error details

void rf_auto_classification_clear(void *classifier_handle, rf_error_type *error)

Clear the classification module enrolled data

Parameters
  • classifier_handle: classifier handle

  • error: output parameter to return an error details

const char *rf_get_model_version(const char *model_base_path)

Get current version of the model

param model_path path to the model

Return

model version