Abstract
Mosquito identification and classification are the most important steps in a surveillance program of mosquito-borne diseases. With conventional approach of data collection, the process of sorting and classification are laborious and time-consuming. The advancement of computer vision with transfer learning provides excellent alternative to the challenge. Transfer learning is a type of machine learning that is viable and durable in image classification with limited training images. This protocol aims to develop step-by-step procedure in developing a classification system with transfer learning algorithm for mosquito, we demonstrate the protocol to classify two species of Aedes mosquito - Aedes aegypti L. and Aedes albopitus L, but user can adopt the protocol for higher number of species classification. We demonstrated the way of start from the scratch, fine-tuning two pre-trained model performance by using different combination of hyperparameters – batch size and learning rate, and explain the terminology in the Appendix. This protocol target on the domain expert such as entomologist and public health practices to develop their own model to solve the task of mosquito/insect classification.
Keywords: Aedes aegypti, Aedes albopictus, Deep learning, Expert system
Graphical Abstract
Specifications Table
| Subject Area: | Bioinformatics |
| More specific subject area: | Deep learning, automated recognition system |
| Protocol name: | Mosquito automated recognition system |
| Experimental design: | This study aims to develop a protocol for entomologist or taxonomist to build their own transfer learning model. The tool that we used to demonstrate the protocol is Google Colaboratory (Google Colab) which is using Python programming language and allows us to train a robust deep learning (including transfer learning) without the restriction of hardware, especially GPU. It also relieved us from the restriction of package or libraries installation. Overall experiment design of this protocol started with dataset retrieving, following with the process of pre-processing, data augmentation, transfer learning model training and evaluation. To validate the protocol, we trained two model with the step of fine-tuning and compare their performance in brief. |
| Trial registration: | Not applicable |
| Ethics: | Not applicable |
| Value of the Protocol: |
|
Description of protocol
This study aims to develop a protocol for entomologist or taxonomist to build their own transfer learning model. The protocol is arranged according to the implementation environment, overall process flow, dataset and data pre-processing preparation, and model built-up. Each of the section is attached with the respective Appendix that consists of Python code that allow entomologist/taxonomist to implement in the Google Colab environment. The Appendix consists of a brief introduction of each method, justification of its implementation, and how it is implemented in the project's coding. Although the protocol demonstrated a classification task in distinguishing two species of Aedes mosquitoes, the protocol can be reused in a task with more than two classes of insects, which required some minor changes to the organisation of the folders used for inclusion in the model. An example of applying the protocol to five species of dipterous fly was shown in [1].
Programming tools
The tool that we used is the Google Colaboratory (Google Colab) which is using Python programming language. This tool allows us to train a robust deep learning (including transfer learning) without the restriction of hardware, especially GPU. It also relieved us from the restriction of package or libraries installation.
Overall Process Flow of Transfer Learning Model Development.
Fig. 1 shows the process flow of constructing a transfer learning algorithm. Using the dataset obtained, it goes through the process of pre-processing, data augmentation and train modelling. The trained model then implements transfer learning and goes through testing and validation.
Fig. 1.
Overall process flow for developing a transfer learning model.
Dataset
Dataset of Aedes aegypti L. and Aedes albopictus L. are retrieved from Kaggle database [2]. The dataset has a total number of 4,800 images of Aedes mosquitoes, 2,400 images of Ae. aegypti and 2,400 images of Ae. albopictus respectively. It consists of images of Ae. aegypti and Ae. albopictus that are older than 12 days and the white scales on the thorax that are no longer present. A more detailed explanation can be found in Ong et al. [3] that have implemented deep convolutional neuron network (DCNN) to classify the images.
Data augmentation and data splitting
Since the image dataset obtained from Kaggle consists of 1,205 images which may not be enough to train a robust image classification model, therefore, we proceeded with data augmentation to increase the number of images for training [4]. Data augmentation was performed on the train and test sets, which geometric transformations was done on the training data by rotating the images by 0, 90, 180 and 270 degrees. Developing a machine learning model (including the transfer learning), requires partition or splitting the data into two “set” – 1) training set, that serves as the data for the algorithm and architecture to “learn” the features and patterns form the images; 2) test set, that serves as the data to evaluate the model performance. In this study, the dataset was split into 70% train set and 30% test set (Fig. 1). The details of implementation of data augmentation and splitting were demonstrated in Appendix A, which used ImageDataGenerator package that is imported along with Keras and Tensorflow libraries.
Transfer learning model construction
The transfer learning in this study is a type of Convolutional Neural Network (CNN) that is commonly used to train classification model. We utilized Keras API and TensorFlow libraries to retrieve two pre-trained models – MobileNetV2 and VGG16 and fine-tune the hyperparameter of the model with two levels of batch size (32 and 64), and two levels of learning rate (0.0005 and 0.001) for each batch size, respectively. Appendix A consists of the explanation for each of the terms of hyperparameter. The details of implementation of model built-up were demonstrated in Appendix B. The model evaluation was based of the matrices of accuracy, precision, specificity, sensitivity, and F1 score. The evaluation matrix was derived from the confusion matrix that have been generated from the model prediction as described in Appendix B.
Protocol validation
To validate the protocol, we run the Python code to develop two pre-trained model – MobileNetV2 and VGG16, and Figs. 2 and 3 show the results of model performance, respectively. In general, higher batch size-64 performed greater than batch size-32. To be more specific, MobileNetV2 performed better than VGG16 with learning rate of 0.001, the model can achieve at least 0.96 for all the evaluation matrices. In terms of sensitivity, VGG16 has at least 0.98 for all the batch sizes and learning rate, except for batch size 64 with 0.0005 learning rate. Sensitivity or true positive rate that measures the proportion of actual positive (true value) are correctly predicted, which indicate the correctness of VGG16 in predicting correct classes of Aedes mosquito.
Fig. 2.
Model performance of MobileNetV2.
Fig. 3.
Model performance of VGG16.
Fig. 4 shows the confusion matrix for MobileNetV2 and VGG16, respectively. Con-fusion matrix is a common evaluation tools used in the domain of machine learning to visualize the information of model performance such as accuracy, precision, etc. by referring to the intensity of the colour used by the matrices. For training and testing (validation) process, MobileNetV2 consists of more stable and consistent output of accuracy and loss (Fig. 5a), in relative to VGG16 (Fig. 5b).
Fig. 4.
Confusion Matrix. (a) MobileNetV2 for transfer learning on four different combinations of hyperparameters; (b) VGG16 for transfer learning on four different combinations of hyperparameters.
Fig. 5.
Training and testing (validation) process. (a) MobileNetV2 (b) VGG16
This study aims to act as a protocol for entomologist or taxonomist to construct their own machine learning model. Therefore, the design of the architecture was constructed to be fundamental yet can be benchmarked with the latest studies. We also provided the explanation and the programming codes details and terminologies that are in-volved in processing the image data, training the transfer learning, and model evaluation in Appendix. From our result, the higher batch size-64 obtained greater result than lower batch size-32. The result obtained agrees with the studies of Smith et al [5] and Kandel et al [6] that have demonstrated how higher batch size was used to improve the generalization of a model. However, as suggested by Kevin [7], when the batch size increased until some extent, the generalization will decay, therefore, more levels of batch size could be studied to obtain the optimum result.
Most of previous studies focused on using VGG architecture such as VGG16 and VGG19 to develop the mosquito classification system [8], [9], [10], [11] due to the architecture being used to win the ILSVR and is still powerful in computer vision model till date. Relatively fewer studies on mosquito classification focused on MobileNetV2 due to its lower performance in ILSVR, and our result demonstrated that the MobileNetV2 outperformed over VGG16 at batch size-64. These findings were parallel with Ong et al [1,3] that used a platform – Teachable Machine by Google, that implement MobileNet architecture. MobileNetV2 is comparably a thinner and more lightweight network due to it having fewer parameters as compared to VGG16, which is suitable for experiments with limited training samples [12]. Theoretically, any deep CNN architecture can be used in this approach, this is proven by how both models performs with not much difference in terms of accuracy giving off more than 90% accuracy score in model testing. The application of fine tuning in transfer learning concept is proven to improve the performance of the model [13]. Additionally, despite MobileNetV2 highest accuracy score outperforms VGG16, there is a noticeable similarity that contributes as a major factor to the highest accuracy of both models. In addition, from the point of view of time and cost, MobileNet2 is relatively faster in deriving unseen data and has a small size that incurs low computational costs (Table 1). Both model MobileNetV2 and VGG16 obtained its highest accuracy score by using batch size of 32 and learning rate of 0.001 and this demonstrated a significant factor. Based on the results, to achieve the best performing model, it can be concluded and proven that hyperparameter tuning is very crucial in order to obtain high accuracies. Hyperparameters specifically the learning rate and its batch size has to carefully be decided, since it majorly affects the performance of the model.
Table 1.
Example of transfer learning model with their respective size and time per inference step [14].
| Model | Size (MB) | Time (ms) per inference step (GPU) |
| ResNet50 | 98 | 4.6 |
| Xception | 88 | 8.1 |
| InceptionV3 | 92 | 6.9 |
| MobileNetV2 | 14 | 3.8 |
| VGG16 | 528 | 4.2 |
We have also demonstrated that the classification system of Ae aegypti and Ae albopictus can achieved at least 0.90 accuracy, precision, specificity, sensitivity and F1 score. However, it has to be emphasized that the dataset used in this project were the images taken by a specific device, with the same background, and under the same lighting, which makes the appearance of the mosquitoes’ physical features in the im-ages consistent. In real life application, if the model is to be deployed as a mobile ap-plication, it might affect the performance due to the inconsistency of certain environment such as the difference in level of brightness and colours of the background where the mosquito picture is taken. Additionally, the model architecture of this project was trained only on two different species of Aedes mosquitoes which are Ae aegypti and Ae albopictus. The model is limited to recognizing only the two said species which means it is not familiar with other mosquitoes’ species that are present. This will be a constraint on the model's ability to predict other mosquito species correctly. For future work, the suggestion is to expand the collection of vectors across the world taken using different devices, with various backgrounds and settings. The larger the dataset, the better the model will learn and perform in the future, thus making it possible for it to be deployed as a system and be very useful for entomologists, health workers, or even non-experts.
Declaration of interests
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
Data Availability
I have share the link to my data/code at the attach file step
References
- 1.Ong S.Q., Ahmad H. An annotated image dataset of medically and forensically important flies for deep learning model training. Sci Data. 2022;9:510. doi: 10.1038/s41597-022-01627-5. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 2.P. Isawasan, (2020). Aedes Mosquitos Dataset Kaggle. https://www.kaggle.com/pradeepisawasan/aedes-mosquitos/metadata.
- 3.Ong S.Q., Ahmad H., Nair G., Isawasan P. Implementation of a deep learning model for automated classification of Aedes aegypti (Linnaeus) and Aedes albopictus (Skuse) in real time. Scient. Rep. 2021;0123456789:1–12. doi: 10.1038/s41598-021-89365-3. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 4.L. Perez, & J. Wang, (2017). The effectiveness of data augmentation in image classification using deep learning. arXiv preprint arXiv:1712.04621.
- 5.S.L. Smith, P. J. Kindermans, C. Ying, & Q. V. Le, (2017). Don't decay the learning rate, increase the batch size. arXiv preprint arXiv:1711.00489.
- 6.Kandel I., Castelli M. The effect of batch size on the generalizability of the convolutional neural networks on a histopathology dataset. ICT Expr. 2020;6(4):312–315. [Google Scholar]
- 7.Kevin Shen (2018). Effect of batch size on training dynamics. [assessed on 2 Feb 2022] https://medium.com/mini-distill/effect-of-batch-size-on-training-dynamics21c14f7a716e#:~:text=;Training%20loss%20and%20accuracy%20when,trained%20using%20different%20batch%20sizes.&text=Finding%3A%20higher%20batch%20sizes%20leads,number%20of%20epochs%20of%20training.
- 8.M. Akter, M. S. Hossain, T. U. Ahmed, & K. Andersson, (2021). Mosquito Classification Using Convolutional Neural Network with Data Augmentation. 865–879. https://doi.org/10.1007/978-3-030-68154-8_74
- 9.Motta D., Santos A.Á.B., Winkler I., Machado B.A.S., Pereira D.A.D.I., Cavalcanti A.M., Fonseca E.O.L., Kirchner F., Badaró R. Application of convolutional neural networks for classification of adult mosquitoes in the field. PLoS ONE. 2019;14(1):1–18. doi: 10.1371/journal.pone.0210829. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Ortiz A.S., Miyatake M.N., Tünnermann H., Teramoto T., Shouno H. Proceedings of the International Conference on Parallel and Distributed Processing Techniques and Applications (PDPTA) Computer Engineering and Ap-plied Computing (WorldComp); 2018. Mosquito larva classification based on a convolution neural network; pp. 320–325. The Steering Committee of The World Congress in Computer Science. [Google Scholar]
- 11.Park J., Kim D.I., Choi B., Kang W., Kwon H.W. Classification and morphological analysis of vector mosquitoes using deep convolutional neural networks. Scient. Rep. 2020;10(1):1–12. doi: 10.1038/s41598-020-57875-1. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 12.Saxen F., Werner P., Handrich S., Othman E., Dinges L., Al-Hamadi A. 2019 11th International Sym-posium on Image and Signal Processing and Analysis (ISPA) IEEE; 2019. Face attribute detection with MobileNetV2 and NasNet-Mobile; pp. 176–180. [Google Scholar]
- 13.Vrbančič G., Podgorelec V. Transfer learning with adaptive fine-tuning. IEEE Access. 2020;8:196197–196211. [Google Scholar]
- 14.Keras Applications. Available models. https://keras.io/api/applications/Accessed on 2 November 2022.
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
I have share the link to my data/code at the attach file step






