The Four Color Theorem for Cell Instance Segmentation

Ye Zhang, Yu Zhou, Yifeng Wang, Jun Xiao, Ziyue Wang, Yongbing Zhang, Jianxu Chen

Abstract

Accurate cell instance segmentation is a fundamental requirement in biomedical imaging, yet it remains a significant challenge when cells are densely packed or exhibit irregular morphologies. Traditional methods, ranging from detection-based to distance-mapping approaches, often suffer from high computational costs or sensitivity to post-processing parameters. This paper introduces FCIS, a novel framework that reformulates instance segmentation as a four-class semantic segmentation task. By leveraging the Four Color Theorem, we assign distinct labels to adjacent cells, effectively simplifying instance differentiation. To overcome the challenge of label non-uniqueness, we implement an asymptotic training strategy and feature orthogonality constraints. Our results demonstrate that FCIS achieves state-of-the-art accuracy across diverse imaging modalities while significantly reducing computational complexity compared to existing distance-based models.

1. Introduction

In biomedical research, the ability to segment individual cells—instance segmentation—is crucial for downstream analysis. However, the task is notoriously difficult in scenarios where cells are tightly clustered or overlapping. Current methodologies generally fall into three categories: detection-based methods (e.g., Mask R-CNN), which struggle with non-ellipsoidal shapes; contour-based methods, which are prone to errors at boundaries; and distance mapping-based methods, which require complex multi-branch architectures and intensive post-processing like watershed transforms.

The fundamental hurdle in these approaches is instance differentiation: the ability of a neural network to distinguish between two touching objects of the same class. We propose a paradigm shift by treating cell clusters as a map-coloring problem, reducing the complexity of instance segmentation to a simpler semantic classification task.

2. Methodology

2.1 Greedy Encoding and the Four Color Theorem

The Four Color Theorem states that any map can be colored with at most four colors such that no two adjacent regions share the same color. By treating each cell as a "country" and the background as the "ocean," we can assign one of four labels to every cell in an image. We utilize a greedy algorithm to perform this encoding, transforming the instance segmentation problem into a 4-class semantic segmentation task.

2.2 Overcoming Label Non-Uniqueness

A significant challenge in this approach is that a single cell arrangement can be validly colored in multiple ways. This non-uniqueness can confuse a network during training. To stabilize the learning process, FCIS introduces three key components:

  • Asymptotic Training Strategy: The model is trained in stages, first learning to distinguish the foreground (cells) from the background before attempting to predict specific color categories within the foreground.
  • Negative Sampling Constraint: To ensure the network learns distinct features for adjacent cells, we impose an orthogonality constraint in the feature space. By minimizing the cosine similarity between features of adjacent cells, we force the model to represent neighboring instances as mathematically distinct entities.
  • Encoding Transformation Module: This module maps raw network predictions to a consistent "minimum color representation," ensuring that the output adheres to the four-color rules even if internal label assignments shift during training.

3. Theoretical Insights

While the Four Color Theorem provides a theoretical upper bound, our analysis (Theorem 1) suggests that biological structures are often simpler than general maps. Because cells typically aggregate in clusters with few neighbors or form chain-like structures, greedy coloring is often globally optimal. Statistical analysis of our datasets reveals that most cell images can actually be resolved using only three colors, further simplifying the learning objective for the network.

4. Experimental Results

4.1 Datasets

We evaluated FCIS on four diverse benchmarks to ensure generalizability across different imaging modalities:

  • DSB2018: Fluorescence-stained nuclei.
  • BBBC006v1: Hoechst 33342 marker-stained images.
  • PanNuke: 19 different organ types using H&E pathology staining.
  • YeaZ: Bright-field and phase-contrast yeast cell images.

4.2 Performance and Efficiency

FCIS achieved state-of-the-art (SOTA) results across all benchmarks. On the DSB2018 dataset, it reached a DICE score of 0.939, outperforming established models such as CellPose and StarDist. On the complex PanNuke dataset, it achieved a Panoptic Quality (PQ) score of 0.610, demonstrating robustness against the varied textures of pathology slides.

Beyond accuracy, FCIS is highly efficient. With approximately 39M parameters and 58G FLOPs, it is significantly leaner than distance-based competitors like HoverNet (~200G FLOPs). This efficiency makes FCIS particularly suitable for high-throughput clinical pipelines where computational resources may be a bottleneck.

5. Conclusion and Future Work

By reformulating instance segmentation through the lens of the Four Color Theorem, FCIS eliminates the need for complex proposal stages or fragile post-processing. While the non-uniqueness of encoding remains a challenge, our asymptotic and orthogonality constraints provide a robust workaround. Future research will focus on adaptive encoding strategies that can dynamically adjust to varying tissue densities, potentially further enhancing the model's ability to generalize to unseen biological structures.

Summary updated

BibTeX
@inproceedings{zhang2025four,
  author = {Ye Zhang and Yu Zhou and Yifeng Wang and Jun Xiao and Ziyue Wang and Yongbing Zhang and Jianxu Chen},
  title = {{The Four Color Theorem for Cell Instance Segmentation}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=VK8SuRaJfX},
}
Figure