Sun-cured ginseng under-forest grade classification identification method, system and device and storage medium

By introducing the SCConv module in the EfficientNet_v2_s model, using CombinedLoss loss function and adding a lightweight S-FPN module, the problem of low computing efficiency in the existing technology is solved, and high-precision and high-efficiency image level classification recognition is achieved.

CN119964151APending Publication Date: 2025-05-09WUXI UNIV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510444610.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-05-09

AI Technical Summary

Technical Problem

The prior art lacks an image level classification recognition method that improves calculation efficiency while improving calculation accuracy.

Method used

By building the EfficientNet_v2_s model, and introducing the SCConv module in the Fused-MBConv module, the CombinedLoss loss function combined with the FocalLoss loss function and the DiceLoss loss function is adopted, and the lightweight S-FPN module is added to the model to optimize the feature extraction and loss function design of the model.

Benefits of technology

It achieves image level classification recognition effect that improves computing efficiency while improving computing efficiency. It is suitable for low-resource devices and performs excellently in extracting colors, textures and shapes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119964151A_ABST
    Figure CN119964151A_ABST
Patent Text Reader

Abstract

The invention discloses a sun-cured ginseng grade classification identification method, system and device and a storage medium, relates to application in the field of ginseng grade classification, and solves the problem that an existing ginseng grade classification method is difficult to improve the calculation speed while improving the calculation precision. Collecting suncured under-forest parameter image samples, and preprocessing the suncured under-forest parameter image samples to obtain a preprocessed multi-grade suncured under-forest parameter data set; the method comprises the following steps: constructing an OfficientNetv2s model; replacing the standard convolution of the fused inverse residual convolution block with SCConv; a lightweight S-FPN module is added to the model, and an optimized EfficientNetv2s model is obtained; and training the optimized model, and classifying the grades of the sun-cured under-forest parameters based on the preprocessed multi-grade sun-cured under-forest parameter data set. The method is used for realizing efficient and accurate grade classification and identification of the sun-dried under-forest ginseng.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the application of ginseng grade classification, and in particular to a method, system, equipment and storage medium for classifying and identifying ginseng grades under forest sun-dried trees. Background Art

[0002] The quality of ginseng is directly related to its medicinal effects, and different grades of ginseng differ in appearance, color, texture, and shape. Traditional manual classification methods not only rely on the perception and judgment of experts, but are also inefficient and difficult to meet the requirements of standardization and quality control in the modern Chinese medicine industry. Therefore, it has become an inevitable trend to use image processing and deep learning technology to automatically grade and identify ginseng.

[0003] The development of image classification technology has experienced a rapid evolution from early traditional feature extraction to CNN (deep neural network). First, the classification method based on hand-designed features has established extraction and expression capabilities, and it is difficult to handle complex scenes; secondly, the emergence of deep networks such as AlexNet (deep convolutional neural network), VGGNet (visual geometry group network), GoogLeNet (network with parallel connections), etc., makes it possible to automatically learn image features and multiple information levels, and greatly improves the classification ability. In recent years, lightweight network architectures have received widespread attention, and their goal is to ensure accuracy while reducing model complexity and computing resource consumption. The EfficientNet (efficient neural network) series has achieved excellent performance in classification tasks with its efficient hierarchical scaling strategy. After architecture optimization and training strategy improvements, it has not only achieved further compression in model parameters and inference speed, but also retained the target feature extraction ability. These improvements make EfficientNet very suitable for embedded devices and mobile applications, providing ideal technical support for real-time image classification. However, its operation efficiency on low-resource devices is low, and its performance in extracting color, texture, and shape is not outstanding.

[0004] In the prior art, Chinese patent document CN118212631A discloses "a method for classifying rotten strawberries based on the GC-EfficientNet V2 model", which includes collecting photos of strawberries in intact and rotten states, manually annotating the collected photos, and using the manually annotated strawberry photos as a data set; dividing the data set into a training set and a validation set by a 5-fold cross-validation method; constructing a GC-EfficientNet V2 model, training the GC-EfficientNet V2 model using the training set, and testing the performance of the GC-EfficientNet V2 model using the validation set based on the cross-validation method, and finally obtaining a GC-EfficientNet V2 classification model; collecting strawberry photos, inputting the collected strawberry photos into the GC-EfficientNet V2 classification model, and the classification model outputs the classification results, but this technical solution only improves the accuracy of model classification, and it is difficult to improve the calculation efficiency while improving the calculation accuracy.

[0005] In summary, the prior art lacks an image grade classification and recognition method that improves computational accuracy and efficiency at the same time. Summary of the invention

[0006] The present invention solves the problem that the prior art lacks an image grade classification and recognition method that improves calculation accuracy and efficiency at the same time.

[0007] The method for classifying and identifying the grade of sun-dried understory ginseng of the present invention comprises the following steps: Step 1, collecting sun-dried ginseng image samples, establishing a multi-level sun-dried ginseng dataset, and performing preprocessing to obtain a preprocessed multi-level sun-dried ginseng dataset; Step 2, build the EfficientNet_v2_s model; Step 3: Optimize the EfficientNet_v2_s model built in step 2, including: The Fused-MBConv module in the EfficientNet_v2_s model is replaced with an improved Fused-MBConv module, wherein the improved Fused-MBConv module introduces SCConv instead of standard convolution in the Fused-MBConv module; a lightweight S-FPN module is added to the EfficientNet_v2_s model to obtain an optimized EfficientNet_v2_s model; Step 4: train the optimized EfficientNet_v2_s model described in step 3, and classify the grades of the sun-dried forest ginseng based on the preprocessed multi-grade sun-dried forest ginseng dataset described in step 1.

[0008] Further, in the embodiment of the present invention, the preprocessing in step 1 is specifically as follows: The multi-level sun-dried ginseng dataset was preprocessed using random brightness, random contrast, random Gaussian noise and random salt and pepper noise.

[0009] Further, in the embodiment of the present invention, the EfficientNet_v2_s model optimized in step 3 further includes: The optimized EfficientNet_v2_s model adopts the CombinedLoss loss function, which is a combined loss function obtained by weighted summation of the FocalLoss loss function and the DiceLoss loss function.

[0010] Further, in an embodiment of the present invention, the SCConv includes SRU and CRU, the group normalization GroupNorm in the SRU is replaced with GroupBatchnorm2d, and the feature map input at the input end of the optimized EfficientNet_v2_s model is subjected to spatial redundancy suppression to obtain a spatially refined feature map by separation and reconstruction, and the spatially refined feature map is transmitted to the CRU; The CRU reduces the channel redundancy of the received spatially refined feature map and fuses the features by splitting, converting and fusing, thereby obtaining a channel-refined feature map.

[0011] Further, in the embodiment of the present invention, the lightweight S-FPN module is specifically: The lightweight S-FPN module is added between the mobile flip bottleneck convolution module and the head network in the optimized EfficientNet_v2_s model. The mobile flip bottleneck convolution module generates a multi-scale feature map. Based on the upsampling operation, the multi-scale feature map is cascaded and fused through a multi-level scale fusion module, and the multi-level cascade fusion feature map is output through the corresponding output layer.

[0012] Further, in the embodiment of the present invention, the optimized EfficientNet_v2_s model described in step 3 is trained in step 4, and the grades of the sun-dried forest ginseng are classified based on the preprocessed multi-grade sun-dried forest ginseng dataset described in step 1, specifically: The preprocessed multi-level sun-dried ginseng dataset described in step 1 is divided into a training set and a test set. The optimized EfficientNet_v2_s model is trained using the training set. The performance of the optimized EfficientNet_v2_s model is tested using the test set based on the cross-validation method to obtain the grade classification results.

[0013] The system for classifying and identifying the grade of sun-dried forest ginseng of the present invention comprises the following modules: The preprocessing module collects sun-dried ginseng image samples, establishes a multi-level sun-dried ginseng dataset, and performs preprocessing to obtain a preprocessed multi-level sun-dried ginseng dataset. Build the module and build the EfficientNet_v2_s model; Optimize the module, optimize the EfficientNet_v2_s model after the construction module is built, including: The Fused-MBConv module in the EfficientNet_v2_s model is replaced with an improved Fused-MBConv module, wherein the improved Fused-MBConv module introduces SCConv instead of standard convolution in the Fused-MBConv module; a lightweight S-FPN module is added to the EfficientNet_v2_s model to obtain an optimized EfficientNet_v2_s model; The classification module trains the optimized EfficientNet_v2_s model described in the optimization module, and classifies the grades of the sun-dried forest ginseng based on the preprocessed multi-grade sun-dried forest ginseng dataset described in the preprocessing module.

[0014] The electronic device for classifying and identifying the grade of understory ginseng in the sun-dried forest of the present invention comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; The processor is used to implement any of the above-mentioned methods for classifying and identifying the grades of sun-dried forest ginseng when executing the program stored in the memory.

[0015] The computer-readable storage medium of the present invention stores a computer program, and when the computer program is executed by a processor, any of the above-mentioned methods for classifying and identifying the grade of sun-dried forest ginseng is implemented.

[0016] The present invention solves the problem that the prior art lacks an image level classification and recognition method that improves both computational accuracy and computational efficiency. Specific beneficial effects include: The method for classifying and identifying the grade of ginseng under the sun-dried forest described in the present invention constructs an EfficientNet_v2_s model, firstly introduces the SCConv (spatial and channel reconstruction convolution) module, reduces redundant features and improves model performance. Secondly, the CombinedLoss loss function (combined loss function) formed by combining the FocalLoss loss function (focal loss function) and the DiceLoss loss function (Dice coefficient loss function) replaces the original basic loss function, wherein the FocalLoss loss function focuses on the optimization of the category level, while the DiceLoss loss function focuses on the regional level. The combination of the two can guide model learning from different angles, thereby achieving more accurate prediction. Finally, a lightweight S-FPN (synthetic fusion pyramid network) module is introduced, which can effectively process targets of different scales, and by suppressing noise and redundant information, improve the robustness and adaptability of the EfficientNet_v2_s model in complex scenarios, and by applying the EfficientNet_v2_s model to the recognition of the grade classification of ginseng under the sun-dried forest, it is ensured that the calculation efficiency is improved while the calculation accuracy is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which: Figure 1 It is a schematic diagram of the structure of the improved EfficientNet_v2_s (efficient neural network_v2_s) model described in Implementation Method 1; Figure 2 This is a structural comparison diagram of the Fused-MBConv (fused inverted residual convolution block) module before and after improvement described in Implementation Method 1; Figure 3 is a schematic diagram of an SRU (spatial reconstruction unit) module in the SCConv module described in Implementation Example 1; Figure 4 is a schematic diagram of a CRU (channel reconstruction unit) module in the SCConv module described in Implementation Example 1; Figure 5 is a schematic diagram of the working principle of S-FPN described in Implementation Method 1; Figure 6 is a comparison chart of loss values ​​of different models described in Implementation Method 1; Figure 7 is a comparison chart of the accuracy of different models described in Implementation Method 1; Figure 8 This is a comparison diagram of the confusion matrix of the EfficientNet_v2_s model before and after the improvement in Implementation Mode 1; Fig. 9is the accuracy and parameter quantity of the model before and after training described in Implementation Mode 1; Fig.10 It is the comparison result of the accuracy and parameter amounts of different models described in Implementation Method 1. DETAILED DESCRIPTION

[0018] The following will clearly and completely describe various embodiments of the present invention in conjunction with the accompanying drawings. The embodiments described with reference to the accompanying drawings are exemplary and intended to be used to explain the present invention, but should not be understood as limiting the present invention.

[0019] Implementation method 1. The method for classifying and identifying the grade of sun-dried ginseng in forests described in this implementation method comprises the following steps: Step 1, collecting sun-dried ginseng image samples, establishing a multi-level sun-dried ginseng dataset, and performing preprocessing to obtain a preprocessed multi-level sun-dried ginseng dataset; Step 2, build the EfficientNet_v2_s model; Step 3: Optimize the EfficientNet_v2_s model built in step 2, including: The Fused-MBConv module in the EfficientNet_v2_s model is replaced with an improved Fused-MBConv module, wherein the improved Fused-MBConv module introduces SCConv instead of standard convolution in the Fused-MBConv module; a lightweight S-FPN module is added to the EfficientNet_v2_s model to obtain an optimized EfficientNet_v2_s model; Step 4: train the optimized EfficientNet_v2_s model described in step 3, and classify the grades of the sun-dried forest ginseng based on the preprocessed multi-grade sun-dried forest ginseng dataset described in step 1.

[0020] In this implementation manner, the pre-processing in step 1 is specifically as follows: The multi-level sun-dried ginseng dataset was preprocessed using random brightness, random contrast, random Gaussian noise and random salt and pepper noise.

[0021] In this implementation, the EfficientNet_v2_s model optimized in step 3 further includes: The optimized EfficientNet_v2_s model adopts the CombinedLoss loss function, which is a combined loss function obtained by weighted summation of the FocalLoss loss function and the DiceLoss loss function.

[0022] In this implementation, the SCConv includes SRU and CRU, and the group normalization GroupNorm (group normalization) in the SRU is replaced by GroupBatchnorm2d (group batch normalization 2D). By separation and reconstruction, the feature map input at the input end of the optimized EfficientNet_v2_s model is subjected to spatial redundancy suppression to obtain a spatially refined feature map, and the spatially refined feature map is transmitted to the CRU; GroupBatchnorm2d is a normalization method that combines grouping ideas and batch statistics, mainly targeting two-dimensional convolutional features (such as image data). Its core operations are as follows: 1. Grouping: Divide the channels of the input feature map into G groups, each group contains C / G channels; 2. Batch statistics: For each channel group, the mean and variance of all samples in the group are calculated across the entire batch; 3. Normalization and Scaling: Features are normalized using the intra-group batch statistics and scaled and translated via learnable parameters (γ and β).

[0023] The CRU reduces the channel redundancy of the received spatially refined feature map and fuses the features by splitting, converting and fusing, thereby obtaining a channel-refined feature map.

[0024] In this implementation manner, the lightweight S-FPN module is specifically: The lightweight S-FPN module is added between the mobile flip bottleneck convolution module and the head network in the optimized EfficientNet_v2_s model. The mobile flip bottleneck convolution module generates a multi-scale feature map. Based on the upsampling operation, the multi-scale feature map is cascaded and fused through a multi-level scale fusion module, and the multi-level cascade fusion feature map is output through the corresponding output layer.

[0025] In this implementation, the optimized EfficientNet_v2_s model described in step 3 is trained in step 4, and the grades of the sun-dried forest ginseng are classified based on the preprocessed multi-grade sun-dried forest ginseng dataset described in step 1, specifically: The preprocessed multi-level sun-dried ginseng dataset described in step 1 is divided into a training set and a test set. The optimized EfficientNet_v2_s model is trained using the training set. The performance of the optimized EfficientNet_v2_s model is tested using the test set based on the cross-validation method to obtain the grade classification results.

[0026] In the prior art, there is a lack of image grade classification and recognition methods that can improve both computational accuracy and computational efficiency. To solve the above technical problems, this embodiment proposes a method for classifying and recognizing ginseng understory, including the following steps: Step 1: Establish a multi-level sun-dried forest ginseng dataset and perform preprocessing.

[0027] Step 1 specifically includes: Step 11, using a professional image acquisition device to acquire a sample, the image acquisition device includes a camera, a bracket, an artificial light source, and a background device; Step 12, offline enhancement is performed on the collected data set. The offline enhancement uses random brightness, random contrast, random Gaussian noise, and random salt and pepper noise to expand the data set. Data enhancement can expand the data set by generating additional training samples and provide more samples for training the model, thereby improving the generalization ability of the model. Step 13, divide the enhanced data set and use the five-fold cross-validation method to comprehensively evaluate the model performance.

[0028] Step 2: Build the EfficientNet_v2_s model, adjust and configure the corresponding training parameters; Step 2 specifically includes: Build the EfficientNet_v2_s model, adjust and configure the corresponding training parameters to adapt it to the image classification task.

[0029] Step 3: Improve and optimize the EfficientNet_v2_s model, introduce the SCConv module into Fused-MBConv, introduce the lightweight S-FPN module, and use the CombinedLoss loss function which combines the FocalLoss loss function with the DiceLoss loss function; Step 3 specifically includes: Step 31, introduce the SCConv module into the Fused-MBConv module, and use SCConv instead of the standard convolution, so that the model can focus more on learning representative and discriminative features, reduce the interference of irrelevant or redundant features, and thus improve the quality and expression ability of features; Step 32: introduce a lightweight S-FPN module. The S-FPN module creates various synthetic layers between the original FPN (Feature Pyramid Network) layers to reduce the impact of scale truncation, and can better perform feature fusion between feature maps of different scales, thereby improving feature expression capabilities and final task performance without significantly increasing computational costs. Step 33, using the CombinedLoss loss function, which is a loss function that combines the FocalLoss loss function and the DiceLoss loss function in a certain proportion. This loss function uses the FocalLoss loss function to alleviate the imbalance between classes, and optimizes the target boundary recognition through the DiceLoss loss function. The CombinedLoss loss function combines the two functions to balance the loss contribution, allowing the model to focus on both categories and regions.

[0030] Step 32 specifically includes: Step 321, horizontal connection, using 1x1 convolutional layers to establish connections between different layers of the network, reducing channel dimensions and reducing the amount of calculation; Step 322, upsampling operation, by gradually upsampling high-level features to the same resolution as the underlying feature map, and fusing the lateral connection features with the features generated in the top-down path by element-by-element addition at each scale, thereby retaining the spatial information of the underlying features and enhancing the expression ability of the high-level semantic features; In step 322, upsampling usually adopts a simple bilinear interpolation or nearest neighbor interpolation method to further reduce the computational burden.

[0031] Step 32 also includes: In step 323, 3×3 convolution integrates information. The S-FPN module applies 3×3 convolution on the fused feature map to integrate local information and enhance the nonlinear expression ability of the feature.

[0032] Step 4: Use the optimized model for training and rank classification.

[0033] Therefore, this implementation improves the EfficientNet_v2_s model, optimizes its operating efficiency on low-resource devices, and designs a special feature layer for ginseng appearance features, which makes the model perform better in extracting color, texture, shape, etc. The improved model effectively overcomes the problems of strong subjectivity and low efficiency in traditional manual grading, and provides technical support for detection and mobile terminal deployment while maintaining high recognition accuracy.

[0034] In order to better illustrate the method for classifying and identifying the grade of sun-dried ginseng in forests described in this embodiment, a detailed description is given through the following examples: The method for classifying and identifying the grade of sun-dried understory ginseng proposed in this embodiment specifically includes the following steps: Step 1, establish a data set of sun-dried ginseng understory with multi-level classification and perform preprocessing; Step 1 specifically includes: Step 11, use professional image acquisition devices to obtain samples and create a dataset of raw sun-dried forest ginseng. The dataset for this study was collected in a Chinese herbal medicine store in Changchun in October 2023. The rating was based on the "Jilin Province Authentic Medicinal Material Ginseng" standard, and the forest ginseng was divided into four grades: special grade, first grade, second grade, and ordinary. Subsequent verification was carried out by ginseng experts from the College of Chinese Medicinal Materials of Jilin Agricultural University to ensure that the classification was accurate. Data collection used a micro single camera Canon EOS R10 and a 50mm fixed-focus lens, and the camera was fixed at a height of 1.5 meters above the ginseng through a camera bracket to maintain a uniform brightness of the ambient light source. The camera parameters were set to ISO400, shutter speed 1 / 200 second, aperture value 2.8, and high-definition photos with a resolution of 4000×6000 were taken. The picture details were clear, and multi-angle photos were taken for each forest ginseng, and the background was uniformly white A3 size. This dataset contains 152 special-grade sun-dried ginseng photos, 154 first-grade sun-dried ginseng photos, 154 second-grade sun-dried ginseng photos, and 154 ordinary sun-dried ginseng photos, providing rich and reliable data support for subsequent research. Step 12: Offline enhancement of the collected data set. Offline enhancement uses random brightness, random contrast, random Gaussian noise, and random salt and pepper noise to expand the data set. After offline enhancement, the data is expanded to 3070 images. By generating additional training samples to expand the data set, data enhancement effectively solves the problem of limited data volume, provides sample support for model training, and improves model robustness. Step 13, divide the enhanced data set, and use the five-fold cross-validation method to evaluate the model performance, specifically, randomly select 80% of the images from the data set as the training set, and 20% of the images as the test set, that is, use 614 images as test data each time, and 2456 images as training data, without repeated test data. After the division, the training set and test set of each level of ginseng are: 608 and 152 for special ginseng; 616 and 154 for first, second and ordinary ginseng. The final result of the experiment is the average of five experiments. Through data enhancement to prevent the accidental results of a single experiment, the generalization ability of the model can be more comprehensively evaluated.

[0035] Step 2: Build the EfficientNet_v2_s model, adjust and configure the corresponding training parameters to make it more suitable for image classification tasks; Step 3: Improve and optimize the EfficientNet_v2_s model, introduce the SCConv module into Fused-MBConv, introduce the lightweight S-FPN module, and use the CombinedLoss loss function which combines the FocalLoss loss function with the DiceLoss loss function; After the model is optimized in step 3, Figure 1 As shown, the optimization steps specifically include: Step 31, as Figure 2 As shown in Figure 2, SCConv is used instead of standard convolution in the Fused-MBConv module. Figure 2 The left and right sides of the figure are schematic diagrams of the module structure before and after improvement. SCConv is a convolutional module that mainly includes SRU and CRU. It optimizes the feature extraction process by processing the spatial and channel redundancy of feature maps, thereby reducing computing resource consumption and improving network performance, making the model more focused on learning representative and discriminative features, reducing the interference of irrelevant or redundant features, and improving feature quality and expression capabilities. The SRU spatial reconstruction unit structure in step 31 is as follows Figure 3 As shown in the figure, the GroupNorm of SCConv is replaced with the custom GroupBatchnorm2d to adapt to the default configuration of BatchNorm (batch normalization) of the EfficientNet_v2_s model to avoid statistical deviation during training. The specific implementation process includes: (a) GroupBatchnorm2d: Normalizes the input features to reduce the scale differences between different feature maps; (b) Weight generation: weights are generated from the normalized feature maps by applying normalization and an activation function such as Sigmoid. (c) Feature separation: According to the generated weights, the input features are separated to form multiple sub-feature sets; (d) Feature reconstruction: reorganize these separated features to improve information flow and reduce spatial redundancy; Through these steps, SRU can effectively reduce the redundancy of features in the spatial dimension and improve the spatial expression ability of features.

[0036] The CRU channel reconstruction unit structure in step 31 is as follows Figure 4 As shown, the specific implementation process includes: (A) Split operation: The channels of the input feature map are divided into two parts, one containing αC channels and the other containing (1-α)C channels, and then compressed through 1×1 convolution to reduce the amount of calculation; (B) Conversion operation: The separated upper half feature map is transformed by GroupBatchnorm2d and Group-wiseConvolution to further reduce the redundancy between channels and enhance the feature expression capability; (C) Fusion operation: The transformed features are fused with the unseparated lower half features, and the channel dimension is fused through 1×1 convolution to output the refined features; Through these three steps, CRU can effectively reduce redundancy in the channel dimension and improve the representativeness of features, thereby improving the performance and efficiency of the model.

[0037] Therefore, the SCConv module is formed by combining SRU and CRU, which can make the model more focused on learning representative and discriminative features, reduce the interference of irrelevant or redundant features, and thus improve the quality and expression ability of features. However, if SRU is simply combined with CRU, when adapting the default configuration of BatchNorm of EfficientNet_v2_s, statistical deviation problems will occur in training. In order to overcome the above technical problems, this implementation method avoids the problem of statistical deviation in training by replacing the GroupNorm of SCConv with a customized GroupBatchnorm2d.

[0038] Step 32, introduce a lightweight S-FPN module, which constructs various synthetic layers between the original FPN layers and scales the feature maps to different scales such as 1 / 2, 1 / 3, 1 / 4, and 1 / 6, so as to achieve a smoother scale transition, reduce the impact of scale truncation, and improve the feature fusion capability between feature maps of different scales. At the same time, without significantly increasing the computational cost, the feature expression capability and the final task performance are enhanced; In step 32, the S-FPN module is as follows Figure 5 As shown, the specific implementation process includes: Step 321, horizontal connection, using 1x1 convolutional layers to establish connections between different layers of the network, reducing channel dimensions and reducing the amount of calculation; Step 322, upsampling operation, through the upsampling operation of the top-down path, gradually upsampling the high-level features to the same resolution as the low-level feature map, and fusing the lateral connection features with the features generated in the top-down path by element-by-element addition at each scale, thereby retaining the spatial information of the underlying features and enhancing the expression ability of the high-level semantic features; In step 322, upsampling usually adopts a simple bilinear interpolation or nearest neighbor interpolation method, which further reduces the computational burden.

[0039] Step 323, 3×3 convolution integrates information. S-FPN applies 3×3 convolution on the fused feature map to integrate local information and enhance the nonlinear expression ability of the feature. S-FPN is integrated between the backbone network and the head network of EfficientNet_v2_s. During the forward propagation process, the backbone network generates multiple feature maps of different scales, which are then passed to the S-FPN module for multi-scale feature fusion. By introducing S-FPN at this position, the model can improve the model performance without significantly increasing the computational cost.

[0040] Step 33 uses the CombinedLoss loss function, which is a loss function that combines the FocalLoss loss function and the DiceLoss loss function in a certain proportion. The FocalLoss loss function can weight difficult-to-classify samples to alleviate the problem of category imbalance and make the model pay more attention to minority class samples. The DiceLoss loss function effectively enhances the recognition ability of the target area in the image segmentation task, thereby improving the segmentation performance of the model. By combining the above two functions, the improved loss function can balance the loss contribution, allowing the model to focus on category discrimination and target areas at the same time, improving the overall task performance; In step 33, the FocalLoss loss function is improved on the basis of the standard cross entropy loss. The core idea is to introduce the adjustment factor , so that the model pays more attention to difficult samples that are difficult to classify during training, while reducing the attention to simple samples that have been classified correctly. The calculation process is shown in formula (1), where is the predicted probability, is the balance factor, is the adjustment factor: ; (1) In step 33, the DiceLoss loss function is a measure for evaluating sample similarity, which is widely used in semantic segmentation tasks, especially in situations where the foreground and background are unbalanced. This function effectively reduces the influence of background pixels on the model by calculating the intersection ratio between the predicted and true labels. The calculation process is shown in formula (2), where: is the prediction set, For the real set, is a small constant used to avoid zero denominator: ; (2) In step 33, the CombinedLoss loss function is a combined loss function obtained by weighted summation of the FocalLoss loss function and the DiceLoss loss function. First, the values ​​of the FocalLoss loss function and the DiceLoss loss function are calculated respectively, and then the two are linearly combined by the weighted coefficient. The calculation process is shown in formula (3), where: and Respectively represent The loss function and The weight coefficient of the loss function is used to control the ratio of the two in the combined loss: ; (3) Step 4: Use the optimized model for training and rank classification.

[0041] In step 4, the specific steps include: Step 41, adjust parameters: use the EfficientNet_v2_s model before and after optimization for training respectively, where the data set input size is 224×224, the number of samples is 3070, the number of training rounds is 100, the batch size is set to 32, and the model parameters are adjusted to be consistent according to the training results; Step 42, ablation experiment: save the model weights after each training, and use the weights to evaluate the test set. The average value of the five experiments is used as the final result of the experiment to evaluate the performance of the model. After the improved model, the recognition accuracy rate reached 92.37%, and the number of parameters was only 2.37M. The specific experimental results are as follows Fig. 9 As shown in the figure, the confusion matrix comparison after model training is as follows Figure 8 As shown, Figure 8 The left and right figures are schematic diagrams of the confusion matrix of the original model and the improved model, respectively. Figure 8 As shown in the figure, the improved model has a greatly improved accuracy in identifying ginseng under the forest, especially in reducing the misclassification of the second level as the first level. At the same time, the recognition accuracy of the ordinary level has also been significantly improved. By comparison, it can be observed that S-FPN has improved the problem of uneven feature fusion caused by the large scale gap between adjacent layers, enabling the model to extract the visual features of the target more accurately. Step 43, comparative experiment: the training weights of the models before and after improvement are respectively compared with multiple common lightweight models. The experiment selects MobileNetV2 (lightweight convolutional neural network V2), RegNet_x1_6gf (regular network_x1_6gf), ShuffleNetV2_x0_5 (lightweight deep convolutional neural network V2_x0_5), ShuffleNetV2_x1_0 (lightweight deep convolutional neural network V2_x1_0), SqueezeNet1_0 (compressed network 1_0) as comparison models. The comparison results are as follows: Fig.10 As shown, the loss values ​​of different models are compared. Figure 6 As shown in Figure 2, the accuracy of different models is compared. Figure 7 As shown in the above results, it can be seen that the improved model is superior to other models in terms of accuracy and loss value.

[0042] In order to solve the limitations of the above-mentioned image grade classification and recognition model, combined with the market demand for ginseng classification and the current development status of image classification technology, the data set constructed in this implementation method is based on the "Authentic Medicinal Material Ginseng in Jilin Province" and the expert rating system, and the classification is scientific and rigorous. By introducing SCConv into Fused-MBConv, the efficiency of feature extraction is improved; a lightweight S-FPN module is added between the backbone network and the head network of EfficientNet_v2_s, and objects of different scales can be processed more effectively by selectively aggregating feature maps; the CombinedLoss loss function, which is a combination of the FocalLoss loss function and the DiceLoss loss function, can not only improve the model's recognition ability for complex samples, but also help the model to more accurately capture the target boundaries in the task, improve model performance, and adapt to the needs of different scenarios. This time, the optimized EfficientNet_v2_s model was used to classify the grades of forest ginseng, showing a wide range of use value and application prospects.

[0043] This implementation method selects forest ginseng as the research object because its growth environment is affected by many factors, its morphology is diverse, and it has a large market demand, as well as greater economic and medicinal value. To ensure data quality, this implementation method uses standardized high-definition photography technology, combined with the "Jilin Province Authentic Medicinal Material Ginseng" standard and expert appraisal, to construct a data set of raw sun-dried forest ginseng containing special, first, second and ordinary grades, providing a solid foundation for subsequent algorithm research.

[0044] In general, this implementation method not only promotes the development of Chinese medicinal materials grading and scheduling technology, but also helps to formulate unified industry standards, improve the level of market supervision of Chinese medicinal materials, ensure and improve the quality and safety of drugs in real time, and accelerate the deep integration of traditional medicine and modern artificial intelligence technology.

[0045] Implementation method 2. The system for classifying and identifying raw sun-dried ginseng understory ginseng according to this implementation method comprises the following modules: The preprocessing module collects sun-dried ginseng image samples, establishes a multi-level sun-dried ginseng dataset, and performs preprocessing to obtain a preprocessed multi-level sun-dried ginseng dataset. Build the module and build the EfficientNet_v2_s model; Optimize the module, optimize the EfficientNet_v2_s model after the construction module is built, including: The Fused-MBConv module in the EfficientNet_v2_s model is replaced with an improved Fused-MBConv module, wherein the improved Fused-MBConv module introduces SCConv instead of standard convolution in the Fused-MBConv module; a lightweight S-FPN module is added to the EfficientNet_v2_s model to obtain an optimized EfficientNet_v2_s model; The classification module trains the optimized EfficientNet_v2_s model described in the optimization module, and classifies the grades of the sun-dried forest ginseng based on the preprocessed multi-grade sun-dried forest ginseng dataset described in the preprocessing module.

[0046] Implementation method three. The electronic device for classifying and identifying the grade of ginseng under forests described in this implementation method comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; The processor is used to implement the method for classifying and identifying the grades of sun-dried forest ginseng described in the first embodiment when executing the program stored in the memory.

[0047] Embodiment 4. The computer-readable storage medium described in this embodiment stores a computer program, and when the computer program is executed by a processor, the method for classifying and identifying the grade of sun-dried forest ginseng described in embodiment 1 is implemented.

[0048] The above is a detailed introduction to the method, system, equipment and storage medium for classifying and identifying the grade of sun-dried forest ginseng proposed in the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for classifying and identifying the grades of sun-dried forest ginseng, characterized in that: The following steps are involved: Step 1, collecting sun-dried ginseng image samples, establishing a multi-level sun-dried ginseng dataset, and performing preprocessing to obtain a preprocessed multi-level sun-dried ginseng dataset; Step 2, build the EfficientNet_v2_s model; Step 3: Optimize the EfficientNet_v2_s model built in step 2, including: The Fused-MBConv module in the EfficientNet_v2_s model is replaced with an improved Fused-MBConv module, wherein the improved Fused-MBConv module introduces SCConv instead of standard convolution in the Fused-MBConv module; a lightweight S-FPN module is added to the EfficientNet_v2_s model to obtain an optimized EfficientNet_v2_s model; Step 4: train the optimized EfficientNet_v2_s model described in step 3, and classify the grades of the sun-dried forest ginseng based on the preprocessed multi-grade sun-dried forest ginseng dataset described in step 1.

2. The method for classifying and identifying the grade of sun-dried forest ginseng according to claim 1 is characterized in that: The pre-processing in step 1 is specifically as follows: The multi-level sun-dried ginseng dataset was preprocessed using random brightness, random contrast, random Gaussian noise and random salt and pepper noise.

3. The method for classifying and identifying the grade of sun-dried forest ginseng according to claim 1, characterized in that: The EfficientNet_v2_s model optimized in step 3 further includes: The optimized EfficientNet_v2_s model adopts the CombinedLoss loss function, which is a combined loss function obtained by weighted summation of the FocalLoss loss function and the DiceLoss loss function.

4. The method for classifying and identifying the grade of sun-dried forest ginseng according to claim 1, characterized in that: The SCConv includes SRU and CRU, and the group normalization GroupNorm in SRU is replaced by GroupBatchnorm2d. The feature map input at the input end of the optimized EfficientNet_v2_s model is subjected to spatial redundancy suppression to obtain a spatially refined feature map by separation and reconstruction, and the spatially refined feature map is transmitted to CRU; The CRU reduces the channel redundancy of the received spatially refined feature map and fuses the features by splitting, converting and fusing, thereby obtaining a channel-refined feature map.

5. The method for classifying and identifying the grade of sun-dried forest ginseng according to claim 1, characterized in that: The lightweight S-FPN module is specifically: The lightweight S-FPN module is added between the mobile flip bottleneck convolution module and the head network in the optimized EfficientNet_v2_s model. The mobile flip bottleneck convolution module generates a multi-scale feature map. Based on the upsampling operation, the multi-scale feature map is cascaded and fused through a multi-level scale fusion module, and the multi-level cascade fusion feature map is output through the corresponding output layer.

6. The method for classifying and identifying the grade of sun-dried forest ginseng according to claim 1, characterized in that: In step 4, the optimized EfficientNet_v2_s model described in step 3 is trained, and based on the preprocessed multi-level sun-dried forest ginseng dataset described in step 1, the levels of the sun-dried forest ginseng are classified, specifically: The preprocessed multi-level sun-dried ginseng dataset described in step 1 is divided into a training set and a test set. The optimized EfficientNet_v2_s model is trained using the training set. The performance of the optimized EfficientNet_v2_s model is tested using the test set based on the cross-validation method to obtain the grade classification results.

7. The system for classifying and identifying the grade of sun-dried forest ginseng is characterized by: Includes the following modules: The preprocessing module collects sun-dried ginseng image samples, establishes a multi-level sun-dried ginseng dataset, and performs preprocessing to obtain a preprocessed multi-level sun-dried ginseng dataset. Build the module and build the EfficientNet_v2_s model; Optimize the module, optimize the EfficientNet_v2_s model after the construction module is built, including: The Fused-MBConv module in the EfficientNet_v2_s model is replaced with an improved Fused-MBConv module, wherein the improved Fused-MBConv module introduces SCConv instead of standard convolution in the Fused-MBConv module; a lightweight S-FPN module is added to the EfficientNet_v2_s model to obtain an optimized EfficientNet_v2_s model; The classification module trains the optimized EfficientNet_v2_s model described in the optimization module, and classifies the grades of the sun-dried forest ginseng based on the preprocessed multi-grade sun-dried forest ginseng dataset described in the preprocessing module.

8. Electronic equipment for classifying and identifying the grade of fresh and dried forest ginseng, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the method for classifying and identifying the grade of sun-dried forest ginseng as described in any one of claims 1 to 6 when executing the program stored in the memory.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for classifying and identifying the grade of sun-dried forest ginseng described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Method for classifying rotten strawberries based on GC-OfficientNet V2 model

    CN118212631A

  • Under-forest parameter year nondestructive identification system and method based on visible light hyperspectrum and convolutional neural network model

    CN116524262A

  • Ginseng grading method, device and equipment

    CN117456286A