Disable stabilized feature by default. Need ,more time to test
This commit is contained in:
@@ -418,10 +418,24 @@ namespace ANSCENTER
|
||||
}
|
||||
}
|
||||
|
||||
const bool prevTracker = _trackerEnabled;
|
||||
const bool prevStab = _stabilizationEnabled;
|
||||
|
||||
_trackerEnabled = enabled;
|
||||
_trackerType = trackerType;
|
||||
|
||||
if (!enabled) return true;
|
||||
if (!enabled) {
|
||||
// Invariant: stabilization requires the tracker. Disabling the
|
||||
// tracker forces stabilization off so the flag does not lie —
|
||||
// otherwise StabilizeDetections is dead code (gated on
|
||||
// _trackerEnabled in the inference path) but introspection
|
||||
// would still report stabilization as on.
|
||||
_stabilizationEnabled = false;
|
||||
ANS_DBG("ANSOD_StabState",
|
||||
"this=%p SetTracker(false) tracker=%d->0 stab=%d->0",
|
||||
(void*)this, (int)prevTracker, (int)prevStab);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Store config so per-camera trackers can be created lazily
|
||||
_trackerMotType = 1; // default BYTETRACK
|
||||
@@ -447,10 +461,14 @@ namespace ANSCENTER
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-enable stabilization with defaults when tracker is enabled
|
||||
if (!_stabilizationEnabled) {
|
||||
_stabilizationEnabled = true;
|
||||
}
|
||||
// Note: stabilization is NOT auto-enabled here. Tracker can run
|
||||
// without stabilization (raw trackId assignment, no ghost
|
||||
// injection / EMA / hysteresis). Callers that want stabilization
|
||||
// must opt in explicitly via SetStabilization(true), which
|
||||
// auto-enables the tracker if needed.
|
||||
ANS_DBG("ANSOD_StabState",
|
||||
"this=%p SetTracker(true,type=%d) tracker=%d->1 stab=%d (unchanged)",
|
||||
(void*)this, (int)trackerType, (int)prevTracker, (int)prevStab);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -463,8 +481,13 @@ namespace ANSCENTER
|
||||
bool ANSODBase::SetStabilization(bool enabled, int historySize, int maxMisses) {
|
||||
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||
try {
|
||||
const bool prevTracker = _trackerEnabled;
|
||||
const bool prevStab = _stabilizationEnabled;
|
||||
|
||||
if (enabled) {
|
||||
// Auto-enable tracker if not already enabled
|
||||
// Invariant: stabilization requires tracker. Auto-enable
|
||||
// tracker if currently off so the flag is meaningful at
|
||||
// runtime (StabilizeDetections is gated on _trackerEnabled).
|
||||
if (!_trackerEnabled) {
|
||||
if (!SetTracker(_trackerType, true)) {
|
||||
_logger.LogError("ANSODBase::SetStabilization",
|
||||
@@ -476,9 +499,18 @@ namespace ANSCENTER
|
||||
_stabilizationQueueSize = static_cast<size_t>(std::max(historySize, 5));
|
||||
_stabilizationMaxConsecutiveMisses = std::max(maxMisses, 1);
|
||||
QUEUE_SIZE = _stabilizationQueueSize;
|
||||
ANS_DBG("ANSOD_StabState",
|
||||
"this=%p SetStabilization(true,hist=%d,miss=%d) tracker=%d->%d stab=%d->1",
|
||||
(void*)this, historySize, maxMisses,
|
||||
(int)prevTracker, (int)_trackerEnabled, (int)prevStab);
|
||||
}
|
||||
else {
|
||||
// Disabling stabilization leaves the tracker untouched —
|
||||
// tracker is independently useful (raw trackId assignment).
|
||||
_stabilizationEnabled = false;
|
||||
ANS_DBG("ANSOD_StabState",
|
||||
"this=%p SetStabilization(false) tracker=%d (unchanged) stab=%d->0",
|
||||
(void*)this, (int)prevTracker, (int)prevStab);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user