You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

274 lines
6.6 KiB

/*
* @Author: turboLIU
* @Date: 2022-11-02 15:04:08
* @LastEditTime: 2024-10-25 09:17:48
* @Description: Do not edit
* @FilePath: /Algo_ACL_Common/API/AI_API.h
*/
#ifndef AI_API
#define AI_API
#include <string>
#include "detection_type_api.h"
using namespace AIGO;
#ifdef __cplusplus
extern "C"{
#endif
/**
* @brief NPU
*
* @return int 0
*/
int Init_ACL();
/**
* @brief Set the deque size object
*
* @param irdetin
* @param visdetin
* @param irsegin
* @param vissegin
* @param irdetout
* @param visdetout
* @param irsegout
* @param vissegout
* @param irdetres
* @param visdetres
* @param irsegres
* @param vissegres
* @return int
*/
int set_deque_size(int irdetin=3, int visdetin=3, int irsegin=3, int vissegin=3, int irdetout=5, int visdetout = 5, int irsegout = 5, int vissegout = 5,
int irdetres = 10, int visdetres = 10, int irsegres = 10, int vissegres = 10);
int get_deque_size(int &irdetin, int &visdetin, int &irsegin, int &vissegin, int &irdetout, int &visdetout, int &irsegout, int &vissegout,
int &irdetres, int &visdetres, int &irsegres, int &vissegres);
int reset_dequeu_size(int irdetin=30, int visdetin=30, int irsegin=30, int vissegin=30, int irdetout=50, int visdetout = 50, int irsegout = 50, int vissegout = 50,
int irdetres = 100, int visdetres = 100, int irsegres = 100, int vissegres = 100);
/**
* @brief Set the stream size object
* init 1280 1024
*
* @param width 1280
* @param height 1024
* @return int
*/
int set_stream_size(int width, int height, MODE mode);
int get_stream_size(int &width, int &height, MODE mode);
int reset_stream_size(int width, int height, MODE mode);
/**
* @brief
*
* @param irdetmodel
* @param visdetmodel
* @param irsegmodel
* @param vissegmodel
* @return int
*/
int Init_AI(const char* irdetmodel, const char* visdetmodel, const char* irsegmodel, const char* vissegmodel);
int Det_VL(ImgMat frame, std::vector<objinfo> &outputs);
int Det_IR(ImgMat frame, std::vector<objinfo> &outputs);
int Seg_VL(ImgMat frame, TenMat* output);
int Seg_IR(ImgMat frame, TenMat* output);
/**
* @brief get_result
*
* @param img
* @param GoDet
* @param GoSeg
* @param cropFlag set_ROIArea
* @return int
*/
int runAsync(ImgMat img, bool GoDet=true, bool GoSeg=true, bool cropFlag=false);
/**
* @brief Get the result object
*
* @param timestamp
* @param dets
* @param maskImg
* @param front: true: false:
* @param single true false
* @return int -1: 1: ; 0:
*/
int get_result(long long &timestamp, std::vector<objinfo> &dets, TenMat * maskImg, bool front=true, MODE mode=VIS); // async
/**
* @brief
*
* @return int
*/
int switch_vis_to_ir();
/**
* @brief
*
* @return int
*/
int switch_ir_to_vis();
/**
* @brief Set the dropout param
*
* @param drop true: drop deque front data, false: not drop data, : false
* @return int
*/
int set_dropout_param(bool drop);
/**
* @brief Get the dropout param
*
* @param drop
* @return int
*/
int get_dropout_param(bool &drop);
/**
* @brief
*
* @param mode IR or VIS
* @param road segment road or not
* @param bridge segment bridge or not
* @param water segment water or not
* @param building segment building or not
* @return int
*/
int set_seg_classes(MODE mode, bool road, bool bridge, bool water, bool building);
/**
* @brief Set the nms threshold object
*
* @param nms
* @return int
*/
int set_nms_threshold(float nms);
/**
* @brief Get the nms threshold object
*
* @param nms
* @return int
*/
int get_nms_threshold(float& nms);
/**
* @brief Set the det threshold object
*
* @param threshold
* @param idx 115CLASSTYPE
* @return int
*/
int set_det_threshold(float threshold, int idx);
/**
* @brief Get the det threshold object
*
* @param threshold
* @param idx 115CLASSTYPE
* @return int
*/
int get_det_threshold(float &threshold, int idx);
/**
* @brief Set the seg threshold object
*
* @param thr
* @return int
*/
int set_seg_threshold(float thr);
/**
* @brief Get the seg threshold object
*
* @return float
*/
float get_seg_threshold();
/**
* @brief : BGRRGBNV12 NV21 RGB
*
* @param m
* @return int
*/
int set_StreamMode(INPUT_LAYOUT m);
/**
* @brief Get the StreamMode object
*
* @return INPUT_LAYOUT
*/
INPUT_LAYOUT get_StreamMode();
/**
* @brief
*
* @return int
*/
int Uninit_AI();
/**
* @brief only deinit hardware
*
* @return int
*/
int Uninit_ACL();
/**
* @brief Set the ROIArea object
*
* @param x1 lefttop
* @param y1 lefttop
* @param x2 botright
* @param y2 botright
* @return int
*/
int set_ROIArea(int x1, int y1, int x2, int y2);
int setLabelMap(uint32_t A[], uint32_t B[], uint32_t len);
class DETECTION_API
{
private:
/* data */
public:
DETECTION_API(/* args */);
~DETECTION_API();
public:
int netWidth=0;
int netHeight = 0;
int clsnum = 0;
std::vector<std::vector<float>> anchors;// = {{7,11, 9,21, 21,15},{16,39, 31,24, 57,27},{43,59, 90,59, 131,116}};
void* AIGOhandle=NULL;
int AIGOinit(const char* modename, int deviceID=0);
int AIGOpreprocess(ImgMat img, bool doCopy=true);
int AIGOinfer();
int AIGOpostprocess(std::vector<objinfo> &results);
int AIGOdeinit();
};
class SEGMENTION_API
{
private:
/* data */
public:
SEGMENTION_API(/* args */);
~SEGMENTION_API();
int netWidth = 0;
int netHeight = 0;
int clsnum = 0;
void* AIGOhandle = NULL;
int AIGOinit(const char* modename, int deviceID=0);
int AIGOpreprocess(ImgMat img, bool doCopy=true);
int AIGOinfer();
int AIGOpostprocess();
int AIGOdeinit();
};
#ifdef __cplusplus
}
#endif
#endif