motor_rainshed_cls.h 3.27 KB
/*************************************************************************
* Version: motor_rainshed_cls_v0.0.0.20230921
* CopyRight : 中国科学院自动化所模式识别实验室图像视频组
* UpdateDate:20230921
* Content : 二轮车是否加装雨棚
*************************************************************************/
#ifndef MOTORRAINCLS_H_
#define MOTORRAINCLS_H_

#if _MSC_VER
#ifdef MOTORRAINCLS_EXPORTS
#define MOTORRAINCLS_API __declspec(dllexport)
#else
#define MOTORRAINCLS_API __declspec(dllimport)
#endif
#else
#define MOTORRAINCLS_API __attribute__ ((visibility ("default")))
#endif

#include "sy_common.h"



#ifndef MAX_BATCH_SIZE
#define MAX_BATCH_SIZE 16
#endif


#ifdef __cplusplus
extern "C"
{
#endif



//分类结果
#ifndef MRCRESULT_
#define MRCRESULT_
typedef struct mrc_result
{
	float score;
	int index;
}mrc_result;
#endif


#ifndef __MRCPARAM__
#define __MRCPARAM__
	typedef struct mrc_param
	{
		int devId;              //ָ指定显卡id
		char* modelNames;
		char* modelNames_b;
        float thresld;    //阈值
		int max_batch;
		mrc_param() :devId(0), max_batch(8), thresld(0.0), modelNames(nullptr), modelNames_b(nullptr) {};
	}mrc_param;
#endif

	/*************************************************************************
	* FUNCTION: mrc_init
	* PURPOSE: 载入模型
	* PARAM:
	[in] handle			- 句柄
	[in] params			- 参数
	* RETURN:	成功(0)或者错误代码
	* NOTES:
	*************************************************************************/
	MOTORRAINCLS_API int mrc_init(void ** handle, mrc_param param);

	/*************************************************************************
	* FUNCTION: mrc_process
	* PURPOSE: 二轮车加装雨棚分类
	* PARAM:
	[in] handle			- 检测句柄
	[in] img_data		- 图像数据
	[in] result			- 结果 内存在外部申请
	* RETURN:	成功(0) 或 错误代码(< 0)
	* NOTES:
	*************************************************************************/
	MOTORRAINCLS_API int mrc_process(void *handle, sy_img img_data, mrc_result * result);

	/*************************************************************************
	* FUNCTION: mrc_batch
	* PURPOSE: 二轮车加装雨棚分类 batch
	* PARAM:
	[in] handle			- 检测句柄
	[in] img_data_array	- 图像数据
	[in] batch_size		- 图像数目
	[in] result			- 结果 内存在外部申请
	* RETURN:	成功(0) 或 错误代码(< 0)
	* NOTES:
	*************************************************************************/
	MOTORRAINCLS_API int mrc_batch(void *handle, sy_img* img_data_array, int batch_size, mrc_result * result);
	MOTORRAINCLS_API int mrc_batchV2(void *handle, sy_img* img_data_array, int batch_size, mrc_result * result);

	/*************************************************************************
	* FUNCTION: mrc_release
	* PURPOSE: 释放
	* PARAM:
	[in] handle			- handle
	* RETURN:	NULL
	* NOTES:
	*************************************************************************/
	MOTORRAINCLS_API void mrc_release(void ** handle);


	/*************************************************************************
	* FUNCTION: mrc_get_version
	* PURPOSE:
	* PARAM:	NULL
	* RETURN:	版本号
	* NOTES:
	*************************************************************************/
	MOTORRAINCLS_API const char * mrc_get_version();

#ifdef __cplusplus
};
#endif

#endif