CoAtNet-DeepMoE: A Convolution-Attention Hybrid with DeepSeek Mixture-of-Experts for Parameter-Efficient Tomato Disease Classification
Authors: Md Nadim Mahamood, Md Arif Shahriar, Md Shafi Ud Doula, Kamrul Hasan
Organizations: Department of Computer Science and Engineering Begum Rokeya University Rangpur, Bangladesh · Department of Computer Science Texas State University San Marcos, Texas, USA · Department of Information and Communication Technologies Asian Institute of Technology Pathum Thani, Thailand
The world population is growing rapidly, and technology is improving in parallel. Meeting the huge demand for food for these 7 billion people not only depends on increasing food production but also on reducing food loss. Crop losses due to disease affect both the food supply and the financial and economic stability of a country. Tomatoes are among the top food-producing crops globally, and a significant portion of this production is lost due to disease. People have used Machine Learning techniques for feature extraction and early diagnosis of tomato diseases, and nowadays, Deep Learning-based models are widely used for disease recognition. However, most existing models are highly parameter-intensive, which increases the time required for training and inference. As a result, while lightweight models are more suitable for user-friendly applications, they often show a reduction in performance. To balance performance and model size, we propose CoAtNet-DeepMoE, a Convolution-Attention hybrid architecture for rich feature extraction, further enhanced with a DeepSeek Mixture of Experts to substantially reduce the number of parameters without sacrificing accuracy. We evaluate our model on both balanced and imbalanced datasets from Kaggle and PlantVillage, demonstrating robustness and achieving 99.80% accuracy, 99.80% precision, 99.80% recall, and 99.80% F1-score on Kaggle, and 99.83% accuracy, 99.85% precision, 99.76% recall, and 99.80% F1-score on PlantVillage, representing state-of-the-art performance with only 2.47M parameters. The source code will be available at https://github.com/nadimbrur/CoAt-MoE.
Figures & tables
Figure 1: Overview of the proposed CoAtNet-DeepMoE architecture. The model integrates convolutional layers for local feature extraction, MbConv and SE blocks for channel-wise enhancement, and attention layers for global feature modeling. A parameter-efficient DeepSeek Mixture-of-Experts replaces the traditional MLP, where the router selects the top-k experts ( 2 in this case) along with a shared expert for feature processing. The selected experts specialize in capturing disease-specific patterns, enabling the model to focus on the most relevant features for each input. The shared expert, on the other hand, preserves common information across all classes (e.g., common characteristics), ensuring stable and generalizable representations. This selective expert activation enhances feature representation while greatly reducing computational cost and overall parameter count ( 26.67M to 2.47M , ≈90.73% ).
Module
CoAt-Base
CoAt-DeepMoE
Stem
19,360
19,360
MbConv-0
236,768
83,648
MbConv-1
1,410,720
208,416
Transformer2D-2
12,145,374
437,174
Transformer2D-3
12,852,804
1,715,492
Classifier Head
9,226
9,226
Table 1: Block-wise parameter comparison between CoAt-Base and CoAt-DeepMoE.
Table 2: Corrected class distribution comparison between Kaggle and PlantVillage tomato datasets (instances and ratios).
Figure 2: Examples of representative images from each class in the tomato leaf disease datasets, illustrating the visual diversity and key characteristics.
Parameter
Value
Learning Rate (LR)
1×10−5
Loss Function
CE (label_smoothing = 0.1)
Optimizer
AdamW (weight_decay = 1×10−4 )
LR Scheduler
CosineAnnealingLR ( Tmax=300 )
Stopping Patience
50 epochs
Batch Size
32
Table 3: Training configuration details used for model training.
Metric
Expression
Accuracy
∑i=1K(TPi+FPi+FNi)∑i=1KTPi
Recall
K1i=1∑KTPi+FNiTPi
Precision
K1i=1∑KTPi+FPiTPi
F1-score
K1i=1∑K2TPi+FPi+FNi2TPi
Table 4: Macro-averaged metrics used to evaluate the proposed CoAtNet-DeepMoE
SL
Reference
Parameters
Model Name
Accuracy
Precision
Recall
F1-score
1
[ 37 ]
11.00 M
YOLOv8s
93.2
90.3
–
–
2
[ 9 ]
32.29 M
DenseNet
95.4
95.7
95.4
95.4
3
[ 23 ]
23.50 M
ResNet50
92.4
–
–
–
4
[ 23 ]
23.56 M
SDE-ResNet50
98.0
98.0
–
98.0
5
[ 23 ]
54.32 M
Inception-ResNet
98.2
98.23
–
98.2
6
[ 49 ]
200.00 M
AlexNet + ResNet50 + VGG16 + QSSVM
98.3
–
–
–
Table 5: Performance comparison of state-of-the-art (SOTA) models on the Kaggle tomato disease dataset. “M” denotes the number of trainable parameters in millions. Accuracy, Precision, Recall, and F1-score are reported in percentage (%) form. Bold values indicate the best performance among the compared models.
Figure 3: 2D comparison of SOTA models on (a) the Kaggle dataset and (b) the PlantVillage dataset. Each plot presents model accuracy against parameter count (in millions), illustrating how different architectures balance predictive performance and model complexity.
Figure 4: Normalized confusion matrices of the proposed CoAtNet-DeepMoE model on (a) the Kaggle tomato leaf disease dataset and (b) the PlantVillage tomato dataset.
SL
Reference
Parameters
Model Name
Accuracy
Precision
Recall
F1-score
1
[ 52 ]
138.36 M
VGG16
96.46
–
–
–
2
[ 52 ]
3.50 M
MobileNetV2
95.76
–
–
–
3
[ 52 ]
27.53 M
Swin Transformer
99.10
–
–
–
4
[ 52 ]
8.06 M
Vision Transformer
99.45
–
–
–
5
[ 41 ]
25.60 M
ResNet50
99.80
–
–
–
6
[ 51 ]
5.70 M
ViT
96.50
93.90
96.70
94.20
Table 6: Performance comparison of state-of-the-art (SOTA) models on the PlantVillage dataset. “M” denotes the number of parameters in millions. Accuracy, Precision, Recall, and F1-score are reported in percentage (%) form. Bold values indicate the best performance among the compared models.
Figure 5: Normalized confusion matrices for cross-dataset evaluation.
PlantVillage → Kaggle
Kaggle → PlantVillage
Class
Accuracy
Precision
Recall
F1-score
Accuracy
Precision
Recall
F1-score
BS
1.0000
1.0000
1.0000
1.0000
0.9994
1.0000
0.9951
0.9975
EB
1.0000
1.0000
1.0000
1.0000
0.9997
1.0000
0.9953
0.9977
LB
1.0000
1.0000
1.0000
1.0000
0.9994
0.9949
1.0000
0.9974
LM
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
SLS
0.9990
0.9901
1.0000
0.9950
0.9997
1.0000
0.9971
0.9986
Table 7: Class-wise performance of the proposed model under cross-dataset evaluation. The model is trained on one dataset and evaluated on the other. Accuracy, Precision, Recall, and F1-score are reported as decimal values. The Average row represents the macro-average across all ten classes.
Figure 6: Cost–latency trade-off among CoAtNet-Base, ResNet50, ViT-Tiny, and the proposed CoAtNet-DeepMoE. The x-axis shows computational cost (GFLOPs), the y-axis shows inference latency (ms/img), and bubble size represents the number of parameters (M). The dashed line marks the Pareto frontier of non-dominated models.
Model
Params (M) ↓
GFLOPs ↓
Time/img (ms) ↓
p95 (ms) ↓
p99 (ms) ↓
FPS ↑
CoAtNet-Base
26.67
8.42
6.79
6.90
6.98
147.3
ResNet50
23.53
8.26
4.47
4.65
4.70
223.6
ViT-Tiny
5.53
2.15
3.78
4.93
5.02
264.8
CoAtNet-DeepMoE
2.47
1.34
4.04
4.19
4.24
247.6
Table 8: Cost analysis of different models in terms of parameter count (M), computational complexity (GFLOPs), and inference latency (ms/img), measured on the same hardware. p95/p99 denote the 95th/99th-percentile per-image latency over repeated runs. All metrics follow a lower-is-better ( ↓ ) convention, except FPS, which is higher-is-better ( ↑ ). Bold values indicate the most efficient performance among the compared models.
Department of Computer Engineering, University of Peradeniya, Sri Lanka. · Faculty of Science and Technology, Charles Darwin University, Australia. · Canadian Institute for Cybersecurity, University of New Brunswick, Canada. +1
Department of Computer Science and Engineering, Rajshahi University of Engineering & Technology, Rajshahi, 6204, Bangladesh · Department of Computer Science and Engineering, Bangladesh Army University of Science & Technology, Saidpur, Bangladesh