Barley seed fine particle classification method, system, electronic device and storage medium
Patent Information
- Application Number
- CN202610822178.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-09
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2046-06-09
AI Technical Summary
[0005]为了解决现有RGB机器视觉方法识别形态高度相似的大麦品种时,抗干扰能力弱、分类精度不足的问题,本发明提供了大麦种子细粒度分类方法、系统、电子设备及存储介质,具体方案如下:
[0011] This results in a progressive feature extraction structure that moves from shallow to deep and from coarse to fine. It can quickly extract basic features such as barley seed outline and color at the shallow layer, and fully explore subtle and high-dimensional features such as seed coat texture and ventral groove morphology at the deep layer. Combined with the LRSG frequency domain enhancement module embedded in each layer, it significantly improves the fine-grained discrimination ability for highly similar barley varieties. This layer ratio is a natural match for DenseNet161, ensuring smooth feature transfer, stable gradients, and efficient model convergence. It avoids feature degradation or overfitting caused by an unreasonable number of layers, further improving classification accuracy and robustness.
Smart Images

Figure CN122368659B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method, system, electronic device, and storage medium for fine-grain size classification of barley seeds, belonging to the field of intelligent detection technology for agricultural seeds. Background Technology
[0002] Barley is an essential raw material for beer brewing and malt processing. Its varietal purity directly affects the quality of malt processing, enzyme activity, protein composition, saccharification efficiency, and the final flavor stability of beer. Therefore, rapid, accurate, and non-destructive identification of barley seed varieties is of great significance before large-scale malting or seed distribution.
[0003] Current methods for identifying barley varieties mainly include manual morphological observation, biochemical detection, molecular marker detection, and machine vision detection. Manual morphological observation relies on expert experience and is easily affected by environment, maturity, seed posture, and subjective judgment. While biochemical and molecular detection methods are highly accurate, they typically suffer from long detection cycles, high costs, complex operations, or destructive nature, making them unsuitable for large-scale real-time screening. In recent years, seed identification methods based on RGB images and deep learning have gradually developed, offering advantages such as low cost, non-destructive nature, and automation. However, existing convolutional neural networks primarily focus on spatial domain features such as shape, color, and macroscopic texture, failing to adequately utilize high-frequency information such as the fine texture of the barley seed coat, ventral groove structure, and surface wrinkles.
[0004] For closely related barley varieties with extremely similar appearances, relying solely on spatial domain appearance features can easily lead to class confusion. Although hyperspectral or near-infrared hyperspectral imaging can provide richer spectral information, the related equipment is expensive, data processing is complex, and deployment costs are high, which is not conducive to portable and high-throughput applications. Therefore, there is an urgent need for a fine-grained classification method for barley seeds that can fully extract subtle textures and frequency domain features of seeds based on ordinary RGB images under low-cost conditions. Summary of the Invention
[0005] To address the issues of weak anti-interference capability and insufficient classification accuracy in existing RGB machine vision methods when identifying barley varieties with highly similar morphologies, this invention provides a fine-grained classification method, system, electronic device, and storage medium for barley seeds. The specific solution is as follows: In a first aspect, the present invention provides a method for fine-grain size classification of barley seeds, comprising: Step 1: Acquire RGB images of barley seeds and perform preprocessing; Step 2: Construct the LRSG-DenseNet classification model and perform feature extraction and classification; The LRSG-DenseNet classification model uses DenseNet161 as the backbone network for spatial feature extraction. The input is a preprocessed RGB image of barley seeds. The image is sequentially processed through convolution, normalization, activation, max pooling, and several DenseBlock modules for multi-level spatial feature extraction. An LRSG module is embedded after each DenseBlock module and before the Transition layer. The LRSG module performs a two-dimensional real-valued Fast Fourier Transform on the input features, mapping the spatial domain features to the frequency domain, based on the current feature channel index. c Frequency domain pseudo-radial frequency index From the learnable spectral parameter matrix The weight values of the matching positions are extracted from the index, converted into frequency domain gating coefficients through an activation function, and the amplitude spectrum is adaptively enhanced and suppressed, as shown below:
[0006] in, and These represent the amplitude spectra before and after recalibration, respectively. u , v ( ) represents the frequency domain coordinates. Use the Sigmoid activation function; After recalibration, the amplitude spectrum Global average pooling is performed to obtain channel description vectors, which are then used to generate channel attention vectors via a multilayer perceptron. Finally, residual fusion is used to fuse the channel attention vectors with the original spatial features to obtain fused features.
[0007] Thus, this invention embeds an LRSG module between the DenseBlock and Transition layers of the DenseNet161 backbone network, mapping spatial features to the frequency domain via a two-dimensional real-valued Fast Fourier Transform. Based on the feature channel index and pseudo-radial frequency index, it adaptively generates frequency domain gating coefficients using a learnable spectral parameter matrix to achieve amplitude spectrum enhancement and suppression. The resulting spatial feature is then obtained through global average pooling, a multilayer perceptron, and residual fusion. Frequency domain collaborative features can significantly improve the model's ability to perceive high-frequency features such as barley seed coat texture, ventral groove structure, and fine surface texture, while reducing phase shift and background noise interference. This effectively solves the technical problems of insufficient accuracy and easy confusion in the identification of similar barley varieties by traditional spatial domain convolutional networks. At the same time, this method can achieve fine-grained classification based on ordinary RGB images only, without the need for expensive equipment such as hyperspectral imaging. It has the advantages of high recognition accuracy, strong anti-interference, low deployment cost, and suitability for high-throughput non-destructive testing.
[0008] Optionally, the LRSG-DenseNet classification model includes four DenseBlock modules.
[0009] Thus, LRSG The DenseNet classification model is structured with four DenseBlock modules. This structure ensures multi-level and multi-scale spatial feature extraction while enabling the network to synergistically enhance spatial and frequency domain features at different feature levels. It fully preserves the DenseNet backbone network's ability to extract features such as seed outlines, textures, and local details. Furthermore, through four-level progressive feature abstraction and frequency domain adaptive perception, it improves the model's ability to capture subtle differences among similar barley varieties and enhances classification stability. This avoids insufficient representation due to too few feature levels or computational redundancy due to too many levels, thus balancing recognition accuracy and model efficiency.
[0010] Optionally, the number of DenseBlock layers in the four DenseBlock modules are 6, 12, 36, and 24, respectively.
[0011] This results in a progressive feature extraction structure that moves from shallow to deep and from coarse to fine. It can quickly extract basic features such as barley seed outline and color at the shallow layer, and fully explore subtle and high-dimensional features such as seed coat texture and ventral groove morphology at the deep layer. Combined with the LRSG frequency domain enhancement module embedded in each layer, it significantly improves the fine-grained discrimination ability for highly similar barley varieties. This layer ratio is a natural match for DenseNet161, ensuring smooth feature transfer, stable gradients, and efficient model convergence. It avoids feature degradation or overfitting caused by an unreasonable number of layers, further improving classification accuracy and robustness.
[0012] Optionally, the images acquired in step 1 include top views and side views.
[0013] In this way, by simultaneously acquiring top and side views of barley seeds, it is possible to obtain complete multi-directional morphological features such as seed projection shape, ventral groove structure, dorsal texture, side contour and edge texture. This overcomes the problems of incomplete information from a single viewpoint and easy recognition deviation caused by differences in seed posture, providing the model with more comprehensive and richer feature input, and significantly improving the recognition accuracy and robustness of barley varieties with highly similar morphologies.
[0014] Optionally, the frequency domain coordinates ( u , v The corresponding Manhattan distance calculation formula is: The distance values are cropped to 128 as the frequency index, and the dimension of the learnable spectrum parameter matrix is set to... .
[0015] Thus, a pseudo-radial frequency index is constructed using Manhattan distance and then pruned to 128, with a matching dimension of... CThe learnable spectral parameter matrix of ×128 can efficiently and concisely group and weight frequency domain features, significantly reducing frequency dimension and computational complexity while ensuring complete expression of frequency domain information. This setting enables the model to accurately locate effective frequency bands related to barley seed texture, adaptively enhance subtle texture features, suppress noise and redundant frequency interference, and improve the targeting of frequency domain enhancement and model classification accuracy.
[0016] Optionally, the calculation formula for the fusion feature is: Y = X + X ⊙ a in, X Represents the original spatial characteristics. a This represents the channel attention vector.
[0017] In this way, the channel attention vector is weighted and fused with the original spatial features, which can not only fully preserve the semantic information and contour structure features of the original spatial domain, but also fully introduce the texture detail weights after frequency domain enhancement, so as to achieve efficient complementarity between spatial features and frequency domain features. This residual structure can avoid feature loss and gradient vanishing, improve feature representation ability and model convergence stability, and further enhance the fine-grained recognition accuracy of subtle differences in barley seeds.
[0018] Optionally, the LRSG-DenseNet classification model uses a two-layer multilayer perceptron to generate channel attention vectors.
[0019] Thus, by using a two-layer multilayer perceptron to generate channel attention vectors, it is possible to perform nonlinear mapping and adaptive learning of channel weights on frequency domain features with low parameters and low computational overhead. This accurately highlights effective feature channels related to barley seed texture, ventral groove, and seed coat details, while suppressing interference from ineffective channels. The two-layer structure avoids the problems of insufficient feature expression due to an overly shallow network and overfitting due to an overly deep network, thereby improving the representational ability of channel attention and the generalization of the model, and further ensuring the stability and accuracy of fine-grained classification.
[0020] In a second aspect, the present invention provides a barley seed fine-grained classification system, the system being configured to implement the barley seed fine-grained classification method as described in any of the preceding claims, comprising: The image acquisition module is configured to acquire RGB images of barley seeds and perform preprocessing. The LRSG-DenseNet classification module is configured to build an LRSG-DenseNet classification model and perform feature extraction and classification. The LRSG-DenseNet classification model uses DenseNet161 as the backbone network for spatial feature extraction. The input is a preprocessed RGB image of barley seeds. The image is sequentially processed through convolution, normalization, activation, max pooling, and several DenseBlock modules for multi-level spatial feature extraction. An LRSG module is embedded after each DenseBlock module and before the Transition layer. The LRSG module performs a two-dimensional real-valued Fast Fourier Transform on the input features, mapping the spatial domain features to the frequency domain, based on the current feature channel index. c Frequency domain pseudo-radial frequency index From the learnable spectral parameter matrix The weight values of the matching positions are extracted from the index, converted into frequency domain gating coefficients through an activation function, and the amplitude spectrum is adaptively enhanced and suppressed, as shown below:
[0021] in, and These represent the amplitude spectra before and after recalibration, respectively. u , v ( ) represents the frequency domain coordinates. Use the Sigmoid activation function; After recalibration, the amplitude spectrum Global average pooling is performed to obtain channel description vectors, which are then used by a multilayer perceptron to generate channel attention vectors. Finally, residual fusion is used to fuse the channel attention vectors with the original spatial features to obtain fused features.
[0022] Through the image acquisition module and LRSG The DenseNet classification module, working in tandem, can automate, standardize, and achieve high throughput in the entire process of barley seed image acquisition, preprocessing, feature extraction, and variety classification, and can stably reproduce spatial data. The system features fine-grained recognition capabilities through frequency domain collaborative sensing. It boasts low deployment costs, strong compatibility, and stable operation, and can be directly applied to scenarios such as seed purity detection, rapid variety identification, and intelligent sorting, significantly improving the efficiency and accuracy of barley seed detection.
[0023] Thirdly, the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the barley seed fine-grain classification method as described in any of the preceding claims.
[0024] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the steps of the barley seed fine-grain classification method as described in any of the preceding claims. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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.
[0026] Figure 1 This is a schematic diagram of the barley seed image acquisition and dual-view data construction process of the present invention.
[0027] Figure 2 This is a schematic diagram of the overall structure of the LRSG-DenseNet model of this invention.
[0028] Figure 3 This is a schematic diagram of the LRSG frequency domain adaptive sensing module structure of the present invention.
[0029] Figure 4 This is a schematic diagram of the data preprocessing and training enhancement process of the present invention.
[0030] Figure 5 This is a comparison chart of the classification performance of the present invention and different deep learning models.
[0031] Figure 6 This is the confusion matrix for the classification of the model in this invention. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
[0033] Example 1: This embodiment provides a method for fine-grain size classification of barley seeds, including: Step 1: Acquire RGB images of barley seeds and perform preprocessing; Step 2: Construct the LRSG-DenseNet classification model and perform feature extraction and classification; The LRSG-DenseNet classification model uses DenseNet161 as the backbone network for spatial feature extraction. The input is a preprocessed RGB image of barley seeds. The image is sequentially processed through convolution, normalization, activation, max pooling, and several DenseBlock modules for multi-level spatial feature extraction. An LRSG module is embedded after each DenseBlock module and before the Transition layer. The LRSG module performs a two-dimensional real-valued Fast Fourier Transform on the input features, mapping the spatial domain features to the frequency domain, based on the current feature channel index. c Frequency domain pseudo-radial frequency index From the learnable spectral parameter matrix The weight values of the matching positions are extracted from the index, converted into frequency domain gating coefficients through an activation function, and the amplitude spectrum is adaptively enhanced and suppressed, as shown below:
[0034] in, and These represent the amplitude spectra before and after recalibration, respectively. u , v ( ) represents the frequency domain coordinates. Use the Sigmoid activation function; After recalibration, the amplitude spectrum Global average pooling is performed to obtain channel description vectors, which are then used to generate channel attention vectors via a multilayer perceptron. Finally, residual fusion is used to fuse the channel attention vectors with the original spatial features to obtain fused features.
[0035] Thus, this invention embeds an LRSG module between the DenseBlock and Transition layers of the DenseNet161 backbone network, mapping spatial features to the frequency domain via a two-dimensional real-valued Fast Fourier Transform. Based on the feature channel index and pseudo-radial frequency index, it adaptively generates frequency domain gating coefficients using a learnable spectral parameter matrix to achieve amplitude spectrum enhancement and suppression. The resulting spatial feature is then obtained through global average pooling, a multilayer perceptron, and residual fusion. Frequency domain collaborative features can significantly improve the model's ability to perceive high-frequency features such as barley seed coat texture, ventral groove structure, and fine surface texture, while reducing phase shift and background noise interference. This effectively solves the technical problems of insufficient accuracy and easy confusion in the identification of similar barley varieties by traditional spatial domain convolutional networks. At the same time, this method can achieve fine-grained classification based on ordinary RGB images only, without the need for expensive equipment such as hyperspectral imaging. It has the advantages of high recognition accuracy, strong anti-interference, low deployment cost, and suitability for high-throughput non-destructive testing.
[0036] Example 2: This embodiment provides a fine-grained classification method for barley seeds based on deep learning and frequency domain adaptive sensing, including the following steps: Step 1: Collect RGB images of barley seeds.
[0037] After removing severely damaged seeds, seed images are acquired under fixed shooting height and uniform background conditions. Images may include top and side views to simultaneously preserve seed projection shape, ventral groove structure, dorsal texture, side profile, and edge texture information.
[0038] Step 2: Preprocess the acquired RGB image.
[0039] To address the issue of irregular aspect ratios in barley seeds and the potential for texture distortion when directly scaling them, a SquarePad And Resize normalization strategy is adopted. This involves first zero-padding non-square images to expand them into squares, then uniformly adjusting them to 340×340 pixels using bilinear interpolation, and finally standardizing the pixels according to ImageNet statistics.
[0040] Step 3: Construct the LRSG-DenseNet classification model and perform feature extraction and classification.
[0041] The LRSG-DenseNet classification model constructed in this embodiment uses DenseNet161 as the backbone network for spatial feature extraction. By embedding a Learnable Radial Spectral Gating (LRSG) module into the backbone network, it achieves feature extraction that is jointly perceived in the spatial and frequency domains. The specific construction and operation process is as follows: The structure of the LRSG-DenseNet classification model is as follows: Figure 2 As shown, this model uses DenseNet161 as the backbone network for spatial feature extraction. The input is a normalized RGB image of 340×340×3. The image is sequentially processed through convolution, normalization, activation, max pooling, and four DenseBlocks for multi-level spatial feature extraction. The number of DenseBlock layers are 6, 12, 36, and 24, respectively. Unlike ordinary DenseNet, this invention embeds an LRSG module after each DenseBlock and before the Transition layer, enabling the model to simultaneously perform frequency domain adaptive enhancement during spatial feature extraction.
[0042] The input to the LRSG module is a spatial feature tensor. ,in C , H , W These represent the number of feature channels, feature map height, and width, respectively. The module first... X Performing a two-dimensional real-valued Fast Fourier Transform (2D-RFFT) maps spatial domain features to the frequency domain while preserving the amplitude spectrum. This embodiment focuses on using amplitude spectrum to describe global texture energy distribution, thereby reducing the impact of phase shift on recognition and enhancing the model's ability to perceive seed coat texture, ventral groove texture, and surface fine structures.
[0043] Subsequently, the LRSG module constructs a pseudo-radial frequency index based on Manhattan distance. For frequency domain coordinates ( u , v ),calculate The buffer length is then trimmed to a preset buffer length, which is set to 128 in this embodiment. The model settings can learn the spectral parameter matrix. According to the feature channel index c and frequency index The corresponding frequency domain weights are retrieved, and a dynamic gating factor is generated using the Sigmoid function. The frequency domain recalibration process can be represented as:
[0044] in, The amplitude spectrum after recalibration. This is the Sigmoid function. This design enables the model to adaptively enhance the effective frequency band, suppress background noise, and reduce redundant frequency responses according to the classification task.
[0045] Finally, the LRSG module performs global average pooling on the recalibrated frequency domain amplitude spectrum to obtain the channel description vector. z Then, channel attention vectors are generated through two layers of multilayer perceptrons. a The module employs a residual fusion approach, applying the channel weights obtained from frequency domain sensing to the original spatial features, with the output being: Y = X + X ⊙ a Here, ⊙ represents element-wise multiplication. This residual structure preserves the original spatial semantic information while introducing frequency domain texture enhancement information, thus forming a feature representation that is jointly perceived in the spatial and frequency domains, providing more comprehensive and effective feature support for subsequent seed classification.
[0046] Step 4: Feature Representation Based on Spatial Domain and Frequency Domain Co-sensing Y Fine-grain classification of barley seeds was performed.
[0047] Example 3: This embodiment provides a fine-grained classification method for barley seeds based on deep learning and frequency domain adaptive sensing, including the following steps: This embodiment's algorithm is implemented based on the PyTorch deep learning framework, and the training platform is a high-performance computing platform configured with an NVIDIA GeForce RTX 4090 GPU. The image acquisition device is a standard RGB camera; in this embodiment, the 50-megapixel mode of the iQOO 13 smartphone is used for shooting, with a fixed shooting height of 15cm. A pure black cardboard background is used to reduce environmental background interference. Detailed implementation steps are as follows: (1) Dataset preparation This embodiment selects 10 representative barley varieties, including Yangnongpi 7, Yan 12133, Yanmai 6, Yanmai 7, Supi 3, Supi 8, Supi 9, Supi 12, Supi 13, and Supi 14. For example... Figure 1 As shown, approximately 3,000 original seeds were collected during the sample preparation stage of this embodiment. After removing severely damaged seeds, 2,992 valid physical samples were obtained. A dual-view barley seed dataset was constructed by collecting top and side views, containing a total of 14,810 single seed images, including 11,969 top view images and 2,841 side view images.
[0048] (2) Data partitioning and preprocessing like Figure 4 As shown, in this embodiment, the dataset is divided into training, validation, and test sets in a ratio of 70%:15%:15%, corresponding to 10361, 2218, and 2231 images, respectively. To avoid information leakage, images generated from the same physical seed are grouped into the same subset. All images are first zero-padded to form squares, then adjusted to 340×340 pixels, and then standardized.
[0049] (3) Model building The preprocessed image is input into the LRSG-DenseNet model. The model's front end extracts shallow texture features through convolutional layers, normalization layers, activation layers, and max pooling layers, and then enters four DenseBlocks. Each DenseBlock is followed by an LRSG module, and then a Transition layer is used to compress the feature dimension and spatial size. Finally, the feature map is subjected to global average pooling to obtain a 2208-dimensional feature vector, which is then input into a fully connected classification layer to output the class probabilities of 10 barley varieties.
[0050] (4) Model training During model training, geometric augmentation and hybrid augmentation strategies are employed. Geometric augmentation includes random horizontal or vertical flipping, ±15° random rotation, and sharpness enhancement. Hybrid augmentation includes Mixup and CutMix, which are randomly alternated with a probability of 0.5. The Mixup parameter α is set to 0.8, and the CutMix parameter α is set to 1.0. Since hybrid augmentation generates soft labels, this embodiment uses the soft-label cross-entropy loss function for training. The optimizer is AdamW, with an initial learning rate of [missing value]. The weight decays to The batch size is 16, the number of training rounds is 100, and the learning rate is gradually decayed using a cosine annealing strategy. Training was stopped early if the accuracy of the validation set did not improve for 30 consecutive rounds.
[0051] (5) Experimental results On the test set, the macro-average precision of the model of this invention is 0.9822, recall is 0.9821, and F1-score is 0.9821. Figure 5 As shown. The F1-scores for all categories generally exceeded 0.96, with Salt 12133 achieving a Precision, Recall, and F1-score of 1.0000, and Su Beer 14 achieving a Recall of 1.0000. For example... Figure 6 The confusion matrix results show that the present invention can reduce misjudgment among morphologically similar varieties such as Yanmai 6, Supi 8, and Supi 12.
[0052] Example 4: This embodiment provides a barley seed fine-grained classification system, configured to implement the barley seed fine-grained classification method described in any of the above embodiments, including: The image acquisition module is configured to acquire RGB images of barley seeds and perform preprocessing. The LRSG-DenseNet classification module is configured to build an LRSG-DenseNet classification model and perform feature extraction and classification. The LRSG-DenseNet classification model uses DenseNet161 as the backbone network for spatial feature extraction. The input is a preprocessed RGB image of barley seeds. The image is sequentially processed through convolution, normalization, activation, max pooling, and several DenseBlock modules for multi-level spatial feature extraction. An LRSG module is embedded after each DenseBlock module and before the Transition layer. The LRSG module performs a two-dimensional real-valued Fast Fourier Transform on the input features, mapping the spatial domain features to the frequency domain, based on the current feature channel index. c Frequency domain pseudo-radial frequency index From the learnable spectral parameter matrix The weight values of the matching positions are extracted from the index, converted into frequency domain gating coefficients through an activation function, and the amplitude spectrum is adaptively enhanced and suppressed, as shown below:
[0053] in, and These represent the amplitude spectra before and after recalibration, respectively. u , v ( ) represents the frequency domain coordinates. Use the Sigmoid activation function; After recalibration, the amplitude spectrum Global average pooling is performed to obtain channel description vectors, which are then used to generate channel attention vectors via a multilayer perceptron. Finally, residual fusion is used to fuse the channel attention vectors with the original spatial features to obtain fused features.
[0054] Through the image acquisition module and LRSG The DenseNet classification module, working in tandem, can automate, standardize, and achieve high throughput in the entire process of barley seed image acquisition, preprocessing, feature extraction, and variety classification, and can stably reproduce spatial data. The system features fine-grained recognition capabilities through frequency domain collaborative sensing. It boasts low deployment costs, strong compatibility, and stable operation, and can be directly applied to scenarios such as seed purity detection, rapid variety identification, and intelligent sorting, significantly improving the efficiency and accuracy of barley seed detection.
[0055] Some steps in the embodiments of the present invention can be implemented using software, and the corresponding software program can be stored in a readable storage medium, such as an optical disc or a hard disk.
[0056] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for fine-grain size classification of barley seeds, characterized in that, The method includes: Step 1: Acquire RGB images of barley seeds and perform preprocessing; Step 2: Construct the LRSG-DenseNet classification model and extract features; The LRSG-DenseNet classification model uses DenseNet161 as the backbone network for spatial feature extraction. The input is a preprocessed RGB image of barley seeds. The image is sequentially processed through convolution, normalization, activation, max pooling, and several DenseBlock modules for multi-level spatial feature extraction. An LRSG module is embedded after each DenseBlock module and before the Transition layer. The LRSG module performs a two-dimensional real-valued Fast Fourier Transform on the input features, mapping the spatial domain features to the frequency domain, based on the current feature channel index. c Frequency domain pseudo-radial frequency index From the learnable spectral parameter matrix The weight values of the matching positions are extracted from the index, converted into frequency domain gating coefficients through an activation function, and the amplitude spectrum is adaptively enhanced and suppressed, as shown below: in, and These represent the amplitude spectra before and after recalibration, respectively. u , v ( ) represents the frequency domain coordinates. Use the Sigmoid activation function; After recalibration, the amplitude spectrum Global average pooling is performed to obtain channel description vectors. These vectors are then processed by a multilayer perceptron to generate channel attention vectors. Finally, residual fusion is used to fuse the channel attention vectors with the original spatial features to obtain fused features. The calculation formula for these fused features is as follows: Y = X + X ⊙ a in, X Represents the original spatial characteristics. a Represents the channel attention vector; Step 3: Perform fine-grained classification of barley seeds based on the fusion features.
2. The method for fine-grain size classification of barley seeds according to claim 1, characterized in that, The LRSG-DenseNet classification model includes four DenseBlock modules.
3. The method for fine-grain size classification of barley seeds according to claim 2, characterized in that, The number of DenseBlock layers in the four DenseBlock modules are 6, 12, 36, and 24, respectively.
4. The method for fine-grain size classification of barley seeds according to claim 1, characterized in that, The images acquired in step 1 include top view and side view.
5. The method for fine-grain size classification of barley seeds according to claim 1, characterized in that, The frequency domain coordinates ( u , v The corresponding Manhattan distance calculation formula is: The distance values are cropped to 128 as the frequency index, and the dimension of the learnable spectrum parameter matrix is set to... .
6. The method for fine-grain size classification of barley seeds according to claim 1, characterized in that, The LRSG-DenseNet classification model uses a two-layer multilayer perceptron to generate channel attention vectors.
7. A fine-grain size classification system for barley seeds, characterized in that, The system is configured to implement the barley seed fine-grain classification method as described in any one of claims 1-6, comprising: The image acquisition module is configured to acquire RGB images of barley seeds and perform preprocessing. The LRSG-DenseNet classification module is configured to build an LRSG-DenseNet classification model and perform feature extraction and classification. The LRSG-DenseNet classification model uses DenseNet161 as the backbone network for spatial feature extraction. The input is a preprocessed RGB image of barley seeds. The image is sequentially processed through convolution, normalization, activation, max pooling, and several DenseBlock modules for multi-level spatial feature extraction. An LRSG module is embedded after each DenseBlock module and before the Transition layer. The LRSG module performs a two-dimensional real-valued Fast Fourier Transform on the input features, mapping the spatial domain features to the frequency domain, based on the current feature channel index. c Frequency domain pseudo-radial frequency index From the learnable spectral parameter matrix The weight values of the matching positions are extracted from the index, converted into frequency domain gating coefficients through an activation function, and the amplitude spectrum is adaptively enhanced and suppressed, as shown below: in, and These represent the amplitude spectra before and after recalibration, respectively. u , v ( ) represents the frequency domain coordinates. Use the Sigmoid activation function; After recalibration, the amplitude spectrum Global average pooling is performed to obtain channel description vectors, which are then used to generate channel attention vectors via a multilayer perceptron. Finally, residual fusion is used to fuse the channel attention vectors with the original spatial features to obtain fused features.
8. An electronic 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 computer program, it implements the steps of the barley seed fine-grain classification method as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the steps of the barley seed fine-grain classification method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Deep counterfeit image detection method fusing depth learning and width learning
CN114549481A
Wheat seed screening method based on CS-DNet lightweight model
CN118470414A