YoloCrowdDetector.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef __YOLOCROWDDETECTOR_H
  2. #define __YOLOCROWDDETECTOR_H
  3. #include "Detector.h"
  4. #include "YoloCrowdApp.h"
  5. #include "YoloCrowdCfg.h"
  6. NAMESPACE_MAS_BEGIN
  7. NAMESPACE_YOLOCROWD_BEGIN
  8. class YoloCrowdDetector : public Detector, public tzc::OSThread {
  9. public:
  10. YoloCrowdDetector(const std::string& key, const std::string& name);
  11. ~YoloCrowdDetector();
  12. virtual TZ_INT Initialize(const std::string& initParam);
  13. virtual TZ_INT Dispose();
  14. virtual TZ_INT TurnOnGPU();
  15. virtual TZ_INT TurnOffGPU();
  16. virtual TZ_INT DoDetect(SPtr<StreamInfo>& media, fDetCallback callback, void* ctx);
  17. virtual TZ_INT SetDetectCfg(const std::string& param);
  18. private:
  19. virtual void Entry();
  20. void skipFrame(SPtr<StreamInfo>& media, fDetCallback callback, void* ctx);
  21. void draw(YoloCrowdDetectResult& yoloCrowdRst, DrawInfo& draw, TZ_INT height, TZ_INT width);
  22. TargetInfo m_targets;
  23. std::list<std::tuple<SPtr<StreamInfo>, fDetCallback, void*>> m_waitList;
  24. YoloCrowdApp* m_yoloCrowd;
  25. tzc::Mutex m_cntLock;
  26. tzc::Mutex m_listLock;
  27. tzc::Mutex m_rstLock;
  28. tzc::Semaphore m_sema;
  29. const TZ_Uint32 MAX_WAIT_LIST_LEN = 5;
  30. const TZ_Uint32 YOLO_WAIT_MSECOND = 100;
  31. };
  32. NAMESPACE_YOLOCROWD_END
  33. NAMESPACE_MAS_END
  34. #endif