Towards Democratising Low-Data Medical Image Classification: CPU-Trainable ZACH-ViT and Its Geometric Variants
Organizations: BioML Lab, Research Institute CODE, UniBw, Munich, Germany · Amsterdam UMC, University of Amsterdam, Amsterdam, Netherlands
Abstract
Medical image classification in resource-constrained settings must contend with limited annotations and computational capacity. We evaluate four ZACH-ViT variants with linear, Euclidean prototype, Poincare and spherical heads alongside two compact multiple-instance-learning baselines. All models are trained from scratch with fewer than 260,000 parameters across seven MedMNIST+ datasets and three external benchmarks (PCam, ISIC2017 and Shenzhen tuberculosis radiographs). The low-data protocol uses 50 training images per class and five seeds, with validation-selected checkpoints at 23 and 47 epochs; a full-data reference uses one seed. Compact-TransMIL achieves the highest ten-dataset mean test Macro-F1 at 23 epochs (53.34%) and with full data (73.93%). At 47 epochs, ZACH-Linear narrowly leads (57.76% versus 57.54% for Compact-TransMIL). Extending training improves Macro-F1 in 239 of 300 paired comparisons. On ISIC2017, hZACH-Spherical has the highest 47-epoch low-data Macro-F1 (44.09% with SD 4.09%), whereas ZACH-EuclideanProto leads with full data (51.27%). We additionally conduct 40 CPU-only training runs on ISIC2017 and Shenzhen using four CPU threads; model-only single-image inference requires approximately 4-9 ms, while image decoding and preprocessing substantially increase end-to-end latency. The results demonstrate the feasibility of CPU-only training on the tested platform and the task- and regime-dependence of compact medical imaging under strict resource constraints.
Figures & tables
| Dataset | Classes | Train | Val. | Test | 50/class |
| BloodMNIST | 8 | 11,959 | 1,712 | 3,421 | 400 |
| PathMNIST | 9 | 89,996 | 10,004 | 7,180 | 450 |
| BreastMNIST | 2 | 546 | 78 | 156 | 100 |
| PneumoniaMNIST | 2 | 4,708 | 524 | 624 | 100 |
| DermaMNIST | 7 | 7,007 | 1,003 | 2,005 | 350 |
| OCTMNIST | 4 | 97,477 | 10,832 | 1,000 | 200 |
| Model | Minimum | Maximum |
| ZACH-Linear | 248,257 | 248,907 |
| ZACH-EuclideanProto | 248,386 | 249,612 |
| hZACH-Poincare | 248,386 | 249,612 |
| hZACH-Spherical | 248,386 | 249,612 |
| Compact-TransMIL | 258,306 | 259,467 |
| Patch-ABMIL | 92,290 | 93,451 |
| Model | 50/class, 23 | 50/class, 47 | Full, 47 |
| ZACH-Linear | 52.21 (2.80) | 57.76 (2.50) | 70.53 (4.00) |
| ZACH-EuclideanProto | 52.09 (2.90) | 57.21 (3.00) | 72.88 (3.10) |
| hZACH-Poincare | 46.95 (5.00) | 53.57 (4.50) | 69.95 (4.05) |
| hZACH-Spherical | 50.25 (4.00) | 56.64 (3.50) | 72.39 (3.35) |
| Compact-TransMIL | 53.34 (2.20) | 57.54 (2.90) | 73.93 (1.80) |
| Patch-ABMIL | 43.84 (4.10) | 48.44 (4.60) | 64.03 (4.70) |
| Dataset | Regime and observed winner | Score |
| PCam | 50/class 23: Patch-ABMIL | 69.96 |
| 50/class 47: ZACH-Linear | 71.14 | |
| Full 47: Patch-ABMIL | 81.68 | |
| ISIC2017 | 50/class 23: Compact-TransMIL | 34.34 |
| 50/class 47: hZACH-Spherical | 44.09 | |
| Full 47: ZACH-EuclideanProto | 51.27 |
| ISIC2017 | Shenzhen | |||
| Model | 23 epochs | 47 epochs | 23 epochs | 47 epochs |
| ZACH-Linear | 35.59 3.20 | 41.09 2.79 | 73.74 4.15 | 77.01 2.24 |
| ZACH-EuclideanProto | 32.84 8.19 | 42.04 3.82 | 74.20 6.03 | 79.15 2.66 |
| hZACH-Poincare | 32.57 3.36 | 36.88 7.00 | 74.16 4.53 | 78.63 6.27 |
| hZACH-Spherical | 36.08 5.75 | 41.66 4.42 | 73.94 6.35 | 77.49 6.17 |
| ISIC2017 | Shenzhen | |||
| Model | Model | End-to-end | Model | End-to-end |
| ZACH-Linear | 8.87 | 179.36 | 4.36 | 188.52 |
| ZACH-EuclideanProto | 4.68 | 165.02 | 5.09 | 220.22 |
| hZACH-Poincare | 5.40 | 177.46 | 5.67 | 196.11 |
| hZACH-Spherical | 4.89 | 170.87 | 4.78 | 215.10 |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | ZACH-Linear | ZACH-EuclideanProto | hZACH-Poincare | hZACH-Spherical | Compact-TransMIL | Patch-ABMIL |
| BloodMNIST | 67.95 3.94 | 66.78 2.03 | 53.94 9.13 | 64.46 3.67 | 65.94 3.91 | 31.55 4.94 |
| PathMNIST | 49.42 7.99 | 48.69 5.35 | 34.13 9.57 | 45.28 4.48 | 54.82 2.26 | 29.04 5.20 |
| BreastMNIST | 56.49 1.92 | 57.52 3.53 | 55.97 1.87 | 53.36 3.02 | 57.10 1.51 | 58.79 11.65 |
| PneumoniaMNIST | 71.91 1.02 | 71.70 1.36 | 70.90 1.80 | 70.48 0.91 | 71.40 1.19 | 75.38 0.69 |
| DermaMNIST | 31.55 0.81 | 29.73 1.92 | 24.51 4.45 | 27.59 3.85 | 31.43 2.34 | 21.20 1.02 |
| OCTMNIST | 23.19 1.44 | 25.38 4.32 | 22.55 4.23 | 23.39 4.37 | 25.15 4.19 | 20.41 4.84 |
| Dataset | ZACH-Linear | ZACH-EuclideanProto | hZACH-Poincare | hZACH-Spherical | Compact-TransMIL | Patch-ABMIL |
| BloodMNIST | 80.38 1.91 | 78.40 3.34 | 67.37 7.90 | 75.38 2.28 | 79.97 2.82 | 39.63 5.21 |
| PathMNIST | 60.70 5.24 | 57.31 3.82 | 46.17 17.94 | 56.20 5.20 | 60.35 3.41 | 41.79 5.24 |
| BreastMNIST | 59.78 2.69 | 60.64 1.88 | 59.47 4.33 | 59.56 2.63 | 58.95 3.28 | 63.88 7.39 |
| PneumoniaMNIST | 73.79 1.16 | 72.02 1.75 | 70.79 1.89 | 70.49 0.91 | 71.17 0.71 | 75.38 0.69 |
| DermaMNIST | 36.87 1.74 | 32.97 1.11 | 32.34 1.80 | 33.70 1.03 | 35.14 0.98 | 26.08 2.03 |
| OCTMNIST | 26.34 4.64 | 28.77 2.08 | 29.49 4.01 | 29.53 5.11 | 27.80 5.32 | 26.69 6.39 |
| Dataset | ZACH-Linear | ZACH-EuclideanProto | hZACH-Poincare | hZACH-Spherical | Compact-TransMIL | Patch-ABMIL |
| BloodMNIST | 95.92 | 96.16 | 95.43 | 95.37 | 96.25 | 83.62 |
| PathMNIST | 83.88 | 85.09 | 83.33 | 85.25 | 86.65 | 76.04 |
| BreastMNIST | 56.75 | 60.80 | 59.99 | 59.76 | 62.53 | 59.76 |
| PneumoniaMNIST | 73.36 | 68.26 | 70.95 | 73.37 | 75.55 | 80.75 |
| DermaMNIST | 47.57 | 50.54 | 48.89 | 41.92 | 51.51 | 15.01 |
| OCTMNIST | 72.23 | 69.25 | 68.14 | 72.69 | 75.02 | 61.88 |
| Model | Inference b=1 | Inference b=16 | Adam step b=16 |
| ZACH-Linear | 8.60 | 123.41 | 427.04 |
| ZACH-EuclideanProto | 4.88 | 98.73 | 403.71 |
| hZACH-Poincare | 9.36 | 139.01 | 369.56 |
| hZACH-Spherical | 5.42 | 86.36 | 406.70 |
| Compact-TransMIL | 5.46 | 72.04 | 330.25 |
| Patch-ABMIL | 0.96 | 37.66 | 38.75 |
| Model | Exact epoch 23 | Exact epoch 47 |
| ZACH-Linear | 49.99 | 56.14 |
| ZACH-EuclideanProto | 51.05 | 55.36 |
| hZACH-Poincare | 42.38 | 51.08 |
| hZACH-Spherical | 48.13 | 54.37 |
| Compact-TransMIL | 51.54 | 57.28 |
| Patch-ABMIL | 39.31 | 44.60 |
Medical Image Classification
Medical image classification uses computational models to identify diseases, grade severity, and support decisions from clinical images.
See all 548 papers