Fine-grained image recognition method and system based on multi-layer dynamic expert learning
By dynamically selecting and fusing the internal layers and attention heads of the Transformer through a multi-layer dynamic expert learning transformer (MLT), the problem of large intra-class differences and small inter-class differences in fine-grained visual recognition is solved, achieving efficient and accurate fine-grained image recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANDONG UNIV OF FINANCE & ECONOMICS
- Filing Date
- 2026-03-12
- Publication Date
- 2026-06-09
AI Technical Summary
Existing fine-grained visual recognition methods struggle to accurately capture key local information when faced with the challenge of "large intra-class differences and small inter-class differences." Furthermore, existing Transformer models are prone to noise accumulation during multi-layer feature fusion and lack adaptive feature selection mechanisms.
A multi-layer dynamic expert learning transformer (MLT) is adopted. Through the hybrid expert (MoE) mechanism, the network layers and attention heads inside the Transformer are dynamically selected and fused to achieve adaptive feature selection and noise suppression, thus constructing a multi-layer dynamic expert learning framework.
It significantly improves the accuracy and robustness of fine-grained classification, accurately focusing on key discrimination regions without the need for additional manual annotation, reducing model inference complexity and improving recognition performance.
Smart Images

Figure CN122176392A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, and in particular to a fine-grained image recognition method and system based on multi-layer dynamic expert learning. Background Technology
[0002] Fine-Grained Visual Categorization (FGVC), an important direction in computer vision, aims to distinguish different subcategories within the same broad class. Its precise classification capabilities have played a crucial role in various practical fields such as retail product recognition, intelligent transportation, and biodiversity conservation. The core challenge of this task stems from the inherent contradiction of "large intra-class differences and small inter-class differences": samples within the same subclass can exhibit significant visual differences due to external factors such as shooting posture, angle, and lighting; however, the core discriminative features of different subclasses are often concentrated in local areas, resulting in extremely high overall visual similarity. Furthermore, fine-grained annotation relies on specialized knowledge, leading to high annotation costs.
[0003] This characteristic places stringent demands on the accuracy and flexibility of recognition methods, but existing technologies still have significant shortcomings. Current mainstream solutions fall into two categories: location-based and feature-encoding-based. The former relies excessively on manually labeled bounding boxes or key points, which is not only time-consuming and labor-intensive but also severely limits the scalability of the method. The latter enhances the discriminative ability through global feature aggregation, but feature fusion is mostly statically designed and cannot dynamically adjust the fusion strategy according to the specific content of the input image, making it difficult to accurately capture local key information.
[0004] While the Vision Transformer, which has emerged in recent years, has demonstrated advantages in visual tasks due to its multi-head self-attention mechanism, its potential in fine-grained recognition scenarios has not yet been fully realized. In existing applications, the differences in the contributions of different network layers and attention heads of the Transformer to fine-grained discrimination have not been effectively modeled. Noise accumulation is prone to occur during multi-layer feature fusion, and there is a lack of adaptive selection mechanism for effective features, making it difficult for the model to focus on key discriminative information and suppress redundant interference. Summary of the Invention
[0005] To address the aforementioned issues, this invention proposes a fine-grained image recognition method and system based on multi-layer dynamic expert learning. By introducing a Mixture of Experts (MoE) mechanism, a multi-layer dynamic expert learning transformer (MLT) is constructed, which enables adaptive dynamic selection and fusion of inputs to the internal representation of the Transformer, thereby significantly improving the accuracy and robustness of fine-grained classification.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides a fine-grained image recognition method based on multi-layer dynamic expert learning, comprising: The fine-grained image to be identified is processed into a token sequence, and learnable category and location codes are added to obtain the initial feature sequence. After inputting into the ViT network, the attention weights and output feature sequences of each layer are obtained. The final layer category token is obtained from the output feature sequence, and then input into the hierarchical expert router and the head expert router respectively to obtain the corresponding hierarchical weight distribution and attention head weight distribution. The importance score of each image token is calculated based on two types of weight distribution, and the K tokens with the highest scores are selected as key discrimination regions. Feature representations are extracted from the key discrimination regions of each layer and fused according to the hierarchical weights to obtain the enhanced key local features. Key local features are concatenated with the final layer category token to form a fused feature sequence, which is then input into the encoding block for deep interaction. The fused category token is extracted, and fine-grained classification results are obtained based on the fused category token.
[0007] Secondly, the present invention provides a fine-grained image recognition system based on multi-layer dynamic expert learning, comprising: The feature encoding module is configured to process the fine-grained image to be identified into a token sequence, add learnable category and position encoding to obtain an initial feature sequence, input it into the ViT network, and obtain the attention weights and output feature sequences of each layer. The dynamic expert routing module is configured to obtain the final layer category token from the output feature sequence, and input it into the hierarchical expert router and the head expert router respectively to obtain the corresponding hierarchical weight distribution and attention head weight distribution. The region selection and feature fusion module is configured to calculate the importance score of each image token based on two weight distributions, select the K tokens with the highest scores as key discrimination regions, extract feature representations from each layer of key discrimination regions, and fuse them according to hierarchical weights to obtain enhanced key local features; The classification prediction module is configured to concatenate key local features with the final layer category token to form a fused feature sequence, input the encoding block for deep interaction, extract the fused category token, and obtain fine-grained classification results based on the fused category token.
[0008] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the fine-grained image recognition method based on multi-layer dynamic expert learning as described in the first aspect.
[0009] Fourthly, the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the fine-grained image recognition method based on multi-layer dynamic expert learning described in the first aspect.
[0010] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention constructs a multi-layer dynamic expert learning framework by deeply integrating the Hybrid Expert (MoE) mechanism with the Vision Transformer, effectively solving the challenge of discriminative feature extraction in fine-grained visual recognition due to large intra-class differences and small inter-class differences. Through the designed hierarchical expert routing and head expert routing mechanisms, adaptive dynamic selection and weighting of inputs from different Transformer layers and attention heads are achieved, enabling the model to flexibly focus on the most discriminative semantic levels and local regions for different samples. Through MoE-based cross-layer feature aggregation and key token selection strategies, collaborative fusion and noise suppression of multi-layer and multi-head discriminative information are achieved, significantly enhancing the ability to capture subtle local features and the robustness of representation, providing an efficient, reliable, and scalable solution for fine-grained visual recognition tasks.
[0011] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0012] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute a limitation thereof.
[0013] Figure 1 The main flowchart of a fine-grained image recognition method based on multi-layer dynamic expert learning provided in this embodiment of the invention is shown below. Detailed Implementation
[0014] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0015] Example 1 like Figure 1 As shown, this embodiment discloses a fine-grained image recognition method based on multi-layer dynamic expert learning, including the following steps: S1: Process the fine-grained image to be identified into a token sequence, add learnable category and position encoding to obtain the initial feature sequence, input it into the ViT network to obtain the attention weights and output feature sequences of each layer; S2: Obtain the final layer category Token from the output feature sequence, and input it into the hierarchical expert router and the head expert router respectively to obtain the corresponding hierarchical weight distribution and attention head weight distribution; S3: Calculate the importance score of each image token based on two types of weight distribution, and select the K tokens with the highest scores as key discrimination regions; extract feature representations from the key discrimination regions of each layer, and fuse them according to the hierarchical weights to obtain the enhanced key local features; S4: Concatenate key local features with the final layer category token to form a fused feature sequence, input it into the encoding block for deep interaction, extract the fused category token, and obtain fine-grained classification results based on the fused category token.
[0016] Next, combined Figure 1 This embodiment provides a detailed description of a fine-grained image recognition method based on multi-layer dynamic expert learning.
[0017] Fine-grained visual recognition (FGVC) has long faced the core challenge of "large intra-class differences and small inter-class differences". Existing Transformer-based methods have failed to fully model the significant differences in the discriminative abilities of different levels and attention heads within the model. Furthermore, noise is easily introduced during multi-layer feature fusion, making it difficult for the model to accurately focus on key local discriminative regions.
[0018] To address the aforementioned problems, this invention proposes a fine-grained image recognition method, system, medium, and device based on multi-layer dynamic expert learning. The core of this invention lies in providing a model architecture called "Multi-layer Dynamic Expert Learning Transformer (MLT)." This method does not rely on any additional manual annotations (such as bounding boxes or component keypoints), making it a fully weakly supervised recognition method. Its "dynamic expert learning" mechanism refers to the model's ability to automatically evaluate and select network layers of different depths (hierarchical experts) and attention heads with different functions (head experts) based on the content of the input image. The opinions of these "experts" are then dynamically weighted and fused to ultimately achieve precise focusing and recognition of subtle local features in the image.
[0019] S1, Image input and multi-level feature encoding.
[0020] In S1, a fine-grained image to be identified is acquired, preprocessed, and feature-encoded to obtain a unified representation containing multi-layer outputs and attention weights.
[0021] Specifically, it includes: S101 Image Segmentation and Embedding; Input image The image is uniformly divided into N non-overlapping patches of size P×P. Each patch is mapped to a D-dimensional embedding vector (Token) through a learnable linear projection layer E, resulting in an image Token sequence. ; S102 Construct model input; Prepend a learnable category token before the image token sequence: Subsequently, trainable positional encodings are superimposed. The initial inputs that constitute the Transformer encoder are: ; S103 multi-layer Transformer encoding; Will Input a standard Vision Transformer (ViT) backbone network with L layers. Each layer l contains a multi-head self-attention (MHSA) module and a feedforward network (MLP) module.
[0022] After forward propagation, the output feature sequence of each layer is obtained: ; And the self-attention weight matrix for each attention head h in each layer: ; Finally, collect the feature sets of all layers. and attention weight set .
[0023] It should be understood that the fine-grained images to be identified in this embodiment can be selected as images collected in scenarios such as retail goods, intelligent traffic monitoring, biological species identification, industrial defect detection, and medical image analysis. They are used for fine-grained classification tasks in the corresponding fields, including accurately distinguishing different subcategories, brands, or models under the same major category of goods, finely identifying vehicle models, vehicle types, and specific traffic signs, distinguishing species or subspecies with similar appearances, identifying the categories of minor defects on the product surface, and assisting in distinguishing similar lesions or microbial categories in medical images. Those skilled in the art can flexibly select suitable scenarios according to actual application needs.
[0024] This embodiment generates a unified representation containing multi-layered output features and attention weights by embedding images into blocks, adding category tokens and location encoding, and combining multi-layer ViT encoding. It achieves weakly supervised feature extraction without additional manual annotation, preserving local image details while aggregating global semantics. This provides multi-dimensional and multi-layered basic feature support for subsequent dynamic expert routing. Simultaneously, it fully collects the attention weights of each layer, laying a data foundation for subsequent key region localization and ensuring the accuracy and effectiveness of subsequent modules.
[0025] S2, Dynamic Expert Routing based on MoE.
[0026] After passing through multiple layers of Transformer encoding and aggregating information from all preceding layers, the final layer's category token, containing global semantic information, is obtained. Based on this Dynamically route to the most relevant level of experts and top experts.
[0027] S201: Hierarchical expert routing.
[0028] Will Input a lightweight hierarchical expert router This router is typically implemented using a multilayer perceptron (MLP), whose output is the raw importance score of each layer. .
[0029] Through the Softmax normalization is performed to obtain the dynamic hierarchical weight distribution. ,satisfy This weight reflects the relative discriminative importance of different Transformer layers for the current input image.
[0030] Due to the final layer category Token It aggregates global semantic information encoded by multiple Transformer layers. The hierarchical expert router learns the association between the input image and the features of each Transformer layer based on this token, and outputs weights normalized by Softmax. These weights quantify the contribution of each layer's features to the fine-grained recognition of the current image, thus enabling dynamic evaluation of the importance of different Transformer layers, allowing the model to accurately focus on key layer features. At the same time, hierarchical expert routing dynamically selects highly important layers and discards redundant layers, reducing ineffective computation while strengthening the utilization of key features, achieving efficient allocation of expert resources. This improves the model's inference efficiency and feature focusing ability while ensuring fine-grained recognition accuracy.
[0031] S202: Head Expert Router.
[0032] Also based on the final-level category Token Through another lightweight router Predict the raw score for each attention head. The core computing module of the router is a two-layer standard MLP, which maps the input features to the raw relevance scores of each expert, providing a basis for subsequent soft / hard routing decisions.
[0033] A Top-k sparsity strategy is adopted, retaining only the k heads with the highest scores and generating a binary mask. The scores after masking are normalized using Softmax to obtain the weight distribution of the activated attention heads. The inactive head has a weight of 0.
[0034] By using a binary mask, based on the global semantic information of the final layer category token, the top-k attention heads most critical for fine-grained recognition of the current image are accurately selected (set to 1), while redundant and invalid heads are masked (set to 0), thus achieving targeted focus of attention resources. At the same time, this mask, in conjunction with head expert routing, allows only high-value attention heads to participate in subsequent weighted fusion, avoiding the redundant overhead of full head computation and enhancing the ability to capture key local features. This achieves efficient allocation and precise utilization of attention resources, thereby reducing the complexity of model inference while ensuring the accuracy of fine-grained recognition in weakly supervised scenarios.
[0035] This embodiment dynamically allocates weights based on the global semantic information of the final layer category token through hierarchical and head expert routing. Hierarchical routing quantifies the contribution of each layer, efficiently filtering key layers and eliminating redundancy; head routing activates the core attention head through Top-k sparsity. The two work together to achieve accurate allocation of expert resources, reducing the complexity of model inference while strengthening the ability to focus on key features, providing targeted expert discrimination support for fine-grained recognition.
[0036] S3, Dynamic Feature Aggregation and Key Region Selection.
[0037] By utilizing the weights obtained from routing, multi-layer and multi-head information is adaptively fused, and key discrimination regions are located.
[0038] S301: MoE cross-layer feature aggregation.
[0039] Based on hierarchical weight distribution We perform a weighted summation of the output feature sequences from all layers to generate a robust cross-layer global feature representation. ; in, It is an optional lightweight feature adaptation layer used to map features from different layers to a unified space. Extraction Category Token Features As an auxiliary monitoring signal.
[0040] S302: Key Token Selection for MoE Bootstrapping
[0041] Combining hierarchical weights and top weight Calculate the importance score for each image Token i. :
[0042] in, This is the attention weight of the category token to the i-th image token in the h-th attention head of the l-th layer. This score incorporates the judgment opinions of all activated experts. Subsequently, the K image tokens with the highest scores are selected as key discrimination regions, and their index set is denoted as . .
[0043] Hierarchical weights quantify the discriminative contribution of each Transformer layer, while head weights filter out effective information from key attention heads. This, combined with the attention weights of category tokens on image tokens, aggregates effective discriminative information from multiple layers and heads. This design allows scores to accurately reflect the degree of attention different "experts" pay to each image region, avoiding the limitations of single-dimensional features and eliminating redundant interference. Thus, it can adaptively locate key regions for fine-grained recognition without manual annotation, strengthening the utilization of core discriminative features and improving the model's adaptability to complex scenes, providing a reliable basis for subsequent accurate classification.
[0044] S303: Cross-layer fusion of key regional features.
[0045] For each selected key token index Extract representations from all corresponding layer features The enhanced key local features are obtained by fusing them according to hierarchical weights.
[0046] This embodiment leverages routing weights to perform cross-layer feature aggregation and key token selection. It generates a robust global representation by fusing multi-layer features through hierarchical weights, and calculates token importance by combining head-level weights and attention weights to accurately locate key discrimination regions. Further cross-layer fusion enhances local feature representation, effectively integrating multi-layer and multi-head discrimination opinions, highlighting the core discriminative information of fine-grained images, improving the discriminative power and specificity of features, and providing high-quality key feature support for final classification.
[0047] S4: Feature Refinement and Classification Output. Integrates global and local information to make the final decision.
[0048] S401: Feature Interaction and Refinement.
[0049] The fused K key local features Category Tokens ultimately output by the backbone network splicing to form a sequence The sequence is then fed into an additional, lightweight Transformer encoding block for deep interaction, modeling the relationships between key regions and their relation to global semantics.
[0050] S402: Classification prediction.
[0051] Extract new category token representations from the refined feature sequence. The data is then fed into a fully connected classifier (Header) to obtain the final fine-grained category prediction results.
[0052] In the training phase of this embodiment, the total loss function consists of three parts: 1. Principal Classification Loss Based on final refined features Calculate the cross-entropy loss.
[0053] 2. Auxiliary classification loss Based on cross-layer aggregation features The calculated cross-entropy loss is used to enhance the utilization of multi-layer information.
[0054] 3. Expert load balancing losses Encourage hierarchical routers and head routers to activate different experts evenly on batch data to prevent routing collapse.
[0055] The total loss is:
[0056] in, It is a hyperparameter that balances the weights of each loss term.
[0057] It should be understood that the specific implementation methods of the main classification loss, auxiliary classification loss and expert load balancing loss are adaptively selected and constructed by those skilled in the art by combining the mainstream loss forms of classification tasks in the prior art (such as cross-entropy loss) and the training paradigm of multi-loss collaboration, and will not be elaborated here.
[0058] This embodiment concatenates key local features with global category tokens, enabling deep interaction through lightweight coding blocks. This modeling of the global and local relationships refines feature representation. A fully connected classifier outputs the prediction results, combining primary classification loss, auxiliary loss, and load balancing loss to ensure model training stability and generalization ability. Ultimately, without additional annotations, it significantly improves the accuracy and robustness of fine-grained classification, achieving efficient transformation from features to decisions.
[0059] Through the above steps, this embodiment can automatically and dynamically integrate discriminative features of different depths and functions in the Transformer, accurately focusing on local regions in the image that are crucial for fine-grained classification, thereby significantly improving recognition performance without additional annotation.
[0060] This specific embodiment dynamically evaluates the discriminative contributions of each network layer and attention head through hierarchical and head expert routing, enabling adaptive adjustment of the input to the feature fusion strategy and solving the problem that static fusion cannot accurately capture local key information. By leveraging cross-layer feature aggregation, key token filtering, and deep interaction, it effectively models the differences in features across multiple layers and heads, suppresses noise accumulation, and establishes an effective adaptive feature filtering mechanism. At the same time, it avoids routing collapse through load balancing loss, improving fine-grained recognition accuracy and robustness while reducing inference complexity, fully releasing the application potential of Vision Transformer in fine-grained recognition scenarios, and improving the model's recognition accuracy and robustness under the challenge of "large intra-class differences and small inter-class differences".
[0061] Example 2 This embodiment provides a fine-grained image recognition system based on multi-layer dynamic expert learning, including: The feature encoding module is configured to process the fine-grained image to be identified into a token sequence, add learnable category and position encoding to obtain an initial feature sequence, input it into the ViT network, and obtain the attention weights and output feature sequences of each layer. The dynamic expert routing module is configured to obtain the final layer category token from the output feature sequence, and input it into the hierarchical expert router and the head expert router respectively to obtain the corresponding hierarchical weight distribution and attention head weight distribution. The region selection and feature fusion module is configured to calculate the importance score of each image token based on two weight distributions, select the K tokens with the highest scores as key discrimination regions, extract feature representations from each layer of key discrimination regions, and fuse them according to hierarchical weights to obtain enhanced key local features; The classification prediction module is configured to concatenate key local features with the final layer category token to form a fused feature sequence, input the encoding block for deep interaction, extract the fused category token, and obtain fine-grained classification results based on the fused category token.
[0062] Example 3 This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of a fine-grained image recognition method based on multi-layer dynamic expert learning as described in Embodiment 1 above.
[0063] Example 4 This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the steps in the fine-grained image recognition method based on multi-layer dynamic expert learning as described in Embodiment 1 above.
[0064] The steps or modules involved in Embodiments 2 to 4 above correspond to those in Embodiment 1. For specific implementation details, please refer to the relevant description section of Embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood as including any medium capable of storing, encoding, or carrying an instruction set for execution by a processor and enabling the processor to perform any of the methods in this invention.
[0065] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A fine-grained image recognition method based on multi-layer dynamic expert learning, characterized in that, include: The fine-grained image to be identified is processed into a token sequence, and learnable category and location codes are added to obtain the initial feature sequence. After inputting into the ViT network, the attention weights and output feature sequences of each layer are obtained. The final layer category token is obtained from the output feature sequence, and then input into the hierarchical expert router and the head expert router respectively to obtain the corresponding hierarchical weight distribution and attention head weight distribution. The importance score of each image token is calculated based on two types of weight distribution, and the K tokens with the highest scores are selected as key discrimination regions. Feature representations are extracted from key discrimination regions at each layer and fused according to hierarchical weights to obtain enhanced key local features; Key local features are concatenated with the final layer category token to form a fused feature sequence, which is then input into the encoding block for deep interaction. The fused category token is extracted, and fine-grained classification results are obtained based on the fused category token.
2. The fine-grained image recognition method based on multi-layer dynamic expert learning as described in claim 1, characterized in that, The process of processing the fine-grained image to be identified into a token sequence specifically includes: uniformly dividing the fine-grained image to be identified into multiple non-overlapping image blocks, converting each image block into an embedding vector through a learnable linear mapping layer, and arranging all the embedding vectors in order to form an image token sequence.
3. The fine-grained image recognition method based on multi-layer dynamic expert learning as described in claim 1, characterized in that, The process of inputting the ViT network and obtaining the attention weights and output feature sequences of each layer specifically includes: inputting the initial feature sequence into the ViT network, performing multi-head self-attention operation and feedforward network operation in sequence at each layer, and obtaining the attention weight matrix of each attention head and the output feature sequence of each layer.
4. The fine-grained image recognition method based on multi-layer dynamic expert learning as described in claim 1, characterized in that, The process of obtaining the final layer category token from the output feature sequence and inputting it into the hierarchical expert router and the head expert router respectively to obtain the corresponding hierarchical weight distribution and attention head weight distribution specifically includes: inputting the final layer category token into a hierarchical expert router composed of a multilayer perceptron to obtain the original importance scores of each layer, and forming the hierarchical weight distribution after normalization processing; Simultaneously, the final layer category token is input into another lightweight router-based head expert router to obtain the original scores of each attention head. The Top-k sparsity strategy is used to filter out key attention heads and generate the corresponding attention head weight distribution.
5. The fine-grained image recognition method based on multi-layer dynamic expert learning as described in claim 1, characterized in that, The calculation of the importance score of each image token based on two types of weight distribution is as follows: ; in, It is the attention weight of the category token to the i-th image token in the h-th attention head of the l-th layer. This represents the total number of layers in the ViT network; This represents the weight of the l-th layer in the hierarchical weight distribution; This represents the h-th attention head weight in the attention head weight distribution; This represents the total number of attention heads in the multi-head self-attention modules of each layer of the ViT network.
6. The fine-grained image recognition method based on multi-layer dynamic expert learning as described in claim 1, characterized in that, The process of concatenating key local features with the final layer category token to form a fused feature sequence, inputting it into the encoding block for deep interaction, extracting the fused category token, and obtaining fine-grained classification results based on the fused category token specifically includes: The enhanced key local features are concatenated with the final layer category token to form a new sequence, which is then input into a lightweight Transformer encoding block to perform deep interaction and relationship modeling between features. The first token is extracted from the sequence after the interaction and used as the fusion category token. Finally, it is input into the classifier to obtain fine-grained recognition results.
7. The fine-grained image recognition method based on multi-layer dynamic expert learning as described in claim 1, characterized in that, The total loss function used during the training phase includes the main classification loss, the auxiliary classification loss, and the expert load balancing loss. Specifically, the calculation of the auxiliary classification loss is as follows: based on the output feature sequence and the hierarchical weight distribution, the features of each layer are weighted and fused to obtain cross-layer global features, the category token features are extracted as auxiliary supervision signals, and the auxiliary classification loss is calculated based on the auxiliary supervision signals.
8. A fine-grained image recognition system based on multi-layer dynamic expert learning, characterized in that, include: The feature encoding module is configured to process the fine-grained image to be identified into a token sequence, add learnable category and position encoding to obtain an initial feature sequence, input it into the ViT network, and obtain the attention weights and output feature sequences of each layer. The dynamic expert routing module is configured to obtain the final layer category token from the output feature sequence, and input it into the hierarchical expert router and the head expert router respectively to obtain the corresponding hierarchical weight distribution and attention head weight distribution. The region selection and feature fusion module is configured to calculate the importance score of each image token based on two types of weight distribution, and select the K tokens with the highest scores as key discrimination regions; Feature representations are extracted from key discrimination regions at each layer and fused according to hierarchical weights to obtain enhanced key local features; The classification prediction module is configured to concatenate key local features with the final layer category token to form a fused feature sequence, input the encoding block for deep interaction, extract the fused category token, and obtain fine-grained classification results based on the fused category token.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps in the fine-grained image recognition method based on multi-layer dynamic expert learning as described in any one of claims 1-7.
10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps in the fine-grained image recognition method based on multi-layer dynamic expert learning as described in any one of claims 1-7.