Japanese mayfly family classification with a vision transformer model

This is a Preprint and has not been peer reviewed. This is version 2 of this Preprint.

Add a Comment

You must log in to post a comment.


There are no comments or no comments have been made public for this article.


Download Preprint


Yuichi Iwasaki, Hiroko Arai, Akihiro Tamada, Hirokatsu Kataoka


Benthic macroinvertebrates are a frequently used indicator group for biomonitoring and biological assessment of river ecosystems. However, their taxonomic identification is laborious and requires special expertise. In this study, we aimed to assess the capability of a vision transformer (ViT) model for family-level identification of mayflies (order Ephemeroptera). Specifically, we focused on evaluating the model’s capacity to classify three commonly found mayfly families (Baetidae, Ephemerellidae, and Heptageniidae) as well as other families that were grouped together. For the modeling, we originally constructed two different image datasets containing a total of 1,110 images of mayflies, which were split into training and validation datasets, and a test dataset was prepared from two different online photo galleries. The developed ViT model achieved reasonable accuracy, reaching 94.2% and 82.9% for the validation and test datasets, respectively. Given the use of a relatively small number of images in the training process, as well as some variations in the visual styles of the test dataset compared to the training dataset, we consider the level of accuracy to be high. Our results are encouraging toward the use of computer vision for taxonomic identification of macroinvertebrates, although there is still a need to develop specific designs and plans for this purpose, which can vary depending on regional differences in biodiversity as well as sampling and survey methods.




Aquaculture and Fisheries Life Sciences, Artificial Intelligence and Robotics, Biodiversity, Civil and Environmental Engineering, Computer Sciences, Databases and Information Systems, Engineering, Environmental Health and Protection, Environmental Indicators and Impact Assessment, Environmental Monitoring, Environmental Sciences, Terrestrial and Aquatic Ecology


Macroinvertebrate, Aquatic Insect, machine learning, Pattern recognition, computer vision


Published: 2024-02-10 17:34

Last Updated: 2024-02-14 16:18

Older Versions

CC BY Attribution 4.0 International

Additional Metadata


Data and Code Availability Statement:
All the original image data used for developing the vision transformer model (i.e., training and validation datasets) are available on the GitHub website (https://github.com/yuichiwsk/images_mayfly_families).