UCLA's PhyCV Jumps Medical AI Accuracy from 70% to 90% Across Hospitals
A UCLA team uses optical physics as a deterministic preprocessor to fix stain and lighting drift, lifting Camelyon17 OOD accuracy from 70.8% to 90.9%.
ProTakeaways
- UCLA's Jalali Lab proposes PhyCV preprocessing to reduce domain shift in medical imaging.
- The transform simulates light propagation and reads out phase, removing color and lighting variation.
- Out-of-distribution accuracy on Camelyon17-WILDS jumps from 70.8% (ERM) to 90.9%.
- Matches or beats data augmentation and domain generalization methods at negligible compute cost.
- Deterministic, differentiable, and interpretable, so it fits fixed or end-to-end pipelines.
- Open-source at github.com/JalaliLabUCLA/phycv, PyTorch-based with CUDA acceleration.
Medical image models tend to look brilliant on the hospital they were trained in and mediocre everywhere else. A new paper from UCLA's Jalali Lab argues the fix does not have to be a bigger model or a heavier augmentation stack. Instead, they run every image through a deterministic optical-physics transform before the network ever sees it, and report that this preprocessing pass alone closes most of the cross-hospital accuracy gap on a standard pathology benchmark.
The framework is built on PhyCV, an open-source library the same lab has been developing for a few years. PhyCV is a Physics-inspired Computer Vision Python library with a class of computer vision algorithms that emulates the propagation of light through a physical medium with natural and engineered diffractive properties followed by coherent detection. In plain terms: treat the image as a light field, mathematically propagate it through a simulated dispersive medium, and read out the phase rather than the raw intensity.
Why hospital-to-hospital drift breaks models
The benchmark used in the paper is Camelyon17, which poses several challenges for domain generalization due to the heterogeneous nature of histopathology data, with domain shifts manifesting as color variation from different staining procedures, structural differences in tissue morphology, and differences in scanner resolution and lighting conditions. The dataset comprises 455,954 patches extracted from 50 whole-slide images of breast cancer metastases in lymph node sections, with 10 slides from each of 5 hospitals.
The standard protocol trains on some hospitals and tests on unseen ones, so any color or illumination cue that correlates with hospital of origin becomes a shortcut the model happily latches onto. That is exactly what PhyCV is designed to strip out.

How the physics preprocessor works
PhyCV models the input as a spatially varying complex field, applies a frequency-dependent phase kernel in the Fourier domain, then extracts the phase of the output. Concretely, the operation looks like this:
E_out = IFFT2( FFT2(E_in) * K(k) * L(k) )
feature = angle(E_out) # coherent phase detection
The Phase Stretch Transform smooths the image with a localization kernel, then passes it through a nonlinear frequency-dependent phase operation, applying a 2D phase function in the frequency domain where higher-frequency features receive more phase. The result is a grayscale phase map that emphasizes edges and textures while discarding the absolute color and brightness that vary between labs. The library also ships PAGE for directional gradients and VEViD for exposure correction, and the paper uses all three as complementary refiners.
Because the whole pipeline is a couple of FFTs and pointwise multiplications, it is differentiable and cheap. PhyCV features low-dimensionality and high-efficiency, making it ideal for edge computing applications, with real-time video processing demonstrated on an NVIDIA Jetson Nano.
The numbers
On Camelyon17-WILDS, PhyCV preprocessing improves out-of-distribution breast-cancer classification accuracy from 70.8% (Empirical Risk Minimization baseline) to 90.9%, matching or exceeding data-augmentation and domain-generalization approaches. For context, that 70.8% ERM baseline is the well-known weak spot of the benchmark, and specialized domain-generalization methods have historically been the ones clawing accuracy back up. Getting there with a fixed, model-agnostic preprocessor is the surprising part.

Where it fits, and where it does not
The authors frame PhyCV as a general "data refinery" that could sit in front of most medical imaging pipelines. Reasonable places to reach for it:
- Multi-site histopathology where stain protocols vary between labs.
- Endoscopy or microscopy pipelines with uncontrolled illumination.
- Federated setups where you cannot centrally normalize but want each client to emit a comparable representation.
- Edge deployments where a learned normalization network would be too expensive.
The trade-offs are real, though. Phase-based outputs are grayscale, so any downstream task that genuinely needs chromatic information (immunohistochemistry channels, dermatology color cues) will lose signal. The transform also has hyperparameters, the phase kernel shape and strength, that were tuned for this benchmark and are not guaranteed to transfer without a sweep. And the reported gains are on one benchmark with one type of shift, dominated by staining color. Modalities where the domain gap is geometric rather than photometric may see smaller wins.
The bigger idea
The real claim underneath the accuracy number is architectural: physics-based preprocessing can significantly narrow the generalization gap between institutions without increasing model complexity or data requirements, which matters for clinical translation where annotated datasets remain limited and imaging systems differ across sites, and the negligible computational overhead supports integration into large-scale or real-time clinical pipelines. In other words, a chunk of what looks like a modeling problem is actually a data-normalization problem, and a closed-form optical transform can handle it.
The PhyCV library is on GitHub, installable via pip, PyTorch-based with CUDA support, and the full paper is available on arXiv. Dropping it in front of an existing classifier is a few lines of code, which makes it easy to test on your own domain-shifted dataset before committing to anything heavier.