In this study, we introduce a plant disease recognition framework in which a dual-channel attention-based network is designed as the teacher model, while MobileNetV3 is employed as the lightweight student network. The teacher model captures spatial and channel-wise contextual dependencies through a dual-channel self-attention mechanism. The student network is optimized not only using ground-truth labels but also under the supervision of the teacher model. We further use a category-guided knowledge distillation strategy to explicitly transfer inter-class feature relationships from the teacher, thereby narrowing the representation gap observed when MobileNetV3 is trained independently.
3.1. Dual-Channel Feature Enhancement Network
This section presents the Dual-Channel Feature Enhancement Network (DC-FEN), as shown in
Figure 2, which uses a dual-channel attention mechanism to refine feature representations. The network extracts spatial context and channel-wise dependencies, enabling more discriminative representation learning for plant disease classification. DC-FEN is composed of several Dual-Channel Attention (DC-A) blocks. Each block uses spatial and channel attention in parallel, so that the model can capture complementary dependencies in the input features.
Let the input image be defined as , where H, W, and C denote the height, width, and number of channels, respectively. The Dual-Channel Attention strategy incorporates two complementary modules: spatial attention and channel attention. These mechanisms generate attention maps that facilitate focusing on the most salient regions of the feature maps while emphasizing discriminative channels critical for accurate classification.
Spatial Attention. Spatial attention aims to determine where disease-related regions are located. In plant disease recognition, this capability is particularly important because discriminative symptoms are often spatially localized and irregularly distributed. For example, early blight, late blight, rust, chlorosis, and mildew may appear as scattered lesions, blurred boundaries, or non-uniform texture changes over the leaf surface. Purely local convolutional operations may fail to capture the long-range dependencies among these spatially separated disease cues. Therefore, spatial attention is introduced to explicitly model global interactions among different spatial locations and to enhance lesion-sensitive regions while suppressing irrelevant background interference.
Given an input feature map
, we first reshape it into a token sequence
where
H,
W, and
C denote the height, width, and channel dimension of the feature map, respectively, and
N is the number of spatial tokens. We then project
into query, key, and value representations:
where
, and
d denotes the embedding dimension.
The spatial attention matrix is computed by scaled dot-product attention:
Here, each element of
measures the relevance between two spatial positions, allowing each token to aggregate contextual information from all other positions. In this way, the model can establish long-range dependencies across spatially distributed disease regions, thereby strengthening its ability to represent lesion-associated structures more effectively and comprehensively.
The spatially enhanced feature is then obtained by applying the attention matrix to the value representation:
This operation generates a new spatial feature representation in which each location is enriched by global contextual cues from other disease-relevant regions.
After that,
is reshaped back to the spatial form
. To further refine the lesion localization effect, a
convolution followed by sigmoid activation is used to produce a spatial gating map:
where
denotes the sigmoid activation function.
The produced gating map assigns higher responses to disease-sensitive spatial regions and lower responses to background or less informative areas. Consequently, the network is guided to focus more strongly on key discriminative cues such as lesion locations, discoloration regions, and abnormal structural patterns in leaves that are essential for distinguishing different disease categories.
Channel Attention. While spatial attention focuses on where disease-related regions are located, channel attention aims to determine which feature channels are most discriminative for plant disease recognition. For example, lesion-type diseases may be characterized more strongly by texture-sensitive channels, while chlorosis or nutrient-deficiency-like symptoms may be more distinguishable in color- or intensity-related channels. Therefore, channel attention is introduced to adaptively model inter-channel dependencies and to emphasize those channels that are most relevant to disease discrimination.
Given the same input feature map
, we first reshape it into a token sequence
and then project it into query, key, and value representations:
where
, and
d denotes the embedding dimension.
To model the relationships among channels, we transpose the projected query and compute channel-wise attention as
Here,
captures the dependency structure between channels, and the normalization term uses
N because the channel-wise dot product is accumulated over spatial tokens.
The channel-enhanced feature is then obtained by
Through this operation, each channel is re-weighted according to its interaction with other channels, resulting in a feature representation that better highlights disease-relevant spectral, color, and texture characteristics.
After reshaping
back to the
form, a
convolution followed by sigmoid activation is used to generate a channel gating map:
This gate adaptively enhances informative disease-related channels and suppresses less relevant responses, thereby improving the discriminability of subtle plant disease patterns.
Finally, the spatially enhanced and channel-enhanced representations are fused through residual gated aggregation:
where
denotes the input feature projected to the same dimension as
and
, and ⊙ denotes element-wise multiplication. All terms are reshaped to
, and the gating maps are broadcast when necessary. This fusion preserves the original representation while adaptively incorporating spatial and channel cues.
3.2. Category-Guided Knowledge Distillation
Although lightweight models are more suitable for real-world deployment, their limited representation capacity often makes it difficult to capture the subtle inter-class differences among visually similar plant diseases. To address this limitation, we propose a Category-Guided Knowledge Distillation (CGKD) framework that enables the transfer of both category-level semantic information and feature-level relational cues from the teacher model to a lightweight student network. The complete architecture of the proposed method is presented in
Figure 3. In our framework, the proposed Dual-Channel Feature Enhancement Network (DC-FEN) serves as the teacher network, while MobileNetV3 is adopted as the student network.
The proposed CGKD framework contains two complementary components. The first component, referred to as Category Knowledge Distillation (CKD), transfers category-level semantic information by aligning the softened prediction distributions of the teacher and student. This enables the student to learn inter-class similarity structure beyond hard labels. The second component, referred to as Feature Knowledge Distillation (FKD), transfers fine-grained feature knowledge from intermediate representations, so that the student can better preserve discriminative disease patterns learned by the teacher.
The overall training objective is defined as
where
denotes the supervised classification loss, and
and
are trade-off coefficients used to balance the category-level and feature-level distillation losses, respectively. For single-label experiments,
is implemented as cross-entropy loss with softmax outputs. For the multi-label FGVC8 setting, the final activation is changed to sigmoid and
is implemented as binary cross-entropy loss.
Category Knowledge Distillation (CKD). To transfer category-level semantic knowledge, we perform alignment between the teacher and student by matching their softened prediction distributions. Let
and
denote the logits produced by the final prediction layers of the teacher and student before activation, respectively. For single-label classification, their softened probability distributions are computed as
where
K denotes the number of disease categories and
denotes the temperature parameter. A larger
produces a softer probability distribution, which helps reveal inter-class similarity information. For notation consistency,
is used only for temperature throughout this paper, while the superscript
t denotes the teacher model.
The CKD loss is formulated as
where
B denotes the mini-batch size. This loss encourages the student network to mimic the category-level semantic structure encoded in the teacher predictions. In the FGVC8 multi-label experiment, the same alignment is applied to sigmoid-based teacher and student confidence scores rather than softmax-normalized probabilities. Specifically, we define
and use the multi-label CKD loss
For FGVC8,
in the overall objective is replaced by
.
Feature Knowledge Distillation (FKD). In addition to output-level supervision, we further transfer feature-level knowledge from an intermediate representation of the teacher to the student. Specifically, let
and
denote the intermediate token features extracted from the teacher and student, respectively, before the final classification head. Here,
N is the number of spatial tokens and
,
are the corresponding feature dimensions. Since the teacher and student may have different feature dimensions, a learnable linear projection
is introduced to map the student features into the teacher feature space. This operation is necessary because the teacher and student not only differ in feature dimensionality but also exhibit different representation spaces due to their heterogeneous architectures.
The direct feature alignment loss is then defined as
This term helps the student preserve fine-grained disease-related feature patterns learned by the teacher.
To further transfer structural relationships among tokens, we construct token correlation matrices for the teacher and student features:
where
describe pairwise relationships among spatial tokens. Here, a token corresponds to one spatial location obtained after flattening the feature map.
The relational distillation loss is defined as
Finally, the feature-level distillation loss is written as
By jointly optimizing the above objectives, the proposed CGKD framework allows the lightweight MobileNetV3 student to inherit both category-level semantic knowledge and fine-grained feature relationships from the DC-FEN teacher and improves lightweight plant disease recognition performance.