Abstract
Mosquitoes are important vectors of infectious diseases, and accurate species identification is essential for effective surveillance and control. Traditional image-based identification methods are labor-intensive, while existing deep learning models often exhibit limited generalization in real-world environments due to sensitivity to out-of-distribution (OOD) samples. To address these challenges, this study constructs a real-world mosquito dataset by integrating multiple publicly available sources, comprising 11,514 original images across 33 predefined species. To mitigate class imbalance, data augmentation is applied to the training set, resulting in a total of 17,302 images for training and evaluation. In addition, two OOD datasets are constructed, including a non-target mosquito dataset and a non-Culicidae insect dataset. Based on a comprehensive comparison of mainstream object detection models, RT-DETRv2 with a PResNet-101 backbone is selected as the baseline detector. Building upon this model, a two-stage OOD-aware approach, termed MosquitoID, is proposed by integrating Mahalanobis distance and Energy-based scoring. The first stage performs image-level OOD filtering using Mahalanobis distance, while the second stage conducts instance-level OOD discrimination based on Energy scores. Under a fixed threshold setting determined from the ID validation set to retain 95% of ID samples, experimental results show that the proposed method achieves a Precision of 92.0%, Recall of 93.8%, mAP\(_{50}\) of 90.4%, and mAP\(_{50:95}\) of 84.1% on the ID dataset. For OOD detection, MosquitoID attains AUROC values of 0.914 and 0.935 on the two OOD datasets, with corresponding FPR@95TPR values of 0.205 and 0.156, and \(F_1\)-scores of 83.7% and 90.8%. These results indicate that the proposed approach improves robustness to unknown samples and provides a practical method for mosquito detection in real-world surveillance scenarios.
Similar content being viewed by others
Funding
This work was supported by the National Natural Science Foundation of China (Grant No. 32572927) and Zhejiang Provincial Xinmiao Talent Program (Grant No. 2025R406A054).
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Competing interests
The authors declare that they have no competing interests.
Additional information
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
About this article
Cite this article
Ni, Z., Feng, Z., Jiao, J. et al. A two-stage OOD-aware approach for mosquito species detection based on RT-DETRv2. Sci Rep (2026). https://doi.org/10.1038/s41598-026-52890-0
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41598-026-52890-0


