Manuscript Offprint
arXiv:2610.33081SWIFT-Cell: Segmentation Without Iterative Flow Tracking
ABSTRACT
Generalist segmenters such as Cellpose-SAM (CPSAM) outline cells accurately across stains but slowly; watershed detectors such as QuPath's are fast but less accurate. In time-critical use, such as interactive retrieval of cells from a user-drawn region, CPSAM at the reference settings takes 58–303 s per measured 8192² region on an RTX 4500 Ada GPU, beyond a seconds-scale interactive target. We distil CPSAM into SWIFT-Cell (SWIFT), a 0.63M-parameter U-Net trained only on CPSAM masks of 1,202 H&E and IHC tiles. On three 8192² development regions SWIFT takes 2.0–5.2 s on 4 CPU cores in int8, 2.5–5.1 × faster than QuPath's detector on the same cores, and 0.36–0.49 s on a GPU. Against human annotations on eight H&E, IHC and ISH sets it keeps 95% of CPSAM's panoptic quality (PQ) on PanNuke (0.593 vs. 0.627) and is level on NuCLS (0.546 vs. 0.540). On Ki-67 IHC masks scored to the outline centre it is 0.205 PQ above QuPath's better mode, 0.079 below CPSAM and 0.027 below InstanSeg (CI includes 0; at the outer edge 0.008 below CPSAM); on 212 pathologist-outlined nuclei in Ki-67 fields of 12 untouched patients its recall is 0.925 (CPSAM 0.920, InstanSeg 0.901; paired difference CIs include 0); one method-blinded pathologist accepted its outlines in 96% of 100 fields (60 from two development tissue patients, 40 hematology; CPSAM 83%, QuPath 53%; tissue 100% for SWIFT and CPSAM); on ER/PR points from 12 patients its detection F1 is 0.882 (CPSAM 0.896, InstanSeg 0.857), and on 4-reader PD-L1 points 0.83 (CPSAM 0.85, readers 0.87). SWIFT is close to CPSAM in accuracy and faster than watershed detection: it bridges the gap between research and real-world deployment.
Index Terms: Nucleus segmentation, knowledge distillation, Cellpose-SAM, computational pathology, hematology
1. INTRODUCTION
Generalist segmenters such as Cellpose-SAM (CPSAM) [1] work across stains and modalities without retraining. Some uses are time-critical: a user draws a region and waits for its cells to be outlined, a deployment has only CPU cores or a T4-class GPU, or whole regions must be segmented within seconds. On the timed regions (Table 1), CPSAM on a GPU at QuPath's working resolution of 0.5 m/px takes 3.3–4.9× as long as QuPath on 4 CPU cores.
QuPath's cell detector [2] takes seconds on a CPU. It thresholds one colour-deconvolved channel and splits nuclei by watershed. Because detection runs on the hematoxylin channel by default, DAB-positive nuclei are often missed or outlined smaller than by CPSAM (Sec. 3). Lighter supervised nucleus models exist (StarDist [3], InstanSeg [4]), and students have been trained on a teacher's output [5]: HoverFast [6] (a 0.94M-parameter U-Net) and HoVer-UNet [7] learn from HoVer-Net [8] outputs, [9] distils a pathology foundation model, and EfficientBioAI [10] quantises Cellpose to int8. We found no prior distillation of CPSAM.
Large generalists are the research state of the art, but real-world deployment has time and hardware limits. To bridge this gap, we distil the trusted generalist on its own masks into a student sized for those limits, and measure the cost.
Contributions.
-
A recipe. Distil the trusted generalist into a 0.63M-parameter U-Net using only its masks on the target stain mix, decode in one pass from centre offsets [11], and run it in fp16 on a GPU or int8 on a CPU (Sec. 2).
-
A measured trade-off. Speed, fidelity to the teacher and DAB-positive outline size against QuPath, InstanSeg and the teacher on the same hardware (Table 1).
-
An evaluation protocol. What the student keeps and loses against the teacher, human annotations on H&E and IHC (InstanSeg, StarDist and QuPath as references), zero-shot hematology and a blinded pathologist rating (Table 2, Sec. 4).
Student. The student is a 5-level U-Net [15] with 16 base channels, additive skips and a dilated bottleneck: 0.63M parameters (0.6MB in int8), fewer than CPSAM (304.6M). Input is resampled to 0.5 m/px; a stride-2 stem places the finest feature grid at 1 m/px. A full-resolution stage (adding 928 parameters) refines the decoder features on the input grid, where three outputs are predicted: a foreground logit (BCE + Dice), a Gaussian centre heatmap ( px, weighted MSE) and the offset ( ) from each foreground pixel to its centroid (smooth-L1, weight 2). Training uses AdamW, flip, rotation, colour, blur and scale augmentation, and up-weights the palest third of hematoxylin nuclei. A first model is trained in two stages on an earlier set of up to 811 tiles (12k steps, 70 min on one GPU), then fine-tuned on the full set (1,091 training, 111 validation tiles; 10k steps, 40 min); the last checkpoint is used. Some validation tiles may have been warm-start training tiles, so validation did not select the model and is not independent. The full-resolution stage, stem and pale weighting were not ablated.
Offset decoding. Seeds are local maxima of the heatmap (7×7 max-pool, threshold 0.35) inside the foreground (probability > 0.5) on the 0.5 μm/px grid; the seed map V is dilated by 5 px (GPU) or 3 px (CPU), and where dilations overlap the larger ID wins. Foreground and offsets are bilinearly resampled to the output grid. An output pixel p with working-grid position π(p) is foreground if and takes the label , so a pixel that reaches no seed stays background. Objects under 5 working-grid pixels are removed. Outputs are computed per tile with a 48-px halo; the halo-free centres form one region map, decoded once (no per-tile instance reconciliation), and empty glass tiles are skipped. The GPU path runs in fp16; the CPU path uses OpenVINO int8, post-training quantised on 64 training tiles, in throughput mode with asynchronous requests.
3. RESULTS ON TISSUE
Setup. We use three large regions: H&E breast (27k CPSAM detections), Ki-67 (97k) and CD3 colon (10k). They lie on development slides: their crops tuned SWIFT's decoding, and the regions compared design variants. A warm-start set filtered by name held 4 tiles from a renamed copy of the Ki-67 slide, outside its region. CPSAM uses these reference settings: , blocks, cellprob -1, flow threshold 0.6. QuPath 0.7.0 runs headless with defaults (WatershedCellDetection at , default stain vectors, measurements and cell expansion). CPU work is pinned to 4 physical cores of an AMD EPYC 7282; GPU runs use an RTX 4500 Ada plus the same cores. Segmentation latency is measured in one session on a decoded RGB region, without slide reading or model loading: median of 5 runs after a warm-up (CPSAM, InstanSeg CPU: 3). For SWIFT and InstanSeg it includes resampling, host-device copies and upsampling of labels to the native grid, for QuPath measurements and cell expansion; for CPSAM it excludes painting masks into a native-grid label image. Fidelity is object F1 at against reference CPSAM (qualifying pairs verified one-to-one); it measures agreement with the teacher, not accuracy.
| Method (hardware) | Time (s) | F1 vs. CPSAM | |
|---|---|---|---|
| H&E / Ki-67 / CD3 | H&E / Ki-67 / CD3 | area | |
| CPSAM 0.30 μm/px (GPU) | 86 / 303 / 58 | 1 / 1 / 1 | 1.00 |
| CPSAM 0.5 μm/px (GPU) | 34 / 131 / 23 | .93 / .95 / .84 | 1.00 |
| QuPath (4 CPU thr.) | 10.2 / 26.6 / 5.1 | .68 / .54 / .61 | 0.68 |
| InstanSeg [4] (GPU fp16) | 1.73 / 5.95 / 1.19 | .87 / .84 / .76 | 0.85 |
| InstanSeg (4 CPU thr.) | 78 / 199 / 49 | .88 / .84 / .76 | 0.85 |
| SWIFT (GPU fp16) | 0.38 / 0.49 / 0.36 | .89 / .88 / .73 | 1.00 |
| SWIFT (4 CPU int8) | 2.32 / 5.23 / 2.02 | .89 / .87 / .73 | 0.97 |
Table 1. Evaluation regions on development slides. Times: one session (Sec. 3). DAB area: median area ratio to CPSAM, matched DAB-positive Ki-67 nuclei. InstanSeg: released brightfield_nuclei v0.1.1 at 0.5 m/px, antialiased, our tiling; GPU: its TorchScript decoder, CPU: ours. SWIFT GPU (fp16, seed dilation 5 px) and CPU (int8, 3 px) are two deployment configurations, not a quantisation comparison.

Fig. 1. Ki-67 tuning crop (development slide). Scale bar .
What is kept and what is lost.
-
Speed: against QuPath detection alone (F1 0.94–0.97 to its default output) the int8 segmenter is faster on the same cores.
-
Ki-67: of CPSAM's DAB-positive nuclei, default QuPath misses 39% outright (no object at the CPSAM centroid) and outlines a further 20% at under half their area; the student misses 2.2% and recovers 91% at IoU≥0.5, against 32% for default QuPath and 76% (area 0.74) for its optical-density-sum (OD-sum) mode (Fig. 1). The labelling index does not gain: on this one region (CPSAM 45%) the student's is 2.1 points lower, as 12% of its objects are small, mostly DAB-negative extras; QuPath's is within 0.1 points, as misses and extras cancel.
Decoder ablation. Offsets help assignment and the output grid helps shape (Table 3): a heatmap watershed on the output grid comes within 0.004 of offsets except on dense Ki-67, and labels on the grid keep F1 within 0.003 but flip 20-35% of circularity decisions.
Human ground truth. Patches (PanNuke: 2,656) are mirror-padded by and packed into mosaics; an object is kept if at least of it lies inside its patch (Table 2). On NuCLS (1,720 fields) box and point annotations are ignored and predictions at least inside them are dropped; fields of two patients with possible training overlap are excluded. CPSAM's training includes 6,053 of 7,898 PanNuke tiles and MoNuSeg train, and StarDist's (2D-versatile_he, run at
| Set | Stain, tissue; reference | Patients | Nuclei | Metric | SWIFT | CPSAM | InstanSeg | StarDist | QuPath | Δ vs. CPSAM [95% CI] |
|---|---|---|---|---|---|---|---|---|---|---|
| PanNuke fold 1 [16] | H&E, 19 tissues; masks | no ids | 63,218 | PQ | .593 | .627 | .589 | .577 | .417 | -.033 [-.036, -.030] |
| NuCLS [17] | H&E, breast; polygons | 122 | 19,175 | PQ | .546 | .540 | .524 | .527 | .413 | +.006 [.000, .011] |
| MoNuSeg test [18] | H&E, 7 organs; masks | 14 | 6,697 | PQ | .629 | .656 | .657 | .665 | .503 | -.027 [-.039, -.010] |
| BC-DeepLIIF [19] | Ki-67, breast; tumour masks | unknown (10-15 inferred) | 6,240 | PQ | .609 | .688 | .637 | .496 | .344 (.405) | -.079 [-.089, -.064] |
| EndoNuke [20] | ER/PR, endometrium; points | 12 | 210,419 | F1 | .882 | .896 | .857 | .684 | .803 | -.014 [-.019, -.005] |
| IGNITE, 4 readers [14] | PD-L1, lung; points | 10 | 9,676 | F1 | .826 | .851 | n.m. | n.m. | .657 | -.025 [-.062, -.005] |
| Ki67-IH12 (in-house) | Ki-67, breast; outlined nuclei | 12 | 212 | Recall | .925 | .920 | .901 | .703 | .882 (.896) | +.005 [-.020, +.040] |
Table 2. Human ground truth across stains, with patient counts where known. Pooled binary PQ [21] (IoU>0.5) for masks, detection F1 or recall ( 4 m, 1:1) for points; no tuning on these sets. SWIFT: GPU fp16 (int8 within 0.004). QuPath in parentheses: OD-sum mode (threshold 0.1, fixed on development data). BC-DeepLIIF: 41 fields; predictions 50% outside all masks dropped. EndoNuke: 1,472 of 1,740 tiles by non-pathologists. IGNITE: 32 test ROIs, reader mean (inter-reader F1 0.867). Ki67-IH12: recall of 212 pathologist-outlined nuclei (centroids). InstanSeg: Table 1 settings (CPU on PanNuke and NuCLS; released pipeline within 0.007 except NuCLS, .475). CIs: paired bootstrap over patients, PanNuke patches or BC-DeepLIIF inferred cases. n.m.: not measured.
| Decoder | F1 vs. CPSAMH&E/Ki-67/CD3 | PQPanNuke/NuCLS | Flips (%)H&E/Ki-67/CD3 |
|---|---|---|---|
| Offsets, output | .886/.879/.728 | .593/.546 | 6.0/25.5/7.2 |
| Offsets, 0.5 μm | .886/.876/.727 | .587/.544 | 20.2/34.8/21.5 |
| Heatmap WS, output | .882/.864/.726 | .590/.544 | 8.0/36.3/8.4 |
| Nearest seed | .872/.842/.719 | .571/.535 | 18.5/53.3/17.8 |
Table 3. Decoder ablation: final model, GPU, same seeds and foreground (bold: SWIFT). Output / 0.5 m: labels assigned on the native / working grid. WS: watershed. Flips: matched cells whose circularity-filter decision ( 0.7, shapes on one 0.30 m/px grid) differs from CPSAM's.
0.25 m/px) MoNuSeg train, so CPSAM's PanNuke cell is not an unseen-data score and both MoNuSeg test cells are in-domain; no compared model lists any other set of Table 2. On NuCLS the student's F1 is 0.018 below CPSAM's [-0.024, -0.012]. StarDist has a higher NuCLS F1 than the student (-0.027 [-0.040, -0.015]). On PD-L1 the student is lower than CPSAM for 8 of 10 patients and for each reader. On MoNuSeg test (none of its 14 patients in SWIFT's training) InstanSeg and StarDist score 0.028 [0.018, 0.036] and 0.036 [0.026, 0.043] PQ above the student, with higher precision (0.87, 0.89 vs. 0.77) and lower recall (0.84 vs. 0.90).
Untouched Ki-67 (Ki67-IH12). Two 56×56 μm fields per patient were fixed before any model ran on Ki-67 slides of 12 breast carcinoma patients (distinct in the laboratory system; not in training, tuning or calibration) at the scanner's 0.44 μm/px. A pathologist blind to model output outlined 212 nuclei in them. Only these nuclei were compared: we report their recall, matching outline centroids one-to-one within 4 μm. SWIFT recalls 0.925 [0.877, 0.967] (CPSAM 0.920, InstanSeg 0.901, default QuPath 0.882, StarDist 0.703; paired difference CIs versus CPSAM and InstanSeg include 0) from 450 objects (CPSAM 420, QuPath 414, InstanSeg 358). It misses 14 of the 100 DAB-positive nuclei (mean DAB optical density above 0.3; CPSAM 13, InstanSeg 14, QuPath 16) and 2 of the 112 negative (CPSAM 4, InstanSeg 7, QuPath 9). Matched outlines are 1.5× the pathologist's area (CPSAM 1.6, InstanSeg 1.4, QuPath 1.1), so 110 of its 196 detected nu- clei match at IoU>0.5 (CPSAM 108, InstanSeg 132, QuPath 120).
Independent IHC. BC-DeepLIIF [19] masks (annotator not stated) cover mainly tumour nuclei (BCData's consensus points mark tumour cells only); one instance per drawn interior, boundary at the outline centre; 0.35 m/px was estimated from nucleus size before any model ran. CIs resample 15 inferred source cases. SWIFT's PQ is 0.205 [0.155, 0.280] above QuPath OD-sum, with Ki-67 recall 0.88/0.83 (CPSAM 0.91/0.84, OD-sum 0.80/0.40). Against InstanSeg its PQ is 0.027 lower ([−0.057, +0.012]) and its F1 0.054 higher ([0.018, 0.099]): InstanSeg's tighter outlines fit the outline-centre boundary (SQ 0.78 vs. 0.70), but it misses more Ki-67 nuclei (recall 0.65); scored to the outline's outer edge, SWIFT, InstanSeg and CPSAM reach PQ 0.698, 0.565 and 0.706. Splits per 100 nuclei were 3.1/1.3/0.7/5.2 for SWIFT/CPSAM/InstanSeg/QuPath; merge rates were 4.0/4.0/2.4% for the first three. One method-blinded pathologist judged 58% [49, 67] of SWIFT CPU int8's and 40% [34, 45] of OD-sum's sampled excluded objects real nuclei (144 per method; 12 images, one per inferred case). Mean image-level boundary ratings were 4.5 vs. 2.4 of 5 (paired difference +2.1 [+1.7, +2.5]; 95% CIs bootstrapped over images). On EndoNuke ER/PR points InstanSeg's precision is higher than the student's (0.93 vs. 0.87) and its recall lower (0.79 vs. 0.89); on 40 tiles against 3 pathologists the student reaches 0.902 (CPSAM 0.921), and the pathologists agree at 0.914. On SiNuS [22] HER2 dual-ISH (21 patients; singular nuclei only; precision not measurable) SWIFT recalls 86% of 1,292 consensus masks (int8 82%), against CPSAM 99.8%, InstanSeg 37%, StarDist 25% and QuPath 15%, but on pale nuclei it can outline the ISH signal clusters, splitting 14–16% of nuclei.
4. ZERO-SHOT HEMATOLOGY
With no hematology training or tuning, we ran the student with its tissue settings as an exploratory test on automatically chosen fields of held-out peripheral smears and bone-marrow aspirate (BMA). On smears it splits 70% of 84 CP-SAM leukocytes into two or more objects (F1 against CP-SAM's leukocyte objects 0.19, 95% CI 0.13–0.27). On 40 BMA counting fields of 2 held-out patients, the student covers 76% of 1,985 compact chromatin blobs found without any segmenter (QuPath 58%, the gain mostly in one patient; CP-SAM 26% at the reference settings, at most 78% in a prespecified sweep and 84% on grayscale input), a proxy that ignores false detections, merges and boundaries. A hematology student trained the same way on CPSAM whole-cell masks (511 tiles, 31 patients) agrees with grayscale-input CPSAM at F1 0.73 on 5 held-out marrow patients (no human reference). The recipe needs no new labels but inherits the teacher's reliability: check the teacher first.
Pathologist rating. One method-blinded pathologist rated 100 fields of m: 60 tissue fields from 2 development patients and 40 hematology fields in 7 clusters, each shown with SWIFT, reference-settings CPSAM and QuPath outlines. Acceptability for retrieval or counting was 96% for SWIFT (field-level Wilson 95% CI [90, 98]), 83% for CPSAM and 53% for QuPath; tissue rates were 100, 100 and 72%, hematology rates 90, 58 and 25%. SWIFT minus CPSAM was +13 points (field-level 95% CI [+6, +21]; 9-cluster sensitivity CI [+1, +41]). Both intervals clear the prespecified -10-point margin, but few-cluster intervals may under-cover, and non-inferiority on a tissue population is not established. Mean quality (1–5) was 4.17, 3.95 and 2.78; the clustered SWIFT minus CPSAM CI was [-0.03, +0.76]. On 10 hidden repeats, excluded from efficacy, acceptability agreed 9 times and quality weighted was 0.61. These results describe one reader's judgements on these fields.
5. LIMITATIONS AND CONCLUSION
The student depends on its teacher's masks: agreement with CPSAM does not establish accuracy where CPSAM is unreliable, as in a dense CD3 aggregate or, at the reference settings, marrow precursors. Its teacher PQ deficits are 0.033 on PanNuke, 0.027 on MoNuSeg and 0.079/0.008 on BC-DeepLIIF at the outline centre/outer edge (Table 2; on MoNuSeg InstanSeg and StarDist also score higher), and it changes CP-SAM's circularity-filter decision for 6–26% of matched cells (Table 3). The timed regions lie on development slides. BC-DeepLIIF patients are inferred, its boundary convention is not stated and changes the InstanSeg ranking, and CD3 has no human-mask evidence. Times come from 4 EPYC cores and an RTX 4500 Ada, not a T4, and downstream retrieval performance is not measured.
Distilling a research generalist on its own masks can bridge the gap to real-world deployment under time and hardware limits: the 0.63M-parameter student runs faster than QuPath's watershed detector on the same CPU and stays close to the teacher in accuracy, with measured losses. Compliance with ethical standards. Institutional slides were de-identified and used retrospectively under an ethics waiver; all other data are public datasets used under their licences. Conflict of interest. The authors build solutions in the digital pathology space.
6. REFERENCES
[1] M. Pachitariu et al., “Cellpose-SAM: superhuman generalization for cellular segmentation,” bioRxiv 2025.04.28.651001, 2025.
[2] P. Bankhead et al., “QuPath: Open source software for digital pathology image analysis,” Sci. Rep., vol. 7, 2017, Art. no. 16878.
[3] U. Schmidt et al., “Cell detection with star-convex polygons,” in MIC-CAI, 2018.
[4] T. Goldsborough et al., “InstanSeg: an embedding-based instance segmentation algorithm optimized for accurate, efficient and portable cell segmentation,” arXiv:2408.15954, 2024.
[5] G. Hinton et al., “Distilling the knowledge in a neural network,” arXiv:1503.02531, 2015.
[6] P. Liakopoulos et al., “HoverFast: an accurate, high-throughput, clinically deployable nuclear segmentation tool for brightfield digital pathology images,” J. Open Source Softw., vol. 9, 2024, Art. no. 7022.
[7] C. Tommasino et al., “HoVer-UNet: Accelerating HoVerNet with UNet-based multi-class nuclei segmentation via knowledge distillation,” in ISBI, 2024.
[8] S. Graham et al., “HoVer-Net: Simultaneous segmentation and classification of nuclei in multi-tissue histology images,” Med. Image Anal., vol. 58, 2019, Art. no. 101563.
[9] N. Shvetsov et al., “A lightweight and extensible cell segmentation and classification model for H&E-stained cancer whole slide images,” Comput. Biol. Med., vol. 199, 2025, Art. no. 111326.
[10] Y. Zhou et al., “EfficientBioAI: making bioimaging AI models efficient in energy and latency,” Nat. Methods, vol. 21, no. 3, pp. 368–369, 2024.
[11] B. Cheng et al., “Panoptic-DeepLab: A simple, strong, and fast baseline for bottom-up panoptic segmentation,” in CVPR, 2020.
[12] J. N. Weinstein et al., “The Cancer Genome Atlas pan-cancer analysis project,” Nat. Genet., vol. 45, no. 10, pp. 1113–1120, 2013.
[13] P. Weitz et al., “The ACROBAT 2022 challenge: Automatic registration of breast cancer tissue,” Med. Image Anal., vol. 97, 2024, Art. no. 103257.
[14] J. Spronck et al., “A tissue and cell-level annotated H&E and PD-L1 histopathology image dataset in non-small cell lung cancer,” IEEE JBHI, 2026.
[15] O. Ronneberger et al., “U-Net: Convolutional networks for biomedical image segmentation,” in MICCAI, 2015.
[16] J. Gamper et al., “PanNuke: An open pan-cancer histology dataset for nuclei instance segmentation and classification,” in ECDP, 2019.
[17] M. Amgad et al., “NuCLS: A scalable crowdsourcing approach and dataset for nucleus classification and segmentation in breast cancer,” GigaScience, vol. 11, 2022.
[18] N. Kumar et al., “A dataset and a technique for generalized nuclear segmentation for computational pathology,” IEEE Trans. Med. Imaging, vol. 36, no. 7, pp. 1550–1560, 2017.
[19] P. Ghahremani et al., “Deep learning-inferred multiplex immunofluorescence for immunohistochemical image quantification,” Nat. Mach. Intell., vol. 4, pp. 401–412, 2022.
[20] A. Naumov et al., “EndoNuke: Nuclei detection dataset for estrogen and progesterone stained IHC endometrium scans,” Data, vol. 7, 2022, Art. no. 75.
[21] A. Kirillov et al., “Panoptic segmentation,” in CVPR, 2019.
[22] M. S. Hossain, M. S. Rahman, and M. Ahmed, “SiNuS: A comprehensive dataset for singular nuclei segmentation for HER2 grading of breast cancer,” Data in Brief, vol. 67, 2026, Art. no. 112934.