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.
66 lines
2.1 KiB
66 lines
2.1 KiB
#ifndef __IM_DNNWORKER_H_INCL__
|
|
#define __IM_DNNWORKER_H_INCL__
|
|
|
|
#include "../../lib/components/base/basicThread.h"
|
|
#include "../../lib/components/base/basicMutex.h"
|
|
#include "../../lib/components/base/basicSettingsProvider.h"
|
|
#include "../../lib/components/base/basicEventHeap.h"
|
|
#include "IM_DataStructs.h"
|
|
|
|
#define DARKNET
|
|
|
|
#ifdef DARKNET
|
|
#define GPU
|
|
//#include <darknet/darknet.h>
|
|
#include <darknet/yolo_v2_class.hpp>
|
|
#undef GPU
|
|
#endif
|
|
|
|
#include <opencv2/opencv.hpp>
|
|
#include <opencv2/core.hpp>
|
|
#include <opencv2/imgcodecs.hpp>
|
|
#include <opencv2/highgui.hpp>
|
|
#include <opencv2/dnn/dnn.hpp>
|
|
|
|
using namespace cv;
|
|
/**
|
|
* TODO: Add class description
|
|
*
|
|
* @author Gagua
|
|
*/
|
|
class IM_DnnWorker : public basicThread {
|
|
private:
|
|
#ifdef DARKNET
|
|
Detector * m_pDarknetDetector;
|
|
#else
|
|
#endif
|
|
basicLogCollection * m_pLog;
|
|
config_setting_t * m_pSettings;
|
|
cv::dnn::Backend m_eBackendEngine;
|
|
cv::dnn::Target m_eTargetDevice;
|
|
cv::dnn::Net m_net;
|
|
cv::Mat m_oWorkingMat;
|
|
float m_fDetectionProbability;
|
|
bool m_bUseClassMapping;
|
|
std::vector<uint32_t> m_vClassesMap;
|
|
basicEventHeap * m_pEvtHeap;
|
|
char m_pPicturesBase[1024];
|
|
char m_pConfigPath[1024];
|
|
char m_pWeightsPath[1024];
|
|
basicMutex m_mBufferProtectorMutex;
|
|
IM_JOB * m_pActiveJob;
|
|
bool m_bDataIsActive;
|
|
IM_RESULT * m_fImageAnalyzer( Mat &Picture );
|
|
protected:
|
|
virtual void m_fThreadProc( void );//getLayerNames()
|
|
public:
|
|
// Constructor
|
|
explicit IM_DnnWorker( config_setting_t * Settings = NULL );
|
|
// Destructor
|
|
virtual ~IM_DnnWorker();
|
|
bool create( void );
|
|
bool enqueueJob( IM_JOB *ptr );
|
|
};
|
|
|
|
|
|
#endif // __IM_DNNWORKER_H_INCL__
|