\begin{abstract}
 
Reliable and stable performance is crucial for the application of computer-aided medical image systems in clinical settings. However, approaches based on deep learning often fail to generalize well under distribution shifts. In medical imaging, such distribution shifts can, for example, be introduced by changes in scanner types or imaging protocols. To counter this, test-time generalization aims to optimize a model that has been trained on single or multiple source domains to an unseen target domain. Common test-time adaptation methods fine-tune model weights utilizing losses with gradient-based optimization, a time-consuming and computationally demanding procedure. In contrast, our approach adopts a non-parametric method that is entirely feedforward and utilizes information from target samples to extract neighborhood information with dynamic voting. By doing so, we avoid fine-tuning or optimization procedures, enabling our method to be more efficient and achieve stable adaptation. We demonstrate the effectiveness of our approach by benchmarking it against different state-of-the-art methods with three backbones on two publicly available medical imaging datasets, consisting of fetal ultrasound and retinal images, and achieve classification accuracy improvements by up to 3.4\% and 1.1\%, respectively. {Moreover, we also demonstrate the utility of our method in practical scenarios, proving efficiency in terms of computational runtime and handling of uncertainty.} Our code is publicly available at: \href{https://github.com/compai-lab/2024-miccai-emerge-ambekar}{https://github.com/compai-lab/2024-miccai-emerge-ambekar}


\keywords{domain adaptation, generalization, unsupervised learning, parameter-free optimization}
\end{abstract}





