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.

83 lines
2.5 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 "../../lib/App/common/imageParser.h"
  9. #define DARKNET
  10. //#define GPU
  11. #ifdef DARKNET
  12. #ifndef GPU
  13. #define DIRECT_DARKNET
  14. #endif
  15. #ifdef DIRECT_DARKNET
  16. //#include <darknet/darknet.h>
  17. #include "../../lib/data/darknet/darknetWraper.h"
  18. #endif
  19. //#include <darknet/yolo_v2_class.hpp>
  20. #endif
  21. #ifdef GPU
  22. #undef GPU
  23. #endif
  24. #include <opencv2/opencv.hpp>
  25. #include <opencv2/core.hpp>
  26. #include <opencv2/imgcodecs.hpp>
  27. #include <opencv2/highgui.hpp>
  28. #include <opencv2/dnn/dnn.hpp>
  29. using namespace cv;
  30. /**
  31. * TODO: Add class description
  32. *
  33. * @author Gagua
  34. */
  35. class IM_DnnWorker : public basicThread {
  36. private:
  37. #ifdef DARKNET
  38. #ifndef DIRECT_DARKNET
  39. Detector * m_pDarknetDetector;
  40. #else
  41. darknetWraper * m_pDarknetWraper;
  42. #endif
  43. #else
  44. #endif
  45. basicLogCollection * m_pLog;
  46. config_setting_t * m_pSettings;
  47. cv::dnn::Backend m_eBackendEngine;
  48. cv::dnn::Target m_eTargetDevice;
  49. cv::dnn::Net m_net;
  50. cv::Mat m_oWorkingMat;
  51. float m_fDetectionProbability;
  52. bool m_bUseClassMapping;
  53. std::vector<uint32_t> m_vClassesMap;
  54. basicEventHeap * m_pEvtHeap;
  55. char m_pPicturesBase[1024];
  56. char m_pConfigPath[1024];
  57. char m_pWeightsPath[1024];
  58. basicMutex m_mBufferProtectorMutex;
  59. IM_JOB * m_pActiveJob;
  60. bool m_bDataIsActive;
  61. IM_RESULT * m_fImageAnalyzer( Mat &Picture );
  62. protected:
  63. virtual void m_fThreadProc( void );//getLayerNames()
  64. public:
  65. // Constructor
  66. explicit IM_DnnWorker( config_setting_t * Settings = NULL );
  67. // Destructor
  68. virtual ~IM_DnnWorker();
  69. bool create( void );
  70. bool enqueueJob( IM_JOB *ptr );
  71. };
  72. #endif // __IM_DNNWORKER_H_INCL__