Abstract
Cell and nuclear segmentation are fundamental tasks in bioimage analysis, yet current state-of-the-art methods often struggle to balance accuracy, computational efficiency, and cross-platform portability. We present InstanSeg, a proposal-free, embedding-based instance segmentation algorithm designed for high-throughput digital pathology. InstanSeg utilizes a lightweight U-Net backbone and a learned similarity metric to achieve superior segmentation accuracy across diverse datasets. Our results show that InstanSeg is significantly faster than existing tools—approximately 3x faster than StarDist and 10x faster than Cellpose—while maintaining a small memory footprint and full compatibility with Java-based environments like QuPath via TorchScript.
Introduction
In digital pathology, analyzing Whole Slide Images (WSIs) requires the segmentation of millions of individual cells. Researchers currently face a "trilemma" between accuracy, speed, and portability. StarDist provides speed but relies on star-convex approximations that fail on complex shapes. Cellpose offers high accuracy but is computationally intensive and slow. Furthermore, most tools require complex Python environments, hindering integration into user-friendly software like QuPath. InstanSeg breaks this trilemma by providing a method that is simultaneously more accurate, faster, and easily portable.
Methods
InstanSeg's architecture is built on a modified U-Net with approximately 4 million parameters. The pipeline involves three primary stages:
- Seed Selection: Predicting a seed map based on distance to the nearest boundary. Local maxima serve as potential object seeds.
- Learned Similarity: A Multi-Layer Perceptron (MLP) learns to group pixels around seeds by mapping embeddings and spatial offsets to instance probabilities. This allows the model to capture complex, non-convex morphologies that traditional fixed-kernel methods struggle with.
- Vectorized Post-processing: Instance resolution is parallelized on the GPU, removing traditional bottlenecks like the watershed algorithm.
Crucially, the entire pipeline is implemented to be fully serializable via TorchScript, allowing the model to run inside Java applications like QuPath without a Python installation.
Results
Evaluation across six public datasets (TNBC 2018, NuInsSeg, MoNuSeg, IHC TMA, CoNSeP, and LyNSeC) demonstrates InstanSeg's robustness. It outperformed StarDist, HoVer-Net, and Cellpose on 11 out of 12 metrics across these benchmarks. Notably, InstanSeg achieved a total processing time of 9.4 seconds for 199 images, compared to 26.6 seconds for StarDist and 103.2 seconds for Cellpose.
Key insights include the benefit of increasing positional embedding dimensionality beyond the 2D plane to separate crowded nuclei and the efficiency gained from optimizing the U-Net backbone.
Discussion and Future Work
InstanSeg provides a highly efficient solution for large-scale cell segmentation. While currently optimized for non-overlapping 2D histology and dependent on known physical pixel resolutions for peak performance, it represents a significant step forward in portable bioimage analysis. Future iterations will explore multi-compartment segmentation (e.g., cytoplasm vs. nucleus) and handling overlapping objects in multiplexed imaging. Its low memory requirement (1.5 GB) makes it accessible for researchers working on standard hardware rather than high-end server clusters.
Summary updated