A visual transformer-based model and method for extracting multi-granularity characteristics of rapeseed
By using a visual Transformer-based multi-granularity trait feature extraction model for rapeseed, and leveraging primitive feature fusion and multi-head attention mechanisms, the problem of multi-scale and multi-granularity feature extraction of rapeseed traits in existing technologies is solved, achieving efficient and accurate rapeseed trait analysis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOUTHWEST UNIV
- Filing Date
- 2026-04-23
- Publication Date
- 2026-07-31
AI Technical Summary
Existing technologies struggle to effectively extract multi-scale and multi-granular features of rapeseed traits from complex multimodal remote sensing images, failing to meet the needs of refined phenotypic analysis of rapeseed.
A multi-granularity trait feature extraction model for rapeseed based on visual Transformer is adopted. Through single-granularity and multi-granularity visual reasoning modules, combined with primitive feature fusion mechanism and multi-head attention mechanism, a fused feature tensor representing global information of the boundary domain is generated to realize multi-granularity feature extraction.
It improves the accuracy and efficiency of rapeseed trait feature extraction, enables refined analysis of multi-granular features without sacrificing model efficiency, reduces the cost and subjectivity of manual annotation, and improves computational efficiency and accuracy.
Smart Images

Figure CN122493312A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of remote sensing image processing technology, and in particular to a model and method for extracting multi-granularity trait features of rapeseed based on visual Transformer. Background Technology
[0002] Rapeseed is an important oilseed crop in my country. At different growth stages, it exhibits multi-granular traits such as leaf shape, flower quantity, structural texture, and edge contour. These traits are crucial for rapeseed breeding improvement, planting density control, and yield assessment. With the development of UAV remote sensing technology, using UAVs to acquire multimodal rapeseed images and automatically analyze their trait characteristics has become an important direction in agricultural intelligence research.
[0003] Existing methods for acquiring rapeseed traits mainly fall into two categories: manual measurement and automatic extraction based on convolutional neural networks (CNNs). Manual measurement relies on human observation and recording, which is inefficient, labor-intensive, and easily affected by subjective human factors, making it difficult to meet the needs of refined trait monitoring in large-scale rapeseed fields. Trait extraction methods based on CNNs can automatically identify local features of rapeseed from remote sensing images; however, due to the inherent limitation of the local receptive field in CNNs, the same model struggles to simultaneously capture multi-granularity trait features exhibited by rapeseed at different growth stages. Furthermore, rapeseed traits show significant differences in time and space, and traditional convolutional structures also have limitations in modeling spatiotemporal variations.
[0004] Although existing technologies have improved feature extraction capabilities by increasing network depth, expanding convolutional kernels, or fusing multi-scale convolutional modules, they still struggle to effectively extract multi-scale, multi-granular features of rapeseed traits from complex multimodal remote sensing images, failing to meet the practical needs of refined phenotypic analysis of rapeseed. Therefore, a technical solution that can adapt to multi-granular feature representation and improve the accuracy of rapeseed trait extraction is still needed. Summary of the Invention
[0005] The purpose of this invention is to provide a multi-granularity trait feature extraction model and method for rapeseed based on visual Transformer. For remote sensing images of rapeseed at different growth stages, a multi-granularity trait feature extraction model for rapeseed based on visual Transformer is trained, and an extraction method using the multi-granularity trait feature extraction model for rapeseed is proposed. The feature extraction model is used to extract trait features from the rapeseed remote sensing images to be processed, effectively improving the precision of the features without sacrificing the efficiency of the model.
[0006] To achieve the above objectives, this invention provides a multi-granularity trait feature extraction model for rapeseed based on visual Transformer, including a single-granularity visual inference module and a multi-granularity visual inference module. The multi-granularity visual reasoning module includes: The multi-granularity segmentation submodule is used to analyze the image blocks split by the single-granularity visual reasoning module, and divides the image blocks into detail image blocks, contour image blocks and environment image blocks according to the amount of effective information. The primitive feature fusion submodule contains a primitive feature hierarchical mechanism and a primitive feature fusion mechanism. The primitive feature fusion mechanism utilizes a neural tensor network to extract the nonlinear long-range dependencies between different primitives and different feature channels within the boundary domain, generating a fused feature tensor that can represent the global information of the boundary domain; and... Multiple Transformer encoding layers.
[0007] Furthermore, the single-granularity visual reasoning module includes: Coarse-grained block embedding layers are used to convert pixels into high-dimensional feature vectors; and, Multiple Transformer encoding layers.
[0008] The present invention provides a rapeseed multi-granularity trait feature extraction model based on visual Transformer. In the single-granularity visual inference module, a coarse-grained block embedding layer is used to achieve fast feature extraction. In the multi-granularity visual inference module, fine feature analysis is achieved through multi-granularity segmentation and primitive feature fusion. With the help of the global interaction capability of the self-attention layer and the feature deepening capability of the feedforward network, deep learning is performed on the features of different rapeseed traits. The most representative trait features are learned from the training set. Then, through multi-granularity feature fusion, an accurate mapping from rapeseed images to multi-granularity trait features is established, which can achieve efficient multi-granularity feature extraction.
[0009] Furthermore, the primitive feature hierarchical mechanism includes: Detail image patches are segmented into 3×3 blocks to obtain primitives and thus detail feature information; The contour image block is segmented into 2×2 segments to obtain primitives that capture contour shape information; Environmental image blocks are directly used as individual primitives.
[0010] Furthermore, the primitive feature fusion mechanism specifically includes the following steps: All primitive features in the boundary domain are organized into a second-order tensor according to their original embedding sequence and feature dimension. By combining the head dimension in the multi-head attention mechanism, it is extended to a third-order tensor; The initial tensor is decomposed into a low-rank value using the neural tensor decomposition operator. During the decomposition process, the neural tensor decomposition operator uses a neural tensor network to extract the nonlinear long-range dependencies between different primitives and between different feature channels within the boundary domain, generating a fused feature tensor that represents the global information of the boundary domain.
[0011] The third-order tensor In the formula, N The number of boundary domain primitives, H For the number of attention heads, D The feature dimensions for each head.
[0012] In the positive domain, primitive features have very low mutual information and are directly used for task decision-making. Primitive features in the negative domain have high redundancy and are directly merged into a single primitive feature. However, for primitive features in the boundary domain, it is difficult to simply determine their importance to the decision. Therefore, a primitive feature fusion mechanism is designed to organize all primitive features in the boundary domain according to their original embedding sequence and feature dimensions into a second-order tensor, and further expand it into a third-order tensor by combining the head dimension from a multi-head attention mechanism. (in N The number of boundary domain primitives, H For the number of attention heads, D (Each head has a feature dimension). Subsequently, a neural tensor decomposition operator is used to perform low-rank decomposition on the initial tensor. During the decomposition process, the operator uses a neural tensor network to extract nonlinear long-range dependencies between different primitives and between different feature channels within the boundary domain, removes redundant components and noise in the feature dimensions, and generates a fused feature tensor that can represent the global information of the boundary domain. The primitive feature fusion submodule effectively avoids the randomness of manually setting similarity thresholds while reducing the number of primitives. By utilizing the low-rank approximation properties of tensors, it significantly compresses the primitive scale while accurately restoring and preserving the key discriminative features of rapeseed traits (such as silique length and plant branching) in the deep feature space through core tensors, thereby significantly improving the accuracy and computational efficiency of subsequent decision-making tasks.
[0013] This invention also discloses a method for extracting multi-granularity trait features of rapeseed based on visual Transformer, comprising the following steps: S1: Create the training dataset; S2: Build a multi-granularity visual Transformer model and set the initial parameters of the model. The multi-granularity visual Transformer model includes a single-granularity visual inference module and a multi-granularity visual inference module. S3: Based on the set model training parameters, train the multi-granularity visual Transformer model with the goal of minimizing the loss function, and complete the construction of the rapeseed multi-granularity trait feature extraction model; S4: Input the rapeseed remote sensing image to be processed into the rapeseed multi-granularity trait feature extraction model to output multi-granularity trait features.
[0014] The present invention provides a method for extracting multi-granularity trait features of rapeseed based on visual Transformer. It adopts a feature extraction model architecture that includes two visual neural network modules: single-granularity visual reasoning and multi-granularity visual reasoning. A deep neural network model is created and trained using a dataset of rapeseed remote sensing images. The model accurately learns the multi-granularity trait features of rapeseed and establishes a mapping from rapeseed remote sensing images to multi-granularity trait features. Thus, the learned mapping can be used to extract the corresponding multi-granularity trait features of rapeseed based on the input rapeseed remote sensing image.
[0015] Furthermore, step S1 specifically includes acquiring remote sensing images of rapeseed at different growth stages, performing image preprocessing and manual labeling, and creating a training dataset.
[0016] The image preprocessing and manual labeling include converting the rapeseed remote sensing image into standard image data through size normalization, and distinguishing the growth stage of the rapeseed standard image data through manual labeling.
[0017] Since the growth stages of rapeseed are divided into germination, seedling, budding, flowering, and maturity, using image data with uniform size makes it easier for the model to mine the corresponding traits of rapeseed at different stages, which can speed up the training process and improve the feature extraction performance to some extent.
[0018] In step S2, the single-granularity visual reasoning module includes a coarse-grained block embedding layer and multiple Transformer encoding layers. The coarse-grained block embedding layer is used to convert pixels into high-dimensional feature vectors.
[0019] Furthermore, in step S3, the loss function to be minimized is selected as a combination of cross-entropy loss and KL divergence: in, , These are the output features of the single-granularity visual reasoning module and the multi-granularity visual reasoning module, respectively. This is a true label for the characteristics of rapeseed. For cross-entropy loss, Let KL divergence be denoted as KL divergence.
[0020] Furthermore, the optimizer for training the neural network is the Adam optimizer. When optimizing network parameters, the Adam optimizer calculates the first momentum of the gradient and the second momentum of the squared gradient when calculating the iteration step size.
[0021] When optimizing network parameters, the Adam optimizer incorporates the first-order momentum (exponential moving average of the gradient) and the second-order momentum (exponential moving average of the squared gradient) of the gradient into the calculation of the iteration step size. This ensures that the first-order and second-order momentum of the gradient are adaptively adjusted during each iteration optimization, effectively preventing the neural network model from converging to a local optimum during optimization and accelerating the overall optimization efficiency.
[0022] This invention discloses a rapeseed multi-granularity trait feature extraction model based on visual Transformer. It employs a feature extraction model architecture including a single-granularity visual inference module and a multi-granularity visual inference module. The model is trained using a created rapeseed remote sensing image training dataset to accurately learn rapeseed multi-granularity trait features, establishing a mapping from rapeseed remote sensing images to multi-granularity trait features. The invention also discloses a rapeseed multi-granularity trait feature extraction method, enabling the extraction of corresponding rapeseed multi-granularity trait features from input rapeseed remote sensing images using the learned mapping. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart of a method for extracting multi-granularity trait features of rapeseed based on visual Transformer according to the present invention.
[0025] Figure 2 This is a schematic diagram illustrating the mechanism of the single-granularity visual reasoning module and the multi-granularity visual reasoning module in the embodiments of the present invention.
[0026] Figure 3 This is a flowchart of the primitive feature fusion mechanism in the multi-granularity visual reasoning module of this invention. Detailed Implementation
[0027] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.
[0028] Please see Figures 1 to 3This invention provides a multi-granularity trait feature extraction model for rapeseed based on visual Transformer, including a single-granularity visual inference module and a multi-granularity visual inference module; The multi-granularity visual reasoning module includes: The multi-granularity segmentation submodule is used to analyze the image blocks split by the single-granularity visual reasoning module, and divides the image blocks into detail image blocks, contour image blocks and environment image blocks according to the amount of effective information. The primitive feature fusion submodule includes a primitive feature hierarchical mechanism and a primitive feature fusion mechanism. The primitive feature hierarchical mechanism divides primitive features into positive, negative, and boundary domains. The primitive feature fusion mechanism utilizes a neural tensor network to extract nonlinear long-range dependencies between different primitives and different feature channels within the boundary domain, generating a fused feature tensor that represents the global information of the boundary domain. Multiple Transformer encoding layers.
[0029] Single-granularity visual reasoning module, including: Coarse-grained block embedding layers are used to convert pixels into high-dimensional feature vectors; and, Multiple Transformer encoding layers.
[0030] This invention provides a method for extracting multi-granularity trait features of rapeseed based on visual Transformer, comprising the following steps: S1: Create the training dataset; S2: Build a multi-granularity visual Transformer model and set the initial parameters of the model. The multi-granularity visual Transformer model includes a single-granularity visual inference module and a multi-granularity visual inference module. S3: Based on the set model training parameters, train the multi-granularity visual Transformer model with the goal of minimizing the loss function, and complete the construction of the rapeseed multi-granularity trait feature extraction model; S4: Input the rapeseed remote sensing image to be processed into the rapeseed multi-granularity trait feature extraction model to output multi-granularity trait features.
[0031] Step S1, which involves creating a training dataset, further involves collecting remote sensing images of rapeseed at different growth stages, performing image preprocessing and manual labeling, and creating the training dataset. Rapeseed has a long growth cycle, typically 180-240 days (winter rapeseed), going through germination, seedling, budding, flowering, and maturity stages, exhibiting a characteristic of alternating vegetative and reproductive growth: early stage of root and leaf development, mid-stage of flower bud formation, and late stage of pod formation. Images of rapeseed at different stages themselves show significant differences. Labeling the growth stages allows the model to be trained to capture these features automatically, which is the fundamental purpose of this invention. It also simplifies the tedious labeling process.
[0032] The multi-granularity visual Transformer model constructed in step S2 includes a single-granularity visual inference module and a multi-granularity visual inference module. The single-granularity visual inference module includes a coarse-grained block embedding layer and multiple Transformer encoding layers. The multi-granularity visual inference module includes a multi-granularity segmentation submodule, a primitive feature fusion submodule, and multiple Transformer encoding layers. According to the feature extraction method of the present invention, the multi-granularity visual Transformer model trained by the invention can process rapeseed images at a very fast speed and can complete feature extraction in a short time under most hardware conditions, which has great advantages in practical applications.
[0033] Step S3 further involves training the multi-granularity visual Transformer model based on the multi-granularity visual Transformer model and its training parameters, with the goal of minimizing the loss function, to form a rapeseed multi-granularity trait feature extraction model. Step S4 further involves preprocessing the rapeseed remote sensing image to be processed and then inputting it into the feature extraction model to output multi-granularity trait features.
[0034] Please see Figure 2 In one embodiment, the single-granularity visual inference module performs coarse-grained segmentation of the rapeseed remote sensing image to be processed into multiple image patches. These patches are then serialized and embedded into a single image patch representation. Multiple Transformer encoding layers then perform visual inference to obtain a single-granularity visual feature representation. Based on this feature representation, the model determines whether to accept the current single-granularity classification result based on whether the confidence level of the classification result exceeds a given threshold. If the confidence level is higher than the given threshold, the extracted trait features from the single-granularity model are directly accepted; if it is lower than the threshold, the multi-granularity visual inference module performs analysis and shape feature extraction.
[0035] Please see Figure 2 In one embodiment, the multi-granularity segmentation submodule analyzes the image blocks segmented by the single-granularity visual reasoning module, classifying them into three categories based on the effective information content of the image blocks: detail image blocks, contour image blocks, and environment image blocks. The detail image blocks are further segmented into 3×3 to obtain primitives and capture detailed feature information. The contour image blocks are segmented into 2×2 to capture contour feature information. The environment image blocks are directly used as individual primitives. The primitive feature fusion submodule consists of a primitive feature hierarchical mechanism and a primitive feature fusion mechanism. The primitive feature hierarchical mechanism divides primitive features into three groups: positive domain, negative domain, and boundary domain, in order to perform appropriate feature extraction and analysis.
[0036] Please see Figure 2 and Figure 3In another embodiment, the primitive feature grading mechanism divides primitive features into three groups—positive, negative, and boundary regions—by calculating attention scores and combining them with three-way decision theory. The attention score is calculated by starting from the third layer of the Transformer, using a global attention score, specifically: in It is the attention score of layer l. yes Layer attention score It is the original attention score of layer l.
[0037] In the positive domain, primitive features have very low mutual information and are directly used for task decision-making. Primitive features in the negative domain have high redundancy and are directly merged into a single primitive feature. However, for primitive features in the boundary domain, it is difficult to simply determine their importance to the decision. Therefore, this invention discloses a primitive feature fusion mechanism based on neural tensor decomposition: Specifically, the primitive feature fusion submodule first organizes all primitive features in the boundary domain according to their original embedding sequence and feature dimensions to form a second-order tensor, and further expands it into a third-order tensor by combining the head dimension from the multi-head attention mechanism. (in N The number of boundary domain primitives, H For the number of attention heads, D (Each head has a feature dimension). Subsequently, a neural tensor decomposition operator is used to perform low-rank decomposition on this initial tensor. This operator autonomously learns through a tensor neural network architecture to obtain basis vector matrices corresponding to primitive indices, attention heads, and feature dimensions, as well as a neural kernel tensor representing the core semantic coupling relationship among the three, thus mapping the original high-dimensional redundant features to a low-dimensional neural latent space. During the decomposition process, the operator uses a neural tensor network to extract nonlinear long-range dependencies between different primitives and between different feature channels within the boundary domain, eliminating redundant components and noise in the feature dimensions, and generating a fused feature tensor that can represent the global information of the boundary domain. This approach effectively avoids the randomness of manually setting similarity thresholds. Utilizing the low-rank approximation properties of tensors, while significantly compressing the primitive scale, the core tensor accurately restores and preserves the key discriminative features of rapeseed traits (such as silique length and plant branching) in the deep feature space, thereby significantly improving the accuracy and computational efficiency of subsequent decision-making tasks.
[0038] In another embodiment, step S2 further includes: converting the rapeseed remote sensing image into standard image data through size normalization. This is because a unified size makes it easier for the model to mine features of different rapeseed traits, accelerating training speed and improving feature extraction performance to some extent. Since the input data is an RGB image, the number of input data channels is 3. Then, the output dimension of the coarse-grained patch embedding layer is set to C=384, the purpose of which is to convert patch pixels into high-dimensional feature vectors, improving the model's ability to learn rapeseed traits. The number of layers L of the single-granularity visual inference module Transformer is set to 12, used for global interaction of coarse-grained features. This processing can effectively improve the accuracy of model learning. Correspondingly, the token dimension after multi-granularity segmentation in the multi-granularity visual inference module is set to 512, used to fuse fine-grained details with global features. The neural network learning rate is set to 0.001, and in other embodiments, it can be any value between 0.1 and 0.001, optimized according to the actual situation.
[0039] In another embodiment, in step S2, a dataset of rapeseed remote sensing images with different growth cycles is selected, and a multi-granularity visual Transformer model is trained according to the method described in step S3. In step S4, the rapeseed remote sensing images to be processed are input into the corresponding model to extract the corresponding multi-granularity trait features and output the trait feature data of rapeseed.
[0040] The initial values of the model weights are generated by a Gaussian random function. The scaling factor of the residual connection in each Transformer module is initially set to 1 to ensure that the residual branch is initially an identity mapping and that the Transformer module initially exhibits feature preservation from input to output.
[0041] The multi-granularity segmentation design provided by this invention can effectively improve the fineness of features without sacrificing model efficiency. The primitive feature fusion strategy can effectively avoid the inference speed reduction problem caused by multi-granularity primitive features without increasing additional computation, thus enjoying the accuracy improvement brought by multi-granularity features while ensuring model efficiency. Simultaneously, the introduction of global attention scoring can automatically distinguish key trait regions of rapeseed without introducing additional annotations, effectively avoiding the increased costs and strong subjectivity problems caused by manual annotation.
[0042] This invention presents a method for extracting multi-granularity trait features of rapeseed based on a visual Transformer. This method combines a visual Transformer with a two-stage inference architecture. In the single-granularity visual inference module, coarse-grained patches are used for rapid feature extraction. In the multi-granularity visual inference module, multi-granularity segmentation and primitive feature fusion are used for fine-grained feature analysis. Leveraging the global interaction capabilities of the self-attention layer and the feature deepening capabilities of the feedforward network, deep learning is performed on the features of different rapeseed traits. The most representative trait features are learned from the training set. Then, through multi-granularity feature fusion, an accurate mapping from rapeseed images to multi-granularity trait features is established. A deep neural network model is created by combining mechanisms such as category attention hierarchical classification, block fine-grained segmentation, and primitive merging. The model is trained on a training dataset of rapeseed remote sensing images to accurately learn the multi-granularity trait features of rapeseed, establishing a mapping from rapeseed remote sensing images to multi-granularity trait features. This allows for the extraction of corresponding multi-granularity trait features of rapeseed based on the input rapeseed remote sensing image using the learned mapping. This achieves efficient multi-granularity feature extraction. Among them, the residual connection in the model structure can directly superimpose the input and output of the Transformer layer to preserve the initial features, improve the stability of the network, and effectively avoid the gradient vanishing problem.
[0043] The above-disclosed embodiments are merely some preferred embodiments of the present invention and should not be construed as limiting the scope of the present invention. Those skilled in the art will understand that implementing all or part of the above-described embodiments and making equivalent changes in accordance with the claims of the present invention are still within the scope of the invention.
Claims
1. A multi-granularity trait feature extraction model for rapeseed based on visual Transformer, characterized in that, It includes single-granularity visual reasoning modules and multi-granularity visual reasoning modules; The multi-granularity visual reasoning module includes: The multi-granularity segmentation submodule is used to analyze the image blocks split by the single-granularity visual reasoning module, and divides the image blocks into detail image blocks, contour image blocks and environment image blocks according to the amount of effective information. The primitive feature fusion submodule includes a primitive feature hierarchical mechanism and a primitive feature fusion mechanism. The primitive feature hierarchical mechanism divides primitive features into positive, negative, and boundary domains. The primitive feature fusion mechanism utilizes a neural tensor network to extract nonlinear long-range dependencies between different primitives and different feature channels within the boundary domain, generating a fused feature tensor that represents the global information of the boundary domain. Multiple Transformer encoding layers.
2. The rapeseed multi-granularity trait feature extraction model based on visual Transformer as described in claim 1, characterized in that, The single-granularity visual reasoning module includes: Coarse-grained block embedding layers are used to convert pixels into high-dimensional feature vectors; and, Multiple Transformer encoding layers.
3. The rapeseed multi-granularity trait feature extraction model based on visual Transformer as described in claim 1, characterized in that, The primitive feature hierarchical mechanism includes: Detail image patches are segmented into 3×3 blocks to obtain primitives and thus detail feature information; The contour image block is segmented into 2×2 segments to obtain primitives that capture contour shape information; Environmental image blocks are directly used as individual primitives.
4. The rapeseed multi-granularity trait feature extraction model based on visual Transformer as described in claim 1, characterized in that, The primitive feature fusion mechanism specifically includes the following steps: All primitive features in the boundary domain are organized into a second-order tensor according to their original embedding sequence and feature dimension. By combining the head dimension in the multi-head attention mechanism, it is extended to a third-order tensor; The initial tensor is decomposed into a low-rank value using the neural tensor decomposition operator. During the decomposition process, the neural tensor decomposition operator uses a neural tensor network to extract the nonlinear long-range dependencies between different primitives and between different feature channels within the boundary domain, generating a fused feature tensor that represents the global information of the boundary domain.
5. The rapeseed multi-granularity trait feature extraction model based on visual Transformer as described in claim 1, characterized in that, The third-order tensor In the formula, N The number of boundary domain primitives, H For the number of attention heads, D The feature dimensions for each head.
6. A method for extracting multi-granularity trait features of rapeseed based on a visual Transformer-based multi-granularity trait feature extraction model according to any one of claims 1 to 5, characterized in that, Includes the following steps: S1: Create the training dataset; S2: Build a multi-granularity visual Transformer model and set the initial parameters of the model. The multi-granularity visual Transformer model includes a single-granularity visual inference module and a multi-granularity visual inference module. S3: Based on the set model training parameters, train the multi-granularity visual Transformer model with the goal of minimizing the loss function, and complete the construction of the rapeseed multi-granularity trait feature extraction model; S4: Input the rapeseed remote sensing image to be processed into the rapeseed multi-granularity trait feature extraction model to output multi-granularity trait features.
7. The method for extracting multi-granularity trait features of rapeseed based on visual Transformer as described in claim 6, characterized in that, Step S1 specifically includes acquiring remote sensing images of rapeseed at different growth stages, performing image preprocessing and manual labeling, and creating a training dataset.
8. The method for extracting multi-granularity trait features of rapeseed based on visual Transformer as described in claim 7, characterized in that, The image preprocessing and manual labeling include converting the rapeseed remote sensing image into standard image data through size normalization, and distinguishing the growth stage of the rapeseed standard image data through manual labeling.
9. The method for extracting multi-granularity trait features of rapeseed based on visual Transformer as described in claim 6, characterized in that, In step S2, the single-granularity visual reasoning module includes a coarse-grained block embedding layer and multiple Transformer encoding layers. The coarse-grained block embedding layer is used to convert pixels into high-dimensional feature vectors.
10. The method for extracting multi-granularity trait features of rapeseed based on visual Transformer as described in claim 6, characterized in that, In step S3, the loss function to be minimized is selected as a combination of cross-entropy loss and KL divergence: in, , These are the output features of the single-granularity visual reasoning module and the multi-granularity visual reasoning module, respectively. This is a true label for the characteristics of rapeseed. For cross-entropy loss, Let KL divergence be denoted as KL divergence.