123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- #ifndef __INFINEFILTER_H_
- #define __INFINEFILTER_H_
- #include <iostream>
- #include "Notices.h"
- #include "Util/util.h"
- #include "Util/logger.h"
- #include "Network/Socket.h"
- #include "Util/TimeTicker.h"
- #include "Util/NoticeCenter.h"
- #include "Poller/Timer.h"
- #include "CNStreamInferData.h"
- #include "config.hpp"
- #include <cmath>
- #include <queue>
- using namespace std;
- using namespace toolkit;
- namespace gsd
- {
-
- class InfineFilter
- {
- private:
- struct HistoryData
- {
- std::shared_ptr<Ticker> ticker = nullptr;
- std::shared_ptr<CNStreamInferData> CnStreamInferData = nullptr;
- };
-
- struct SimilarityData
- {
- std::shared_ptr<Ticker> ticker = nullptr;
- InferInfo info;
- };
-
-
- private:
- InfineFilter(){
- }
- InfineFilter(InfineFilter&) = delete;
- InfineFilter& operator=(const InfineFilter&) = delete;
-
-
-
-
-
-
- int sensitivity = 2;
-
-
-
-
-
- int filterLevel = 2;
- int interval = 2000;
- vector<HistoryData> HistoryDatas;
- queue<HistoryData> LatestDatas;
- vector<SimilarityData> SimilarityDatas;
- int TimeOut = 10 * 60 * 1000;
-
- Timer::Ptr timer = nullptr;
- private:
-
-
- int8_t LastOneJudgment(std::shared_ptr<CNStreamInferData>& cnStreamInferData);
-
-
- int8_t IntervalJudgment();
-
-
- int8_t HistoricalJudgment(std::shared_ptr<CNStreamInferData>& cnStreamInferData);
-
-
- int8_t SimilarityJudgment(std::shared_ptr<CNStreamInferData>& cnStreamInferData);
-
-
- void HistoricalCheck();
-
-
- void SimilarityCheck();
- public:
- using Ptr = std::shared_ptr<InfineFilter>;
- ~InfineFilter(){}
-
-
- int8_t MinBBoxFilter(std::shared_ptr<CNStreamInferData>& cnStreamInferData);
-
- int8_t judgementResult(std::shared_ptr<CNStreamInferData>& cnStreamInferData);
-
-
- int8_t CalculateSimilarity(InferInfo& infer1, InferInfo& infer2, std::shared_ptr<CNStreamInferData>& cnStreamInferData);
-
-
- int8_t SimilarityResult(std::shared_ptr<CNStreamInferData>& cnStreamInferData);
-
-
- static std::shared_ptr<InfineFilter> getPtr();
-
-
- int8_t setFilterLevel(int FilterLevel);
-
-
- int8_t setInterval(int Interval);
-
-
- int8_t setTimeOut(int timeOut);
-
-
- float getIou(InferInfo infer1, InferInfo infer2, std::shared_ptr<CNStreamInferData>& cnStreamInferData);
- public:
- double bboxSize = 0.0;
- };
- }
- #endif
|