SparseFocus: Learning-based One-shot Autofocus for Microscopy with Sparse Content
Yongping Zhai, Xiaoxi Fu, Qiang Su, Jia Hu, Yake Zhang, Yunfeng Zhou, Chaofan Zhang, Xiao Li, Wenxin Wang, Dongdong Wu, Shen Yan
TL;DR
SparseFocus tackles the problem of one-shot autofocus failing on sparse content by introducing a two-stage network: Region Importance Network identifies informative image patches and Defocus Prediction Network estimates the defocus distance $d$ from those patches. A large-scale dataset with millions of labeled defocused images under dense, sparse, and extremely sparse conditions supports training and evaluation, with a median-pooling step to obtain the final defocus estimate. The approach yields lower MAE, higher DoF-Accuracy, and DSS above $99\%$ across scenarios, and is integrated into a Whole Slide Imaging system, demonstrating practical impact for high-throughput microscopy. This work advances autofocus robustness in real-world microscopy by leveraging content-aware patch selection and regional defocus estimation, enabling reliable one-shot focusing in diverse content regimes.$
Abstract
Autofocus is necessary for high-throughput and real-time scanning in microscopic imaging. Traditional methods rely on complex hardware or iterative hill-climbing algorithms. Recent learning-based approaches have demonstrated remarkable efficacy in a one-shot setting, avoiding hardware modifications or iterative mechanical lens adjustments. However, in this paper, we highlight a significant challenge that the richness of image content can significantly affect autofocus performance. When the image content is sparse, previous autofocus methods, whether traditional climbing-hill or learning-based, tend to fail. To tackle this, we propose a content-importance-based solution, named SparseFocus, featuring a novel two-stage pipeline. The first stage measures the importance of regions within the image, while the second stage calculates the defocus distance from selected important regions. To validate our approach and benefit the research community, we collect a large-scale dataset comprising millions of labelled defocused images, encompassing both dense, sparse and extremely sparse scenarios. Experimental results show that SparseFocus surpasses existing methods, effectively handling all levels of content sparsity. Moreover, we integrate SparseFocus into our Whole Slide Imaging (WSI) system that performs well in real-world applications. The code and dataset will be made available upon the publication of this paper.
