QUANTIZED MOBILENETV2 FOR TOMATO LEAF DISEASE CLASSIFICATION TARGETING AN ESP32-CAM MICROCONTROLLER
Keywords:
TinyML, MobileNetV2, plant disease classification, INT8 quantization, ESP32-CAM, edge inference, transfer learning, sensor fusion, edge deployment, real-time monitoringAbstract
Early detection of plant diseases is critical for food security, yet most deep learning models require GPU-class hardware. This paper presents an end-to-end edge AI system for tomato disease detection deployed on an ESP32-CAM microcontroller ($7 USD). We train MobileNetV2 (α=0.35) on six tomato leaf classes from PlantVillage (10,431 images), achieving 91.57% test accuracy. Full INT8 post-training quantization compresses the model from 1,588 KB to 614 KB (2.6× reduction) with 1.41 percentage-point accuracy loss. The quantized model is deployed on ESP32-CAM using TensorFlow Lite for Microcontrollers with a 220 KB tensor arena in PSRAM. Measured on-device inference latency is approximately 8.7 seconds per frame at 240 MHz. This reflects the computational intensity of MobileNetV2 on the ESP32's Xtensa LX6 cores without hardware neural network acceleration. A late-fusion module combines visual classification with environmental sensor readings (temperature, humidity, soil moisture, CO₂) to produce a four-level plant health assessment (Healthy, Environmental Stress, Disease, Critical) with a continuous risk score. The complete system—camera capture, inference, sensor fusion, and MQTT reporting—operates as a FreeRTOS task consuming approximately 201 KB tensor arena in PSRAM and 50 KB static RAM, well within the ESP32-CAM's 4 MB PSRAM budget. The system performs one classification every 14 seconds (8.7 s inference + 5 s interval), suitable for periodic greenhouse monitoring without cloud connectivity. To our knowledge, this is the first system combining quantized CNN inference with environmental sensor fusion on the original ESP32-CAM platform.
References
1.Abade A, Ferreira PA, de Barros Vidal F (2021). Plant diseases recognition on images using convolutional neural networks: A systematic review. Computers and Electronics in Agriculture, 185, 106125.
2.Banbury CR, Reddi VJ, Lam M et al (2021). Benchmarking TinyML systems: Challenges and direction. Proceedings of Machine Learning and Systems (MLSys), 3, 73–87.
3.Boulent J, Foucher S, Théau J, St-Charles PL (2019). Convolutional neural networks for the automatic identification of plant diseases. Frontiers in Plant Science, 10, 941.
4.Chen J, Chen J, Zhang D, Sun Y, Nanehkaran YA (2020). Using deep transfer learning for image-based plant disease identification. Computers and Electronics in Agriculture, 173, 105393.
5.David R, Duke J, Jain A et al (2021). TensorFlow Lite Micro: Embedded machine learning for TinyML systems. Proceedings of Machine Learning and Systems (MLSys), 3, 800–811.
6.Espressif Systems. (2023). ESP32 Technical Reference Manual. Version 5.0. https://www.espressif.com/en/products/socs/esp32
7.Ferentinos KP (2018). Deep learning models for plant disease detection and diagnosis. Computers and Electronics in Agriculture, 145, 311–318.
8.Howard AG, Zhu M, Chen B et al (2017). MobileNets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861.
9.Hughes D, Salathé M (2015). An open access repository of images on plant health to enable the development of mobile disease diagnostics. arXiv preprint arXiv:1511.08060.
10.Hoang TH et al. (2026). A comprehensive evaluation of lightweight deep learning models for tomato disease classification on edge computing environments. Scientific Reports, 16.
11.Jacob B, Kligys S, Chen B et al (2018). Quantization and training of neural networks for efficient integer-arithmetic-only inference. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2704–2713.
12.Khan AT, Jensen SM, Khan AR, Li S (2023). Plant disease detection model for edge computing devices. Frontiers in Plant Science, 14, 1308528.
13.Krishnamoorthi R (2018). Quantizing deep convolutional networks for efficient inference: A whitepaper. arXiv preprint arXiv:1806.08342.
14.Malche T, Joshi M, Upadhyay GM, Soni PK (2025). Automated tomato leaf disease detection and alert system using Internet of Things and TinyML. Discover Internet of Things, 6, 8.
15.Mohanty SP, Hughes DP, Salathé M (2016). Using deep learning for image-based plant disease detection. Frontiers in Plant Science, 7, 1419.
16.Nyakuri M, Wahid KA, Dinh A (2025). AI and IoT-powered edge device optimized for crop pest and disease detection. Scientific Reports, 15, 45.
17.Sandler M, Howard A, Zhu M, Zhmoginov A, Chen LC (2018). MobileNetV2: Inverted residuals and linear bottlenecks. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 4510–4520.
18.Savary S, Willocquet L, Pethybridge SJ et al (2019). The global burden of pathogens and pests on major food crops. Nature Ecology, Evolution, 3(3), 430–439.
19.Too EC, Yujian L, Njuki S, Yingchun L (2019). A comparative study of fine-tuning deep learning models for plant disease identification. Computers and Electronics in Agriculture, 161, 272–279.
20.Warden P, Situnayake D (2019). TinyML: Machine Learning with TensorFlow Lite on Arduino and Ultra-Low-Power Microcontrollers. O'Reilly Media.