52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
|
|
#pragma once
|
|||
|
|
|
|||
|
|
#ifdef YOLO_EXPORTS
|
|||
|
|
#define YOLO_API __declspec(dllexport)
|
|||
|
|
#else
|
|||
|
|
#define YOLO_API __declspec(dllimport)
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
#include <vector>
|
|||
|
|
|
|||
|
|
struct Detection
|
|||
|
|
{
|
|||
|
|
int class_id;
|
|||
|
|
float score;
|
|||
|
|
int x;
|
|||
|
|
int y;
|
|||
|
|
int width;
|
|||
|
|
int height;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
extern "C" {
|
|||
|
|
YOLO_API int perform_detection(
|
|||
|
|
const wchar_t* model_path,
|
|||
|
|
unsigned char* image_bytes,
|
|||
|
|
int image_width,
|
|||
|
|
int image_height,
|
|||
|
|
Detection** out_detections,
|
|||
|
|
int* out_detections_count,
|
|||
|
|
const char** class_names,
|
|||
|
|
int class_names_count,
|
|||
|
|
float conf_threshold, // <20><><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>ֵ (<28><><EFBFBD><EFBFBD> 0.5f)
|
|||
|
|
float iou_threshold, // NMS<4D><53>IOU<4F><55>ֵ (<28><><EFBFBD><EFBFBD> 0.5f)
|
|||
|
|
int input_width, // ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> 640)
|
|||
|
|
int input_height // ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD> (<28><><EFBFBD><EFBFBD> 640)
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
YOLO_API void free_memory(Detection* detections);
|
|||
|
|
|
|||
|
|
YOLO_API void draw_and_encode_image(
|
|||
|
|
unsigned char* image_bytes,
|
|||
|
|
int image_width,
|
|||
|
|
int image_height,
|
|||
|
|
const Detection* detections,
|
|||
|
|
int detections_count,
|
|||
|
|
const char** class_names,
|
|||
|
|
int class_names_count,
|
|||
|
|
unsigned char** out_image_bytes,
|
|||
|
|
int* out_image_size
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
YOLO_API void free_image_memory(unsigned char* image_bytes);
|
|||
|
|
}
|