CAFlow: Adaptive-Depth Single-Step Flow Matching for Efficient Histopathology Super-Resolution
Organizations: School of Biomedical Engineering, Tel Aviv University, Tel Aviv, Israel
Abstract
In digital pathology, whole-slide images routinely exceed gigapixel resolution, making computationally intensive generative super-resolution (SR) impractical for routine deployment. We introduce CAFlow, an adaptive-depth single-step flow-matching framework that routes each image tile to the shallowest network exit that preserves reconstruction quality. CAFlow performs flow matching in pixel-unshuffled rearranged space, reducing spatial computation by 16x while enabling direct inference. We show that dedicating half of training to exact t=0 samples is essential for single-step quality (-1.5 dB without it). The backbone, FlowResNet (1.90M parameters), mixes convolution and window self-attention blocks across four early exits spanning 3.1 to 13.3 GFLOPs. A lightweight exit classifier (~6K parameters) achieves 33% compute savings at only 0.12 dB cost. On multi-organ histopathology x4 SR, adaptive routing achieves 31.72 dB PSNR versus 31.84 dB at full depth, while the shallowest exit exceeds bicubic by +1.9 dB at 2.8x less compute than SwinIR-light. The method generalizes to held-out colon tissue with minimal quality loss (-0.02 dB), and at x8 upscaling it outperforms all comparable-compute baselines while remaining competitive with the much larger SwinIR-Medium model. Downstream nuclei segmentation confirms preservation of clinically relevant structure. The model trains in under 5 hours on a single GPU, and adaptive routing can reduce whole-slide inference from minutes to seconds.
Figures & tables
| Method | Params | GFLOPs | PSNR | SSIM | LPIPS |
|---|---|---|---|---|---|
| Bicubic | — | — | 29.24 | 0.8096 | 0.2495 |
| EDSR | 1.52M | 16.25 | 31.44 | 0.8316 | 0.2003 |
| SwinIR-light | 0.93M | 8.72 | 31.76 | 0.8494 | 0.1953 |
| SwinIR-Medium | 11.90M | 107.11 | 31.84 | 0.8790 | 0.1958 |
| SRFormer-light | 0.87M | 8.25 | 31.55 | 0.8718 | 0.1955 |
| SR3 | 2.94M | 4376 | 31.39 | 0.8672 | 0.1917 |
| Method | Params | GFLOPs | ms | img/s | VRAM |
|---|---|---|---|---|---|
| Bicubic | — | — | 0.9 | 1,125 | 2 |
| EDSR | 1.52M | 16.25 | 20.8 | 48 | 30 |
| SwinIR-light | 0.93M | 8.72 | 60.1 | 17 | 99 |
| SwinIR-Medium | 11.90M | 107.11 | 84.1 | 12 | 129 |
| SRFormer-light | 0.87M | 8.25 | 44.9 | 22 | 106 |
| SR3 | 2.94M | 4,376 | 1,082.1 | 1 | 145 |
| Exit | Blocks | Hybrid | GFLOPs | PSNR | SSIM | LPIPS |
|---|---|---|---|---|---|---|
| E0 | 0–3 | 0 | 3.10 | 31.17 | 0.8625 | 0.2003 |
| E1 | 0–7 | 1 | 6.07 | 31.60 | 0.8717 | 0.1969 |
| E2 | 0–11 | 3 | 9.39 | 31.72 | 0.8740 | 0.1971 |
| E3 | 0–15 | 6 | 13.34 | 31.84 | 0.8797 | 0.1961 |
| Adaptive | — | — | 8.92 | 31.72 | 0.8737 | 0.1967 |
| Variant | PSNR | SSIM | LPIPS | PSNR |
|---|---|---|---|---|
| Full CAFlow | 31.72 | 0.8737 | 0.1967 | – |
| w/o early exit | 31.65 | 0.8742 | 0.1959 | |
| w/o consistency | 31.55 | 0.8717 | 0.1975 | |
| w/o mixing | 30.17 | 0.8414 | 0.2175 | |
| w/o SSIM loss | 31.41 | 0.8680 | 0.1978 | |
| Fewer blocks (8) | 31.41 | 0.8677 | 0.1968 |
| Breast | Kidney | Lung | |||||||
| Method | PSNR | SSIM | LPIPS | PSNR | SSIM | LPIPS | PSNR | SSIM | LPIPS |
| Bicubic | 30.64 4.41 | 0.8331 0.0928 | 0.2293 0.0523 | 27.35 5.76 | 0.7777 0.0957 | 0.2765 0.0686 | 27.80 3.92 | 0.7932 0.0867 | 0.2639 0.0527 |
| EDSR | 32.97 4.42 | 0.8834 0.0727 | 0.1837 0.0506 | 29.57 5.30 | 0.8499 0.0734 | 0.2204 0.0642 | 30.13 4.06 | 0.8574 0.0659 | 0.2138 0.0525 |
| SwinIR-light | 33.23 4.40 | 0.8883 0.0701 | 0.1808 0.0496 | 30.05 5.37 | 0.8611 0.0675 | 0.2148 0.0586 | 30.46 3.97 | 0.8650 0.0627 | 0.2099 0.0511 |
| SwinIR-Medium | 33.39 4.40 | 0.8913 0.0687 | 0.1789 0.0497 | 30.27 5.33 | 0.8665 0.0647 | 0.2165 0.0579 | 30.66 4.04 | 0.8691 0.0611 | 0.2099 0.0513 |
| SRFormer-light | 33.04 4.36 | 0.8852 0.0714 | 0.1812 0.0494 | 29.84 5.39 | 0.8559 0.0706 | 0.2125 0.0605 | 30.26 3.92 | 0.8611 0.0639 | 0.2088 0.0510 |
| Method | Precision | Recall | Detection F1 | Count | Mean IoU |
|---|---|---|---|---|---|
| Bicubic | 0.863 0.152 | 0.886 0.132 | 0.869 0.132 | 0.9799 | 0.847 0.080 |
| EDSR | 0.898 0.127 | 0.926 0.095 | 0.905 0.109 | 0.9878 | 0.879 0.065 |
| SwinIR-light | 0.906 0.122 | 0.928 0.099 | 0.911 0.108 | 0.9886 | 0.883 0.064 |
| SwinIR-Medium | 0.895 0.126 | 0.936 0.102 | 0.909 0.111 | 0.9868 | 0.884 0.068 |
| SRFormer-light | 0.913 0.111 | 0.916 0.111 | 0.910 0.101 | 0.9895 | 0.885 0.042 |
| SR3 | 0.901 0.122 | 0.924 0.100 | 0.906 0.106 | 0.9866 | 0.880 0.065 |
| Method | PSNR | SSIM | LPIPS |
|---|---|---|---|
| Bicubic | 29.58 4.72 | 0.8104 0.0815 | 0.2469 0.0595 |
| EDSR | 31.49 4.44 | 0.8620 0.0630 | 0.2030 0.0579 |
| SwinIR-light | 31.75 4.34 | 0.8678 0.0610 | 0.1994 0.0564 |
| SwinIR-Medium | 31.90 4.40 | 0.8709 0.0602 | 0.1991 0.0574 |
| SRFormer-light | 31.60 4.30 | 0.8650 0.0617 | 0.1987 0.0557 |
| SR3 | 31.42 4.54 | 0.8592 0.0655 | 0.1931 0.0536 |
| Method | PSNR | SSIM | LPIPS |
|---|---|---|---|
| Bicubic | 24.13 4.58 | 0.6149 0.1538 | 0.4303 0.0733 |
| EDSR | 25.43 4.45 | 0.6684 0.1410 | 0.3800 0.0697 |
| SwinIR-light | 25.30 4.46 | 0.6616 0.1399 | 0.3785 0.0680 |
| SwinIR-Medium | 26.52 4.61 | 0.7105 0.1316 | 0.3555 0.0711 |
| SRFormer-light | 25.23 4.44 | 0.6584 0.1406 | 0.3820 0.0678 |
| SR3 | 25.57 4.61 | 0.6728 0.1430 | 0.3504 0.0659 |
Medical Image Super-Resolution
Medical image super-resolution reconstructs fine spatial detail from low-resolution scans to support clearer anatomy and more useful clinical measurements.
See all 57 papers