ParaVisionNet: A multitask vision transformer framework for accurate detection and classification of parasitic eggs in microscopy images
Muhammad Bilal Zia, Xujuan Zhou, Raj Gururajan, Ka Ching Chan · Computers & Electrical Engineering · 2026
The accurate detection of parasite eggs is a critical challenge in medical and veterinary diagnostics, as parasites can rapidly infect animals, humans, and even plants, causing serious health concerns. Traditional egg identification methods are highly dependent on manual microscopy, which is time consuming, skill intensive, and prone to human error, particularly in the recognition of subtle or overlapping egg features. To address these limitations, we introduce ParaVisionNet, a multitask deep learning framework that integrates Vision Transformers (ViT), Feature Pyramid Networks (FPN), and Mask Region-based Convolutional Neural Network (Mask R-CNN). This architecture is designed to detect, segment, and classify parasite eggs simultaneously in microscopic images. ViT serves as the backbone, extracting rich, high-dimensional feature maps. These are then organized into a multi-scale representation using FPN, enhancing feature clarity across different resolutions. The Region Proposal Network (RPN) proposes candidate egg regions, which are then refined by Mask Region-based Convolutional Neural Network (Mask R-CNN) with Region of Interest (ROI) align to produce precise masks and class predictions. Unlike previous ViT FPN or Swin Mask R-CNN hybrids that optimize prediction tasks independently or in sequential stages, ParaVisionNet does unified multitask inference in one pass by sharing RoI aligned features for detection, instance segmentation, and parasite type classification. Furthermore, Monte Carlo Dropout has also been incorporated within both the transformer encoder and FPN branches so that the uncertainty can be propagated throughout the prediction heads and result in the production of spatial entropy maps that indicate where uncertainty is concentrated. To the best of our knowledge, this is the first parasite microscopy framework capable of producing bounding boxes, instance masks, species classification, and uncertainty estimates from a single end-to-end training process. The model was extensively trained for over 50 epochs and tested on three datasets: the Sheep Egg dataset, Chula-Parasite Egg-11, and a custom Human Hookworm Egg dataset. It achieved remarkable results with 98.87% detection accuracy, 97.99% classification accuracy, and 98.98% multitasking accuracy, outperforming current state-of-the-art approaches. In practice, a single multitask pass reduces workflow steps and compute compared to running separate models, and the uncertainty maps help technicians triage ambiguous cases for review. These results show that ParaVisionNet is not only accurate, but is also a practical diagnostic tool in resource-limited settings.