#ifndef YOLODETECTSERVERI_H
|
#define YOLODETECTSERVERI_H
|
#define GPU
|
|
#include "YoloServer.h"
|
#include <thread>
|
#include <darknet.h>
|
#include <opencv2/opencv.hpp>
|
#include <basic/util/resource/ResourcesManager.h>
|
|
#include "DnDetect.h"
|
#include <atomic>
|
|
struct DnDetectRes {
|
public:
|
DnDetectRes() : i(3) {
|
}
|
|
DnDetect::DnDetect *dnDetect;
|
// 序号及线程id
|
std::unordered_map<int, std::thread::id> map_pid;
|
// 接受的线程个数
|
int i;
|
};
|
|
class YoloDetectServerI : public YoloDetect::YoloDetectServer {
|
public:
|
YoloDetectServerI();
|
|
virtual ~YoloDetectServerI();
|
// FaceDetectServer interface
|
public:
|
virtual ::YoloDetect::ObjInfos
|
YoloDetect(::Ice::Int, ::Ice::Int, const ::std::string &, const ::Ice::Current & = ::Ice::emptyCurrent) override;
|
|
virtual YoloDetect::stringData getCocoData(const Ice::Current &) override;
|
|
private:
|
network *m_net;
|
float m_thresh;
|
float m_hier_thresh;
|
float m_nms;
|
char **names;
|
image **alphabet;
|
bool m_bInitThd;
|
std::thread m_thdInit;
|
|
std::map<int, DnDetectRes> map_dnDetRes;
|
|
// ResourcesManager<int> resourcesManager;
|
|
private:
|
|
static int init(void *arg);
|
|
cv::Mat bufferToMat(const int w, const int h, const int channels, const void *buffer);
|
|
|
};
|
|
|
#endif
|