Taming Dynamic Clutter: Variance-Driven Adaptive Gain Control for Bio-inspired Small Target Detection
Official implementation of the Adaptive Gain Control (AGC) module for bio-inspired Small Target Motion Detection (STMD).
Existing STMD models suffer from a false-alarm collapse under non-stationary environmental interference (e.g. rustling leaves, water glints, high-frequency flickers). We introduce a lightweight, plug-and-play adaptive shunting-inhibition operator that quantifies local temporal variance and maps it into a gain-control factor, suppressing heavy-tailed clutter while preserving genuine dim targets. The module integrates seamlessly into mainstream STMD architectures.
Given a baseline STMD response Q, the AGC operator computes a variance-driven
suppression factor omega and gates the response (Q̃ = omega · Q):
| Step | Equation |
|---|---|
| Macro-compensated residual | E(x,y,t) = I(x,y,t) − I(x−φ, y−ψ, t−Δt) (Eq. 1) |
| Temporal variance (EMA) | σ²(t) = (1−γ)·σ²(t−Δt) + γ·E²(t) (Eq. 6) |
| Center-surround field | W_s = A[G_s2 − e·G_s3 − ρ]+ + B[G_s2 − e·G_s3 − ρ]− (Eq. 8) |
| Spatial clutter metric | C(x,y,t) = (σ² ∗ W_s)(x,y,t) (Eq. 7) |
| Suppression factor | omega(x,y,t) = exp(−C² / λ²) (Eq. 10) |
| Modulated output | Q̃ = omega · Q (Eq. 11) |
Default parameters (paper Sec. 4.2): λ = 0.05, γ = 0.1, σ_s = 1.5.
The core operator lives in
core/suppression.py
(AdaptiveSuppression).
python/smalltargetmotiondetectors/
├── api/ High-level inference / evaluation entry points
├── core/ Neural-cascade operators (incl. suppression.py = AGC module)
├── model/ STMD baselines and their *WithSuppression (AGC) variants
├── util/ Kernels, I/O, evaluation metrics
├── demo/ Inference demos, dataset generation, and evaluation scripts
└── test/ Unit tests for the baselines
data/ Sample synthetic sequence + ground truth
demodata/ Sample image stream / videos for the inference demos
Baselines and their AGC variants:
| Baseline | AGC variant (Q̃ = omega · Q) |
|---|---|
ESTMD |
ESTMDWithSuppression |
DSTMD |
DSTMDWithSuppression |
FeedbackSTMD |
FeedbackSTMDWithSuppression |
STFeedbackSTMD |
STFeedbackSTMDWithSuppression |
pip install -r requirements.txtRequires Python ≥ 3.12. Dependencies: numpy, scipy, opencv-python,
matplotlib, tqdm, torch.
Run a model on the bundled image stream / video and visualize the output:
python start_by_python.py
# or directly:
python python/smalltargetmotiondetectors/demo/inference_image_stream.py
python python/smalltargetmotiondetectors/demo/inference_video.pyProgrammatic use:
from smalltargetmotiondetectors.api import instancing_model, inference
model = instancing_model('STFeedbackSTMDWithSuppression') # baseline + AGC
model.init_config()
result, run_time = inference(model, gray_frame) # per-frame callDatasets (download separately): Vision Egg (synthetic, generated locally), RIST, and the Infrared dim-small aircraft dataset. Update the dataset paths at the top of the relevant script before running.
Script (demo/) |
Purpose |
|---|---|
generate_vision_egg.py |
Generate the synthetic Vision Egg sequences |
add_flicker_to_real.py / add_target_to_real.py |
Inject controlled flickers / targets into real video |
multi_model_experiment.py |
Synthetic comparison across 4 baselines × (with/without AGC) |
standalone_evaluate_vision_egg.py |
Vision Egg evaluation table |
evaluate_real_world.py |
RIST evaluation with injected flickers |
sensitivity_analysis.py |
Sensitivity to γ and λ |
smoke_test_models.py |
Quick end-to-end pipeline check |
Metrics: AUC, Detection Rate, Precision, F1, False-Alarm Suppression Ratio (FASR).
This project builds on the open-source Small-Target-Motion-Detectors library by Mingshuo Xu, which provides the ESTMD/DSTMD/FeedbackSTMD/STFeedbackSTMD baselines. The STFeedbackSTMD baseline and its LPTC ego-motion compensation follow Wang et al., Bio-Inspired Small Target Motion Detection With Spatio-Temporal Feedback in Natural Scenes, IEEE TIP, 2024. Our contribution is the variance-driven AGC module and its integration with these baselines.
This work is under review. A citation entry will be added upon publication.
Released for research purposes. See the original Small-Target-Motion-Detectors repository for the baseline implementations' terms.