Attention Pooling Enhances NCA-based Classification of Microscopy Images

Chen Yang, Michael Deutges, Jingsong Liu, Han Li, Nassir Navab, Carsten Marr, Ario Sadafi

TL;DR

This paper introduces attentionNCA (aNCA), a highly parameter-efficient model that integrates spatial attention pooling with Neural Cellular Automata (NCA) for microscopy image classification. With only 89k parameters, aNCA bridges the performance gap between minimalistic cellular models and complex deep learning architectures, consistently outperforming standard lightweight CNNs and Vision Transformers across eight diverse biomedical datasets.

What Problem Does This Paper Address?

Accurate cell classification in microscopy images is vital for medical diagnostics, yet manual analysis is slow and prone to human error. While deep learning models like Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs) have advanced the field, they typically suffer from massive parameter counts. In low-data medical settings, these large models are highly susceptible to overfitting and generalize poorly.

Neural Cellular Automata (NCA) have emerged as a lightweight, robust, and interpretable alternative. NCAs learn local update rules to iteratively evolve pixel states, mimicking biological growth or pattern formation. However, a major bottleneck in previous classification-based NCAs was the dimensionality reduction step: they relied on simple maximum pooling to squash high-dimensional feature maps into compact embeddings, discarding crucial spatial information. This paper tackles this performance gap by introducing a learnable, attention-driven pooling mechanism.

Methods

The authors propose attentionNCA (aNCA), which pairs an NCA feature extractor backbone with a novel spatial attention pooling layer.

Fig. 1. Architecture of our attention neural cellular automata (aNCA). A: The model extracts feature maps from the padded input image using neural cellular automata. Each feature map is aggregated into a single value via a learnable weighted sum, a mechanism we call attention pooling, which enhances focus on the most informative regions. The resulting feature embedding is then passed through a fully connected network for classification. The gradient flow is indicated with blue arrows. The model including the attention mask and NCA is trained end-to-end.
  1. NCA Backbone: The model processes an image iteratively over 64 steps. For each cell (pixel), a perception function aggregates information from its local $3 \times 3$ neighborhood using convolutional filters. A two-layer fully connected network then computes the state update. To improve robustness, only a random half of the cells are updated at each step.
  2. Attention Pooling: Instead of max-pooling, a matrix of learnable weights $\theta$ is introduced to compute a spatially weighted sum across the feature maps. To filter out background noise, the model sorts these weighted features and averages only the top 10% highest activations per channel.
  3. Classification Head: This low-dimensional, noise-reduced embedding is finally fed into a simple two-layer fully connected network to output the class probabilities. The entire pipeline is trained end-to-end using focal loss to handle class imbalances.

Datasets

The model was rigorously evaluated on eight distinct, domain-spanning microscopy datasets:

Fig. 2. Example images from the eight diverse microscopy datasets used in this study. The datasets cover a wide range of domains and differ in class distribution and size.
  • Matek-19: 18,365 white blood cell images (15 classes).
  • Acevedo-20: 17,092 peripheral blood cell images (8 classes).
  • INT-20: An in-house dataset containing ~42,000 single-cell images (18 classes).
  • Sipakmed: 4,049 Pap smear cervical cell images (5 classes).
  • Urine-23: 8,509 urine sediment particle images (8 classes).
  • Malaria-18: 27,560 Giemsa-stained red blood cell images (2 classes).
  • CRC: 100,000 colorectal tissue histopathology patches (9 classes).
  • PatchCam: 327,680 lymph node histopathology patches (2 classes).

Key Insights and Ideas

  • The Bottleneck is the Bridge: The transition from high-dimensional feature maps to low-dimensional classification vectors is where traditional lightweight models fail. Replacing rigid pooling (like max-pooling) with a flexible, learnable spatial attention map preserves localized diagnostic features (like intracellular parasites or nuclear abnormalities).
  • Less is More (Sparsity Wins): Restricting the pooling mechanism to the top 10% of activations acts as an incredibly effective regularizer. It prevents the model from averaging in uninformative background noise, which is highly prevalent in microscopy slides.
  • Extreme Parameter Efficiency: By utilizing localized, iterative cellular updates rather than deep stacks of global convolutions or self-attention layers, the model achieves competitive accuracy with a fraction of the memory footprint.

Key Results

The proposed aNCA model (89k parameters) was compared against a previous max-pooled NCA baseline (WBC-NCA, 86k), a lightweight CNN (MobileNetV3, 580k), a lightweight Transformer (MobileViT, 955k), and heavy, non-lightweight state-of-the-art models (21M–139M parameters).

Table 1. aNCA consistently outperforms lightweight baselines across all datasets. Classification accuracies of our proposed aNCA against WBC-NCA, MobileNetV3, MobileViTxxs, and dataset-specific baselines are reported across eight datasets, with their model sizes in parentheses. Standard accuracy is reported for most datasets, while balanced accuracy is used for CRC to align with the published baseline. The highest accuracy among lightweight models (<1M parameters) for each dataset is highlighted in bold.
  • Outperforming Lightweight Baselines: aNCA consistently outperformed MobileNetV3 and MobileViT across all eight datasets, often by substantial margins (e.g., achieving 91.6% accuracy on CRC compared to MobileNetV3's 70.5%).
  • Beating the NCA Baseline: The addition of attention pooling provided a clear boost over WBC-NCA across the board, proving that smart feature aggregation is vital for cellular automata architectures.
  • Optimal Sparsity Threshold: Ablation studies confirmed that pooling the top 10% of pixel values yielded the highest accuracy across nearly all datasets compared to alternative thresholds (5%, 20%, 50%) or generating attention maps via standard convolutional layers.
Table 2. Averaging the highest 10% of pixels in feature maps achieves the highest performance on most datasets. For each NCA feature channel, we take the average of the highest x percent of pixel values as the reduced feature. We studied the performance when setting x to 5%, 10%, 20%, and 50% (Column 1-4). We also studied an alternative approach (conv) where the attention map is generated through a convolutional layer that operates on the feature (Column 5). The highest accuracy for each dataset is highlighted in bold, the second highest is underlined.

Limitations and Future Work

While aNCA demonstrates remarkable parameter efficiency and accuracy, the authors note that further work is required to enhance its computational efficiency and deployment readiness. Because NCAs rely on iterative processing (running the update rule 64 times per image), they can introduce higher computational latency during inference compared to single-pass feed-forward networks. Additionally, while aNCA dominates the lightweight category, a performance gap still remains when compared to massive, heavy foundation models (21M+ parameters) trained on massive compute budgets.

Summary updated

BibTeX
@inproceedings{yang2025attention,
  author = {Chen Yang and Michael Deutges and Jingsong Liu and Han Li and Nassir Navab and Carsten Marr and Ario Sadafi},
  title = {{Attention Pooling Enhances NCA-based Classification of Microscopy Images}},
  booktitle = {MLMI @ MICCAI},
  year = {2025},
  doi = {10.1007/978-3-032-09513-8\_56},
}
Figure