[KongchangAI]
· 2 min read· 1,137 words

D²Mamba: How Deformable Dual-State Mamba Improves Retinal Microaneurysm Segmentation

D²Mamba: How Deformable Dual-State Mamba Improves Retinal Microaneurysm Segmentation

D²Mamba boosts retinal tiny lesion segmentation accuracy with deformable Mamba scanning and non-causal state space duality.

This article introduces D²Mamba, a new study on diabetic retinopathy lesion segmentation. DR lesions vary greatly in scale—microaneurysms are only a few pixels and easily lost to downsampling and attention mechanisms. The authors hypothesize that jointly modeling lesion spatial organization with global context and shape-adaptive scanning can improve small object segmentation. The model combines non-causal state space duality with deformable Mamba scanning, enabling bidirectional information flow and scan paths that adapt to lesion shape. In five-fold cross-validation on the DDR dataset, D²Mamba achieves 33.87% mIoU, 2.99 percentage points above the strongest baseline; microaneurysm Dice improves by 10.06 percentage points, the largest gain among all lesion types, directly validating the core hypothesis. Ablation studies confirm the two components work synergistically, and code and weights are open-sourced. The article also notes the study is validated on only one dataset and cross-dataset generalization remains to be tested.

Early diagnosis of retinopathy relies heavily on medical image segmentation, but lesions in diabetic retinopathy (DR) vary enormously in morphology, with microaneurysms (MAs) measuring only a few pixels in size. To address this challenge, a new paper proposes the D²Mamba model, which achieves significant breakthroughs in small lesion segmentation through deformable Mamba scanning and state space duality.

D²Mamba paper illustration

The Dilemma of Small Object Segmentation and the Hypothesis

DR lesions span an enormous range of scales: regions such as hemorrhages and hard exudates are relatively prominent, while microaneurysms occupy only a few pixels and are easily overwhelmed by downsampling and attention dilution in conventional convolution or Transformer architectures. The authors propose a core hypothesis: if a model can capture the spatial organization of lesion regions while combining global context with shape-adaptive scanning, it can improve segmentation of these small and irregular lesions.

This hypothesis directly targets the pain points of existing segmentation models. Traditional U-Net-like structures rely on fixed receptive fields and have limited adaptability to lesions with variable shapes; Transformers possess global modeling capability but their computational complexity grows with resolution, and their localization accuracy for extremely small targets is insufficient. Mamba-like state space models achieve long-range dependencies with linear complexity, offering a new approach to the problem.

Mamba and State Space Models (SSM)

Mamba is a sequence modeling architecture proposed in 2023, built on structured state space models (the S4 family). An SSM uses a set of linear ordinary differential equations to describe how an input sequence drives the evolution of hidden states, then decodes them into outputs, in the form (h_t = A h_{t-1} + B x_t), (y_t = C h_t). Compared with Transformer attention mechanisms, SSMs have approximately linear computational and memory costs in sequence length, giving them an advantage when processing high-resolution images or long sequences. Mamba's key improvement is making the parameters (A, B, C) vary dynamically with the input (the "selective" mechanism), allowing the model to decide which information to retain or forget based on content. In vision tasks, images typically must first be flattened into a scan sequence, so the "scan order" itself becomes an important design variable affecting modeling performance.

Two Key Designs of D²Mamba

D²Mamba's core innovation lies in combining non-causal state space duality with deformable Mamba scanning. Non-causal duality means the model is not limited to a unidirectional causal order when scanning sequences, but allows information to flow bidirectionally across spatial dimensions—this is especially important for mutual referencing between lesions and surrounding tissue in medical images.

Deformable Mamba scanning then makes the scan path no longer fixed in raster order but adaptively adjusted according to lesion shape. For point-like targets such as microaneurysms, fixed scanning easily blends them with the background; deformable scanning can dynamically organize receptive fields around candidate regions, essentially letting the model "lean in for a closer look." This design conceptually borrows from deformable convolution but embeds it within a state space sequence modeling framework.

State Space Duality and Non-Causal Scanning

State space duality means the same set of SSM parameters can be equivalently computed from two perspectives—"sequence recurrence" and "convolution/matrix"—enabling efficient implementation at different granularities. Mamba's original form is causal, meaning position (t) can only see information before (t), which suits language modeling but not images—pixels have no natural ordering. Non-causal duality allows forward and backward scan paths to run in parallel and fuse at the output, so each position can aggregate information from different directions in the image, equivalent to establishing bidirectional dependencies across spatial dimensions. This is similar in goal to bidirectional RNNs or global attention in vision Transformers, but computational complexity remains linear.

Experimental Results: Largest Gains on Tiny Lesions

The paper uses five-fold cross-validation on the DDR dataset, comparing against several representative segmentation baselines under identical training protocols, and conducts ablation studies for each component. In overall performance, D²Mamba achieves 33.87% mIoU, 2.99 percentage points above the strongest baseline.

More notably, the microaneurysm sub-category shows a Dice coefficient improvement of 10.06 percentage points—the largest gain among all lesion types. This result directly validates the authors' hypothesis that spatially adaptive state space modeling substantially helps small lesion segmentation. Since microaneurysms are among the earliest clinical signs of DR, improved segmentation accuracy has practical significance for early screening.

Ablation studies further confirm the respective contributions of non-causal duality and deformable scanning, showing that the two are not simply additive but work synergistically in spatial organization modeling. The authors have open-sourced the code and pretrained weights at https://github.com/PUREPANEL1/D2Mamba.

mIoU and Dice Metrics

mIoU (mean Intersection over Union) and the Dice coefficient are the two most commonly used overlap metrics in semantic segmentation. IoU is defined as the intersection of predicted and ground-truth regions divided by their union, and mIoU is the average IoU across classes (with or without background depending on protocol); the Dice coefficient equals (2|X \cap Y|/(|X|+|Y|)), monotonically related to IoU but typically higher in value. For targets occupying only a few pixels such as microaneurysms, metrics are extremely sensitive to boundary shifts: if a prediction is off by just a few pixels, IoU can drop from 0.5 to near 0, so percentage-point gains on such sub-categories often reflect a model's localization ability for tiny structures better than overall metrics. When reading such results, note the differences in sample sizes across lesion categories—a small absolute gain on a minority class may correspond to a large relative improvement.

Implications for Medical Image Segmentation

D²Mamba's value extends beyond retinal lesions. It offers a general approach: when targets are extremely small and variable in shape, make the scan path itself a learnable, adaptable variable rather than a fixed hyperparameter. State space models maintain linear complexity while deformable mechanisms compensate for fine-grained localization capability, which has reference value for other small-object medical segmentation tasks (such as cell nuclei and microcalcifications).

Of course, this study has only completed five-fold validation on a single dataset; cross-dataset generalization and stability across different imaging devices still need further verification. But the data—33.87% mIoU and a 10.06 percentage point Dice improvement on microaneurysms—already makes a convincing case for deformable state space models in medical imaging.

DDR Dataset

DDR (Diabetic Retinopathy Dataset) is a widely used public dataset for diabetic retinopathy analysis, containing a large number of color fundus photographs and pixel-level lesion annotations covering typical DR lesion types such as microaneurysms, hemorrhages, hard exudates, and soft exudates, commonly used for lesion segmentation and DR grading research. Due to its fine annotations and large lesion scale range, DDR has become a common benchmark for evaluating small object segmentation methods. However, five-fold cross-validation on a single dataset mainly reflects stability within the same data distribution; domain shifts caused by different acquisition devices, different ethnic populations, and different annotation protocols still need to be evaluated through cross-dataset experiments—a direction this research needs to address going forward.

#D²Mamba#microaneurysm segmentation#diabetic retinopathy#state space model#Mamba#medical image segmentation#DDR dataset
Share:

Related articles