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.

69 lines
2.2 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #error "This source file seems to be unused. 2026-02-20"
  2. #ifndef __IM_DNNWORKER_H_INCL__
  3. #define __IM_DNNWORKER_H_INCL__
  4. #include "../../lib/components/base/basicThread.h"
  5. #include "../../lib/components/base/basicMutex.h"
  6. #include "../../lib/components/base/basicSettingsProvider.h"
  7. #include "../../lib/components/base/basicEventHeap.h"
  8. #include "IM_DataStructs.h"
  9. #define DARKNET
  10. #ifdef DARKNET
  11. #define GPU
  12. //#include <darknet/darknet.h>
  13. #include <darknet/yolo_v2_class.hpp>
  14. #undef GPU
  15. #endif
  16. #include <opencv2/opencv.hpp>
  17. #include <opencv2/core.hpp>
  18. #include <opencv2/imgcodecs.hpp>
  19. #include <opencv2/highgui.hpp>
  20. #include <opencv2/dnn/dnn.hpp>
  21. using namespace cv;
  22. /**
  23. * TODO: Add class description
  24. *
  25. * @author Gagua
  26. */
  27. class IM_DnnWorker : public basicThread {
  28. private:
  29. #ifdef DARKNET
  30. Detector * m_pDarknetDetector;
  31. #else
  32. #endif
  33. basicLogCollection * m_pLog;
  34. config_setting_t * m_pSettings;
  35. cv::dnn::Backend m_eBackendEngine;
  36. cv::dnn::Target m_eTargetDevice;
  37. cv::dnn::Net m_net;
  38. cv::Mat m_oWorkingMat;
  39. float m_fDetectionProbability;
  40. bool m_bUseClassMapping;
  41. std::vector<uint32_t> m_vClassesMap;
  42. basicEventHeap * m_pEvtHeap;
  43. char m_pPicturesBase[1024];
  44. char m_pConfigPath[1024];
  45. char m_pWeightsPath[1024];
  46. basicMutex m_mBufferProtectorMutex;
  47. IM_JOB * m_pActiveJob;
  48. bool m_bDataIsActive;
  49. IM_RESULT * m_fImageAnalyzer( Mat &Picture );
  50. protected:
  51. virtual void m_fThreadProc( void );//getLayerNames()
  52. public:
  53. // Constructor
  54. explicit IM_DnnWorker( config_setting_t * Settings = NULL );
  55. // Destructor
  56. virtual ~IM_DnnWorker();
  57. bool create( void );
  58. bool enqueueJob( IM_JOB *ptr );
  59. };
  60. #endif // __IM_DNNWORKER_H_INCL__