Methods, systems and computer programs for identifying wolfberry varieties

By lightweight reconstruction of the CoATNet model and image data enhancement, combined with the DAC Block and HWD ADown modules, the problems of low detection accuracy and high computational cost in wolfberry variety identification are solved, achieving efficient and accurate wolfberry variety identification.

CN122090237APending Publication Date: 2026-05-26JILIN AGRICULTURAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
JILIN AGRICULTURAL UNIV
Filing Date
2026-04-13
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing deep learning models are not optimized for the characteristics of goji berries, such as small differences in color and texture and insignificant features, resulting in low detection accuracy and high computational cost, which cannot meet the needs of smart agriculture for portability and real-time operation.

Method used

By reconstructing the CoATNet model in a lightweight manner, introducing the DAC Block and HWD ADown modules, and combining multi-step image data quality enhancement, we can strengthen color and texture features, accurately capture fine-grained features of wolfberry, and solve the problems of small variety differences and large light interference.

Benefits of technology

It achieves high accuracy and low computational cost in identifying wolfberry varieties, improves the accuracy of detection results, and meets the portability and real-time requirements of smart agriculture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122090237A_ABST
    Figure CN122090237A_ABST
Patent Text Reader

Abstract

This invention relates to a method, system, and computer program for identifying goji berry varieties. It addresses the problems of low accuracy and insufficient lightweight design of existing deep learning models, which are not optimized for the characteristics of goji berries. The method comprises the following steps: Step S1: Acquire goji berry image data and perform augmentation processing; Step S2: Enhance the augmented goji berry image data; Step S3: Improve the CoATNet model and input the enhanced goji berry image data into the improved CoATNet model for goji berry variety identification; The improved CoATNet model undergoes lightweight reconstruction and incorporates DAC Block and HWD ADown modules.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of agricultural product variety identification, specifically to a method, system, and computer program product for identifying wolfberry varieties. Background Technology

[0002] There are many shortcomings in the methods for identifying wolfberry varieties: manual identification relies on subjective judgments such as color and shape, which are inaccurate; chemical testing is time-consuming and requires high professional skills; spectroscopic techniques (such as hyperspectral imaging and near-infrared spectroscopy) rely on expensive professional equipment, are complicated to operate, and are difficult to adapt to real-time field detection scenarios.

[0003] In the existing technology, existing deep learning models (such as CoATNet and ConvNeXt) are not optimized for the characteristics of small color and texture differences and insignificant features of goji berries, and they have problems such as large computational overhead and insufficient lightweightness, which cannot meet the portability and real-time requirements of smart agriculture. Summary of the Invention

[0004] This invention solves the problems of low detection accuracy and insufficient lightweightness of existing deep learning models, which are not optimized for the characteristics of wolfberry.

[0005] The method for identifying wolfberry varieties according to the present invention includes the following steps: Step S1: Acquire goji berry image data and perform augmentation processing on the goji berry image data; Step S2: Enhance the expanded wolfberry image data; Step S3: Improve the CoATNet model and input the enhanced goji berry image data into the improved CoATNet model for goji berry variety identification. The improved CoATNet model is reconstructed in a lightweight manner and incorporates the DAC Block and HWD ADown modules.

[0006] Furthermore, in one embodiment of the present invention, in step S1, the expansion process employs translation, rotation, scaling, horizontal flipping, and vertical flipping.

[0007] Furthermore, in one embodiment of the present invention, step S2, specifically the enhancement processing of the expanded wolfberry image data, includes: The expanded wolfberry image data was processed sequentially with color space conversion, adaptive color channel enhancement, 3D-LUT learning-based color fine-tuning, reference-free chromaticity control, and local contrast enhancement.

[0008] Furthermore, in one embodiment of the present invention, in step S3, the improved CoATNet model undergoes lightweight reconstruction, specifically as follows: Replace the original attention mechanism with LinearAttention; Set the num_blocks parameter to [2, 2, 2, 3, 1], adjust the MBConv expansion parameter to 2, and remove the SE module; The convolutional module and feedforward network in the model use the GELU activation function, the linear attention module uses the ReLU activation function, and the classification head uses AvgPool2d for feature aggregation.

[0009] Furthermore, in one embodiment of the present invention, the DAC Block in step S3 specifically refers to: The feature image data is extracted through the first layer of deformable convolution, and then the feature image data is extracted again through the second layer of adaptive rectangular convolution to output the final feature image data.

[0010] Furthermore, in one embodiment of the present invention, the HWD ADown module in step S3 specifically comprises: After average pooling, the feature image data is divided into two branches. One branch is decomposed into low-frequency and high-frequency components by Haar wavelet transform. The low-frequency and high-frequency components are concatenated and then processed through a convolutional compression channel. The other branch is processed through max pooling and convolutional adjustment channels in sequence. The output channels of the two branches are concatenated and fused to complete downsampling.

[0011] The wolfberry variety identification system of the present invention is based on the wolfberry variety identification method described above, and includes the following modules: Module S1 acquires goji berry image data and performs augmentation processing on the goji berry image data; Module S2 performs enhancement processing on the expanded wolfberry image data; Module S3 improves the CoATNet model and inputs the enhanced goji berry image data into the improved CoATNet model for goji berry variety identification. The improved CoATNet model is reconstructed in a lightweight manner and incorporates the DAC Block and HWD ADown modules.

[0012] The computer program product of the present invention includes a computer program or instructions, which, when executed by a processor, implement the wolfberry variety identification method described above.

[0013] This invention addresses the problems of low detection accuracy and insufficient lightweightness in existing deep learning models due to their lack of optimization for the characteristics of goji berries. Specific beneficial effects include: 1. The wolfberry variety identification method of the present invention addresses the problem that existing deep learning models cannot meet the requirements of portability and real-time performance due to insufficient lightweight design. To solve the above technical problems, the present invention significantly reduces the computational overhead of the existing CoATNet model by performing lightweight reconstruction. 2. The method for identifying wolfberry varieties described in this invention suffers from low accuracy in detection results due to the lack of optimization of existing deep learning models for the characteristics of wolfberry. To solve the above technical problems, this invention enhances the quality of wolfberry image data through multi-step enhancement, strengthens color and texture features, solves the problems of small variety differences and large light interference, accurately captures fine-grained features of wolfberry with the help of DAC Block, and retains key information during dimensionality reduction through HWD ADown module, thereby achieving accurate identification of wolfberry varieties. The method for identifying wolfberry varieties described in this invention can be applied to the field of smart agriculture technology. Attached Figure Description

[0014] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 This is the architecture diagram of the improved CoATNet model described in Implementation Method 1. Detailed Implementation

[0015] Various embodiments of the present invention will now be clearly and completely described with reference to the accompanying drawings. The embodiments described with reference to the drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.

[0016] Implementation Method 1: Existing deep learning models are not optimized for the characteristics of small differences in color and texture and insignificant features of wolfberries, resulting in low detection accuracy. They also suffer from high computational overhead and insufficient lightweight design, failing to meet the portability and real-time requirements of smart agriculture.

[0017] To address the aforementioned technical problems, this embodiment proposes a method for identifying wolfberry varieties, comprising the following steps: Step S1, Goji Berry Dataset Creation and Preprocessing: Goji Berry Dataset Creation: A total of 25,899 images of five goji berry varieties (Ningqi 7, Inner Mongolia 5, Teyou 2, Goji 608, and Yuxin) were collected from Gansu, Inner Mongolia, Ningxia, Qinghai, and Xinjiang. Images were taken vertically using a Huawei mobile phone, segmented using the Canny operator (edge ​​detection operator), with the background processed to black, and uniformly adjusted to 224×224 pixels. The images were saved in PNG format.

[0018] Preprocessing: The data was augmented using five methods: translation, rotation, scaling, horizontal flipping, and vertical flipping. The data was then divided into training, validation, and test sets in a 7:2:1 ratio.

[0019] Step S2, Data Augmentation Processing: (1) Color space conversion: Image data is loaded using the OpenCV library (computer vision library), the BGR (blue-red-green) color space is converted to the RGB (red-green-blue) color space, and then to the Lab space (L is the luminance channel, a is the red-green color component, and b is the yellow-blue color component), thus decoupling luminance and color features.

[0020] (2) Adaptive enhancement of color channels based on wavelet transform: The Haar wavelet is used to perform DWT (two-dimensional discrete wavelet transform) on a and b, decomposing them into low-frequency subbands (smooth region information) and high-frequency subbands (edge ​​and detail information).

[0021] The low-frequency subband is subjected to the Canny operator and Gaussian blurring to generate an edge intensity map, and the gain factor is dynamically calculated. ,in, The edge strength is 0-1.

[0022] (3) 3D-LUT (3D Lookup Table) learning-based color fine-tuning: A 17×17×17 three-dimensional color grid is constructed to cover the [0,1] RGB color space. The grid sampling points are subjected to a random perturbation of -10% to +30% in the S of the HSV (H is chroma, S is saturation channel, V is lightness) color space to generate a dynamic LUT.

[0023] The Lab color space image is converted to RGB color space and normalized to [0,1]. The pixel value index is then mapped to the LUT grid to achieve non-linear color fine-tuning.

[0024] (4) No-reference colorimetric control: Calculate colorimetry: ,in, , , , and These are all pixel values ​​in the RGB color space. The mean, The standard deviation is denoted as .

[0025] like If the value exceeds the threshold of 100, convert to the HSV color space and adjust proportionally ( ) Decrease the value of S, where, The maximum value, For color saturation.

[0026] (5) Local contrast post-processing: Calculate the local mean: ,in, , , Center pixel coordinates and For coordinate offset, The value of the neighboring pixels. For Gaussian kernel parameters, Center pixel The sum of all Gaussian weights within the neighborhood is the normalization factor in the Gaussian weighting calculation.

[0027] Calculate the local standard deviation: ; in, For local standard deviation, Center pixel The set of neighborhood ranges, This is a local constant, its purpose is to ensure the numerical stability of the algorithm and avoid the abnormal situation where the denominator is 0. .

[0028] Calculate the local gain factor ,in, , , and These represent the image data height and width, respectively. Limited to the range of 0.1 to 5.0. This is the global mean of the image.

[0029] Achieve local contrast enhancement The outlier processing and range cropping are used to output enhanced image data.

[0030] This implementation method achieves refined enhancement of color and texture features through a multi-step image data quality enhancement method, while avoiding oversaturation and artifacts.

[0031] Step S3: Improve and train the CoATNet model: (1) Improved CoATNet model: In this embodiment, when the enhanced wolfberry image data is input into the existing CoATNet model for variety identification, it is found that the model has problems such as high computational complexity of the attention mechanism, redundant network structure, large number of parameters and large computational overhead.

[0032] To address the core issues of existing CoATNet models, such as high computational cost, large parameter count, and inability to adapt to real-time field detection deployment requirements, this implementation first performs a lightweight reconstruction of the existing CoATNet model, specifically: Replace the original attention mechanism with LinearAttention.

[0033] Simplify the model structure: the num_blocks parameter (number of blocks) is reduced from [2, 2, 3, 5, 2] to [2, 2, 2, 3, 1], the expansion parameter of MBConv (moving inverted residual bottleneck convolution) is adjusted to 2, and the SE module (Squeeze-and-Excitation channel attention module) is removed.

[0034] The model uses GELU as the primary activation function and ReLU activation in the linear attention layer. The classification head uses AvgPool2d for global feature aggregation.

[0035] Therefore, this implementation method lightweights the existing CoATNet model by replacing the linear attention mechanism, simplifying and pruning the network structure, and optimizing computational efficiency. However, while lightweighting the model, this implementation method found that while significantly reducing the number of parameters and computational overhead, the model's performance indicators dropped significantly. The receptive field of the fixed-size convolutions was even less able to adapt to the geometric deformation of wolfberry fruits, and the discriminative power of the extracted low-level features was insufficient, making it difficult to solve the classification difficulties of small differences in color and texture and insignificant features among wolfberry varieties.

[0036] Therefore, this implementation method designs and introduces a DAC Block (DAC module), specifically as follows: The first layer is a deformable convolution: ,in, For convolution weights, For input feature image data, The learned two-dimensional offset, The local coordinates of the preset fixed sampling points of the convolution kernel. To output feature map The coordinates of any center pixel on the surface, This is the output feature map of deformable convolution.

[0037] The second layer is an adaptive rectangular convolution, which learns the height and width of the convolution kernel through the sub-network: ,in, Corresponding height prediction, Corresponding width prediction, The output is a size prediction feature map. For a prediction subnetwork with trainable parameters, The input feature map is mapped to the actual range using a modulation factor: , and This represents a preset modulation factor used to constrain the height and width to their respective actual ranges. , + ), To generate a modulated feature map of the actual size, the number of sampling points is dynamically selected and a sampling map is generated, resulting in the final output. ,in, For convolution kernel parameters, For sampling images, For scaling matrices, This is the bias matrix.

[0038] Furthermore, this implementation also revealed that the absence of any convolutional module significantly degrades model performance. This is primarily because deformable convolution and adaptive rectangular convolution are complementary in their feature modeling capabilities. Deformable convolution dynamically adjusts the convolution sampling position by learning offsets, better adapting to the deformation and irregular structure of the target, thereby enhancing its ability to represent local spatial structures. Adaptive rectangular convolution, on the other hand, dynamically changes the shape of the receptive field by learning the aspect ratio and sampling range of the convolution kernel, enabling the network to better capture features with directionality or different scales. When combined, one flexibly adjusts the sampling position, while the other adaptively adjusts the shape and range of the receptive field, simultaneously enhancing the network's ability to model complex spatial structures and scale variations. Therefore, removing either module reduces the model's feature representation ability, leading to an overall performance decrease.

[0039] That is, the model's ability to capture fine-grained features of goji berries is enhanced by the cascaded design of deformable convolution and adaptive rectangular convolution. However, after introducing the DAC Block, this implementation method found that the model would lose a large number of fine-grained key features such as goji berry edges, textures, and fruit navels that were accurately extracted by the DAC Block during the traditional downsampling process of the subsequent S1 and S2 layers.

[0040] Therefore, the HWD ADown module (sampling module) is introduced, specifically as follows: The input feature image data is divided into two branches after average pooling with a stride of 2. One branch is decomposed into one low-frequency component and three high-frequency components through Haar wavelet transform, and then convolved to compress the channel. The other branch is adjusted by max pooling with a stride of 2 and 1×1 convolution. The output channels of the two branches are then convolved and fused to complete the downsampling.

[0041] This module not only solves the problem of fine-grained feature loss caused by traditional downsampling, but also effectively preserves key discrimination information such as the outline, edge, and texture of goji berries extracted by the DAC Block while compressing the spatial dimension of feature image data. This allows fine-grained features to be effectively transmitted and mined in the deep network of the model. Furthermore, it combines a lightweight design approach with the DAC Block to form a synergistic gain without increasing computational overhead through dual-branch feature fusion and wavelet decomposition. This fully leverages the classification value of fine-grained features and further optimizes the model's feature fusion capability. As a result, the improved CoATNet model achieves a significant improvement in classification accuracy while maintaining its lightweight characteristics, ultimately achieving a dual optimization of high performance and high efficiency.

[0042] like Figure 1 As shown, the improved CoATNet model is as follows: In Stage 0 (S0), the enhanced goji berry image data is input into the DAC Block for fine-grained low-level feature extraction based on deformable convolution and adaptive rectangular convolution cascade. The output is a highly discriminative low-level feature map containing global structural information and local texture and contour details of goji berries. In Stage 1 (S1), the feature map after feature extraction is processed by the HWD ADown module, which outputs a downsampled feature map that retains key texture, edge and contour information of goji berries while compressing spatial dimensions. It is then further processed by MBConv for feature extraction. Stage 2 (S2) repeats the operation of Stage 1. Subsequently, in Stage 3 (S3) and Stage 4, the feature map is processed by the Transformer module to achieve global feature modeling and multi-dimensional feature fusion. Finally, the classification result is output after passing through the classification head.

[0043] (2) Improved CoATNet model training: The batch size is set to 16, the number of training epochs is 150, the learning rate is 0.00003, the input size is 224×224, and the Adam optimizer is used. The training is conducted in the PyTorch framework (an open-source deep learning framework).

[0044] With these parameter settings, the model achieves an accuracy of 97.49%, a precision of 97.48%, a recall of 97.47%, an F1 score of 97.48%, 6.32M parameters, and 1.83 GFLOPS on the enhanced image dataset. Compared to the existing CoATNet model, this represents a 2.81% improvement in accuracy, a 62.8% reduction in parameters, and a 45.37% reduction in GFLOPS.

[0045] When the batch size is 4, the accuracy is 96.76% and the loss is 0.13; when the batch size is 32, the accuracy is 95.87% and the loss is 0.19; when no augmented image dataset is used, the model accuracy is 94.71%, which verifies the superiority of the optimal parameters.

[0046] To better illustrate the performance of the improved CoATNet model described in this embodiment, a comparative experiment was conducted on eight models: the existing CoATNet model, ConvNeXt, EfficientNetV2 (an upgraded version of the EfficientNet (deep neural network architecture) series), GhostNet (edge-side neural network architecture), MobileNetV4 (efficient neural network architecture), RepVGG (re-parameterized VGG network), ShuffleNetV2 (lightweight neural network architecture), and the improved CoATNet model. As shown in Table 1, the improved CoATNet model, while maintaining a low parameter count of 6.32M, significantly improved its accuracy to 97.49%, far exceeding the 94.83% of the existing CoATNet model, achieving the best model performance in the wolfberry variety classification task.

[0047] Table 1 Comparison of Results

[0048] This improvement is mainly due to the lightweight reconstruction of the improved CoATNet model, which reduces the number of parameters of the existing CoATNet model from 16.99M to 6.32M and the GFLOPS (computing power) from 3.35 to 1.83 through operations such as linearizing attention, simplifying the network structure, and removing redundant modules. This significantly reduces the computational cost of the model and reserves sufficient computational budget for the introduction of the DAC Block and HWD ADown modules, avoiding a surge in model computation caused by the addition of new modules.

[0049] As the core module of the initial feature extraction layer of the model, the DAC Block accurately captures key fine-grained features such as the texture density and color depth of wolfberry skin through the cascaded design of deformable convolution and adaptive rectangular convolution. It provides highly discriminative low-level feature input for the lightweight model, making up for the performance loss caused by lightweighting from the data level.

[0050] The HWD ADown module, through wavelet decomposition and dual-branch feature fusion, effectively preserves the fine-grained features such as the outline, edge, and texture of the goji berry extracted by the DAC Block while completing downsampling. This achieves effective preservation of highly discriminative low-level features, allowing the fine-grained features extracted by the DAC Block to be fully mined and utilized in deep networks.

[0051] The three modules work together to form a complete feature processing loop for goji berry classification within the model. DACBlock completes the accurate extraction of fine-grained features, the HWD ADown module completes the effective preservation of features, and the lightweight reconstruction completes the efficient and in-depth mining of features through the optimized network structure and attention mechanism.

[0052] In summary, this implementation method, through the enhancement of wolfberry image data and the synergistic effect of the improved CoATNet model, not only enhances the model's ability to capture fine-grained features of wolfberry by introducing the DAC Block, but also solves the feature loss problem of traditional downsampling by using the HWDADown module, thus achieving accurate identification of wolfberry varieties. Furthermore, by performing lightweight reconstruction of the existing CoATNet model, performance is maintained while reducing computational overhead.

[0053] Implementation Method 2: The wolfberry variety identification system described in this implementation method is based on the wolfberry variety identification method described in Implementation Method 1, and includes the following modules: Module S1 acquires goji berry image data and performs augmentation processing on the goji berry image data; Module S2 performs enhancement processing on the expanded wolfberry image data; Module S3 improves the CoATNet model and inputs the enhanced goji berry image data into the improved CoATNet model for goji berry variety identification. The improved CoATNet model is reconstructed in a lightweight manner and incorporates the DAC Block and HWD ADown modules.

[0054] Implementation Method 3: A computer program product described in this implementation method includes a computer program or instructions, which, when executed by a processor, implement the wolfberry variety identification method described in Implementation Method 1.

[0055] The above provides a detailed description of the wolfberry variety identification method, system, and computer program product proposed in this invention. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.

Claims

1. A method for identifying wolfberry varieties, characterized in that, Includes the following steps: Step S1: Acquire goji berry image data and perform augmentation processing on the goji berry image data; Step S2: Enhance the expanded wolfberry image data; Step S3: Improve the CoATNet model and input the enhanced goji berry image data into the improved CoATNet model for goji berry variety identification. The improved CoATNet model is reconstructed in a lightweight manner and incorporates the DAC Block and HWD ADown modules.

2. The method for identifying wolfberry varieties according to claim 1, characterized in that, In step S1, the expansion process employs translation, rotation, scaling, horizontal flipping, and vertical flipping.

3. The method for identifying wolfberry varieties according to claim 1, characterized in that, In step S2, the enhancement processing of the expanded wolfberry image data specifically includes: The expanded wolfberry image data was processed sequentially with color space conversion, adaptive color channel enhancement, 3D-LUT learning-based color fine-tuning, reference-free chromaticity control, and local contrast enhancement.

4. The method for identifying wolfberry varieties according to claim 1, characterized in that, In step S3, the improved CoATNet model undergoes lightweight reconstruction, specifically as follows: Replace the original attention mechanism with LinearAttention; Set the num_blocks parameter to [2, 2, 2, 3, 1], adjust the MBConv expansion parameter to 2, and remove the SE module; The convolutional module and feedforward network in the model use the GELU activation function, the linear attention module uses the ReLU activation function, and the classification head uses AvgPool2d for feature aggregation.

5. The method for identifying wolfberry varieties according to claim 1, characterized in that, In step S3, the DACBlock specifically refers to: The feature image data is extracted through the first layer of deformable convolution, and then the feature image data is extracted again through the second layer of adaptive rectangular convolution to output the final feature image data.

6. The method for identifying wolfberry varieties according to claim 1, characterized in that, In step S3, the HWDADown module specifically refers to: After average pooling, the feature image data is divided into two branches. One branch is decomposed into low-frequency and high-frequency components by Haar wavelet transform. The low-frequency and high-frequency components are concatenated and then processed through a convolutional compression channel. The other branch is processed through max pooling and convolutional adjustment channels in sequence. The output channels of the two branches are concatenated and fused to complete downsampling.

7. A wolfberry variety identification system, wherein the system is implemented based on the wolfberry variety identification method according to claim 1, characterized in that, Includes the following modules: Module S1 acquires goji berry image data and performs augmentation processing on the goji berry image data; Module S2 performs enhancement processing on the expanded wolfberry image data; Module S3 improves the CoATNet model and inputs the enhanced goji berry image data into the improved CoATNet model for goji berry variety identification. The improved CoATNet model is reconstructed in a lightweight manner and incorporates the DAC Block and HWD ADown modules.

8. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the method for identifying wolfberry varieties as described in any one of claims 1 to 6.