Nguyen Van Khanh * , Bao-Toan Thai , Vy-Khang Tran and Nguyen Chi Ngon

* Corresponding author (vankhanh@ctu.edu.vn)

Abstract

This study proposes a fruit fly recognition method based on wingbeat sounds using autoencoder models deployed on a microcontroller. Spectrogram images were generated from audio data to train ANN-AE and CNN-AE models. Reconstruction error MSE and the Gamma distribution were used to determine the classification threshold. Before quantization, ANN-AE and CNN-AE achieved accuracies of 99.75% and 99.85%, respectively, while post-quantization accuracies remained at 99.60% and 99.65%. ANN-AE achieved a faster inference time of 1.3 ms per image. Although autoencoder models were more sensitive to noise, they showed strong potential for low-cost embedded intelligent insect traps.

Keywords: Fruit fly, wingbeat sound, autoencoder, quantization, ESP32, TinyML

Tóm tắt

Nghiên cứu này được thực hiện nhằm đề xuất phương pháp nhận dạng ruồi vàng dựa trên âm thanh đập cánh bằng mô hình mã hóa tự động triển khai trên vi điều khiển. Dữ liệu âm thanh được chuyển thành ảnh phổ tần số để huấn luyện hai mô hình ANN-AE (Artificial Neural Network - Autoencoder) và CNN-AE (Convolutional Neural Network - Autoencoder). Sai số tái tạo MSE (Mean Squared Error) kết hợp với phân phối Gamma được sử dụng để xác định ngưỡng phân loại. Trước lượng tử hóa, ANN-AE và CNN-AE đạt độ chính xác lần lượt 99,75% và 99,85%; sau lượng tử hóa và triển khai trên ESP32, độ chính xác vẫn đạt 99,60% và 99,65%. ANN-AE có thời gian nhận dạng 1,3 ms/ảnh, nhanh hơn CNN-AE nhưng kém chính xác hơn. Trên dữ liệu nhiễu, các mô hình Autoencoder nhạy hơn CNN phân loại. Kết quả cho thấy Autoencoder phù hợp cho bẫy côn trùng chi phí thấp trên thiết bị nhúng, đặc biệt khi khó thu thập dữ liệu lớp không mục tiêu.

Từ khóa: Ruồi vàng hại quả, âm thanh đập cánh, mã hóa tự động, lượng tử hóa, ESP32, TinyML

Article Details

References

APHIS, U. (2026). Oriental fruit fly. https://www.aphis.usda.gov/plant-pests-diseases/oriental-fruit-fly

Brown, A., Garg, S., & Montgomery, J. (2019). Automatic rain and cicada chorus filtering of bird acoustic data. Applied Soft Computing, 81, 105501. https://doi.org/10.1016/j.asoc.2019.105501

Le, Q. D., & Nguyen, V. H. (2016). Study on Insect Pests and Development of Their Control Measures on Dragon Fruit. Journal of Vietnam Agricultural Science and Technology, 1(2), 74-81.

Diller, Y., Shamsian, A., Shaked, B., Altman, Y., Danziger, B.-C., Manrakhan, A., Serfontein, L., Bali, E., Wernicke, M., & Egartner, A. (2023). A real-time remote surveillance system for fruit flies of economic importance: sensitivity and image analysis. Journal of Pest Science, 96(2), 611-622. https://doi.org/https://link.springer.com/article/10.1007/s10340-022-01528-x

EPPO. (2021). EPPO Datasheet: Bactrocera dorsalis. https://gd.eppo.int/taxon/DACUDO/datasheet

Gordon, L. (1994). A stochastic approach to the gamma function. The American Mathematical Monthly, 101(9), 858-865. https://doi.org/https://doi.org/10.1080/00029890.1994.11997039

Lello, F., Dida, M., Mkiramweni, M., Matiko, J., Akol, R., Nsabagwa, M., & Katumba, A. (2023). Fruit fly automatic detection and monitoring techniques: A review. Smart Agricultural Technology, 5, 100294. https://doi.org/https://doi.org/10.1016/j.atech.2023.100294

Malhotra, P., Ramakrishnan, A., Anand, G., Vig, L., Agarwal, P., & Shroff, G. (2016). LSTM-based encoder-decoder for multi-sensor anomaly detection [Preprint]. arXiv. https://doi.org/10.48550/arXiv.1607.00148

Mamdouh, N., & Khattab, A. (2021). YOLO-based deep learning framework for olive fruit fly detection and counting. IEEE Access, 9, 84252-84262. https://doi.org/https://doi.org/10.1109/ACCESS.2021.3088075

Molina-Rotger, M., Moran, A., Miranda, M. A., & Alorda-Ladaria, B. (2023). Remote fruit fly detection using computer vision and machine learning-based electronic trap. Frontiers in Plant Science, 14, 1241576. https://doi.org/https://doi.org/10.3389/fpls.2023.1241576

Neloy, A. A., & Turgeon, M. (2024). A comprehensive study of auto-encoders for anomaly detection: Efficiency and trade-offs. Machine Learning with Applications, 17, 100572. https://doi.org/https://doi.org/10.1016/j.mlwa.2024.100572

Nguyen, V. K., Tran, V. K., & Nguyen, C. N. (2025). Towards fruit fly automatic counting: Electronic trap design and long-term feature data acquisition. International Journal of Applied Science and Engineering, 22, 2025102. https://doi.org/https://doi.org/10.6703/IJASE.202509_22(3).004

Nguyen, V.-K., Tran, V.-K., & Nguyen, C.-N. (2026). Fruit Fly Detection Based on Wingbeat Sound Using Embedded Artificial Intelligence. International Journal of Technology, 17(3), 1012. https://doi.org/10.14716/ijtech.v17i3.8284

Parvathy, S., Jayan, D. P., Pathrose, N., & Rajesh, K. (2021). Convolutional autoencoder based deep learning model for identification of red palm weevil signals. In Asia-Pacific Signal and Information Processing Association Annual Summit and Conference 2021 (pp. 1987-1992). IEEE.

Potamitis, I., Rigakis, I., & Fysarakis, K. (2014). The electronic McPhail trap. Sensors, 14(12), 22285-22299. https://doi.org/https://doi.org/10.3390/s141222285

Potamitis, I., Eliopoulos, P., & Rigakis, I. (2017). Automated remote insect surveillance at a global scale and the internet of things. Robotics, 6(3), 19. https://doi.org/https://doi.org/10.3390/robotics6030019

Shaked, B., Amore, A., Ioannou, C., Valdés, F., Alorda, B., Papanastasiou, S., Goldshtein, E., Shenderey, C., Leza, M., & Pontikakos, C. (2018). Electronic traps for detection and population monitoring of adult fruit flies (Diptera: Tephritidae). Journal of Applied Entomology, 142(1-2), 43-51. https://doi.org/ https://doi.org/10.1111/jen.12422

TensorFlow. (2022). Post-training quantization. https://www.tensorflow.org/model_optimization/guide/quantization/post_training

Victoria, A. (2026). Oriental fruit fly. Agriculture Victoria. https://agriculture.vic.gov.au/biosecurity/pest-insects-and-mites/priority-pest-insects-and-mites/oriental-fruit-fly