human_parsing.h 4.01 KB
/*******************************************************************************************
* Version: human_parsing_v0.0.0.190402
* CopyRight: 中科视语(北京)科技有限公司
* UpdateDate: 20190402
* Content: 行人分析
********************************************************************************************/

#ifndef HUMANPARSING_H_
#define HUMANPARSING_H_

#ifdef _MSC_VER
#ifdef HUMANPARSING_EXPORTS
#define HUMANPARSING_API __declspec(dllexport)
#else
#define HUMANPARSING_API __declspec(dllimport)
#endif
#else
#define HUMANPARSING_API __attribute__ ((visibility ("default")))
#endif

#include "sy_common.h"

#ifdef __cplusplus
extern "C"
{
#endif

#ifndef __CLASSIFY_OBJ_RESULT__
#define __CLASSIFY_OBJ_RESULT__
	typedef struct classify_obj_res         //分类结果结构体
	{
		int res_index;                      //分类结果
		float res_prob;                     //分类结构体
		classify_obj_res() : res_index(0), res_prob(0) {};
	} classify_obj_res;
#endif

#ifndef __HF_FEA_RESULT__
#define __HF_FEA_RESULT__
	const int HF_FEATURE_SIZE = 576;
#endif

#ifndef __HP_RESULT__
#define __HP_RESULT__
	const int HP_ATTRI_INDEX_SIZE = 16;
	typedef struct hp_analysis_res
	{
		classify_obj_res res_objs[HP_ATTRI_INDEX_SIZE];          //分类结果
		float feature[HF_FEATURE_SIZE]; //行人特征
	} hp_analysis_res;
#endif


#ifndef __HP_PARAM__
#define __HP_PARAM__
	typedef struct hp_param
	{
		int devId;              //ָ指定显卡id
		char* modelNames;		//模型路径
		// int engine;        //指定运行引擎(ENGINE_MCAFFE2 / ENGINE_TENSORRT)
		// int max_batch;     //指定trt最大batch数
		// char* serialize_file;
		// char* auth_license;
		// hp_param() :mode(DEVICE_GPU), gpuid(0) {};
	}hp_param;
#endif

	/*************************************************************************
	* FUNCTION: hp_init
	* PURPOSE: 初始化
	* PARAM:
	[out] handle			   - 句柄
	[in]  hp_param		   - 初始化参数
	* RETURN:
	[out] int             - 初始化是否成功(SUCCEEDED表示成功,FAILED表示失败)
	* NOTES:
	*************************************************************************/
	HUMANPARSING_API int hp_init(void ** handle, hp_param param);

	/*************************************************************************
	* FUNCTION: hp_process
	* PURPOSE: 行人属性检测
	* PARAM:
	[in] tools		      - 句柄
	[in] img_data		  - 检测图像数据
	[in] result           - 检测结果
	* RETURN:
	[out] int             - 检测是否成功(SUCCEED表示成功,FAILED表示失败)
	* NOTES:
	*************************************************************************/
	HUMANPARSING_API int hp_process(void * handle, sy_img img_data, hp_analysis_res * result);

	/*************************************************************************
	* FUNCTION: hp_batch
	* PURPOSE: 行人属性检测 batch
	* PARAM:
	[in] tools		      - 句柄
	[in] img_data_array   - 检测图像数据
	[in] batch_size       - 检测图像数目
	[in] result           - 检测结果
	* RETURN:
	[out] int             - 检测是否成功(SUCCEED表示成功,FAILED表示失败)
	* NOTES:
	*************************************************************************/
	HUMANPARSING_API int hp_batch(void * handle, sy_img *img_data_array, int batch_size, hp_analysis_res * result);


	/*************************************************************************
	* FUNCTION: hp_release
	* PURPOSE: 资源释放
	* PARAM:
	[in] handle		    - 处理句柄
	* RETURN:	NULL
	* NOTES:
	*************************************************************************/
	HUMANPARSING_API void hp_release(void ** handle);

	/*************************************************************************
	* FUNCTION: vc_get_version
	* PURPOSE:
	* PARAM:	NULL
	* RETURN:	版本号
	* NOTES:
	*************************************************************************/
	HUMANPARSING_API const char * hp_get_version();

#ifdef __cplusplus
};
#endif
#endif