Intelligent identification method and device for cordyceps for realizing refined image classification

Through image recognition technology and deep learning models, the problems of strong subjectivity and inconsistent recognition in traditional Cordyceps sinensis identification methods have been solved, refined Cordyceps image classification has been achieved, and identification accuracy and result interpretability have been improved.

CN118154998BActive Publication Date: 2024-10-29NEWLIXON TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410575767.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-10
Publication Date
2024-10-29
Estimated Expiration
2044-05-10

AI Technical Summary

Technical Problem

The traditional Cordyceps identification method relies on manual experience, is highly subjective, inconsistent, and difficult to accurately distinguish between species with similar appearance, and lacks a unified objective standard.

Method used

Image recognition technology is used to collect and label Cordyceps sinensis images for data enhancement and segmentation. Mask R-CNN model and ResNet-based deep neural network model are used for Cordyceps region segmentation and variety identification, combined with cross-domain feature fusion and adversarial loss functions. Achieve refined image classification.

Benefits of technology

It provides objective and reproducible Cordyceps identification results, improves the identification accuracy of similar varieties, reduces the amount of data and calculation costs, enhances the identification accuracy, and improves the interpretability of classification results through a comprehensive scoring mechanism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118154998B_ABST
    Figure CN118154998B_ABST
Patent Text Reader

Abstract

The present application discloses a Cordyceps intelligent recognition method and device for realizing refined image classification, which relates to the field of image recognition technology. Cordyceps images are collected, each Cordyceps image is annotated with a corresponding variety label, data enhancement is performed on the Cordyceps images, the Cordyceps area and the background area in the image are segmented, an image data set is constructed using the segmented images, a ResNet-based deep neural network model is constructed, a cross-domain feature fusion module is added, and an adversarial loss function is designed. The model is trained using the image data set to obtain a Cordyceps recognition model for identifying the probability of Cordyceps being different varieties, an actual Cordyceps image is obtained for segmentation, Cordyceps is identified using the Cordyceps recognition model, the probability of Cordyceps being each variety is obtained, a comprehensive score for the classification of Cordyceps varieties is calculated, and the variety with the highest comprehensive score is selected as the final classification result, thereby realizing refined classification of Cordyceps images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition technology, and in particular to a method and device for intelligently identifying Cordyceps sinensis for realizing refined image classification. Background Art

[0002] Cordyceps sinensis is a precious traditional medicinal material with high medicinal and economic value. It is a symbiotic combination of winter cordyceps and summer grass. Due to differences in growth environment and species, different varieties of Cordyceps sinensis vary greatly in appearance, medicinal ingredients, etc. Therefore, accurate identification and classification of different varieties of Cordyceps sinensis is a key link in ensuring the quality of medicinal materials and guiding their rational use.

[0003] Traditional methods of identifying Cordyceps sinensis mainly rely on manual experience, which is to observe the external features of Cordyceps sinensis, such as morphology, color, texture, etc., combined with information about the growth environment, and rely on expert experience for manual identification and classification. This subjective identification method has some obvious defects: it is highly subjective, there are differences in the experience and judgment of different experts, and there is a lack of unified objective standards; it is difficult to accurately distinguish varieties with similar appearances or slight differences manually.

[0004] With the development of computer vision and machine learning technologies, automated Cordyceps sinensis identification methods based on digital image processing and image recognition have gradually gained attention. Summary of the invention

[0005] The present application aims to solve at least one of the technical problems in the related art to a certain extent. To this end, one purpose of the present application is to propose a Cordyceps intelligent identification method and device for realizing refined image classification, thereby realizing refined classification of Cordyceps images.

[0006] One aspect of the present application provides a method for realizing refined image classification of Cordyceps intelligent identification, comprising:

[0007] Step S100: collecting images of different varieties of Cordyceps sinensis, and labeling each Cordyceps sinensis image with a corresponding variety label;

[0008] The different varieties of Cordyceps sinensis include but are not limited to: Qinghai-Tibet Cordyceps sinensis and Xinjiang Cordyceps sinensis. The back annular region and foot region of different varieties of Cordyceps sinensis have different local features. The total number of varieties of Cordyceps sinensis is N, and the total number of types of local features is M.

[0009] The images of different varieties of Cordyceps sinensis include: images of different varieties of Cordyceps sinensis at different angles and under different backgrounds;

[0010] The specific method of collecting images of different varieties of Cordyceps sinensis and labeling each Cordyceps sinensis image with a corresponding variety label is as follows:

[0011] Obtaining Cordyceps sinensis images of different growth stages, different environmental conditions, different varieties, and different angles from an image library of an agricultural product research system, wherein the Cordyceps sinensis in the Cordyceps sinensis images are healthy and free of pests and diseases, and the different varieties refer to known Cordyceps sinensis varieties with variety labels;

[0012] According to the species of Cordyceps sinensis in each Cordyceps sinensis image, a corresponding species label is annotated on the Cordyceps sinensis image;

[0013] Step S200: performing data enhancement on the Cordyceps sinensis image, segmenting the Cordyceps sinensis region and the background region in the Cordyceps sinensis image, and constructing an image data set using the segmented Cordyceps sinensis image;

[0014] The specific method of performing data enhancement on the Cordyceps sinensis image, segmenting the Cordyceps sinensis region and the background region in the Cordyceps sinensis image, and constructing the image data set using the segmented Cordyceps sinensis image is as follows:

[0015] Step S210: Randomly adjust the brightness, contrast, and color balance of the Cordyceps sinensis image to simulate Cordyceps sinensis under different lighting conditions, and simulate the distortion of Cordyceps sinensis in the natural environment by performing a smooth deformation transformation on the Cordyceps sinensis image;

[0016] Step S220: mirroring the Cordyceps sinensis image, introducing Gaussian noise, and randomly cropping it;

[0017] Step S230: training a Mask R-CNN model to segment the Cordyceps sinensis region from the background region in the Cordyceps sinensis image;

[0018] The specific method of training the Mask R-CNN model to segment the cordyceps region and the background region in the cordyceps image is as follows:

[0019] Step S231: manually marking the position of the bounding box of the Cordyceps sinensis and the Cordyceps sinensis area in the Cordyceps sinensis image;

[0020] Step S232: Initialize the network structure of the Mask R-CNN model, including: ResNet, RPN, RolPool layers and three prediction branches;

[0021] Among them, ResNet is the backbone network, which is used to extract Cordyceps features from the input Cordyceps sinensis image;

[0022] RPN is a region proposal network, which is used to generate a bounding box containing the Cordyceps region from the feature map;

[0023] The RolPool layer is used to extract feature vectors from the bounding box of the Cordyceps region;

[0024] The three prediction branches are predicting the species of Cordyceps sinensis, predicting the bounding box position of Cordyceps sinensis, and predicting the Cordyceps sinensis area;

[0025] Step S233: using the Cordyceps sinensis image with the marked Cordyceps sinensis bounding box position and Cordyceps sinensis area as input data, and using the bounding box position and Cordyceps sinensis area corresponding to each Cordyceps sinensis image as output data, so as to correctly segment the Cordyceps sinensis area and the background area as the classification target of the Mask R-CNN model, to accurately predict the Cordyceps sinensis bounding box position and size as the regression target of the Mask R-CNN model, and to accurately generate the Cordyceps sinensis area of ​​each Cordyceps sinensis as the segmentation target of the Mask R-CNN model;

[0026] Step S234: defining a loss function, wherein the loss function includes classification loss, regression loss and segmentation loss, minimizing the loss function is used as a training goal, and when the loss function reaches convergence, the training is stopped to obtain a trained Mask R-CNN model;

[0027] The calculation formula of the classification loss is: ,in, is the probability that the area in the predicted Cordyceps sinensis image is the Cordyceps sinensis area, is the true label of the region in the Cordyceps sinensis image, log() is the logarithmic function;

[0028] The calculation formula of the regression loss is: ,in, are the four parameters for the predicted bounding box location, is the true kth parameter of the bounding box position, is a smooth L1 loss function;

[0029] The four parameters of the bounding box position are the center coordinates of the bounding box and width, height ;

[0030] The calculation formula of the segmentation loss is: ,in, is the probability that the predicted pixel belongs to the Cordyceps area, is the true label of the pixel;

[0031] The loss function is the weighted sum of classification loss, regression loss, and segmentation loss, and the calculation formula is: , where λ and μ are the weight coefficients of regression loss and segmentation loss respectively. , , They are the normalization coefficients of classification loss, regression loss, and segmentation loss respectively;

[0032] Step S240: using the trained Mask R-CNN model to segment the cordyceps region and the background region in the segmented cordyceps image, and using the segmented cordyceps image to construct an image dataset;

[0033] Step S300: construct a deep neural network model based on ResNet, add a cross-domain feature fusion module, and design an adversarial loss function;

[0034] The specific method of building a deep neural network model based on ResNet, adding a cross-domain feature fusion module, and designing an adversarial loss function is as follows:

[0035] Step S310: constructing a deep neural network model based on ResNet, including: a ResNet backbone network, a cross-domain feature fusion module, a fully connected layer, and a domain classifier;

[0036] The ResNet backbone network is used to extract features of the input Cordyceps sinensis image;

[0037] The cross-domain feature fusion module is used to fuse source domain and target domain features;

[0038] The fully connected layer is used to map the fused features to the prediction results of the varieties of Cordyceps sinensis;

[0039] The domain classifier is used to distinguish whether the feature comes from the source domain or the target domain;

[0040] Step S320: adding a cross-domain feature fusion module on top of the ResNet backbone network;

[0041] The cross-domain feature fusion module extracts features from the labeled image dataset of the source domain and the unlabeled Cordyceps sinensis images of the target domain, and performs feature fusion;

[0042] Step S330: Input the fused features into the fully connected layer, and the fully connected layer outputs the prediction result of the variety of Cordyceps sinensis. Through the softmax activation function, the prediction result is converted into a probability score for predicting that the Cordyceps sinensis belongs to each variety;

[0043] Step S340: designing an adversarial loss function to minimize the error between the prediction result and the real Cordyceps sinensis variety label, and adding a domain classifier to distinguish whether the feature is from the source domain or the target domain;

[0044] The calculation formula of the adversarial loss function is: ,in, is the source domain classification loss, is the target domain classification loss, δ is the weight coefficient for balancing the source domain classification loss and the target domain classification loss;

[0045] The source domain classification loss The calculation formula is: ,in, is the total number of Cordyceps sinensis images in the image dataset in the source domain, represents the xth Cordyceps sinensis image sample in the source domain, represents the probability that the domain classifier predicts that the x-th Cordyceps sinensis image sample comes from the source domain;

[0046] The target domain classification loss The calculation formula is: ,in, is the total number of Cordyceps sinensis images in the target domain, represents the xth Cordyceps sinensis image in the target domain, represents the probability that the domain classifier predicts that the x-th Cordyceps sinensis image comes from the target domain;

[0047] Step S400: using the image data set to train a deep neural network model based on ResNet to obtain a Cordyceps identification model for identifying the probability of Cordyceps sinensis being different varieties;

[0048] The specific method of using the image data set to train the ResNet-based deep neural network model to obtain the Cordyceps identification model for identifying the probability of Cordyceps sinensis being different varieties is:

[0049] Step S410: using the segmented Cordyceps sinensis images in the image data set as input data, encoding the Cordyceps sinensis variety label corresponding to each Cordyceps sinensis image as output data corresponding to the Cordyceps sinensis image;

[0050] Step S420: The ResNet backbone network extracts a feature vector from the input Cordyceps sinensis image, and the fully connected layer maps the feature vector to the number dimension of the variety, which is converted into a probability score of each variety by the softmax activation function for output;

[0051] Step S430: accurately predicting the species of Cordyceps sinensis in the Cordyceps sinensis image as a prediction target, minimizing the adversarial loss function between the predicted species and the true species label as a training target, and stopping the training when the adversarial loss function reaches convergence;

[0052] Step S500: obtaining an actual Cordyceps sinensis image and segmenting it using the Mask R-CNN model, identifying the Cordyceps sinensis using the Cordyceps sinensis recognition model, obtaining the probability that the Cordyceps sinensis is each variety, calculating the comprehensive score of the Cordyceps sinensis variety classification, and selecting the variety with the highest comprehensive score as the final classification result;

[0053] The specific method of obtaining an actual Cordyceps sinensis image and segmenting it using the Mask R-CNN model, identifying the Cordyceps sinensis using the Cordyceps sinensis recognition model, and obtaining the probability that the Cordyceps sinensis is each variety is as follows:

[0054] Obtain the actual Cordyceps sinensis image that needs to be refinedly classified, use the trained Mask R-CNN model to segment the actual Cordyceps sinensis image to obtain the segmented Cordyceps sinensis image, use the segmented Cordyceps sinensis image as input data, use the trained Cordyceps sinensis recognition model to perform recognition, predict the probability of Cordyceps sinensis being each variety, and output it;

[0055] The specific method for calculating the comprehensive score of Cordyceps sinensis variety classification and selecting the variety with the highest comprehensive score as the final classification result is:

[0056] Step S510: define the comprehensive score of the variety classification, the calculation formula of the comprehensive score is: ,in, represents the comprehensive score of the i-th Cordyceps sinensis variety, represents the confidence score of the i-th variety, represents the characteristic consistency score of the i-th variety, represents the growth environment adaptability score of the i-th variety, α is the weight coefficient of the confidence score, β is the weight coefficient of the feature consistency score, and γ is the weight coefficient of the growth environment adaptability score, where ;

[0057] Step S520: Calculate confidence score ;

[0058] The confidence score The calculation formula is: ,in, represents the probability of the i-th variety predicted by the Cordyceps identification model, N represents the total number of Cordyceps varieties, Represents the sum of the predicted probabilities of N varieties;

[0059] Step S530: Calculate feature consistency score ;

[0060] The feature consistency score The calculation formula is: ,in, represents the jth characteristic value of the i-th variety, represents the average characteristic value of the i-th variety, and M represents the total number of local characteristics of Cordyceps sinensis;

[0061] The characteristic value refers to the value of the local characteristics of Cordyceps sinensis quantified after feature extraction, and the average characteristic value is the average value of all characteristic values;

[0062] Step S540: Calculate the growth environment adaptability score ;

[0063] The growth environment adaptability score The calculation formula is: , where E represents the current environmental conditions for the growth of Cordyceps sinensis, represents the most suitable growth environment for the i-th variety of Cordyceps sinensis, and k is the adjustment parameter;

[0064] Step S550: comprehensively calculating the confidence score, the feature consistency score, and the growth environment adaptability score to obtain a comprehensive score for the i-th Cordyceps sinensis variety;

[0065] The final calculation formula for the comprehensive score is: ;

[0066] Step S560: sort the comprehensive scores of all varieties, and select the variety with the highest comprehensive score as the current classification of Cordyceps sinensis.

[0067] One aspect of the present application provides a Cordyceps intelligent identification device for realizing refined image classification, comprising:

[0068] An image collection and annotation module is used to collect images of different varieties of Cordyceps sinensis and annotate each Cordyceps sinensis image with a corresponding variety label;

[0069] An image segmentation processing module is used to perform data enhancement on the Cordyceps sinensis image, segment the Cordyceps sinensis area and the background area in the Cordyceps sinensis image, and construct an image data set using the segmented Cordyceps sinensis image;

[0070] Model building design module, which is used to build a deep neural network model based on ResNet, add a cross-domain feature fusion module, and design an adversarial loss function;

[0071] A recognition model training module is used to train a ResNet-based deep neural network model using an image data set to obtain a Cordyceps recognition model for identifying the probability of Cordyceps sinensis being different varieties;

[0072] The comprehensive score calculation module is used to obtain the actual Cordyceps sinensis image and segment it using the Mask R-CNN model, identify the Cordyceps sinensis using the Cordyceps sinensis recognition model, obtain the probability that the Cordyceps sinensis is each variety, calculate the comprehensive score of the Cordyceps sinensis variety classification, and select the variety with the highest comprehensive score as the final classification result.

[0073] One aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the processor executes the steps in the Cordyceps intelligent identification method for realizing refined image classification.

[0074] One aspect of the present application provides a readable storage medium storing a computer program, wherein the computer program is suitable for loading by a processor to execute the steps in a method for intelligent identification of Cordyceps sinensis for achieving refined image classification.

[0075] Compared with the prior art, the Cordyceps intelligent identification method and device for realizing refined image classification proposed in this application have the following advantages:

[0076] Traditional manual recognition is highly subjective. The judgments of the same expert at different time points may differ, and there are inevitably disagreements between different experts. However, this application is based on computer vision and deep learning models, and the classification results given are objective and reproducible, not affected by personal subjective factors, and have stronger consistency.

[0077] The ResNet-based deep neural network model provided in this application can automatically learn and extract the intrinsic characteristics of Cordyceps sinensis from a large amount of data, including morphology, texture, color, etc., and can discover hidden features that are difficult for the human eye to recognize, so the recognition accuracy of similar varieties is higher;

[0078] The Mask R-CNN model is used to segment the cordyceps region from the background region in the cordyceps image, and then the cordyceps image is identified by the cordyceps recognition model. This helps the cordyceps recognition model focus on learning the characteristics of cordyceps from the segmented cordyceps region, reduces the amount of data and computing costs, increases the cordyceps recognition model's attention to the cordyceps region, and improves the recognition accuracy.

[0079] This application calculates the comprehensive score through a comprehensive scoring mechanism based on confidence, feature consistency, and environmental adaptability, giving the classification results better interpretability and reference value. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] Figure 1 A method flow chart of the method for realizing the refined image classification of Cordyceps intelligent identification provided by the present application;

[0081] Figure 2 A timing diagram of the Cordyceps intelligent identification device for realizing refined image classification provided by the present application;

[0082] Figure 3 A functional module diagram of the Cordyceps intelligent identification device for realizing refined image classification provided by the present application;

[0083] Figure 4 A schematic diagram of the structure of an electronic device provided in this application;

[0084] Figure 5 It is a schematic diagram of the structure of a readable storage medium provided by this application. DETAILED DESCRIPTION

[0085] In order to better understand the present application, various aspects of the present application will be described in more detail with reference to the accompanying drawings. It should be understood that these detailed descriptions are only descriptions of exemplary embodiments of the present application and do not limit the scope of the present application in any way. Throughout the specification, the same reference numerals refer to the same elements. The expression "and / or" includes any and all combinations of one or more of the associated listed items.

[0086] In the accompanying drawings, the size, dimensions and shapes of the elements have been slightly adjusted for ease of illustration. The drawings are for illustration only and are not strictly drawn to scale. As used herein, the terms "substantially", "approximately" and similar terms are used as terms of approximation, not as terms of degree, and are intended to illustrate the inherent deviations in measurements or calculations that will be recognized by those of ordinary skill in the art. In addition, in this application, the order in which the steps are described does not necessarily represent the order in which these processes occur in actual operation, unless otherwise specified or can be derived from the context.

[0087] It should also be understood that expressions such as "including", "comprising", "having", "containing" and / or "comprising" are open rather than closed expressions in this specification, which indicate the presence of the stated features, elements and / or components, but do not exclude the presence of one or more other features, elements, components and / or combinations thereof. In addition, when expressions such as "at least one of..." appear after a list of listed features, they modify the entire list of features rather than just the individual elements in the list. In addition, when describing embodiments of the present application, "may" is used to mean "one or more embodiments of the present application". And, the term "exemplary" is intended to refer to an example or illustration.

[0088] Unless otherwise defined, all words (including engineering terms and scientific and technological terms) used in this article have the same meaning as those commonly understood by ordinary technicians in the field to which this application belongs. It should also be understood that unless there is a clear explanation in this application, words defined in commonly used dictionaries should be interpreted as having the same meaning as their meaning in the context of the relevant technology, and should not be interpreted in an idealized or overly formal sense.

[0089] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0090] Example 1

[0091] like Figure 1 As shown, the Cordyceps intelligent identification method for realizing refined image classification provided by the present application includes:

[0092] Step S100: collecting images of different varieties of Cordyceps sinensis, and labeling each Cordyceps sinensis image with a corresponding variety label;

[0093] The different varieties of Cordyceps sinensis include but are not limited to: Qinghai-Tibet Cordyceps sinensis and Xinjiang Cordyceps sinensis. The back annular region and foot region of different varieties of Cordyceps sinensis have different local features. The total number of varieties of Cordyceps sinensis is N, and the total number of types of local features is M.

[0094] The images of different varieties of Cordyceps sinensis include: images of different varieties of Cordyceps sinensis at different angles and under different backgrounds;

[0095] The specific method of collecting images of different varieties of Cordyceps sinensis and labeling each Cordyceps sinensis image with a corresponding variety label is as follows:

[0096] Obtaining Cordyceps sinensis images of different growth stages, different environmental conditions, different varieties, and different angles from an image library of an agricultural product research system, wherein the Cordyceps sinensis in the Cordyceps sinensis images are healthy and free of pests and diseases, and the different varieties refer to known Cordyceps sinensis varieties with variety labels;

[0097] According to the species of Cordyceps sinensis in each Cordyceps sinensis image, a corresponding species label is annotated on the Cordyceps sinensis image;

[0098] This step provides basic data for subsequent data enhancement model training by obtaining high-quality and diverse Cordyceps sinensis images;

[0099] Step S200: performing data enhancement on the Cordyceps sinensis image, segmenting the Cordyceps sinensis region and the background region in the Cordyceps sinensis image, and constructing an image data set using the segmented Cordyceps sinensis image;

[0100] The specific method of performing data enhancement on the Cordyceps sinensis image, segmenting the Cordyceps sinensis region and the background region in the Cordyceps sinensis image, and constructing the image data set using the segmented Cordyceps sinensis image is as follows:

[0101] Step S210: Randomly adjust the brightness, contrast, and color balance of the Cordyceps sinensis image to simulate Cordyceps sinensis under different lighting conditions, and simulate the distortion of Cordyceps sinensis in the natural environment by performing a smooth deformation transformation on the Cordyceps sinensis image;

[0102] Step S220: mirroring the Cordyceps sinensis image, introducing Gaussian noise, and randomly cropping it;

[0103] Step S230: training a Mask R-CNN model to segment the Cordyceps sinensis region from the background region in the Cordyceps sinensis image;

[0104] The specific method of training the Mask R-CNN model to segment the cordyceps region and the background region in the cordyceps image is as follows:

[0105] Step S231: manually marking the position of the bounding box of the Cordyceps sinensis and the Cordyceps sinensis area in the Cordyceps sinensis image;

[0106] Step S232: Initialize the network structure of the Mask R-CNN model, including: ResNet, RPN, RolPool layers and three prediction branches;

[0107] Among them, ResNet is the backbone network, which is used to extract Cordyceps features from the input Cordyceps sinensis image;

[0108] RPN is a region proposal network, which is used to generate a bounding box containing the Cordyceps region from the feature map;

[0109] The RolPool layer is used to extract feature vectors from the bounding box of the Cordyceps region;

[0110] The three prediction branches are predicting the species of Cordyceps sinensis, predicting the bounding box position of Cordyceps sinensis, and predicting the Cordyceps sinensis area;

[0111] Step S233: using the Cordyceps sinensis image with the marked Cordyceps sinensis bounding box position and Cordyceps sinensis area as input data, and using the bounding box position and Cordyceps sinensis area corresponding to each Cordyceps sinensis image as output data, so as to correctly segment the Cordyceps sinensis area and the background area as the classification target of the Mask R-CNN model, to accurately predict the Cordyceps sinensis bounding box position and size as the regression target of the Mask R-CNN model, and to accurately generate the Cordyceps sinensis area of ​​each Cordyceps sinensis as the segmentation target of the Mask R-CNN model;

[0112] Step S234: defining a loss function, wherein the loss function includes classification loss, regression loss and segmentation loss, minimizing the loss function is used as a training goal, and when the loss function reaches convergence, the training is stopped to obtain a trained Mask R-CNN model;

[0113] The calculation formula of the classification loss is: ,in, is the probability that the area in the predicted Cordyceps sinensis image is the Cordyceps sinensis area, is the true label of the region in the Cordyceps sinensis image, log() is the logarithmic function;

[0114] The calculation formula of the regression loss is: ,in, are the four parameters for the predicted bounding box location, is the true kth parameter of the bounding box position, is a smooth L1 loss function;

[0115] The four parameters of the bounding box position are the center coordinates of the bounding box and width, height ;

[0116] The calculation formula of the segmentation loss is: ,in, is the probability that the predicted pixel belongs to the Cordyceps area, is the true label of the pixel;

[0117] The loss function is the weighted sum of classification loss, regression loss, and segmentation loss, and the calculation formula is: , where λ and μ are the weight coefficients of regression loss and segmentation loss respectively. , , They are the normalization coefficients of classification loss, regression loss, and segmentation loss respectively;

[0118] Step S240: using the trained Mask R-CNN model to segment the cordyceps region and the background region in the segmented cordyceps image, and using the segmented cordyceps image to construct an image dataset;

[0119] This step increases the amount of data, enhances the generalization of the model, and segments the image to focus on the Cordyceps itself, providing more diverse input data for model training. Segmenting the image helps the model focus on the Cordyceps area.

[0120] Step S300: construct a deep neural network model based on ResNet, add a cross-domain feature fusion module, and design an adversarial loss function;

[0121] The specific method of building a deep neural network model based on ResNet, adding a cross-domain feature fusion module, and designing an adversarial loss function is as follows:

[0122] Step S310: constructing a deep neural network model based on ResNet, including: a ResNet backbone network, a cross-domain feature fusion module, a fully connected layer, and a domain classifier;

[0123] The ResNet backbone network is used to extract features of the input Cordyceps sinensis image;

[0124] Preferably, the ResNet backbone network uses ResNet-50 as the basic network, which includes 50 convolutional layers;

[0125] The cross-domain feature fusion module is used to fuse source domain and target domain features;

[0126] The fully connected layer is used to map the fused features to the prediction results of the varieties of Cordyceps sinensis;

[0127] The domain classifier is used to distinguish whether the feature comes from the source domain or the target domain;

[0128] Step S320: adding a cross-domain feature fusion module on top of the ResNet backbone network;

[0129] The cross-domain feature fusion module extracts features from the labeled image dataset of the source domain and the unlabeled Cordyceps sinensis images of the target domain, and performs feature fusion;

[0130] Step S330: Input the fused features into the fully connected layer, and the fully connected layer outputs the prediction result of the variety of Cordyceps sinensis. Through the softmax activation function, the prediction result is converted into a probability score for predicting that the Cordyceps sinensis belongs to each variety;

[0131] Step S340: designing an adversarial loss function to minimize the error between the prediction result and the real Cordyceps sinensis variety label, and adding a domain classifier to distinguish whether the feature is from the source domain or the target domain;

[0132] The calculation formula of the adversarial loss function is: ,in, is the source domain classification loss, is the target domain classification loss, δ is the weight coefficient for balancing the source domain classification loss and the target domain classification loss;

[0133] The source domain classification loss The calculation formula is: ,in, is the total number of Cordyceps sinensis images in the image dataset in the source domain, represents the xth Cordyceps sinensis image sample in the source domain, represents the probability that the domain classifier predicts that the x-th Cordyceps sinensis image sample comes from the source domain;

[0134] The target domain classification loss The calculation formula is: ,in, is the total number of Cordyceps sinensis images in the target domain, represents the xth Cordyceps sinensis image in the target domain, represents the probability that the domain classifier predicts that the x-th Cordyceps sinensis image comes from the target domain;

[0135] This step uses ResNet to extract high-quality features, fuse the source domain and the target domain, enhance domain adaptability, and provide a powerful network structure and feature representation capability for model training;

[0136] Step S400: using the image data set to train a deep neural network model based on ResNet to obtain a Cordyceps identification model for identifying the probability of Cordyceps sinensis being different varieties;

[0137] The specific method of using the image data set to train the ResNet-based deep neural network model to obtain the Cordyceps identification model for identifying the probability of Cordyceps sinensis being different varieties is:

[0138] Step S410: using the segmented Cordyceps sinensis images in the image data set as input data, encoding the Cordyceps sinensis variety label corresponding to each Cordyceps sinensis image as output data corresponding to the Cordyceps sinensis image;

[0139] Step S420: The ResNet backbone network extracts a feature vector from the input Cordyceps sinensis image, and the fully connected layer maps the feature vector to the number dimension of the variety, which is converted into a probability score of each variety by the softmax activation function for output;

[0140] Step S430: accurately predicting the species of Cordyceps sinensis in the Cordyceps sinensis image as a prediction target, minimizing the adversarial loss function between the predicted species and the true species label as a training target, and stopping the training when the adversarial loss function reaches convergence;

[0141] This step optimizes the model parameters on a large amount of data, learns to predict the Cordyceps species, and obtains a probability model that can identify different species, providing a model basis for the final classification;

[0142] Step S500: obtaining an actual Cordyceps sinensis image and segmenting it using the Mask R-CNN model, identifying the Cordyceps sinensis using the Cordyceps sinensis recognition model, obtaining the probability that the Cordyceps sinensis is each variety, calculating the comprehensive score of the Cordyceps sinensis variety classification, and selecting the variety with the highest comprehensive score as the final classification result;

[0143] The specific method of obtaining an actual Cordyceps sinensis image and segmenting it using the Mask R-CNN model, identifying the Cordyceps sinensis using the Cordyceps sinensis recognition model, and obtaining the probability that the Cordyceps sinensis is each variety is as follows:

[0144] Obtain the actual Cordyceps sinensis image that needs to be refinedly classified, use the trained Mask R-CNN model to segment the actual Cordyceps sinensis image to obtain the segmented Cordyceps sinensis image, use the segmented Cordyceps sinensis image as input data, use the trained Cordyceps sinensis recognition model to perform recognition, predict the probability of Cordyceps sinensis being each variety, and output it;

[0145] The specific method for calculating the comprehensive score of Cordyceps sinensis variety classification and selecting the variety with the highest comprehensive score as the final classification result is:

[0146] Step S510: define the comprehensive score of the variety classification, the calculation formula of the comprehensive score is: ,in, represents the comprehensive score of the i-th Cordyceps sinensis variety, represents the confidence score of the i-th variety, represents the characteristic consistency score of the i-th variety, represents the growth environment adaptability score of the i-th variety, α is the weight coefficient of the confidence score, β is the weight coefficient of the feature consistency score, and γ is the weight coefficient of the growth environment adaptability score, where ;

[0147] The weight coefficient α of the confidence score, the weight coefficient β of the feature consistency score, and the weight coefficient γ of the growth environment adaptability score are obtained by statistical analysis of actual data;

[0148] Step S520: Calculate confidence score ;

[0149] The confidence score The calculation formula is: ,in, represents the probability of the i-th variety predicted by the Cordyceps identification model, N represents the total number of Cordyceps varieties, Represents the sum of the predicted probabilities of N varieties;

[0150] Step S530: Calculate feature consistency score ;

[0151] The feature consistency score The calculation formula is: ,in, represents the jth characteristic value of the i-th variety, represents the average characteristic value of the i-th variety, and M represents the total number of local characteristics of Cordyceps sinensis;

[0152] The characteristic value refers to the value of the local characteristics of Cordyceps sinensis quantified after feature extraction, and the average characteristic value is the average value of all characteristic values;

[0153] Step S540: Calculate the growth environment adaptability score ;

[0154] The growth environment adaptability score The calculation formula is: , where E represents the current environmental conditions for the growth of Cordyceps sinensis, represents the most suitable growth environment for the i-th variety of Cordyceps sinensis, and k is the adjustment parameter;

[0155] The adjustment parameter k is set according to actual needs;

[0156] The most suitable growing environment is obtained from the records and research of the Agricultural Products Research Center;

[0157] Step S550: comprehensively calculating the confidence score, the feature consistency score, and the growth environment adaptability score to obtain a comprehensive score for the i-th Cordyceps sinensis variety;

[0158] The final calculation formula for the comprehensive score is: ;

[0159] Step S560: sorting the comprehensive scores of all varieties, and selecting the variety with the highest comprehensive score as the current classification of Cordyceps sinensis;

[0160] This step automatically completes the tasks of image segmentation and recognition through the model, provides probabilistic input for the final comprehensive score of the variety, comprehensively considers confidence, characteristics and environmental factors, improves the interpretability of classification, and provides three core scoring inputs for calculating the final comprehensive score. It combines multiple factors to give the final conclusion of variety classification.

[0161] Example 2

[0162] like Figure 3 As shown, the Cordyceps intelligent identification device for realizing refined image classification provided by the present application includes:

[0163] An image collection and annotation module is used to collect images of different varieties of Cordyceps sinensis and annotate each Cordyceps sinensis image with a corresponding variety label;

[0164] Furthermore, the image collection and annotation module also includes an image collector;

[0165] An image segmentation processing module is used to perform data enhancement on the Cordyceps sinensis image, segment the Cordyceps sinensis area and the background area in the Cordyceps sinensis image, and construct an image data set using the segmented Cordyceps sinensis image;

[0166] Furthermore, the image segmentation processing module also includes a data enhancer, an image segmenter, and a data set builder;

[0167] Furthermore, a trained Mask R-CNN model is deployed in the image segmentor;

[0168] Model building design module, which is used to build a deep neural network model based on ResNet, add a cross-domain feature fusion module, and design an adversarial loss function;

[0169] A recognition model training module is used to train a ResNet-based deep neural network model using an image data set to obtain a Cordyceps recognition model for identifying the probability of Cordyceps sinensis being different varieties;

[0170] Furthermore, the recognition model training module also includes a model trainer;

[0171] The comprehensive score calculation module is used to obtain the actual Cordyceps sinensis image and segment it using the Mask R-CNN model, identify the Cordyceps sinensis using the Cordyceps sinensis recognition model, obtain the probability of Cordyceps sinensis being each variety, calculate the comprehensive score of the Cordyceps sinensis variety classification, and select the variety with the highest comprehensive score as the final classification result;

[0172] Furthermore, the comprehensive score calculation module also includes a Cordyceps identifier, in which a trained Cordyceps identification model is deployed;

[0173] like Figure 2 As shown, it is a timing diagram of the Cordyceps intelligent identification device for realizing refined image classification provided by the present application, including: an image collector collects Cordyceps images and annotates each Cordyceps image according to its corresponding variety label, a data enhancer in the image segmentation processing module performs data enhancement on the Cordyceps image, and then transmits the data-enhanced Cordyceps image to the image segmenter of the image segmentation processing module for image segmentation, a trained Mask R-CNN model is deployed in the image segmenter, after the image segmenter completes the segmentation of the Cordyceps area and the background area in the Cordyceps image, the image is transmitted to the data set builder of the image collection and annotation module to construct an image data set, the image data set is transmitted to the model trainer, the model trainer uses the image data set as a training sample, trains a deep neural network model based on ResNet, obtains a Cordyceps identification model and deploys it in the Cordyceps identifier, obtains an actual Cordyceps image, and uses Mask The R-CNN model segments the Cordyceps image, and the segmented actual Cordyceps image is input into the Cordyceps recognition model as input data to predict the probability scores of the Cordyceps being different varieties. The comprehensive score calculation module calculates the comprehensive score for each variety, and the variety with the highest comprehensive score is classified as the variety of Cordyceps sinensis in the actual Cordyceps image.

[0174] Example 3

[0175] Figure 4 1 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Figure 4 As shown, according to another aspect of the present application, an electronic device is also provided. The electronic device may include one or more processors and one or more memories. The memories store computer-readable codes, and when the computer-readable codes are executed by one or more processors, the Cordyceps intelligent identification method for realizing refined image classification as described above can be executed.

[0176] The method or system according to the embodiment of the present application can also be used by Figure 4 The electronic device architecture shown in FIG. Figure 4 As shown, the electronic device may include a bus, one or more CPUs, a read-only memory (ROM), a random access memory (RAM), a communication port connected to a network, an input / output component, a hard disk, etc. A storage device in the electronic device, such as a ROM or a hard disk, may store the Cordyceps intelligent identification method for realizing refined image classification provided in the present application. The method for realizing refined image classification of Cordyceps sinensis intelligent recognition may, for example, include: collecting images of Cordyceps sinensis of different varieties, and labeling each Cordyceps sinensis image with a corresponding variety label; performing data enhancement on the Cordyceps sinensis images, segmenting the Cordyceps sinensis area and the background area in the Cordyceps sinensis images, and constructing an image data set using the segmented Cordyceps sinensis images; constructing a deep neural network model based on ResNet, adding a cross-domain feature fusion module, and designing an adversarial loss function; using the image data set to train the deep neural network model based on ResNet, and obtaining a Cordyceps sinensis recognition model for identifying the probability of Cordyceps sinensis being different varieties; obtaining actual Cordyceps sinensis images and segmenting them using the Mask R-CNN model, using the Cordyceps sinensis recognition model to identify Cordyceps sinensis, and obtaining the probability of Cordyceps sinensis being each variety, calculating the comprehensive score of the classification of Cordyceps sinensis varieties, and selecting the variety with the highest comprehensive score as the final classification result. Furthermore, the electronic device may also include a user interface. Of course, Figure 4 The architecture shown is only exemplary and can be omitted according to actual needs when implementing different devices. Figure 4 One or more components of an electronic device are shown.

[0177] Example 4

[0178] Figure 5 Schematic diagram of a readable storage medium structure provided by an embodiment of the present application. Figure 5As shown, it is a readable storage medium according to an embodiment of the present application. Computer-readable instructions are stored on the computer-readable storage medium. When the computer-readable instructions are executed by the processor, the Cordyceps intelligent identification method for realizing refined image classification according to the embodiment of the present application described with reference to the above figures can be executed. The storage medium includes, but is not limited to, for example, volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc.

[0179] In addition, according to an embodiment of the present application, the process described above with reference to the flowchart may be implemented as a computer software program. For example, the present application provides a non-temporary machine-readable storage medium, which stores machine-readable instructions, and the machine-readable instructions can be executed by a processor to execute instructions corresponding to the method steps provided in the present application, for example: collecting images of Cordyceps sinensis of different varieties, and labeling each Cordyceps sinensis image with a corresponding variety label; performing data enhancement on the Cordyceps sinensis images, segmenting the Cordyceps sinensis area and the background area in the Cordyceps sinensis images, and constructing an image dataset using the segmented Cordyceps sinensis images; constructing a deep neural network model based on ResNet, adding a cross-domain feature fusion module, and designing an adversarial loss function; using the image dataset to train the deep neural network model based on ResNet, and obtaining a Cordyceps sinensis recognition model for identifying the probability of Cordyceps sinensis being different varieties; obtaining actual Cordyceps sinensis images and segmenting them using the Mask R-CNN model, using the Cordyceps sinensis recognition model to identify Cordyceps sinensis, obtaining the probability of Cordyceps sinensis being each variety, calculating the comprehensive score of the Cordyceps sinensis variety classification, and selecting the variety with the highest comprehensive score as the final classification result. When the computer program is executed by a central processing unit (CPU), the above functions defined in the method of the present application are performed.

[0180] The methods, apparatuses, and devices of the present application may be implemented in many ways. For example, the methods, apparatuses, and devices of the present application may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of steps for the method is for illustration only, and the steps of the method of the present application are not limited to the order specifically described above unless otherwise specified. In addition, in some embodiments, the present application may also be implemented as programs recorded in a recording medium, which include machine-readable instructions for implementing the method according to the present application. Therefore, the present application also covers recording media storing programs for executing the method according to the present application.

[0181] In addition, the parts of the above-mentioned technical solutions provided in the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive redundancy.

[0182] The specific implementation modes as described above further describe the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation mode of the present invention and is not intended to limit the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for realizing intelligent identification of Cordyceps sinensis by refined image classification, characterized in that: include: Collect images of different varieties of Cordyceps sinensis and label each Cordyceps sinensis image with the corresponding variety label; Perform data enhancement on Cordyceps sinensis images, segment the Cordyceps sinensis area and the background area in the Cordyceps sinensis images, and use the segmented Cordyceps sinensis images to construct an image dataset; Build a deep neural network model based on ResNet, add a cross-domain feature fusion module, and design an adversarial loss function; The image dataset was used to train a deep neural network model based on ResNet, and a Cordyceps identification model was obtained to identify the probability of Cordyceps sinensis being different varieties. Obtain actual Cordyceps sinensis images and use the Mask R-CNN model to segment them. Use the Cordyceps sinensis recognition model to identify Cordyceps sinensis, obtain the probability of Cordyceps sinensis being each variety, calculate the comprehensive score of Cordyceps sinensis variety classification, and select the variety with the highest comprehensive score as the final classification result. The specific method of building a deep neural network model based on ResNet, adding a cross-domain feature fusion module, and designing an adversarial loss function is as follows: Build a deep neural network model based on ResNet, including: ResNet backbone network, cross-domain feature fusion module, fully connected layer, and domain classifier; Add a cross-domain feature fusion module on top of the ResNet backbone network; The fused features are input into the fully connected layer, which outputs the prediction results of the varieties of Cordyceps sinensis. The prediction results are converted into the probability scores of predicting that the Cordyceps sinensis belongs to each variety through the softmax activation function. Design an adversarial loss function to minimize the error between the predicted results and the true Cordyceps species labels, and add a domain classifier to distinguish whether the features are from the source domain or the target domain; The calculation formula of the adversarial loss function is: ,in, is the source domain classification loss, is the target domain classification loss, δ is the weight coefficient for balancing the source domain classification loss and the target domain classification loss; The source domain classification loss The calculation formula is: ,in, is the total number of Cordyceps sinensis images in the image dataset in the source domain, represents the xth Cordyceps sinensis image sample in the source domain, represents the probability that the domain classifier predicts that the x-th Cordyceps sinensis image sample comes from the source domain; The target domain classification loss The calculation formula is: ,in, is the total number of Cordyceps sinensis images in the target domain, represents the xth Cordyceps sinensis image in the target domain, represents the probability that the domain classifier predicts that the x-th Cordyceps sinensis image is from the target domain.

2. The method for realizing refined image classification of Cordyceps intelligent identification according to claim 1, characterized in that: The different varieties of Cordyceps sinensis include but are not limited to: Qinghai-Tibet Cordyceps and Xinjiang Cordyceps. The back annular region and foot region of different varieties of Cordyceps sinensis have different local features. The total number of varieties of Cordyceps sinensis is N, and the total number of types of local features is M.

3. The method for realizing refined image classification of Cordyceps intelligent identification according to claim 2, characterized in that: The specific method of collecting images of different varieties of Cordyceps sinensis and labeling each Cordyceps sinensis image with a corresponding variety label is as follows: Obtaining Cordyceps sinensis images of different growth stages, different environmental conditions, different varieties, and different angles from an image library of an agricultural product research system, wherein the Cordyceps sinensis in the Cordyceps sinensis images are healthy and free of pests and diseases, and the different varieties refer to known Cordyceps sinensis varieties with variety labels; According to the species of the Cordyceps sinensis in each Cordyceps sinensis image, the Cordyceps sinensis image is labeled with a corresponding species label.

4. The method for realizing refined image classification of Cordyceps intelligent identification according to claim 3, characterized in that: The specific method of performing data enhancement on the Cordyceps sinensis image, segmenting the Cordyceps sinensis region and the background region in the Cordyceps sinensis image, and constructing the image data set using the segmented Cordyceps sinensis image is as follows: The brightness, contrast, and color balance of the Cordyceps sinensis image are randomly adjusted to simulate Cordyceps sinensis under different lighting conditions. The distortion of Cordyceps sinensis in the natural environment is simulated by performing smooth deformation transformation on the Cordyceps sinensis image. The Cordyceps sinensis image was mirrored, Gaussian noise was introduced, and random cropping was performed; Train the Mask R-CNN model to segment the Cordyceps region from the background region in the Cordyceps sinensis image; The trained Mask R-CNN model is used to segment the cordyceps region and the background region in the segmented Cordyceps sinensis image, and the segmented Cordyceps sinensis image is used to construct an image dataset.

5. The method for realizing refined image classification of Cordyceps intelligent identification according to claim 4, characterized in that: The specific method of training the Mask R-CNN model to segment the cordyceps region and the background region in the cordyceps image is as follows: The bounding box position and the cordyceps region of the cordyceps sinensis image are annotated manually; Initialize the network structure of the Mask R-CNN model, including: ResNet, RPN, RolPool layers and three prediction branches; Among them, ResNet is the backbone network, which is used to extract Cordyceps features from the input Cordyceps sinensis image; RPN is a region proposal network, which is used to generate a bounding box containing the Cordyceps region from the feature map; The RolPool layer is used to extract feature vectors from the bounding box of the Cordyceps region; The three prediction branches are predicting the species of Cordyceps sinensis, predicting the bounding box position of Cordyceps sinensis, and predicting the Cordyceps sinensis area; The Cordyceps sinensis images with marked Cordyceps sinensis bounding box positions and Cordyceps sinensis areas are used as input data, and the bounding box positions and Cordyceps sinensis areas corresponding to each Cordyceps sinensis image are used as output data, so as to correctly segment the Cordyceps sinensis area and the background area as the classification target of the Mask R-CNN model, accurately predict the Cordyceps sinensis bounding box position and size as the regression target of the Mask R-CNN model, and accurately generate the Cordyceps sinensis area of ​​each Cordyceps sinensis as the segmentation target of the Mask R-CNN model; Define a loss function, which includes classification loss, regression loss, and segmentation loss. Minimize the loss function as the training goal. When the loss function reaches convergence, stop training to obtain a trained Mask R-CNN model. The calculation formula of the classification loss is: ,in, is the probability that the area in the predicted Cordyceps sinensis image is the Cordyceps sinensis area, is the true label of the region in the Cordyceps sinensis image; The calculation formula of the regression loss is: ,in, are the four parameters for the predicted bounding box location, is the true kth parameter of the bounding box position, is a smooth L1 loss function; The four parameters of the bounding box position are the center coordinates of the bounding box and width, height ; The calculation formula of the segmentation loss is: ,in, is the probability that the predicted pixel belongs to the Cordyceps area, is the true label of the pixel; The loss function is the weighted sum of classification loss, regression loss, and segmentation loss, and the calculation formula is: , where λ and μ are the weight coefficients of regression loss and segmentation loss respectively. , , are the normalization coefficients of classification loss, regression loss and segmentation loss respectively.

6. The method for realizing refined image classification of Cordyceps intelligent identification according to claim 5, characterized in that: The specific method for calculating the comprehensive score of Cordyceps sinensis variety classification and selecting the variety with the highest comprehensive score as the final classification result is: Define the comprehensive score of the variety classification, the calculation formula of the comprehensive score is: ,in, represents the comprehensive score of the i-th Cordyceps sinensis variety, represents the confidence score of the i-th variety, represents the characteristic consistency score of the i-th variety, represents the growth environment adaptability score of the i-th variety, α is the weight coefficient of the confidence score, β is the weight coefficient of the feature consistency score, and γ is the weight coefficient of the growth environment adaptability score, where ; Calculating confidence scores ; The confidence score The calculation formula is: ,in, represents the probability of the i-th variety predicted by the Cordyceps identification model, N represents the total number of Cordyceps varieties, Represents the sum of the probabilities of the N varieties predicted; calculates the feature consistency score ; The feature consistency score The calculation formula is: ,in, represents the jth characteristic value of the i-th variety, represents the average characteristic value of the i-th variety, M represents the total number of local characteristics of Cordyceps sinensis; Calculate the growth environment adaptability score ; The growth environment adaptability score The calculation formula is: , where E represents the current environmental conditions for the growth of Cordyceps sinensis, represents the most suitable growth environment for the i-th variety of Cordyceps sinensis, and k is the adjustment parameter; The confidence score, feature consistency score, and growth environment adaptability score are calculated comprehensively to obtain a comprehensive score for the i-th Cordyceps sinensis variety; The final calculation formula for the comprehensive score is: ; The comprehensive scores of all varieties are sorted, and the variety with the highest comprehensive score is selected as the current classification of Cordyceps sinensis.

7. An intelligent Cordyceps identification device for realizing refined image classification, characterized in that: include: An image collection and annotation module is used to collect images of different varieties of Cordyceps sinensis and annotate each Cordyceps sinensis image with a corresponding variety label; An image segmentation processing module is used to perform data enhancement on the Cordyceps sinensis image, segment the Cordyceps sinensis area and the background area in the Cordyceps sinensis image, and construct an image data set using the segmented Cordyceps sinensis image; Model building design module, which is used to build a deep neural network model based on ResNet, add a cross-domain feature fusion module, and design an adversarial loss function; A recognition model training module is used to train a ResNet-based deep neural network model using an image data set to obtain a Cordyceps recognition model for identifying the probability of Cordyceps sinensis being different varieties; The comprehensive score calculation module is used to obtain the actual Cordyceps sinensis image and segment it using the Mask R-CNN model, identify the Cordyceps sinensis using the Cordyceps sinensis recognition model, obtain the probability that the Cordyceps sinensis is each variety, calculate the comprehensive score of the Cordyceps sinensis variety classification, and select the variety with the highest comprehensive score as the final classification result; The specific method of building a deep neural network model based on ResNet, adding a cross-domain feature fusion module, and designing an adversarial loss function is as follows: Build a deep neural network model based on ResNet, including: ResNet backbone network, cross-domain feature fusion module, fully connected layer, and domain classifier; Add a cross-domain feature fusion module on top of the ResNet backbone network; The fused features are input into the fully connected layer, which outputs the prediction results of the varieties of Cordyceps sinensis. The prediction results are converted into the probability scores of predicting that the Cordyceps sinensis belongs to each variety through the softmax activation function. Design an adversarial loss function to minimize the error between the predicted results and the true Cordyceps species labels, and add a domain classifier to distinguish whether the features are from the source domain or the target domain; The calculation formula of the adversarial loss function is: ,in, is the source domain classification loss, is the target domain classification loss, δ is the weight coefficient for balancing the source domain classification loss and the target domain classification loss; The source domain classification loss The calculation formula is: ,in, is the total number of Cordyceps sinensis images in the image dataset in the source domain, represents the xth Cordyceps sinensis image sample in the source domain, represents the probability that the domain classifier predicts that the x-th Cordyceps sinensis image sample comes from the source domain; The target domain classification loss The calculation formula is: ,in, is the total number of Cordyceps sinensis images in the target domain, represents the xth Cordyceps sinensis image in the target domain, represents the probability that the domain classifier predicts that the x-th Cordyceps sinensis image is from the target domain.

8. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps in the method for intelligent identification of Cordyceps sinensis for realizing refined image classification as described in any one of claims 1 to 7 are implemented.

9. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor to execute the steps in the Cordyceps intelligent identification method for realizing refined image classification as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Three-stage pest image recognition method based on adaptive feature fusion pyramid network

    CN114565048A

  • Cross-domain field cotton boll identification method based on deep convolutional neural network

    CN116721343A