Test fire and smoke
This commit is contained in:
@@ -20,15 +20,24 @@ class CUSTOM_API ANSCustomFS : public IANSCustomClass
|
||||
int trackId{ 0 };
|
||||
int classId{ 0 }; // fire=0, smoke=2
|
||||
std::deque<cv::Rect> bboxHistory; // bounding box history within window
|
||||
int detectedCount{ 0 }; // frames detected in sliding window
|
||||
std::deque<int> highConfHits; // parallel: 1 if >=HIGH_CONF_THRESHOLD, else 0
|
||||
std::deque<double> vMeanHistory; // parallel: mean HSV V inside bbox (for flicker)
|
||||
int detectedCount{ 0 }; // high-conf hits in sliding window
|
||||
int lowConfDetectedCount{ 0 }; // total hits (any conf >= LOW_CONF_FIRE_THRESHOLD)
|
||||
int totalFrames{ 0 }; // total frames since track appeared
|
||||
bool confirmed{ false }; // passed voting threshold
|
||||
bool confirmed{ false }; // passed high-conf voting threshold
|
||||
};
|
||||
|
||||
// Voting mechanism constants
|
||||
static constexpr int VOTE_WINDOW = 15;
|
||||
static constexpr int VOTE_THRESHOLD = 8;
|
||||
// Dual-path voting mechanism constants
|
||||
static constexpr int VOTE_WINDOW = 15; // sliding window size (frames)
|
||||
static constexpr int VOTE_THRESHOLD = 8; // high-conf fast path (>=0.5)
|
||||
static constexpr int LOW_VOTE_THRESHOLD = 6; // low-conf slow path (>=0.25 + gates)
|
||||
static constexpr float HIGH_CONF_THRESHOLD = 0.5f; // boundary between low/high conf
|
||||
static constexpr float LOW_CONF_FIRE_THRESHOLD = 0.25f; // detector floor for small-fire path
|
||||
static constexpr float BBOX_CHANGE_THRESHOLD = 0.05f;
|
||||
// V-channel flicker gate: real fire oscillates in luma; sunlight does not
|
||||
static constexpr double FLICKER_V_STD_THRESHOLD = 3.0;
|
||||
static constexpr int FLICKER_MIN_SAMPLES = 6;
|
||||
|
||||
private:
|
||||
using ANSLIBPtr = std::unique_ptr<ANSCENTER::ANSLIB, decltype(&ANSCENTER::ANSLIB::Destroy)>;
|
||||
@@ -96,7 +105,6 @@ private:
|
||||
|
||||
cv::Rect GenerateMinimumSquareBoundingBox(const std::vector<ANSCENTER::Object>& detectedObjects, int minSize = 640);
|
||||
void UpdateNoDetectionCondition();
|
||||
bool detectStaticFire(std::deque<cv::Mat>& frameQueue);
|
||||
bool detectScreenFlicker(const std::vector<cv::Mat>& frames);
|
||||
bool detectReflection(const cv::Mat& frame);
|
||||
bool MajorityColourInFrame(cv::Mat frame, Range range, float area_threshold);
|
||||
@@ -136,11 +144,16 @@ private:
|
||||
int getLowestPriorityRegion();
|
||||
cv::Rect getRegionByPriority(int priority);
|
||||
|
||||
// Tracker-based voting methods
|
||||
void UpdateTrackHistory(int trackId, int classId, const cv::Rect& bbox);
|
||||
bool IsTrackConfirmed(int trackId) const;
|
||||
// Tracker-based voting methods (dual path: high-conf fast + low-conf slow)
|
||||
void UpdateTrackHistory(int trackId, int classId, const cv::Rect& bbox, float confidence, double vMean);
|
||||
bool IsTrackConfirmed(int trackId) const; // high-conf path
|
||||
bool IsTrackLowConfirmed(int trackId) const; // low-conf path (fire only)
|
||||
bool HasBboxMovement(int trackId) const;
|
||||
bool HasFireFlicker(int trackId) const; // V-channel temporal std-dev gate
|
||||
void AgeTracks(const std::unordered_set<int>& detectedTrackIds);
|
||||
|
||||
// Warm-color priority scan: re-rank cached sections by HSV warm-pixel count
|
||||
void RankCachedSectionsByWarmColor(const cv::Mat& frame);
|
||||
std::vector<ANSCENTER::Object> FindNewDetectedArea(
|
||||
const cv::Mat& frame,
|
||||
const std::string& camera_id, cv::Mat& draw);
|
||||
|
||||
Reference in New Issue
Block a user