ailia
1.5.0.0
|
AILIA object detection library. More...
Go to the source code of this file.
Classes | |
struct | _AILIADetectorObject |
Macros | |
#define | AILIA_DETECTOR_OBJECT_VERSION (1) |
#define | AILIA_DETECTOR_ALGORITHM_YOLOV1 (0) |
#define | AILIA_DETECTOR_ALGORITHM_YOLOV2 (1) |
#define | AILIA_DETECTOR_ALGORITHM_YOLOV3 (2) |
#define | AILIA_DETECTOR_ALGORITHM_YOLOV4 (3) |
#define | AILIA_DETECTOR_ALGORITHM_YOLOX (4) |
#define | AILIA_DETECTOR_ALGORITHM_SSD (8) |
#define | AILIA_DETECTOR_FLAG_NORMAL (0) |
Typedefs | |
typedef struct _AILIADetectorObject | AILIADetectorObject |
Functions | |
int AILIA_API | ailiaCreateDetector (struct AILIADetector **detector, struct AILIANetwork *net, unsigned int format, unsigned int channel, unsigned int range, unsigned int algorithm, unsigned int category_count, unsigned int flags) |
Creates a detector instance. More... | |
void AILIA_API | ailiaDestroyDetector (struct AILIADetector *detector) |
Destroys the detector instance. More... | |
int AILIA_API | ailiaDetectorCompute (struct AILIADetector *detector, const void *src, unsigned int src_stride, unsigned int src_width, unsigned int src_height, unsigned int src_format, float threshold, float iou) |
Performs object detection. More... | |
int AILIA_API | ailiaDetectorGetObjectCount (struct AILIADetector *detector, unsigned int *obj_count) |
Gets the number of detection results. More... | |
int AILIA_API | ailiaDetectorGetObject (struct AILIADetector *detector, AILIADetectorObject *obj, unsigned int obj_idx, unsigned int version) |
Gets the detection results. More... | |
int AILIA_API | ailiaDetectorSetAnchors (struct AILIADetector *detector, float *anchors, unsigned int anchors_count) |
Sets the anchor information (anchors or biases) for YoloV2 or other systems. More... | |
int AILIA_API | ailiaDetectorSetInputShape (struct AILIADetector *detector, unsigned int input_width, unsigned int input_height) |
Sets the size of the input image for YoloV3 or YoloX model. More... | |
AILIA object detection library.
#define AILIA_DETECTOR_ALGORITHM_SSD (8) |
#define AILIA_DETECTOR_ALGORITHM_YOLOV1 (0) |
#define AILIA_DETECTOR_ALGORITHM_YOLOV2 (1) |
#define AILIA_DETECTOR_ALGORITHM_YOLOV3 (2) |
#define AILIA_DETECTOR_ALGORITHM_YOLOV4 (3) |
#define AILIA_DETECTOR_ALGORITHM_YOLOX (4) |
#define AILIA_DETECTOR_FLAG_NORMAL (0) |
#define AILIA_DETECTOR_OBJECT_VERSION (1) |
typedef struct _AILIADetectorObject AILIADetectorObject |
int AILIA_API ailiaCreateDetector | ( | struct AILIADetector ** | detector, |
struct AILIANetwork * | net, | ||
unsigned int | format, | ||
unsigned int | channel, | ||
unsigned int | range, | ||
unsigned int | algorithm, | ||
unsigned int | category_count, | ||
unsigned int | flags | ||
) |
Creates a detector instance.
detector | A detector instance pointer |
net | The network instance pointer |
format | The network image format (AILIA_NETWORK_IMAGE_FORMAT_*) |
channel | The network image channel (AILIA_NETWORK_IMAGE_CHANNEL_*) |
range | The network image range (AILIA_NETWORK_IMAGE_RANGE_*) |
algorithm | Detection algorithm(AILIA_DETECTOR_ALGORITHM_*) |
category_count | The number of detection categories (specify 20 for VOC or 80 for COCO, etc.) |
flags | Additional option(AILIA_DETECTOR_FLAG_*) |
void AILIA_API ailiaDestroyDetector | ( | struct AILIADetector * | detector | ) |
Destroys the detector instance.
detector | A detector instance pointer |
int AILIA_API ailiaDetectorCompute | ( | struct AILIADetector * | detector, |
const void * | src, | ||
unsigned int | src_stride, | ||
unsigned int | src_width, | ||
unsigned int | src_height, | ||
unsigned int | src_format, | ||
float | threshold, | ||
float | iou | ||
) |
Performs object detection.
detector | A detector instance pointer |
src | Image data (32 bpp) |
src_stride | The number of bytes in 1 line |
src_width | Image width |
src_height | Image height |
src_format | Image format (AILIA_IMAGE_FORMAT_*) |
threshold | The detection threshold (for example, 0.1f) (The smaller it is, the easier the detection will be and the more detected objects found.) |
iou | Iou threshold (for example, 0.45f) (The smaller it is, the fewer detected objects found, as duplication is not allowed.) |
int AILIA_API ailiaDetectorGetObject | ( | struct AILIADetector * | detector, |
AILIADetectorObject * | obj, | ||
unsigned int | obj_idx, | ||
unsigned int | version | ||
) |
Gets the detection results.
detector | A detector instance pointer |
obj | Object information |
obj_idx | Object index |
version | AILIA_DETECTOR_OBJECT_VERSION |
If ailiaDetectorCompute() is not run at all, the function returns AILIA_STATUS_INVALID_STATE . The detection results are sorted in the order of estimated probability.
int AILIA_API ailiaDetectorGetObjectCount | ( | struct AILIADetector * | detector, |
unsigned int * | obj_count | ||
) |
Gets the number of detection results.
detector | A detector instance pointer |
obj_count | The number of objects |
int AILIA_API ailiaDetectorSetAnchors | ( | struct AILIADetector * | detector, |
float * | anchors, | ||
unsigned int | anchors_count | ||
) |
Sets the anchor information (anchors or biases) for YoloV2 or other systems.
detector | A detector instance pointer |
anchors | The anchor dimensions (the shape, height and width of the detection box) |
anchors_count | The number of anchors (half of the anchors array size) |
YoloV2 and other systems perform object detection with multiple detection boxes determined during training. By using this API function to set the shape of the detection box determined during training, correct inferences can be made. The {x, y, x, y ...} format is used for anchor storage. If anchors_count has a value of 5, then anchors is a 10-dimensional array.
int AILIA_API ailiaDetectorSetInputShape | ( | struct AILIADetector * | detector, |
unsigned int | input_width, | ||
unsigned int | input_height | ||
) |
Sets the size of the input image for YoloV3 or YoloX model.
detector | A detector instance pointer |
input_width | Width of the model's input image |
input_height | Height of the model's input image |
The same YoloV3 model can be used for any input image size that is a multiple of 32. The same YoloX model can be used for any input image size. You can use this API if you want to choose the input image size, for example to reduce the calculation complexity. It must be called between ailiaCreateDetector() () and ailiaDetectorCompute() (). If this API is not used, a default size of 416x416 is assumed. If used with some model other than YoloV3 or YoloX, it will return the error status AILIA_STATUS_INVALID_STATE .